|
14 | 14 | import io.weaviate.ConcurrentTest; |
15 | 15 | import io.weaviate.client6.v1.api.WeaviateClient; |
16 | 16 | import io.weaviate.client6.v1.api.collections.CollectionConfig; |
17 | | -import io.weaviate.client6.v1.api.collections.WeaviateObject; |
18 | 17 | import io.weaviate.client6.v1.api.collections.annotations.Collection; |
19 | 18 | import io.weaviate.client6.v1.api.collections.annotations.Property; |
| 19 | +import io.weaviate.client6.v1.api.collections.data.InsertManyResponse.InsertObject; |
| 20 | +import io.weaviate.client6.v1.api.collections.query.Where; |
20 | 21 | import io.weaviate.containers.Container; |
21 | 22 |
|
22 | 23 | public class ORMITest extends ConcurrentTest { |
@@ -224,12 +225,85 @@ public void test_insertAndQuery() throws Exception { |
224 | 225 | var inserted = things.data.insert(thing); |
225 | 226 |
|
226 | 227 | // Assert |
227 | | - var optional = things.query.byId(inserted.uuid()); |
228 | | - var got = Assertions.assertThat(optional).get() |
229 | | - .extracting(WeaviateObject::properties).actual(); |
230 | | - |
231 | | - Assertions.assertThat(got) |
| 228 | + var got = things.query.byId(inserted.uuid()); |
| 229 | + Assertions.assertThat(got).get() |
232 | 230 | .usingRecursiveComparison(COMPARISON_CONFIG) |
233 | 231 | .isEqualTo(thing); |
234 | 232 | } |
| 233 | + |
| 234 | + @Test |
| 235 | + public void test_insertManyAndQuery() throws Exception { |
| 236 | + short short_ = 666; |
| 237 | + int int_ = 666; |
| 238 | + long long_ = 666; |
| 239 | + float float_ = 666; |
| 240 | + double double_ = 666; |
| 241 | + boolean boolean_ = true; |
| 242 | + UUID uuid = UUID.randomUUID(); |
| 243 | + OffsetDateTime date = OffsetDateTime.now(); |
| 244 | + String text = "hello"; |
| 245 | + |
| 246 | + var thing = new Thing( |
| 247 | + text, |
| 248 | + new String[] { text }, |
| 249 | + List.of(text), |
| 250 | + |
| 251 | + OffsetDateTime.now(), |
| 252 | + new OffsetDateTime[] { date }, |
| 253 | + List.of(date), |
| 254 | + |
| 255 | + UUID.randomUUID(), |
| 256 | + new UUID[] { uuid }, |
| 257 | + List.of(uuid), |
| 258 | + |
| 259 | + short_, |
| 260 | + short_, |
| 261 | + new short[] { short_ }, |
| 262 | + new Short[] { short_ }, |
| 263 | + List.of(short_), |
| 264 | + |
| 265 | + int_, |
| 266 | + int_, |
| 267 | + new int[] { int_ }, |
| 268 | + new Integer[] { int_ }, |
| 269 | + List.of(int_), |
| 270 | + |
| 271 | + long_, |
| 272 | + long_, |
| 273 | + new long[] { long_ }, |
| 274 | + new Long[] { long_ }, |
| 275 | + List.of(long_), |
| 276 | + |
| 277 | + float_, |
| 278 | + float_, |
| 279 | + new float[] { float_ }, |
| 280 | + new Float[] { float_ }, |
| 281 | + List.of(float_), |
| 282 | + |
| 283 | + double_, |
| 284 | + double_, |
| 285 | + new double[] { double_ }, |
| 286 | + new Double[] { double_ }, |
| 287 | + List.of(double_), |
| 288 | + |
| 289 | + boolean_, |
| 290 | + boolean_, |
| 291 | + new boolean[] { boolean_ }, |
| 292 | + new Boolean[] { boolean_ }, |
| 293 | + List.of(boolean_)); |
| 294 | + |
| 295 | + var things = client.collections.use(Thing.class); |
| 296 | + |
| 297 | + // Act |
| 298 | + var inserted = things.data.insertMany(thing, thing, thing); |
| 299 | + |
| 300 | + // Assert |
| 301 | + var uuids = inserted.responses().stream().map(InsertObject::uuid).toArray(String[]::new); |
| 302 | + var got = things.query.fetchObjects(q -> q.where(Where.uuid().containsAny(uuids))); |
| 303 | + Assertions.assertThat(got.objects()) |
| 304 | + .hasSize(3) |
| 305 | + .usingRecursiveComparison(COMPARISON_CONFIG) |
| 306 | + .asInstanceOf(InstanceOfAssertFactories.list(Thing.class)) |
| 307 | + .contains(thing, thing, thing); |
| 308 | + } |
235 | 309 | } |
0 commit comments