Please read these guidelines before opening an issue. If you still need to open an issue then we ask that you complete the template as fully as possible.
We welcome pull requests, but ask contributors to keep in mind the following:
- Only PRs with the template completed will be accepted
- We will not accept PRs for user specific functionality
In order for us to accept pull-requests, the contributor must sign-off a Developer Certificate of Origin (DCO). This clarifies the intellectual property license granted with any contribution. It is for your protection as a Contributor as well as the protection of IBM and its customers; it does not change your rights to use your own Contributions for any other purpose.
Please read the agreement and acknowledge it by ticking the appropriate box in the PR text, for example:
- Tick to sign-off your agreement to the Developer Certificate of Origin (DCO) 1.1
Cloudant-client is written in Java and uses gradle as its build tool.
There are two sub-projects in java-cloudant each of which produces an artifact for publishing.
The cloudant-client jar is the main java-cloudant artifact and includes the classes for interacting with the Cloudant or CouchDB servers. It includes the functionality to build requests for specific Cloudant operations and for changing between POJOs and Cloudant documents.
A jar for basic HTTP operations such as forming a request for a URL and specifying the request properties and body. It provides methods for executing the requests and getting the response content in some different forms. It also includes interceptor interfaces and some implementations for customizing requests and handling responses. This jar is used by both the cloudant-client and by the sync-android project.
Adopting the Google Java Style with the following changes:
4.2
Our block indent is +4 characters
4.4
Our line length is 100 characters.
4.5.2
Indent continuation of +4 characters fine, but I think
IDEA defaults to 8, which is okay too.
An IDEA code style matching these guidelines is included in the project,
in the .idea
folder.
If you already have the project, to enable the code style follow these steps:
- Go to Preferences -> Editor -> Code Style.
- In the Scheme dropdown, select Project.
IDEA will then use the style when reformatting, refactoring and so on.
- gradle
- Java 1.6
Follow the instructions for your platform.
The project uses the gradle wrapper to download the specified version of gradle. The gradle wrapper is run by using the following command:
$ ./gradlew
Note: on windows the command to run is gradlew.bat rather than gradlew
The project should build out of the box with:
$ ./gradlew compileJava
The tests can be configured before running, by default they use the local CouchDB. To run tests with a remote CouchDB or Cloudant, you need set the details of this CouchDB server, including access credentials:
systemProp.test.server.user=yourUsername
systemProp.test.server.password=yourPassword
systemProp.test.server.host=couchdborcloudanthost # default localhost
systemProp.test.server.port=5984 # default 5984
systemProp.test.server.protocol=[http|https] # default http
Alternatively, provide a URL containing all the above information:
systemProp.test.couch.url=https://example.couch.db
You can leave out the port (it will use the protocol's default) and username and password (if the server does not require one)
Note: using the uri config option will override all the individual options such as "test.couch.username"
Add these properties to a gradle.properties
file, this can be either:
- in the
GRADLE_USER_HOME
folder - in the same folder as
build.gradle
Take care not to commit your credentials. Using the GRADLE_USER_HOME
folder
will make it harder to do this accidentally!
The default tests (that require a running DB) can be run with:
$ ./gradlew check
The tests are categorized based on the resources they need. In addition to the
default check
and test
tasks there are gradle tasks to run tests from these
selected categories:
- Tests that do not need a database
$ ./gradlew noDBTest
- For tests which run against Cloudant Local or the Cloudant Service
$ ./gradlew cloudantTest
- For tests which run only against the Cloudant Service
$ ./gradlew cloudantServiceTest
Note: you will need a Cloudant account to run tests against the Cloudant service.
Additionally the ReplicatorTest cases require the _replicator
DB to exist.