diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1b8c14b6..3ccd2da4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,9 +2,12 @@
[comment]: <> (When bumping [pc:VERSION_LATEST_RELEASE] create a new entry below)
### Unreleased version
+
+### v0.7.0
- Add support to list indexes
- Add support to configure index
-- Add user-agent as a header
+- Add user-agent to the header
+- Add integration tests for data plane operations
### v0.6.0
- Add async stub for data plane operations
diff --git a/README.md b/README.md
index 7b2b8e47..7219f4e8 100644
--- a/README.md
+++ b/README.md
@@ -15,7 +15,7 @@ Maven:
io.pinecone
pinecone-client
- 0.2.3
+ 0.7.0
```
@@ -23,22 +23,16 @@ Maven:
Gradle:
```
-implementation "io.pinecone:pinecone-client:0.2.3"
+implementation "io.pinecone:pinecone-client:0.7.0"
```
[comment]: <> (^ [pc:VERSION_LATEST_RELEASE])
-Alternatively, you can use our standalone uberjar [pinecone-client-0.2.3-all.jar](https://repo1.maven.org/maven2/io/pinecone/pinecone-client/0.2.3/pinecone-client-0.2.3-all.jar), which bundles the pinecone client and all dependencies together inside a single jar. You can include this on your classpath like any 3rd party JAR without having to obtain the *pinecone-client* dependencies separately.
+Alternatively, you can use our standalone uberjar [pinecone-client-0.7.0-all.jar](https://repo1.maven.org/maven2/io/pinecone/pinecone-client/0.7.0/pinecone-client-0.7.0-all.jar), which bundles the pinecone client and all dependencies together inside a single jar. You can include this on your classpath like any 3rd party JAR without having to obtain the *pinecone-client* dependencies separately.
[comment]: <> (^ [pc:VERSION_LATEST_RELEASE])
-## Features
-
-The Java client doesn't support managing Pinecone services, only reading and writing from existing indices. To create or delete an index, use the Python client.
-
## Examples
-- The most basic example usage is in `src/test/java/io/pinecone/PineconeClientLiveIntegTest.java`, covering most basic operations.
-> [!NOTE]
-> The java-basic-mvn example is outdated.
\ No newline at end of file
+- The data and control plane operation examples can be found in `io/pinecone/integration` folder.
\ No newline at end of file
diff --git a/examples/java-basic-mvn/src/main/java/pineconeexamples/MinimalUpsertAndQueryExample.java b/examples/java-basic-mvn/src/main/java/pineconeexamples/MinimalUpsertAndQueryExample.java
index fdd572f9..88fe1a99 100644
--- a/examples/java-basic-mvn/src/main/java/pineconeexamples/MinimalUpsertAndQueryExample.java
+++ b/examples/java-basic-mvn/src/main/java/pineconeexamples/MinimalUpsertAndQueryExample.java
@@ -53,6 +53,7 @@ public static void main(String[] cliArgs) {
.addAllValues(Floats.asList(5F, 3F, 1F))
.build();
+ // Deprecated: use addValue() or addAllValues() instead of addVector() and addAllVectors() respectively
UpsertRequest upsertRequest = UpsertRequest.newBuilder()
.addVectors(v1)
.addVectors(v2)
diff --git a/examples/java-basic-mvn/src/main/java/pineconeexamples/UpsertsAndQueriesConcurrentExample.java b/examples/java-basic-mvn/src/main/java/pineconeexamples/UpsertsAndQueriesConcurrentExample.java
index e88db89a..2f37013f 100644
--- a/examples/java-basic-mvn/src/main/java/pineconeexamples/UpsertsAndQueriesConcurrentExample.java
+++ b/examples/java-basic-mvn/src/main/java/pineconeexamples/UpsertsAndQueriesConcurrentExample.java
@@ -106,6 +106,8 @@ public static void main(String[] cliArgs) throws InterruptedException {
}
try {
+ // Deprecated: use addValue() or addAllValues() instead of addVector()
+ // and addAllVectors() respectively
UpsertRequest upsertRequest = UpsertRequest.newBuilder()
.addAllVectors(vectors)
.build();
diff --git a/gradle.properties b/gradle.properties
index 7a16702b..54602b59 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1 +1 @@
-pineconeClientVersion = 0.6.0
+pineconeClientVersion = 0.7.0
diff --git a/src/integration/java/io/pinecone/integration/controlPlane/ConfigureIndexTest.java b/src/integration/java/io/pinecone/integration/controlPlane/ConfigureIndexTest.java
index d945c5d2..8555b35d 100644
--- a/src/integration/java/io/pinecone/integration/controlPlane/ConfigureIndexTest.java
+++ b/src/integration/java/io/pinecone/integration/controlPlane/ConfigureIndexTest.java
@@ -1,7 +1,7 @@
package io.pinecone.integration.controlPlane;
import io.pinecone.PineconeClientConfig;
-import io.pinecone.PineconeClientLiveIntegTest;
+import io.pinecone.integration.dataplane.PineconeClientLiveIntegTest;
import io.pinecone.PineconeIndexOperationClient;
import io.pinecone.exceptions.PineconeBadRequestException;
import io.pinecone.exceptions.PineconeNotFoundException;
diff --git a/src/integration/java/io/pinecone/PineconeIndexOperationsClientIntegrationTest.java b/src/integration/java/io/pinecone/integration/controlPlane/CreateListAndDeleteIndexTest.java
similarity index 90%
rename from src/integration/java/io/pinecone/PineconeIndexOperationsClientIntegrationTest.java
rename to src/integration/java/io/pinecone/integration/controlPlane/CreateListAndDeleteIndexTest.java
index 071be2a3..adc05949 100644
--- a/src/integration/java/io/pinecone/PineconeIndexOperationsClientIntegrationTest.java
+++ b/src/integration/java/io/pinecone/integration/controlPlane/CreateListAndDeleteIndexTest.java
@@ -1,5 +1,7 @@
-package io.pinecone;
+package io.pinecone.integration.controlPlane;
+import io.pinecone.PineconeClientConfig;
+import io.pinecone.PineconeIndexOperationClient;
import io.pinecone.helpers.RandomStringBuilder;
import io.pinecone.model.CreateIndexRequest;
import io.pinecone.model.IndexMeta;
@@ -12,7 +14,7 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
-public class PineconeIndexOperationsClientIntegrationTest {
+public class CreateListAndDeleteIndexTest {
private PineconeIndexOperationClient pinecone;
@BeforeEach
diff --git a/src/integration/java/io/pinecone/PineconeClientLiveIntegTest.java b/src/integration/java/io/pinecone/integration/dataplane/PineconeClientLiveIntegTest.java
similarity index 76%
rename from src/integration/java/io/pinecone/PineconeClientLiveIntegTest.java
rename to src/integration/java/io/pinecone/integration/dataplane/PineconeClientLiveIntegTest.java
index 0d9e9b0b..a071c880 100644
--- a/src/integration/java/io/pinecone/PineconeClientLiveIntegTest.java
+++ b/src/integration/java/io/pinecone/integration/dataplane/PineconeClientLiveIntegTest.java
@@ -1,59 +1,39 @@
-package io.pinecone;
+package io.pinecone.integration.dataplane;
import com.google.common.primitives.Floats;
import com.google.protobuf.Struct;
import com.google.protobuf.Value;
+import io.pinecone.PineconeConnection;
import io.pinecone.helpers.RandomStringBuilder;
-import io.pinecone.model.IndexMeta;
import io.pinecone.proto.*;
-import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+import static io.pinecone.helpers.IndexManager.createIndexIfNotExistsDataPlane;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.notNullValue;
-import static org.junit.jupiter.api.Assertions.assertEquals;
public class PineconeClientLiveIntegTest {
- public String indexName = "integ-test-sanity";
-
private static final Logger logger = LoggerFactory.getLogger(PineconeClientLiveIntegTest.class);
+ private static VectorServiceGrpc.VectorServiceBlockingStub blockingStub;
- private PineconeClient dataPlaneClient;
- private PineconeIndexOperationClient controlPlaneClient;
-
- @BeforeEach
- public void setUp() {
- PineconeClientConfig config = new PineconeClientConfig()
- .withApiKey(System.getenv("PINECONE_API_KEY"))
- .withEnvironment(System.getenv("PINECONE_ENVIRONMENT"))
- .withServerSideTimeoutSec(10);
-
- controlPlaneClient = new PineconeIndexOperationClient(config);
- dataPlaneClient = new PineconeClient(config);
+ @BeforeAll
+ public static void defineConfig() throws IOException, InterruptedException {
+ PineconeConnection connection = createIndexIfNotExistsDataPlane(3);
+ blockingStub = connection.getBlockingStub();
}
@Test
- public void checkIndexSetup() throws Exception {
- IndexMeta indexMeta = controlPlaneClient.describeIndex(indexName);
- assertEquals(3, indexMeta.getDatabase().getDimension());
- }
-
- @Test
- public void sanity() throws Exception {
- IndexMeta indexMeta = controlPlaneClient.describeIndex(indexName);
- String host = indexMeta.getStatus().getHost();
- PineconeConnection conn = dataPlaneClient.connect(
- new PineconeConnectionConfig()
- .withConnectionUrl("https://" + host));
-
+ public void sanity() {
String namespace = RandomStringBuilder.build("ns", 8);
// upsert
@@ -76,7 +56,7 @@ public void sanity() throws Exception {
.setNamespace(namespace)
.build();
- UpsertResponse upsertResponse = conn.getBlockingStub().upsert(request);
+ UpsertResponse upsertResponse = blockingStub.upsert(request);
logger.info("Put " + upsertResponse.getUpsertedCount() + " vectors into the index");
assert (upsertResponse.getUpsertedCount() == 3);
@@ -100,14 +80,14 @@ public void sanity() throws Exception {
.addAllVectors(hybridVectors)
.setNamespace(namespace)
.build();
- UpsertResponse hybridResponse = conn.getBlockingStub().upsert(hybridRequest);
+ UpsertResponse hybridResponse = blockingStub.upsert(hybridRequest);
logger.info("Put " + hybridResponse.getUpsertedCount() + " vectors into the index");
assert (hybridResponse.getUpsertedCount() == 3);
// fetch
List ids = Arrays.asList("v1", "v2");
FetchRequest fetchRequest = FetchRequest.newBuilder().addAllIds(ids).setNamespace(namespace).build();
- FetchResponse fetchResponse = conn.getBlockingStub().fetch(fetchRequest);
+ FetchResponse fetchResponse = blockingStub.fetch(fetchRequest);
assert (fetchResponse.containsVectors("v1"));
// Updates vector v1's values to 10.0, 11.0, and 12.0 from 1.0, 2.0, and 3.0
@@ -116,9 +96,9 @@ public void sanity() throws Exception {
.setNamespace(namespace)
.addAllValues(Floats.asList(10F, 11F, 12F))
.build();
- conn.getBlockingStub().update(updateRequest);
+ blockingStub.update(updateRequest);
fetchRequest = FetchRequest.newBuilder().addIds("v1").setNamespace(namespace).build();
- conn.getBlockingStub().fetch(fetchRequest);
+ blockingStub.fetch(fetchRequest);
// DEPRECATED: all methods related to queries in QueryVector
// Use methods related to Vector. Example: addVector, addAllVector, etc.
@@ -145,7 +125,7 @@ public void sanity() throws Exception {
.setIncludeMetadata(true)
.build();
- QueryResponse queryResponse = conn.getBlockingStub().query(batchQueryRequest);
+ QueryResponse queryResponse = blockingStub.query(batchQueryRequest);
assertThat(queryResponse, notNullValue());
assertThat(queryResponse.getResultsList(), notNullValue());
assertThat(queryResponse.getResultsCount(), equalTo(1));
@@ -159,7 +139,7 @@ public void sanity() throws Exception {
.build();
// When querying using a single vector, we get matches instead of results
- queryResponse = conn.getBlockingStub().query(queryRequest);
+ queryResponse = blockingStub.query(queryRequest);
assertThat(queryResponse, notNullValue());
assertThat(queryResponse.getMatchesList(), notNullValue());
assertThat(queryResponse.getMatchesCount(), equalTo(2));
@@ -172,7 +152,7 @@ public void sanity() throws Exception {
.setIncludeMetadata(true)
.build();
- queryResponse = conn.getBlockingStub().query(queryByIdRequest);
+ queryResponse = blockingStub.query(queryByIdRequest);
assertThat(queryResponse, notNullValue());
assertThat(queryResponse.getMatchesList(), notNullValue());
assertThat(queryResponse.getMatchesCount(), equalTo(2));
@@ -185,9 +165,9 @@ public void sanity() throws Exception {
.setDeleteAll(false)
.build();
- conn.getBlockingStub().delete(deleteRequest);
+ blockingStub.delete(deleteRequest);
fetchRequest = FetchRequest.newBuilder().addAllIds(ids).setNamespace(namespace).build();
- fetchResponse = conn.getBlockingStub().fetch(fetchRequest);
+ fetchResponse = blockingStub.fetch(fetchRequest);
assert (fetchResponse.getVectorsCount() == ids.size() - 1);
// Clear out the test
@@ -196,9 +176,9 @@ public void sanity() throws Exception {
.setDeleteAll(true)
.build();
- conn.getBlockingStub().delete(deleteAllRequest);
+ blockingStub.delete(deleteAllRequest);
fetchRequest = FetchRequest.newBuilder().addAllIds(ids).setNamespace(namespace).build();
- fetchResponse = conn.getBlockingStub().fetch(fetchRequest);
+ fetchResponse = blockingStub.fetch(fetchRequest);
assert (fetchResponse.getVectorsCount() == 0);
}
}