Skip to content

Commit ec115b9

Browse files
committed
Fix peerId datatype and disable non-functional cluster tests
1 parent 366dae7 commit ec115b9

File tree

8 files changed

+66
-37
lines changed

8 files changed

+66
-37
lines changed

http/src/main/java/io/metaloom/qdrant/client/http/method/ClusterMethods.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ public interface ClusterMethods {
1010

1111
QDrantClientRequest<ClusterStatusResponse> getClusterStatusInfo();
1212

13-
QDrantClientRequest<GenericBooleanStatusResponse> removePeerFromCluster(String peerId, boolean force);
13+
QDrantClientRequest<GenericBooleanStatusResponse> removePeerFromCluster(String peerId, boolean force);
1414

1515
QDrantClientRequest<CollectionClusterInfoResponse> getCollectionClusterInfo(String collectionName);
1616

17-
QDrantClientRequest<GenericBooleanStatusResponse> updateCollectionClusterSetup(String collectionName, CollectionUpdateClusterSetupRequest request);
17+
QDrantClientRequest<GenericBooleanStatusResponse> updateCollectionClusterSetup(String collectionName,
18+
CollectionUpdateClusterSetupRequest request);
1819

1920
}

http/src/main/java/io/metaloom/qdrant/client/http/model/cluster/operation/AbortTransferOperation.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,31 @@
11
package io.metaloom.qdrant.client.http.model.cluster.operation;
22

3+
import java.math.BigInteger;
4+
35
import com.fasterxml.jackson.annotation.JsonProperty;
46

