@Test public void parseReclassificationRequest_validQuery() throws Exception { JsonNode jsonRequest = JsonHandler.getFromInputStream( PropertiesUtils.getResourceAsStream("Reclassification/dsl_parsing/reclassification_query_complete.json")); ReclassificationRequestDslParser instance = new ReclassificationRequestDslParser(); ParsedReclassificationDslRequest parsedReclassificationDslRequest = instance.parseReclassificationRequest(jsonRequest); assertThat(parsedReclassificationDslRequest.getEntries()).hasSize(4); ParsedReclassificationDslRequestEntry entry1 = parsedReclassificationDslRequest.getEntries().get(0); assertThat(entry1.getSelectMultiQuery().getRoots()).isEmpty(); assertThat(entry1.getSelectMultiQuery().getQueries()).hasSize(1); assertThat(entry1.getSelectMultiQuery().getQueries().get(0).getQUERY().exactToken()).isEqualTo("$exists"); assertThat(entry1.getAttachments()).containsExactlyInAnyOrder("aeaqaaaaaagdmvr3abnwoak7fzjq75qaaaca"); assertThat(entry1.getDetachments()).containsExactlyInAnyOrder("aeaqaaaaaagdmvr3abnwoak7fzjq75qaaacc", "aeaqaaaaaagdmvr3abnwoak7fzjq75qaaacb"); ParsedReclassificationDslRequestEntry entry2 = parsedReclassificationDslRequest.getEntries().get(1); assertThat(entry2.getSelectMultiQuery().getRoots()).containsExactlyInAnyOrder("aeaqaaaaaagdmvr3abnwoak7fzjq75qaaacc"); assertThat(entry2.getSelectMultiQuery().getQueries()).hasSize(1); assertThat(entry2.getSelectMultiQuery().getQueries().get(0).getQUERY().exactToken()).isEqualTo("$exists"); assertThat(entry2.getAttachments()).containsExactlyInAnyOrder("aeaqaaaaaagdmvr3abnwoak7fzjq75qaaacd"); assertThat(entry2.getDetachments()).containsExactlyInAnyOrder("aeaqaaaaaagdmvr3abnwoak7fzjq75qaaace", "aeaqaaaaaagdmvr3abnwoak7fzjq75qaaacf"); ParsedReclassificationDslRequestEntry entry3 = parsedReclassificationDslRequest.getEntries().get(2); assertThat(entry3.getAttachments()).containsExactlyInAnyOrder("aeaqaaaaaagdmvr3abnwoak7fzjq75qaaach"); assertThat(entry3.getDetachments()).isEmpty(); ParsedReclassificationDslRequestEntry entry4 = parsedReclassificationDslRequest.getEntries().get(3); assertThat(entry4.getAttachments()).isEmpty(); assertThat(entry4.getDetachments()).containsExactlyInAnyOrder("aeaqaaaaaagdmvr3abnwoak7fzjq75qaaacj"); }
public ParsedReclassificationDslRequest parseReclassificationRequest(JsonNode reclassificationDslJson) throws InvalidParseOperationException { if (!reclassificationDslJson.isArray() || reclassificationDslJson.size() == 0) { throw new InvalidParseOperationException("Expected array of reclassification updates DSLs"); } List<ParsedReclassificationDslRequestEntry> entries = new ArrayList<>(); for (JsonNode singleReclassificationDslJson : reclassificationDslJson) { SelectMultiQuery selectMultiQuery = parseSelectMultiQuery(singleReclassificationDslJson); Set<String> attachments = parseReclassificationDslAttachments(singleReclassificationDslJson); Set<String> detachments = parseReclassificationDslDetachments(singleReclassificationDslJson); entries.add(new ParsedReclassificationDslRequestEntry( selectMultiQuery, attachments, detachments)); } return new ParsedReclassificationDslRequest(entries); }
ReclassificationRequestDslParser { public ParsedReclassificationDslRequest parseReclassificationRequest(JsonNode reclassificationDslJson) throws InvalidParseOperationException { if (!reclassificationDslJson.isArray() || reclassificationDslJson.size() == 0) { throw new InvalidParseOperationException("Expected array of reclassification updates DSLs"); } List<ParsedReclassificationDslRequestEntry> entries = new ArrayList<>(); for (JsonNode singleReclassificationDslJson : reclassificationDslJson) { SelectMultiQuery selectMultiQuery = parseSelectMultiQuery(singleReclassificationDslJson); Set<String> attachments = parseReclassificationDslAttachments(singleReclassificationDslJson); Set<String> detachments = parseReclassificationDslDetachments(singleReclassificationDslJson); entries.add(new ParsedReclassificationDslRequestEntry( selectMultiQuery, attachments, detachments)); } return new ParsedReclassificationDslRequest(entries); } }
ReclassificationRequestDslParser { public ParsedReclassificationDslRequest parseReclassificationRequest(JsonNode reclassificationDslJson) throws InvalidParseOperationException { if (!reclassificationDslJson.isArray() || reclassificationDslJson.size() == 0) { throw new InvalidParseOperationException("Expected array of reclassification updates DSLs"); } List<ParsedReclassificationDslRequestEntry> entries = new ArrayList<>(); for (JsonNode singleReclassificationDslJson : reclassificationDslJson) { SelectMultiQuery selectMultiQuery = parseSelectMultiQuery(singleReclassificationDslJson); Set<String> attachments = parseReclassificationDslAttachments(singleReclassificationDslJson); Set<String> detachments = parseReclassificationDslDetachments(singleReclassificationDslJson); entries.add(new ParsedReclassificationDslRequestEntry( selectMultiQuery, attachments, detachments)); } return new ParsedReclassificationDslRequest(entries); }  }
ReclassificationRequestDslParser { public ParsedReclassificationDslRequest parseReclassificationRequest(JsonNode reclassificationDslJson) throws InvalidParseOperationException { if (!reclassificationDslJson.isArray() || reclassificationDslJson.size() == 0) { throw new InvalidParseOperationException("Expected array of reclassification updates DSLs"); } List<ParsedReclassificationDslRequestEntry> entries = new ArrayList<>(); for (JsonNode singleReclassificationDslJson : reclassificationDslJson) { SelectMultiQuery selectMultiQuery = parseSelectMultiQuery(singleReclassificationDslJson); Set<String> attachments = parseReclassificationDslAttachments(singleReclassificationDslJson); Set<String> detachments = parseReclassificationDslDetachments(singleReclassificationDslJson); entries.add(new ParsedReclassificationDslRequestEntry( selectMultiQuery, attachments, detachments)); } return new ParsedReclassificationDslRequest(entries); }  ParsedReclassificationDslRequest parseReclassificationRequest(JsonNode reclassificationDslJson); }
ReclassificationRequestDslParser { public ParsedReclassificationDslRequest parseReclassificationRequest(JsonNode reclassificationDslJson) throws InvalidParseOperationException { if (!reclassificationDslJson.isArray() || reclassificationDslJson.size() == 0) { throw new InvalidParseOperationException("Expected array of reclassification updates DSLs"); } List<ParsedReclassificationDslRequestEntry> entries = new ArrayList<>(); for (JsonNode singleReclassificationDslJson : reclassificationDslJson) { SelectMultiQuery selectMultiQuery = parseSelectMultiQuery(singleReclassificationDslJson); Set<String> attachments = parseReclassificationDslAttachments(singleReclassificationDslJson); Set<String> detachments = parseReclassificationDslDetachments(singleReclassificationDslJson); entries.add(new ParsedReclassificationDslRequestEntry( selectMultiQuery, attachments, detachments)); } return new ParsedReclassificationDslRequest(entries); }  ParsedReclassificationDslRequest parseReclassificationRequest(JsonNode reclassificationDslJson);  }