When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.
Please note we have a Code of Conduct, please follow it in all your interactions with the project.
If you find a bug in the source code or a mistake in the documentation, you can help us by submitting an issue to the GitHub Repository. Even better, you can submit a Pull Request with a fix.
You can request a new feature by submitting an issue to the GitHub Repository. If you would like to implement a new feature, please submit an issue with a proposal for your work first, to be sure that we can use it.
- Small Features can be crafted and directly submitted as a Pull Request.
Before you submit an issue, search the archive, maybe your question was already answered.
If your issue appears to be a bug, and hasn't been reported, open a new issue. Help us to maximize the effort we can spend fixing issues and adding new features, by not reporting duplicate issues. Providing the following information will increase the chances of your issue being dealt with quickly:
- Overview of the Issue - if an error is being thrown a non-minified stack trace helps
- Motivation for or Use Case - explain what are you trying to do and why the current behavior is a bug for you
- Reproduce the Error - provide a live example or a unambiguous set of steps
- Suggest a Fix - if you can't fix the bug yourself, perhaps you can point to what might be causing the problem (line of code or commit)
Before you submit your Pull Request (PR) consider the following guidelines:
-
Search the repository (https://github.com/datastax/astra-db-java/pulls) for an open or closed PR that relates to your submission. You don't want to duplicate effort.
-
Create a fork of the repo
-
Make your changes in the forked repo
-
Commit your changes using a descriptive commit message
-
In GitHub, create a pull request: https://help.github.com/en/articles/creating-a-pull-request-from-a-fork
-
If we suggest changes then:
-
Make the required updates.
-
Rebase your fork and force push to your GitHub repository (this will update your Pull Request):
git rebase master -i git push -f
-
That's it! Thank you for your contribution!
-
Use the reference documentation to install a Java Development Kit
-
Validate your installation with:
java --version
-
Use the reference documentation to install Apache Maven
-
Validate your installation with:
mvn -version
Docker is required to run a local HCD/DSE instance for integration tests.
Clone the repository and build:
git clone git@github.com:datastax/astra-db-java.git
cd astra-db-java
mvn clean install -DskipTestsTests are configured through a layered properties system. Values are resolved in priority order:
- Environment variables (e.g.,
ASTRA_DB_APPLICATION_TOKEN) - System properties (e.g.,
-Dastra.token=...) - Config files (loaded in order, later files override earlier ones):
test-config.properties— defaults (committed)test-config-local.properties— local HCD/DSE settings (committed)test-config-astra.properties— Astra credentials (gitignored)test-config-embedding-providers.properties— embedding API keys (gitignored)
For Astra testing, copy the template and fill in your credentials:
cp astra-db-java/src/test/resources/test-config-astra.properties.template \
astra-db-java/src/test/resources/test-config-astra.propertiesThen edit test-config-astra.properties:
test.environment=astra_prod
astra.token=AstraCS:YOUR_TOKEN_HERE
astra.cloud.provider=AWS
astra.cloud.region=us-east-2For embedding provider tests (vectorize), copy and fill in API keys:
cp astra-db-java/src/test/resources/test-config-embedding-providers.properties.template \
astra-db-java/src/test/resources/test-config-embedding-providers.propertiesopenai.api.key=sk-...
cohere.api.key=...
mistral.api.key=...You can override any property without editing config files:
# Via environment variable
export ASTRA_DB_APPLICATION_TOKEN=AstraCS:...
mvn clean test -pl astra-db-java -Pastra-prod
# Via system property
mvn clean test -pl astra-db-java -Pastra-prod -Dastra.cloud.region=eu-west-1
# Override the test environment
mvn clean test -pl astra-db-java -DASTRA_DB_JAVA_TEST_ENV=astra_dev# Run all tests against Astra PROD (with coverage report)
mvn clean verify -pl astra-db-java -Pastra-prod
# Run all tests against Astra DEV (with coverage report)
mvn clean verify -pl astra-db-java -Pastra-dev
# Run all tests against local HCD/DSE (with coverage report)
mvn clean verify -pl astra-db-java -Plocal
# Run tests and generate JaCoCo report explicitly
mvn clean test jacoco:report -pl astra-db-java -Pastra-prod
# Run a specific test class
mvn test -pl astra-db-java -Pastra-prod -Dtest="Astra_Collections_01_IT"
# Build without tests
mvn clean install -DskipTests
# Skip all tests via profile
mvn clean install -pl astra-db-java -Pskip-testsThe JaCoCo coverage report is generated at astra-db-java/target/site/jacoco/index.html.
| Profile | test.environment |
Cloud Provider | Region | Description |
|---|---|---|---|---|
local |
local |
GCP | us-east1 | Local HCD/DSE instance |
astra-dev |
astra_dev |
GCP | us-central1 | Astra development environment |
astra-prod |
astra_prod |
AWS | us-east-2 | Astra production environment |
skip-tests |
- | - | - | Skip all tests |
Profile values are passed as system properties, which take priority over config file values but not environment variables.
Tests work out of the box in IDEs (IntelliJ, Eclipse) with no environment variables required:
- Astra tests: Create
test-config-astra.propertiesfrom the template with your token and region. Right-click anyAstra_*ITtest class and run. - Local tests: Start HCD with
docker-compose up -d, then right-click anyLocal_*ITtest class and run. Tests auto-skip if local HCD is not available.
Test classes use JUnit 5 conditional annotations to run only in the appropriate environment:
| Annotation | Behavior |
|---|---|
@EnabledIfAstra |
Runs only when test.environment is astra_dev, astra_prod, or astra_test and a valid Astra token is available. Skipped otherwise. |
@EnabledIfLocalAvailable |
Runs only when a local HCD/DSE instance is reachable at the configured endpoint. Skipped otherwise. |
This means you can safely run the entire test suite: tests for unavailable environments are skipped (not failed).
- Docker and Docker Compose
- Java 17+
- Maven
- (Optional) A local clone of the Data API repository
Using the docker-compose.yml included in this repository:
docker-compose up -dOr, if you have the Data API repository cloned:
export DATA_API_FOLDER=/path/to/data-api
cd $DATA_API_FOLDER/docker-compose && ./start_hcd.sh -dClone and start the Data API from source:
git clone git@github.com:stargate/data-api.git
cd data-api
STARGATE_DATA_STORE_SAI_ENABLED=true \
STARGATE_DATA_STORE_VECTOR_SEARCH_ENABLED=true \
STARGATE_JSONAPI_OPERATIONS_VECTORIZE_ENABLED=true \
STARGATE_DATA_STORE_IGNORE_BRIDGE=true \
STARGATE_JSONAPI_OPERATIONS_DATABASE_CONFIG_LOCAL_DATACENTER=dc1 \
STARGATE_JSONAPI_OPERATIONS_DATABASE_CONFIG_CASSANDRA_END_POINTS=localhost \
QUARKUS_HTTP_ACCESS_LOG_ENABLED=FALSE \
QUARKUS_LOG_LEVEL=INFO \
JAVA_MAX_MEM_RATIO=75 \
JAVA_INITIAL_MEM_RATIO=50 \
GC_CONTAINER_OPTIONS="-XX:+UseG1GC" \
JAVA_OPTS_APPEND="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager" \
mvn quarkus:dev \
-Dstargate.data-store.ignore-bridge=true \
-Dstargate.jsonapi.operations.vectorize-enabled=true \
-Dstargate.jsonapi.operations.database-config.local-datacenter=dc1 \
-Dquarkus.log.console.darken=2 \
-Dstargate.feature.flags.tables=true \
-Dstargate.jsonapi.operations.extend-error=true \
-Dstargate.feature.flags.reranking=true| Field | Value |
|---|---|
| API Spec | http://localhost:8181/swagger-ui/#/ |
| Endpoint | http://localhost:8181 |
| Token Header Key | Token |
| Token Header Value | Cassandra:Y2Fzc2FuZHJh:Y2Fzc2FuZHJh (Cassandra:Base64(username):Base64(password)) |
Connect to the running HCD instance with cqlsh:
# Docker
docker run -it --rm --network container:$(docker ps | grep hcd | cut -b 1-12) \
cassandra:latest cqlsh -u cassandra -p cassandra
# Podman
podman exec -it $(podman ps | grep hcd | cut -b 1-12) \
cqlsh -u cassandra -p cassandra# Prepare + perform release (core + langchain4j modules)
mvn -pl astra-db-java,langchain4j-astradb -am release:prepare -DskipTests=true
mvn -pl astra-db-java,langchain4j-astradb -am release:perform -DskipTests=trueArtifacts are published to Maven Central via Sonatype Central Publishing with GPG signing.
