2828import io .weaviate .client6 .v1 .api .collections .query .Metadata .MetadataField ;
2929import io .weaviate .client6 .v1 .api .collections .query .QueryMetadata ;
3030import io .weaviate .client6 .v1 .api .collections .query .QueryReference ;
31- import io .weaviate .client6 .v1 .api .collections .query .Where ;
31+ import io .weaviate .client6 .v1 .api .collections .query .Filter ;
3232import io .weaviate .containers .Container ;
3333
3434public class DataITest extends ConcurrentTest {
@@ -52,7 +52,7 @@ public void testCreateGetDelete() throws IOException {
5252 .uuid (id )
5353 .vectors (Vectors .of (VECTOR_INDEX , vector )));
5454
55- var object = artists .query .byId (id , query -> query
55+ var object = artists .query .fetchObjectById (id , query -> query
5656 .returnProperties ("name" )
5757 .returnMetadata (
5858 MetadataField .VECTOR ,
@@ -79,9 +79,16 @@ public void testCreateGetDelete() throws IOException {
7979 .as ("lastUpdateTimeUnix" ).isNotNull ();
8080 });
8181
82- artists .data .delete (id );
82+ var deleted = artists .data .deleteById (id );
83+ Assertions .assertThat (deleted )
84+ .as ("object was deleted" ).isTrue ();
8385 Assertions .assertThat (artists .data .exists (id ))
8486 .as ("object not exists after deletion" ).isFalse ();
87+
88+ deleted = artists .data .deleteById (id );
89+ // TODO: Change to isFalse() after fixed in Weaviate server
90+ Assertions .assertThat (deleted )
91+ .as ("object wasn't deleted" ).isTrue ();
8592 }
8693
8794 @ Test
@@ -99,7 +106,7 @@ public void testBlobData() throws IOException {
99106 "breed" , "ragdoll" ,
100107 "img" , ragdollPng ));
101108
102- var got = cats .query .byId (ragdoll .metadata ().uuid (),
109+ var got = cats .query .fetchObjectById (ragdoll .metadata ().uuid (),
103110 cat -> cat .returnProperties ("img" ));
104111
105112 Assertions .assertThat (got ).get ()
@@ -145,7 +152,7 @@ public void testReferences_AddReplaceDelete() throws IOException {
145152 Reference .object (albie ));
146153
147154 // Assert
148- var johnWithFriends = persons .query .byId (john .metadata ().uuid (),
155+ var johnWithFriends = persons .query .fetchObjectById (john .metadata ().uuid (),
149156 query -> query .returnReferences (
150157 QueryReference .single ("hasFriend" ,
151158 friend -> friend .returnProperties ("name" ))));
@@ -165,7 +172,7 @@ public void testReferences_AddReplaceDelete() throws IOException {
165172 "hasFriend" ,
166173 Reference .object (barbara ));
167174
168- johnWithFriends = persons .query .byId (john .metadata ().uuid (),
175+ johnWithFriends = persons .query .fetchObjectById (john .metadata ().uuid (),
169176 query -> query .returnReferences (
170177 QueryReference .single ("hasFriend" ,
171178 friend -> friend .returnProperties ("name" ))));
@@ -185,7 +192,7 @@ public void testReferences_AddReplaceDelete() throws IOException {
185192 Reference .object (barbara ));
186193
187194 // Assert
188- johnWithFriends = persons .query .byId (john .metadata ().uuid (),
195+ johnWithFriends = persons .query .fetchObjectById (john .metadata ().uuid (),
189196 query -> query .returnReferences (
190197 QueryReference .single ("hasFriend" )));
191198
@@ -214,7 +221,7 @@ public void testReplace() throws IOException {
214221 replace -> replace .properties (Map .of ("year" , 1819 )));
215222
216223 // Assert
217- var replacedIvanhoe = books .query .byId (ivanhoe .metadata ().uuid ());
224+ var replacedIvanhoe = books .query .fetchObjectById (ivanhoe .metadata ().uuid ());
218225
219226 Assertions .assertThat (replacedIvanhoe ).get ()
220227 .as ("has ONLY year property" )
@@ -258,7 +265,7 @@ public void testUpdate() throws IOException {
258265 .vectors (Vectors .of (vector )));
259266
260267 // Assert
261- var updIvanhoe = books .query .byId (
268+ var updIvanhoe = books .query .fetchObjectById (
262269 ivanhoe .metadata ().uuid (),
263270 query -> query
264271 .includeVector ()
@@ -303,7 +310,7 @@ public void testDeleteMany() throws IOException {
303310
304311 // Act (dry run)
305312 things .data .deleteMany (
306- Where .property ("last_used" ).gte (4 ),
313+ Filter .property ("last_used" ).gte (4 ),
307314 opt -> opt .dryRun (true ));
308315
309316 // Assert
@@ -312,7 +319,7 @@ public void testDeleteMany() throws IOException {
312319
313320 // Act (live run)
314321 var deleted = things .data .deleteMany (
315- Where .property ("last_used" ).gte (4 ),
322+ Filter .property ("last_used" ).gte (4 ),
316323 opt -> opt .verbose (true ));
317324
318325 // Assert
@@ -387,7 +394,7 @@ public void testReferenceAddMany() throws IOException {
387394 // Assert
388395 Assertions .assertThat (response .errors ()).isEmpty ();
389396
390- var goodburgAirports = cities .query .byId (goodburg .metadata ().uuid (),
397+ var goodburgAirports = cities .query .fetchObjectById (goodburg .metadata ().uuid (),
391398 city -> city .returnReferences (
392399 QueryReference .single ("hasAirports" )));
393400
@@ -469,7 +476,7 @@ public void testDataTypes() throws IOException {
469476
470477 // Act
471478 var object = types .data .insert (want );
472- var got = types .query .byId (object .uuid ()); // return all properties
479+ var got = types .query .fetchObjectById (object .uuid ()); // return all properties
473480
474481 // Assert
475482 Assertions .assertThat (got ).get ()
0 commit comments