Skip to content

Commit

Permalink
Hide secrets and improve test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
clun committed Jan 22, 2024
1 parent 91fd3cc commit 987a571
Show file tree
Hide file tree
Showing 10 changed files with 2,112 additions and 516 deletions.
3 changes: 0 additions & 3 deletions astra-db-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
</parent>

<properties>
<!-- used for test in this module -->
<stargate-sdk.version>2.3.0</stargate-sdk.version>
<openai-java.version>0.18.2</openai-java.version>
<langchain4j.version>0.25.0</langchain4j.version>
<okhttp.version>4.10.0</okhttp.version>
Expand All @@ -34,7 +32,6 @@
<dependency>
<groupId>com.datastax.stargate</groupId>
<artifactId>stargate-sdk-data</artifactId>
<version>2.3.0</version>
</dependency>

<!-- CQL API (CassioIO) -->
Expand Down
12 changes: 6 additions & 6 deletions astra-db-client/src/main/java/com/dtsx/astra/sdk/AstraDB.java
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public AstraDB(@NonNull String token, @NonNull UUID databaseId, @NonNull String
}

/**
* Accessing the database with id an region.
* Accessing the database with id and region.
*
* @param token
* astra token
Expand Down Expand Up @@ -260,7 +260,7 @@ public AstraDBCollection createCollection(String name) {
* json vector store
*/
public <DOC> AstraDBRepository<DOC> createCollection(String name, Class<DOC> clazz) {
return new AstraDBRepository<DOC>(nsClient.createCollection(name, clazz));
return new AstraDBRepository<>(nsClient.createCollection(name, clazz));
}

/**
Expand Down Expand Up @@ -312,7 +312,7 @@ public AstraDBCollection createCollection(String name, int vectorDimension, Simi
* object type
*/
public <T> AstraDBRepository<T> createCollection(String name, int vectorDimension, Class<T> bean) {
return new AstraDBRepository<T>(nsClient.createCollection(CollectionDefinition.builder()
return new AstraDBRepository<>(nsClient.createCollection(CollectionDefinition.builder()
.name(name)
.vector(vectorDimension, SimilarityMetric.cosine)
.build(), bean));
Expand Down Expand Up @@ -344,7 +344,7 @@ public AstraDBCollection createCollection(CollectionDefinition def) {
* json vector store
*/
public <DOC> AstraDBRepository<DOC> createCollection(CollectionDefinition def, Class<DOC> clazz) {
return new AstraDBRepository<DOC>(nsClient.createCollection(def, clazz));
return new AstraDBRepository<>(nsClient.createCollection(def, clazz));
}

// --------------------
Expand Down Expand Up @@ -376,7 +376,7 @@ public AstraDBCollection collection(@NonNull String storeName) {
* type of the bean in use
*/
public <T> AstraDBRepository<T> collectionRepository(@NonNull String storeName, Class<T> clazz) {
return new AstraDBRepository<T>(nsClient.collectionRepository(storeName, clazz));
return new AstraDBRepository<>(nsClient.collectionRepository(storeName, clazz));
}

/**
Expand All @@ -385,7 +385,7 @@ public <T> AstraDBRepository<T> collectionRepository(@NonNull String storeName,
* @return
* raw namespace client
*/
public NamespaceClient getRawNamespaceClient() {
public NamespaceClient getNamespaceClient() {
return nsClient;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public class AstraDBAdmin {
/**
* Token header param
*/
public static final String TOKEN_HEADER_PARAM = "X-Cassandra-Token";
public static final String TOKEN_HEADER_PARAM = "X-Token";

/**
* Technical Keyspace name.
Expand Down Expand Up @@ -353,7 +353,7 @@ private DatabaseStatusType getStatus(DbOpsClient dbc) {
*/
private void resumeDb(Database db) {
try {
// Compute Endpoint for the Keyspaces
// Compute Endpoint for the Keyspace
String endpoint = ApiLocator.getApiRestEndpoint(db.getId(), db.getInfo().getRegion()) + "/v2/schemas/keyspace";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(endpoint))
Expand Down Expand Up @@ -382,7 +382,7 @@ private void resumeDb(Database db) {
* @return
* database client
*/
public DataApiClient getInternalDataApiClient(@NonNull String databaseName) {
public DataApiClient getDataApiClient(@NonNull String databaseName) {
return database(databaseName).getApiClient();
}

Expand All @@ -394,7 +394,7 @@ public DataApiClient getInternalDataApiClient(@NonNull String databaseName) {
* @return
* database client
*/
public DataApiClient getInternalDataApiClient(@NonNull UUID databaseId) {
public DataApiClient getDataApiClient(@NonNull UUID databaseId) {
return database(databaseId).getApiClient();
}

Expand All @@ -404,7 +404,7 @@ public DataApiClient getInternalDataApiClient(@NonNull UUID databaseId) {
* @return
* devops client.
*/
public AstraDBOpsClient getInternalDevopsApiClient() {
public AstraDBOpsClient getDevopsApiClient() {
return this.devopsDbClient;
}

Expand Down
Loading

0 comments on commit 987a571

Please sign in to comment.