Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/it/java/io/weaviate/containers/Weaviate.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
public class Weaviate extends WeaviateContainer {
private WeaviateClient clientInstance;

public static final String VERSION = "1.29.0";
public static final String VERSION = "1.29.1";
public static final String DOCKER_IMAGE = "semitechnologies/weaviate";

/**
Expand Down
57 changes: 51 additions & 6 deletions src/it/java/io/weaviate/integration/CollectionsITest.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@

import io.weaviate.ConcurrentTest;
import io.weaviate.client6.v1.api.WeaviateClient;
import io.weaviate.client6.v1.api.collections.CollectionConfig;
import io.weaviate.client6.v1.api.collections.InvertedIndex;
import io.weaviate.client6.v1.api.collections.Property;
import io.weaviate.client6.v1.api.collections.Replication;
import io.weaviate.client6.v1.api.collections.VectorIndex;
import io.weaviate.client6.v1.api.collections.WeaviateCollection;
import io.weaviate.client6.v1.api.collections.vectorindex.Hnsw;
import io.weaviate.client6.v1.api.collections.vectorizers.NoneVectorizer;
import io.weaviate.containers.Container;
Expand All @@ -29,8 +31,8 @@ public void testCreateGetDelete() throws IOException {
var thingsCollection = client.collections.getConfig(collectionName);

Assertions.assertThat(thingsCollection).get()
.hasFieldOrPropertyWithValue("name", collectionName)
.extracting(WeaviateCollection::vectors, InstanceOfAssertFactories.map(String.class, VectorIndex.class))
.hasFieldOrPropertyWithValue("collectionName", collectionName)
.extracting(CollectionConfig::vectors, InstanceOfAssertFactories.map(String.class, VectorIndex.class))
.as("default vector").extractingByKey("default")
.satisfies(defaultVector -> {
Assertions.assertThat(defaultVector).extracting(VectorIndex::vectorizer)
Expand Down Expand Up @@ -61,7 +63,7 @@ public void testCrossReferences() throws IOException {
.as("after create Things").get()
.satisfies(c -> {
Assertions.assertThat(c.references())
.as("ownedBy").filteredOn(p -> p.name().equals("ownedBy")).first()
.as("ownedBy").filteredOn(p -> p.propertyName().equals("ownedBy")).first()
.extracting(p -> p.dataTypes(), InstanceOfAssertFactories.LIST)
.containsOnly(nsOwners);
});
Expand All @@ -81,7 +83,7 @@ public void testCrossReferences() throws IOException {
.as("after add property").get()
.satisfies(c -> {
Assertions.assertThat(c.references())
.as("soldIn").filteredOn(p -> p.name().equals("soldIn")).first()
.as("soldIn").filteredOn(p -> p.propertyName().equals("soldIn")).first()
.extracting(p -> p.dataTypes(), InstanceOfAssertFactories.LIST)
.containsOnly(nsOnlineStores, nsMarkets);
});
Expand All @@ -105,7 +107,7 @@ public void testListDeleteAll() throws IOException {
var all = client.collections.list();
Assertions.assertThat(all)
.hasSizeGreaterThanOrEqualTo(3)
.extracting(WeaviateCollection::name)
.extracting(CollectionConfig::collectionName)
.contains(nsA, nsB, nsC);

client.collections.deleteAll();
Expand All @@ -114,4 +116,47 @@ public void testListDeleteAll() throws IOException {
Assertions.assertThat(all.isEmpty());

}

@Test
public void testUpdateCollection() throws IOException {
var nsBoxes = ns("Boxes");
var nsThings = ns("Things");

client.collections.create(nsBoxes);

client.collections.create(nsThings,
collection -> collection
.description("Things stored in boxes")
.properties(
Property.text("name"),
Property.integer("width",
w -> w.description("how wide this thing is")))
.invertedIndex(idx -> idx.cleanupIntervalSeconds(10))
.replication(repl -> repl.asyncEnabled(true)));

var things = client.collections.use(nsThings);

// Act
things.config.update(nsThings, collection -> collection
.description("Things stored on shelves")
.propertyDescription("width", "not height")
.invertedIndex(idx -> idx.cleanupIntervalSeconds(30))
.replication(repl -> repl.asyncEnabled(false)));

// Assert
var updated = things.config.get();
Assertions.assertThat(updated).get()
.returns("Things stored on shelves", CollectionConfig::description)
.satisfies(collection -> {
Assertions.assertThat(collection)
.extracting(CollectionConfig::properties, InstanceOfAssertFactories.list(Property.class))
.extracting(Property::description).contains("not height");

Assertions.assertThat(collection)
.extracting(CollectionConfig::invertedIndex).returns(30, InvertedIndex::cleanupIntervalSeconds);

Assertions.assertThat(collection)
.extracting(CollectionConfig::replication).returns(false, Replication::asyncEnabled);
});
}
}
4 changes: 2 additions & 2 deletions src/it/java/io/weaviate/integration/ReferencesITest.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public void testReferences() throws IOException {
.as("Artists: create collection")
.extracting(c -> c.references().stream().findFirst())
.as("has one reference property").extracting(Optional::get)
.returns("hasAwards", ReferenceProperty::name)
.returns("hasAwards", ReferenceProperty::propertyName)
.extracting(ReferenceProperty::dataTypes, InstanceOfAssertFactories.list(String.class))
.containsOnly(nsGrammy, nsOscar);

Expand All @@ -87,7 +87,7 @@ public void testReferences() throws IOException {
Assertions.assertThat(collectionArtists).get()
.as("Artists: add reference to Movies")
.extracting(c -> c.references().stream()
.filter(property -> property.name().equals("featuredIn")).findFirst())
.filter(property -> property.propertyName().equals("featuredIn")).findFirst())
.as("featuredIn reference property").extracting(Optional::get)
.extracting(ReferenceProperty::dataTypes, InstanceOfAssertFactories.list(String.class))
.containsOnly(nsMovies);
Expand Down
Loading