|
23 | 23 | import io.weaviate.client6.v1.api.collections.data.BatchReference; |
24 | 24 | import io.weaviate.client6.v1.api.collections.data.DeleteManyResponse; |
25 | 25 | import io.weaviate.client6.v1.api.collections.data.Reference; |
| 26 | +import io.weaviate.client6.v1.api.collections.data.WriteWeaviateObject; |
| 27 | +import io.weaviate.client6.v1.api.collections.query.Filter; |
26 | 28 | import io.weaviate.client6.v1.api.collections.query.Metadata; |
27 | 29 | import io.weaviate.client6.v1.api.collections.query.Metadata.MetadataField; |
28 | 30 | import io.weaviate.client6.v1.api.collections.query.QueryMetadata; |
29 | 31 | import io.weaviate.client6.v1.api.collections.query.QueryReference; |
30 | 32 | import io.weaviate.client6.v1.api.collections.query.ReadWeaviateObject; |
31 | | -import io.weaviate.client6.v1.api.collections.query.Filter; |
| 33 | +import io.weaviate.client6.v1.api.collections.tenants.Tenant; |
32 | 34 | import io.weaviate.containers.Container; |
33 | 35 |
|
34 | 36 | public class DataITest extends ConcurrentTest { |
@@ -86,6 +88,7 @@ public void testCreateGetDelete() throws IOException { |
86 | 88 | .as("object not exists after deletion").isFalse(); |
87 | 89 |
|
88 | 90 | deleted = artists.data.deleteById(id); |
| 91 | + |
89 | 92 | // TODO: Change to isFalse() after fixed in Weaviate server |
90 | 93 | Assertions.assertThat(deleted) |
91 | 94 | .as("object wasn't deleted").isTrue(); |
@@ -536,4 +539,22 @@ public void testNestedProperties_insertMany() throws IOException { |
536 | 539 | // Assert |
537 | 540 | Assertions.assertThat(result.errors()).isEmpty(); |
538 | 541 | } |
| 542 | + |
| 543 | + @Test |
| 544 | + public void test_multiTenant() throws IOException { |
| 545 | + // Arrange |
| 546 | + var nsEmails = ns("Emails"); |
| 547 | + var emails = client.collections.create(nsEmails, |
| 548 | + c -> c.multiTenancy(mt -> mt.enabled(true))); |
| 549 | + |
| 550 | + var johndoe = "john-doe"; |
| 551 | + emails.tenants.create(Tenant.active(johndoe)); |
| 552 | + emails = emails.withTenant(johndoe); |
| 553 | + |
| 554 | + // Act |
| 555 | + var inserted = emails.data.insert(Map.of("subject", "McDonald's Xmas Bonanza")); |
| 556 | + |
| 557 | + // Assert |
| 558 | + Assertions.assertThat(inserted).returns(johndoe, WriteWeaviateObject::tenant); |
| 559 | + } |
539 | 560 | } |
0 commit comments