diff --git a/astra-db-client/pom.xml b/astra-db-client/pom.xml index 880c3649..3a6f2b35 100644 --- a/astra-db-client/pom.xml +++ b/astra-db-client/pom.xml @@ -2,7 +2,7 @@ 4.0.0 astra-db-client - + astra-db-client + Java Client for Astra DB com.datastax.astra diff --git a/astra-db-client/src/main/java/com/dtsx/astra/sdk/AstraDB.java b/astra-db-client/src/main/java/com/dtsx/astra/sdk/AstraDB.java index 3a11c66b..10dc1053 100644 --- a/astra-db-client/src/main/java/com/dtsx/astra/sdk/AstraDB.java +++ b/astra-db-client/src/main/java/com/dtsx/astra/sdk/AstraDB.java @@ -21,7 +21,7 @@ import java.util.stream.Stream; /** - * Hiding top level Json Api and skip interaction with namespaces + * Client for AstraDB at database level (crud for collections). */ @Slf4j @Getter public class AstraDB { diff --git a/astra-db-client/src/main/java/com/dtsx/astra/sdk/AstraDBAdmin.java b/astra-db-client/src/main/java/com/dtsx/astra/sdk/AstraDBAdmin.java index 698cbc1a..04469e65 100644 --- a/astra-db-client/src/main/java/com/dtsx/astra/sdk/AstraDBAdmin.java +++ b/astra-db-client/src/main/java/com/dtsx/astra/sdk/AstraDBAdmin.java @@ -33,62 +33,44 @@ import static io.stargate.sdk.utils.Utils.readEnvVariable; /** - * Astra Vector Client, Native experience for Vector Database. + * Client for AstraDB at organization level (crud for databases). */ @Slf4j public class AstraDBAdmin { - /** Default timeout for connection. */ + /** Default timeout for initiating connection. */ public static final int CONNECT_TIMEOUT_SECONDS = 20; - /** - * Free tier. - */ + /** Default cloud provider if not provided by user. (free-tier) */ public static final CloudProviderType FREE_TIER_CLOUD = CloudProviderType.GCP; - /** - * Free tier. - */ + /** Default region if not provided by user. (free-tier) */ public static final String FREE_TIER_CLOUD_REGION = "us-east1"; - /** - * Token header param - */ + /** Header name used to hold the Astra Token. */ public static final String TOKEN_HEADER_PARAM = "X-Token"; - /** - * Technical Keyspace name. - */ + /** Default keyspace name if not provided by user. */ public static final String DEFAULT_KEYSPACE = "default_keyspace"; - /** - * First Level of the API will - */ + /** Client for the Astra Devops Api. (crud on databases) */ final AstraDBOpsClient devopsDbClient; - /** - * Environment - */ + /** Target Astra Environment, default is PROD. */ final AstraEnvironment env; - /** - * Token required to initialize the clients - */ + /** Astra Token used as credentials. */ @Getter final String token; - /** - * JDK HttpClient - */ + /** JDK11 HttpClient to interact with apis. */ final HttpClient httpClient; - /** - * Configuration token - */ + /** Token value read for environment variable. */ static String astraConfigToken; /* - * Load from environment. + * Load token values from environment variables and ~/.astrarc. */ static { new AstraRc().getSectionKey( @@ -99,29 +81,30 @@ public class AstraDBAdmin { } /** - * Load with token from environment + * Default initialization, the token is retrieved from environment variable ASTRA_DB_APPLICATION_TOKEN or from + * file ~/.astrarc, section default, key ASTRA_DB_APPLICATION_TOKEN. */ public AstraDBAdmin() { this(astraConfigToken); } /** - * Default constructor. + * Initialization with an authentification token, defaulting to production environment. * * @param token - * a token is all you need + * authentication token */ public AstraDBAdmin(String token) { this(token, AstraEnvironment.PROD); } /** - * Second constructor for non-production environments. + * Initialization with an authentification token and target environment, Use this constructor for testing purpose. * * @param token - * token + * authentication token * @param env - * target environments + * target Astra environment */ public AstraDBAdmin(String token, AstraEnvironment env) { this.env = env; @@ -134,10 +117,10 @@ public AstraDBAdmin(String token, AstraEnvironment env) { } /** - * List active vector databases. + * List active databases with vector enabled in current organization. * * @return - * active devops databases. + * active databases list */ public Stream findAllDatabases() { return devopsDbClient @@ -146,7 +129,7 @@ public Stream findAllDatabases() { } /** - * Create Db in free Tier. + * Create new database with a name on free tier. The database name should not exist in the tenant. * * @param name * database name @@ -158,37 +141,9 @@ public UUID createDatabase(@NonNull String name) { } /** - * Delete a Database if exists from its name - * - * @param name - * database name - * @return - * if the db has been deleted - */ - public boolean deleteDatabaseByName(@NonNull String name) { - Optional opDb = findDatabaseByName(name).findFirst(); - opDb.ifPresent(db -> devopsDbClient.database(db.getId()).delete()); - return opDb.isPresent(); - } - - /** - * Delete a Database if exists from its name - * - * @param databaseId - * database identifier - * @return - * if the db has been deleted - */ - public boolean deleteDatabaseById(@NonNull UUID databaseId) { - if (findDatabaseById(databaseId).isPresent()) { - devopsDbClient.database(databaseId.toString()).delete(); - return true; - } - return false; - } - - /** - * Create a database with the full definition. + * Create new database with a name on the specified cloud provider and region. + * If the database with same name already exists it will be resumed if not active. + * The method will wait for the database to be active. * * @param name * database name @@ -197,7 +152,7 @@ public boolean deleteDatabaseById(@NonNull UUID databaseId) { * @param cloudRegion * cloud region * @return - * database uid + * database identifier */ public UUID createDatabase(@NonNull String name, @NonNull CloudProviderType cloud, @NonNull String cloudRegion) { Optional optDb = findDatabaseByName(name).findFirst(); @@ -236,6 +191,38 @@ public UUID createDatabase(@NonNull String name, @NonNull CloudProviderType clou return newDbId; } + /** + * Delete a Database if exists from its name + * + * @param name + * database name + * @return + * if the db has been deleted + */ + public boolean deleteDatabaseByName(@NonNull String name) { + Optional opDb = findDatabaseByName(name).findFirst(); + opDb.ifPresent(db -> devopsDbClient.database(db.getId()).delete()); + return opDb.isPresent(); + } + + /** + * Delete a Database if exists from its name + * + * @param databaseId + * database identifier + * @return + * if the db has been deleted + */ + public boolean deleteDatabaseById(@NonNull UUID databaseId) { + if (findDatabaseById(databaseId).isPresent()) { + devopsDbClient.database(databaseId.toString()).delete(); + return true; + } + return false; + } + + + /** * Retrieve list of all Databases of the account and filter on name diff --git a/astra-db-client/src/main/java/com/dtsx/astra/sdk/AstraDBCollection.java b/astra-db-client/src/main/java/com/dtsx/astra/sdk/AstraDBCollection.java index 4ba44bb4..a6a98f45 100644 --- a/astra-db-client/src/main/java/com/dtsx/astra/sdk/AstraDBCollection.java +++ b/astra-db-client/src/main/java/com/dtsx/astra/sdk/AstraDBCollection.java @@ -2,9 +2,9 @@ import io.stargate.sdk.core.domain.Page; import io.stargate.sdk.data.CollectionClient; -import io.stargate.sdk.data.DocumentMutationResult; -import io.stargate.sdk.data.JsonDocumentMutationResult; +import io.stargate.sdk.data.domain.DocumentMutationResult; import io.stargate.sdk.data.domain.JsonDocument; +import io.stargate.sdk.data.domain.JsonDocumentMutationResult; import io.stargate.sdk.data.domain.JsonDocumentResult; import io.stargate.sdk.data.domain.JsonResultUpdate; import io.stargate.sdk.data.domain.UpdateStatus; @@ -25,18 +25,18 @@ import java.util.stream.Stream; /** - * Operation On a Collection. + * Client for AstraDB at collection level (crud for documents). */ @Getter public class AstraDBCollection { /** - * Stargate Client for a collection + * Internal Stargate data api client. */ CollectionClient collectionClient; /** - * Default constructor. + * Constructor with the internal client * * @param collectionClient * collection description @@ -50,10 +50,10 @@ public class AstraDBCollection { // -------------------------- /** - * Insert with a Json String. + * Insert a single document from a Json String. * * @param json - * json Strings + * json String * @return * mutation result with status and id */ @@ -62,7 +62,7 @@ public final JsonDocumentMutationResult insertOne(String json) { } /** - * Insert with a Json String and get return asynchronously. + * Insert a single document from a Json String, asynchronously. * * @param json * json Strings @@ -74,7 +74,7 @@ public final CompletableFuture insertOneAsync(String } /** - * Insert with a Json Document (schemaless) + * Insert a single document from a Json Document (schemaless). * * @param document * current bean @@ -86,7 +86,7 @@ public final JsonDocumentMutationResult insertOne(JsonDocument document) { } /** - * Insert with a Json Document (schemaless) + * Insert a single document from a Json Document (schemaless), asynchronously. * * @param document * current bean @@ -98,7 +98,7 @@ public final CompletableFuture insertOneASync(JsonDo } /** - * Insert with a Json Document object (SchemaFull) + * Insert a single document from a Document<T> object (SchemaFull) * * @param document * current bean @@ -112,7 +112,7 @@ public final DocumentMutationResult insertOne(Document document) } /** - * Insert with a Json Document object (SchemaFull) + * Insert a single document from a Document<T> object (SchemaFull), asynchronously. * * @param document * current bean @@ -130,7 +130,7 @@ public final CompletableFuture> insertOneASync // -------------------------- /** - * Insert with a Json String. + * Upsert a single document from a Json String. * * @param json * json Strings @@ -142,7 +142,7 @@ public final JsonDocumentMutationResult upsertOne(String json) { } /** - * Insert with a Json String and get return asynchronously. + * Upsert a single document from a Json String, asynchronously. * * @param json * json Strings @@ -154,7 +154,7 @@ public final CompletableFuture upsertOneASync(String } /** - * Upsert a document in the collection. + * Upsert a single document from a Json Document (schemaless). * * @param document * current document @@ -166,7 +166,7 @@ public final JsonDocumentMutationResult upsertOne(JsonDocument document) { } /** - * Upsert a document in the collection. + * Upsert a single document from a Json Document (schemaless), asynchronously. * * @param document * current document @@ -178,7 +178,7 @@ public final CompletableFuture upsertOneASync(JsonDo } /** - * Upsert a document in the collection. + * Upsert a single document from a Document<T> object (SchemaFull) * * @param document * current document @@ -192,7 +192,7 @@ public final DocumentMutationResult upsertOne(Document document) } /** - * Upsert a document in the collection. + * Upsert a single document from a Document<T> object (SchemaFull), asynchronously * * @param document * current document @@ -210,7 +210,7 @@ public final CompletableFuture> upsertOneASync // -------------------------- /** - * Insert multiple records in one call, up to 20, then use insertManyChunked. + * Insert multiple documents (up to 20) as a Json String , for more document check insertManyChunked. * * @param json * json String @@ -222,7 +222,7 @@ public final List insertMany(String json) { } /** - * Insert multiple records in one call, up to 20, then use insertManyChunked asynchronously. + * Insert multiple documents (up to 20) as a Json String , for more document check insertManyChunked, Asynchronously. * * @param json * json String @@ -234,7 +234,7 @@ public final CompletableFuture> insertManyASync } /** - * Insert multiple records in one call, up to 20, then use insertManyChunked. + * Insert multiple documents (up to 20) as JsonDocument List , for more document check insertManyChunked. * * @param documents * list of documents @@ -246,7 +246,7 @@ public final List insertManyJsonDocuments(ListJsonDocument List , for more document check insertManyChunked, asynchronously. * * @param documents * list of documents @@ -258,7 +258,7 @@ public final CompletableFuture> insertManyJsonD } /** - * Low level insertion of multiple records + * Insert multiple documents (up to 20) as generic Document<T> List , for more document check insertManyChunked. * * @param documents * list of documents @@ -272,7 +272,7 @@ public final List> insertMany(ListDocument<T> List , for more document check insertManyChunked, asynchronously. * * @param documents * list of documents @@ -290,16 +290,16 @@ public final CompletableFuture>> insertMa // ------------------------------- /** - * Low level insertion of multiple records + * Insert large number of documents as generic Document<T> List. Insertions a redistributed in chunks and chunk processing are parallelized. * * @param documents * list of documents * @param chunkSize - * size of the block + * number of documents in one chunk (up to 20) * @param concurrency - * number of blocks in parallel + * number of chunks processed in parallel (depends on document size) * @param - * represent the pojo, payload of document + * payload for the documents * @return * list of ids */ @@ -308,7 +308,7 @@ public final List> insertManyChunked(ListDocument<T> List. Insertions a redistributed in chunks and chunk processing are parallelized., Asynchronously * * @param documents * list of documents @@ -326,17 +326,33 @@ public final CompletableFuture>> insertMa } /** - * Enforce Mapping with JsonDocument + * Insert large number of documents as JsonDocument List. Insertions a redistributed in chunks and chunk processing are parallelized., * * @param documents * list of documents + * @param chunkSize + * size of the block + * @param concurrency + * number of blocks in parallel * @return - * json document list + * list of mutation status */ public final List insertManyChunkedJsonDocuments(List documents, int chunkSize, int concurrency) { return collectionClient.insertManyJsonDocumentsChunked(documents, chunkSize, concurrency); } + /** + * Insert large number of documents as JsonDocument List. Insertions a redistributed in chunks and chunk processing are parallelized., Asynchronously + * + * @param documents + * list of documents + * @param chunkSize + * size of the block + * @param concurrency + * number of blocks in parallel + * @return + * list of mutation status + */ public final CompletableFuture> insertManyChunkedJsonDocumentsAsync(List documents, int chunkSize, int concurrency) { return CompletableFuture.supplyAsync(() -> insertManyChunkedJsonDocuments(documents, chunkSize, concurrency)); } diff --git a/astra-db-client/src/main/java/com/dtsx/astra/sdk/AstraDBRepository.java b/astra-db-client/src/main/java/com/dtsx/astra/sdk/AstraDBRepository.java index 4b1dbd96..12249932 100644 --- a/astra-db-client/src/main/java/com/dtsx/astra/sdk/AstraDBRepository.java +++ b/astra-db-client/src/main/java/com/dtsx/astra/sdk/AstraDBRepository.java @@ -2,7 +2,7 @@ import io.stargate.sdk.core.domain.Page; import io.stargate.sdk.data.CollectionRepository; -import io.stargate.sdk.data.DocumentMutationResult; +import io.stargate.sdk.data.domain.DocumentMutationResult; import io.stargate.sdk.data.domain.odm.Document; import io.stargate.sdk.data.domain.odm.DocumentResult; import io.stargate.sdk.data.domain.query.DeleteQuery; @@ -18,7 +18,7 @@ import java.util.stream.Stream; /** - * Operation on Collection With object Mapping for Astra. + * Client for AstraDB collection using repository pattern. * * @param * working document diff --git a/astra-db-client/src/main/java/com/dtsx/astra/sdk/cassio/ClusteredMetadataVectorCassandraTable.java b/astra-db-client/src/main/java/com/dtsx/astra/sdk/cassio/ClusteredMetadataVectorCassandraTable.java index e9391102..fc958f15 100644 --- a/astra-db-client/src/main/java/com/dtsx/astra/sdk/cassio/ClusteredMetadataVectorCassandraTable.java +++ b/astra-db-client/src/main/java/com/dtsx/astra/sdk/cassio/ClusteredMetadataVectorCassandraTable.java @@ -213,6 +213,16 @@ public Record mapRow(Row row) { return null; } - public static class Record {} + /** + * Table record. + */ + public static class Record { + + /** + * Default constructor. + */ + public Record() {} + + } } diff --git a/astra-db-client/src/main/java/com/dtsx/astra/sdk/cassio/SimilaritySearchQuery.java b/astra-db-client/src/main/java/com/dtsx/astra/sdk/cassio/SimilaritySearchQuery.java index 18610e00..a3e4aca2 100644 --- a/astra-db-client/src/main/java/com/dtsx/astra/sdk/cassio/SimilaritySearchQuery.java +++ b/astra-db-client/src/main/java/com/dtsx/astra/sdk/cassio/SimilaritySearchQuery.java @@ -38,4 +38,9 @@ public class SimilaritySearchQuery { */ private Map metaData; + /** + * Default constructor. + */ + public SimilaritySearchQuery() {} + } diff --git a/astra-db-client/src/main/java/com/dtsx/astra/sdk/cassio/package-info.java b/astra-db-client/src/main/java/com/dtsx/astra/sdk/cassio/package-info.java index 4ca6ec56..06df7093 100644 --- a/astra-db-client/src/main/java/com/dtsx/astra/sdk/cassio/package-info.java +++ b/astra-db-client/src/main/java/com/dtsx/astra/sdk/cassio/package-info.java @@ -1,4 +1,4 @@ /** - * Client to use Cql language with Astra Vector and adapter to CassIO. + * Client for Astra DB through Cassandra Query Language (CQL) reusing data models from CassIO, */ package com.dtsx.astra.sdk.cassio; \ No newline at end of file diff --git a/astra-db-client/src/main/java/com/dtsx/astra/sdk/package-info.java b/astra-db-client/src/main/java/com/dtsx/astra/sdk/package-info.java index bbae4087..348566ae 100644 --- a/astra-db-client/src/main/java/com/dtsx/astra/sdk/package-info.java +++ b/astra-db-client/src/main/java/com/dtsx/astra/sdk/package-info.java @@ -1,4 +1,4 @@ /** - * Client for the Astra DB Data API. + * Client for Astra DB through Rest Data API. */ package com.dtsx.astra.sdk; \ No newline at end of file diff --git a/astra-db-client/src/test/java/com/dtsx/astra/sdk/AstraDBTestSuiteIT.java b/astra-db-client/src/test/java/com/dtsx/astra/sdk/AstraDBTestSuiteIT.java index ae95b4c3..a961eb60 100644 --- a/astra-db-client/src/test/java/com/dtsx/astra/sdk/AstraDBTestSuiteIT.java +++ b/astra-db-client/src/test/java/com/dtsx/astra/sdk/AstraDBTestSuiteIT.java @@ -4,9 +4,9 @@ import com.dtsx.astra.sdk.db.domain.Database; import com.dtsx.astra.sdk.utils.AstraEnvironment; import com.fasterxml.jackson.annotation.JsonProperty; -import io.stargate.sdk.data.DocumentMutationResult; -import io.stargate.sdk.data.DocumentMutationStatus; -import io.stargate.sdk.data.JsonDocumentMutationResult; +import io.stargate.sdk.data.domain.DocumentMutationResult; +import io.stargate.sdk.data.domain.DocumentMutationStatus; +import io.stargate.sdk.data.domain.JsonDocumentMutationResult; import io.stargate.sdk.data.domain.CollectionDefinition; import io.stargate.sdk.data.domain.JsonDocument; import io.stargate.sdk.data.domain.JsonDocumentResult; @@ -33,6 +33,7 @@ import java.time.Instant; import java.util.ArrayList; +import java.util.Arrays; import java.util.Calendar; import java.util.Date; import java.util.HashMap; @@ -1151,6 +1152,7 @@ public void shouldFindWithLT() { @Order(37) @DisplayName("37. Should find with $lte") public void shouldFindWithLTE() { + shouldInsertOneComplexDocument(); Assertions.assertTrue(collectionSimple.find(SelectQuery.builder() .where("metadata_int") .isLessOrEqualsThan(1).build()).findFirst().isPresent()); @@ -1160,6 +1162,7 @@ public void shouldFindWithLTE() { @Order(38) @DisplayName("38. Should find with $gt") public void shouldFindWithGTE() { + shouldInsertOneComplexDocument(); Assertions.assertTrue(collectionSimple.find(SelectQuery.builder() .where("metadata_int") .isGreaterThan(0).build()).findFirst().isPresent()); @@ -1169,12 +1172,70 @@ public void shouldFindWithGTE() { @Order(39) @DisplayName("39. Should find with $gte and Instant") public void shouldFindWithGTEInstant() { - log.info("Search with $gte and an Instant..."); + shouldInsertOneComplexDocument(); Assertions.assertTrue(collectionSimple.find(SelectQuery.builder() .where("metadata_instant") .isLessThan(Instant.now()).build()).findFirst().isPresent()); } + @Test + @Order(40) + @DisplayName("40. ToString should provide the json String") + public void shouldSerializedAsJson() { + + // Serializing a JsonDocument give you back the Json String + JsonDocument doc1 = new JsonDocument().id("1").put("a", "a").put("b", "c"); + Assertions.assertEquals("{\"a\":\"a\",\"b\":\"c\",\"_id\":\"1\"}", doc1.toString()); + + // Serializing a Document give you back a Json String + Document doc2 = new Document().id("1").data(new Product("name", 1d)); + Assertions.assertEquals("{\"product_name\":\"name\",\"product_price\":1.0,\"_id\":\"1\"}", doc2.toString()); + + initializeCollectionVector(); + collectionVector.insertManyJsonDocuments(List.of( + new JsonDocument() + .id("doc1") // generated if not set + .vector(new float[]{1f, 0f, 1f, 1f, 1f, 1f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f}) + .put("product_name", "HealthyFresh - Beef raw dog food") + .put("product_price", 12.99), + new JsonDocument() + .id("doc2") + .vector(new float[]{1f, 1f, 1f, 1f, 1f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f}) + .data("{\"product_name\": \"HealthyFresh - Chicken raw dog food\", \"product_price\": 9.99}"), + new JsonDocument() + .id("doc3") + .vector(new float[]{1f, 1f, 1f, 1f, 1f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f}) + .data(Map.of("product_name", "HealthyFresh - Chicken raw dog food")), + new JsonDocument() + .id("doc4") + .vector(new float[]{1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}) + .put("product_name", "HealthyFresh - Chicken raw dog food") + .put("product_price", 9.99) + )); + + SelectQuery query2 = SelectQuery.builder() + .orderByAnn(new float[]{1f, 1f, 1f, 1f, 1f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f}) + .withLimit(4) + .includeSimilarity() + .build(); + collectionVector.find(query2).forEach(System.out::println); + } + + @Test + public void testFindInArray() { + initializeCollectionSimple(); + // Given 2 records + collectionSimple.insertManyJsonDocuments(List.of( + new JsonDocument().id("1").put("names", List.of("John", "Doe")), + new JsonDocument().id("2").put("names", List.of("Cedrick", "Lunven")) + )); + // I should perform an any filter in a collection + Assertions.assertEquals(1, collectionSimple.find(SelectQuery.builder() + .where("names") + .isEqualsTo("John") + .build()).count()); + } + // ---------------------------------------- // --------- Object Mapping --------------- // ---------------------------------------- diff --git a/astra-db-client/src/test/java/com/dtsx/astra/sdk/documentation/InsertMany.java b/astra-db-client/src/test/java/com/dtsx/astra/sdk/documentation/InsertMany.java index 12cdf511..e818e105 100644 --- a/astra-db-client/src/test/java/com/dtsx/astra/sdk/documentation/InsertMany.java +++ b/astra-db-client/src/test/java/com/dtsx/astra/sdk/documentation/InsertMany.java @@ -2,7 +2,7 @@ import com.dtsx.astra.sdk.AstraDB; import com.dtsx.astra.sdk.AstraDBCollection; -import io.stargate.sdk.data.JsonDocumentMutationResult; +import io.stargate.sdk.data.domain.JsonDocumentMutationResult; import io.stargate.sdk.data.domain.JsonDocument; import java.util.List; diff --git a/astra-db-client/src/test/java/com/dtsx/astra/sdk/documentation/InsertOne.java b/astra-db-client/src/test/java/com/dtsx/astra/sdk/documentation/InsertOne.java index 0844d39f..ea5711ea 100644 --- a/astra-db-client/src/test/java/com/dtsx/astra/sdk/documentation/InsertOne.java +++ b/astra-db-client/src/test/java/com/dtsx/astra/sdk/documentation/InsertOne.java @@ -2,7 +2,7 @@ import com.dtsx.astra.sdk.AstraDB; import com.dtsx.astra.sdk.AstraDBCollection; -import io.stargate.sdk.data.JsonDocumentMutationResult; +import io.stargate.sdk.data.domain.JsonDocumentMutationResult; import io.stargate.sdk.data.domain.JsonDocument; import java.util.Map; diff --git a/astra-db-client/src/test/java/com/dtsx/astra/sdk/documentation/ObjectMappingInsertMany.java b/astra-db-client/src/test/java/com/dtsx/astra/sdk/documentation/ObjectMappingInsertMany.java index d0dc4f16..c5cbd7c4 100644 --- a/astra-db-client/src/test/java/com/dtsx/astra/sdk/documentation/ObjectMappingInsertMany.java +++ b/astra-db-client/src/test/java/com/dtsx/astra/sdk/documentation/ObjectMappingInsertMany.java @@ -3,7 +3,7 @@ import com.dtsx.astra.sdk.AstraDB; import com.dtsx.astra.sdk.AstraDBRepository; import com.fasterxml.jackson.annotation.JsonProperty; -import io.stargate.sdk.data.DocumentMutationResult; +import io.stargate.sdk.data.domain.DocumentMutationResult; import io.stargate.sdk.data.domain.odm.Document; import java.util.List; diff --git a/astra-db-client/src/test/java/com/dtsx/astra/sdk/documentation/ObjectMappingUpdateMany.java b/astra-db-client/src/test/java/com/dtsx/astra/sdk/documentation/ObjectMappingUpdateMany.java index 02997408..37a0b9c0 100644 --- a/astra-db-client/src/test/java/com/dtsx/astra/sdk/documentation/ObjectMappingUpdateMany.java +++ b/astra-db-client/src/test/java/com/dtsx/astra/sdk/documentation/ObjectMappingUpdateMany.java @@ -4,7 +4,7 @@ import com.dtsx.astra.sdk.AstraDBRepository; import com.fasterxml.jackson.annotation.JsonProperty; import dev.langchain4j.agent.tool.P; -import io.stargate.sdk.data.DocumentMutationResult; +import io.stargate.sdk.data.domain.DocumentMutationResult; import io.stargate.sdk.data.domain.odm.Document; import java.util.List; diff --git a/astra-db-client/src/test/java/com/dtsx/astra/sdk/vector/AstraDBDemoTest.java b/astra-db-client/src/test/java/com/dtsx/astra/sdk/vector/AstraDBDemoTest.java index dd1fef34..277d46e1 100644 --- a/astra-db-client/src/test/java/com/dtsx/astra/sdk/vector/AstraDBDemoTest.java +++ b/astra-db-client/src/test/java/com/dtsx/astra/sdk/vector/AstraDBDemoTest.java @@ -4,7 +4,7 @@ import com.dtsx.astra.sdk.AstraDBTestSuiteIT; import io.stargate.sdk.core.domain.Page; import io.stargate.sdk.data.CollectionClient; -import io.stargate.sdk.data.JsonDocumentMutationResult; +import io.stargate.sdk.data.domain.JsonDocumentMutationResult; import io.stargate.sdk.data.NamespaceClient; import io.stargate.sdk.data.domain.JsonDocument; import io.stargate.sdk.data.domain.JsonDocumentResult; diff --git a/astra-db-client/src/test/java/com/dtsx/astra/sdk/vector/AstraUIQuickStart.java b/astra-db-client/src/test/java/com/dtsx/astra/sdk/vector/AstraUIQuickStart.java new file mode 100644 index 00000000..eaf15c74 --- /dev/null +++ b/astra-db-client/src/test/java/com/dtsx/astra/sdk/vector/AstraUIQuickStart.java @@ -0,0 +1,14 @@ +package com.dtsx.astra.sdk.vector; + +import com.dtsx.astra.sdk.AstraDB; +import io.stargate.sdk.data.domain.CollectionDefinition; + +public class AstraUIQuickStart { + public static void main(String[] args) { + AstraDB db = new AstraDB("", ""); + System.out.println("Connected to AstraDB"); + db.findAllCollections() + .map(CollectionDefinition::getName) + .forEach(col -> System.out.println("Collection:" + col)); + } +} diff --git a/pom.xml b/pom.xml index fd0a25e2..31f9a544 100644 --- a/pom.xml +++ b/pom.xml @@ -39,7 +39,7 @@ 1.18.30 - 2.3.2 + 2.3.3 2.1.0-BETA-7 1.61.0