@@ -19,7 +19,7 @@ public class JobIT extends AbstractITCase {
1919
2020 private final Map <String , String > params = Collections .emptyMap ();
2121
22- private final StringEntity TEST_PAYLOAD_JOB = new StringEntity ("{\n " +
22+ private final StringEntity TEST_PAYLOAD_JOB_ATTRIBUTES = new StringEntity ("{\n " +
2323 " \" attributes\" : {\n " +
2424 " \" attribute_a\" : [ \" a_00\" ]\n " +
2525 " },\n " +
@@ -31,6 +31,33 @@ public class JobIT extends AbstractITCase {
3131 " }\n " +
3232 "}" , ContentType .APPLICATION_JSON );
3333
34+ private final StringEntity TEST_PAYLOAD_JOB_IDS = new StringEntity ("{\n " +
35+ " \" ids\" : {\n " +
36+ " \" .zentity_test_index_a\" : [ \" a0\" ]\n " +
37+ " },\n " +
38+ " \" scope\" : {\n " +
39+ " \" include\" : {\n " +
40+ " \" indices\" : [ \" .zentity_test_index_a\" , \" .zentity_test_index_b\" , \" .zentity_test_index_c\" ],\n " +
41+ " \" resolvers\" : [ \" resolver_a\" , \" resolver_b\" ]\n " +
42+ " }\n " +
43+ " }\n " +
44+ "}" , ContentType .APPLICATION_JSON );
45+
46+ private final StringEntity TEST_PAYLOAD_JOB_ATTRIBUTES_IDS = new StringEntity ("{\n " +
47+ " \" attributes\" : {\n " +
48+ " \" attribute_a\" : [ \" a_00\" ]\n " +
49+ " },\n " +
50+ " \" ids\" : {\n " +
51+ " \" .zentity_test_index_a\" : [ \" a6\" ]\n " +
52+ " },\n " +
53+ " \" scope\" : {\n " +
54+ " \" include\" : {\n " +
55+ " \" indices\" : [ \" .zentity_test_index_a\" , \" .zentity_test_index_b\" , \" .zentity_test_index_c\" ],\n " +
56+ " \" resolvers\" : [ \" resolver_a\" , \" resolver_b\" ]\n " +
57+ " }\n " +
58+ " }\n " +
59+ "}" , ContentType .APPLICATION_JSON );
60+
3461 private final StringEntity TEST_PAYLOAD_JOB_MAX_HOPS_AND_DOCS = new StringEntity ("{\n " +
3562 " \" attributes\" : {\n " +
3663 " \" attribute_d\" : { \" values\" : [ \" d_00\" ] }\n " +
@@ -265,11 +292,11 @@ private Set<String> getActual(JsonNode json) {
265292 return docsActual ;
266293 }
267294
268- public void testJob () throws Exception {
295+ public void testJobAttributes () throws Exception {
269296 try {
270297 prepareTestResources ();
271298 String endpoint = "_zentity/resolution/zentity_test_entity_a" ;
272- Response response = client .performRequest ("POST" , endpoint , params , TEST_PAYLOAD_JOB );
299+ Response response = client .performRequest ("POST" , endpoint , params , TEST_PAYLOAD_JOB_ATTRIBUTES );
273300 JsonNode json = Json .MAPPER .readTree (response .getEntity ().getContent ());
274301 assertEquals (json .get ("hits" ).get ("total" ).asInt (), 6 );
275302
@@ -287,6 +314,74 @@ public void testJob() throws Exception {
287314 }
288315 }
289316
317+ public void testJobIds () throws Exception {
318+ try {
319+ prepareTestResources ();
320+ String endpoint = "_zentity/resolution/zentity_test_entity_a" ;
321+ Response response = client .performRequest ("POST" , endpoint , params , TEST_PAYLOAD_JOB_IDS );
322+ JsonNode json = Json .MAPPER .readTree (response .getEntity ().getContent ());
323+ assertEquals (json .get ("hits" ).get ("total" ).asInt (), 6 );
324+
325+ Set <String > docsExpected = new TreeSet <>();
326+ docsExpected .add ("a0,0" );
327+ docsExpected .add ("b0,1" );
328+ docsExpected .add ("c0,2" );
329+ docsExpected .add ("a1,3" );
330+ docsExpected .add ("b1,4" );
331+ docsExpected .add ("c1,5" );
332+
333+ assertEquals (docsExpected , getActual (json ));
334+ } finally {
335+ destroyTestResources ();
336+ }
337+ }
338+
339+ public void testJobAttributesIds () throws Exception {
340+ try {
341+ prepareTestResources ();
342+ String endpoint = "_zentity/resolution/zentity_test_entity_a" ;
343+ Response response = client .performRequest ("POST" , endpoint , params , TEST_PAYLOAD_JOB_ATTRIBUTES_IDS );
344+ JsonNode json = Json .MAPPER .readTree (response .getEntity ().getContent ());
345+ assertEquals (json .get ("hits" ).get ("total" ).asInt (), 30 );
346+
347+ Set <String > docsExpected = new TreeSet <>();
348+ docsExpected .add ("a0,0" );
349+ docsExpected .add ("a6,0" );
350+ docsExpected .add ("b0,0" );
351+ docsExpected .add ("a2,1" );
352+ docsExpected .add ("a7,1" );
353+ docsExpected .add ("a8,1" );
354+ docsExpected .add ("a9,1" );
355+ docsExpected .add ("b2,1" );
356+ docsExpected .add ("b6,1" );
357+ docsExpected .add ("b7,1" );
358+ docsExpected .add ("b8,1" );
359+ docsExpected .add ("b9,1" );
360+ docsExpected .add ("c0,1" );
361+ docsExpected .add ("c2,1" );
362+ docsExpected .add ("c6,1" );
363+ docsExpected .add ("c7,1" );
364+ docsExpected .add ("c8,1" );
365+ docsExpected .add ("c9,1" );
366+ docsExpected .add ("a1,2" );
367+ docsExpected .add ("a3,2" );
368+ docsExpected .add ("a4,2" );
369+ docsExpected .add ("a5,2" );
370+ docsExpected .add ("b3,2" );
371+ docsExpected .add ("b4,2" );
372+ docsExpected .add ("b5,2" );
373+ docsExpected .add ("c3,2" );
374+ docsExpected .add ("c4,2" );
375+ docsExpected .add ("c5,2" );
376+ docsExpected .add ("b1,3" );
377+ docsExpected .add ("c1,4" );
378+
379+ assertEquals (docsExpected , getActual (json ));
380+ } finally {
381+ destroyTestResources ();
382+ }
383+ }
384+
290385 public void testJobMaxHopsAndDocs () throws Exception {
291386 try {
292387 prepareTestResources ();
0 commit comments