57
public class AbortTransferOperation extends AbstractShardOperation {
68

79
@JsonProperty("to_peer_id")
8-
private long toPeerId;
10+
private BigInteger toPeerId;
911

1012
@JsonProperty("from_peer_id")
11-
private long fromPeerId;
13+
private BigInteger fromPeerId;
1214

13-
public long getToPeerId() {
15+
public BigInteger getToPeerId() {
1416
return toPeerId;
1517
}
1618

17-
public AbortTransferOperation setToPeerId(long toPeerId) {
19+
public AbortTransferOperation setToPeerId(BigInteger toPeerId) {
1820
this.toPeerId = toPeerId;
1921
return this;
2022
}
2123

22-
public long getFromPeerId() {
24+
public BigInteger getFromPeerId() {
2325
return fromPeerId;
2426
}
2527

26-
public AbortTransferOperation setFromPeerId(long fromPeerId) {
28+
public AbortTransferOperation setFromPeerId(BigInteger fromPeerId) {
2729
this.fromPeerId = fromPeerId;
2830
return this;
2931
}

http/src/main/java/io/metaloom/qdrant/client/http/model/cluster/operation/DropReplicaOperation.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
package io.metaloom.qdrant.client.http.model.cluster.operation;
22

3+
import java.math.BigInteger;
4+
35
import com.fasterxml.jackson.annotation.JsonProperty;
46

57
public class DropReplicaOperation extends AbstractShardOperation {
68

79
@JsonProperty("peer_id")
8-
private long peerId;
10+
private BigInteger peerId;
911

10-
public long getPeerId() {
12+
public BigInteger getPeerId() {
1113
return peerId;
1214
}
1315

14-
public DropReplicaOperation setPeerId(long peerId) {
16+
public DropReplicaOperation setPeerId(BigInteger peerId) {
1517
this.peerId = peerId;
1618
return this;
1719
}

http/src/main/java/io/metaloom/qdrant/client/http/model/cluster/operation/MoveShardOperation.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,31 @@
11
package io.metaloom.qdrant.client.http.model.cluster.operation;
22

3+
import java.math.BigInteger;
4+
35
import com.fasterxml.jackson.annotation.JsonProperty;
46

57
public class MoveShardOperation extends AbstractShardOperation {
68

79
@JsonProperty("to_peer_id")
8-
private long toPeerId;
10+
private BigInteger toPeerId;
911

1012
@JsonProperty("from_peer_id")
11-
private long fromPeerId;
13+
private BigInteger fromPeerId;
1214

13-
public long getToPeerId() {
15+
public BigInteger getToPeerId() {
1416
return toPeerId;
1517
}
16-
17-
public MoveShardOperation setToPeerId(long toPeerId) {
18+
19+
public MoveShardOperation setToPeerId(BigInteger toPeerId) {
1820
this.toPeerId = toPeerId;
1921
return this;
2022
}
2123

22-
public long getFromPeerId() {
24+
public BigInteger getFromPeerId() {
2325
return fromPeerId;
2426
}
25-
26-
public MoveShardOperation setFromPeerId(long fromPeerId) {
27+
28+
public MoveShardOperation setFromPeerId(BigInteger fromPeerId) {
2729
this.fromPeerId = fromPeerId;
2830
return this;
2931
}

http/src/main/java/io/metaloom/qdrant/client/http/model/cluster/operation/ReplicateShardOperation.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,31 @@
11
package io.metaloom.qdrant.client.http.model.cluster.operation;
22

3+
import java.math.BigInteger;
4+
35
import com.fasterxml.jackson.annotation.JsonProperty;
46

57
public class ReplicateShardOperation extends AbstractShardOperation {
68

79
@JsonProperty("to_peer_id")
8-
private long toPeerId;
10+
private BigInteger toPeerId;
911

1012
@JsonProperty("from_peer_id")
11-
private long fromPeerId;
13+
private BigInteger fromPeerId;
1214

13-
public long getToPeerId() {
15+
public BigInteger getToPeerId() {
1416
return toPeerId;
1517
}
1618

17-
public ReplicateShardOperation setToPeerId(long toPeerId) {
19+
public ReplicateShardOperation setToPeerId(BigInteger toPeerId) {
1820
this.toPeerId = toPeerId;
1921
return this;
2022
}
2123

22-
public long getFromPeerId() {
24+
public BigInteger getFromPeerId() {
2325
return fromPeerId;
2426
}
2527

26-
public ReplicateShardOperation setFromPeerId(long fromPeerId) {
28+
public ReplicateShardOperation setFromPeerId(BigInteger fromPeerId) {
2729
this.fromPeerId = fromPeerId;
2830
return this;
2931
}

http/src/main/java/io/metaloom/qdrant/client/http/model/collection/config/CollectionClusterInfo.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package io.metaloom.qdrant.client.http.model.collection.config;
22

3+
import java.math.BigInteger;
34
import java.util.List;
45

56
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -9,7 +10,7 @@
910
public class CollectionClusterInfo implements RestModel {
1011

1112
@JsonProperty("peer_id")
12-
private int peerId;
13+
private BigInteger peerId;
1314

1415
@JsonProperty("shard_count")
1516
private int shardCount;
@@ -23,11 +24,11 @@ public class CollectionClusterInfo implements RestModel {
2324
@JsonProperty("shard_transfers")
2425
private List<ShardTransferInfo> shardTransfers;
2526

26-
public int getPeerId() {
27+
public BigInteger getPeerId() {
2728
return peerId;
2829
}
2930

30-
public CollectionClusterInfo setPeerId(int peerId) {
31+
public CollectionClusterInfo setPeerId(BigInteger peerId) {
3132
this.peerId = peerId;
3233
return this;
3334
}

http/src/test/java/io/metaloom/qdrant/client/http/AbstractClientTest.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package io.metaloom.qdrant.client.http;
22

3+
import static io.metaloom.qdrant.client.http.model.collection.config.Distance.EUCLID;
34
import static org.junit.Assert.assertEquals;
45
import static org.junit.Assert.assertTrue;
56
import static org.junit.Assert.fail;
@@ -12,6 +13,8 @@
1213
import io.metaloom.qdrant.client.http.model.ErrorResponse;
1314
import io.metaloom.qdrant.client.http.model.GenericBooleanStatusResponse;
1415
import io.metaloom.qdrant.client.http.model.RestResponse;
16+
import io.metaloom.qdrant.client.http.model.collection.CollectionCreateRequest;
17+
import io.metaloom.qdrant.client.http.model.collection.config.VectorParams;
1518

1619
public abstract class AbstractClientTest extends AbstractContainerTest {
1720

@@ -58,4 +61,10 @@ protected <T extends RestResponse> T invoke(QDrantClientRequest<T> request) thro
5861
}
5962
}
6063

64+
protected void createTestCollection() throws HttpErrorException {
65+
CollectionCreateRequest request = new CollectionCreateRequest();
66+
request.setVectors(VectorParams.of(4, EUCLID));
67+
invoke(client.createCollection(TEST_COLLECTION_NAME, request));
68+
}
69+
6170
}
Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,39 @@
11
package io.metaloom.qdrant.client.http.method;
22

3-
import static org.junit.Assert.fail;
3+
import java.math.BigInteger;
44

5+
import org.junit.Ignore;
56
import org.junit.Test;
67

78
import io.metaloom.qdrant.client.http.AbstractClientTest;
9+
import io.metaloom.qdrant.client.http.impl.HttpErrorException;
10+
import io.metaloom.qdrant.client.http.model.cluster.CollectionUpdateClusterSetupRequest;
811

912
public class ClusterMethodTest extends AbstractClientTest {
1013

1114
@Test
12-
public void testGetClusterStatusInfo() {
13-
fail("not implemented");
15+
public void testGetClusterStatusInfo() throws HttpErrorException {
16+
invoke(client.getClusterStatusInfo());
1417
}
1518

16-
public void testRemovePeerFromCluster() {
17-
fail("not implemented");
19+
@Test
20+
@Ignore("Clustering not implemented for test environment")
21+
public void testRemovePeerFromCluster() throws HttpErrorException {
22+
createTestCollection();
23+
BigInteger peerId = invoke(client.getCollectionClusterInfo(TEST_COLLECTION_NAME)).getResult().getPeerId();
24+
invoke(client.removePeerFromCluster(peerId.toString(), true));
1825
}
1926

2027
@Test
21-
public void testCollectionClusterInfo() {
22-
fail("not implemented");
28+
public void testCollectionClusterInfo() throws HttpErrorException {
29+
createTestCollection();
30+
invoke(client.getCollectionClusterInfo(TEST_COLLECTION_NAME));
2331
}
2432

2533
@Test
26-
public void testUpdateCollectionClusterSetup() {
27-
fail("not implemented");
34+
@Ignore("Clustering not implemented for test environment")
35+
public void testUpdateCollectionClusterSetup() throws HttpErrorException {
36+
CollectionUpdateClusterSetupRequest request = new CollectionUpdateClusterSetupRequest();
37+
invoke(client.updateCollectionClusterSetup(TEST_COLLECTION_NAME, request));
2838
}
2939
}

0 commit comments

Comments
 (0)