@Test public void testParse() { try { final UpdateParserMultiple request1 = new UpdateParserMultiple(); request1.parse(exampleBothEsMd.deepCopy()); assertTrue("Should refuse the request since ES is not allowed", request1.hasFullTextQuery()); request1.parse(exampleMd.deepCopy()); assertFalse("Should accept the request since ES is not allowed", request1.hasFullTextQuery()); } catch (final Exception e) {} try { final UpdateParserMultiple request1 = new UpdateParserMultiple(); request1.parse(exampleBothEsMd.deepCopy()); assertNotNull(request1); assertTrue("Should refuse the request since ES is not allowed", request1.hasFullTextQuery()); assertNotEquals("Data should not be empty", 0, request1.getRequest().getActions().size()); final UpdateMultiQuery update = new UpdateMultiQuery(); update.addRoots("id0"); update.addQueries(path("id1", "id2")); update.addQueries( and().add(exists("mavar1"), missing("mavar2"), isNull("mavar3"), or().add(in("mavar4", 1, 2).add("maval1"), nin("mavar5", "maval2").add(true)))); update.addQueries( not().add(size("mavar5", 5), gt("mavar6", 7), lte("mavar7", 8)) .setExactDepthLimit(4)); update.addQueries(not() .add(eq("mavar8", 5), ne("mavar9", "ab"), range("mavar10", 12, true, 20, true)) .setDepthLimit(1)); update.addQueries(matchPhrase("mavar11", "ceci est une phrase") .setRelativeDepthLimit(0)); update.addQueries(matchPhrasePrefix("mavar11", "ceci est une phrase") .setMatchMaxExpansions(10) .setDepthLimit(0)); update.addQueries(flt("ceci est une phrase", "mavar12", "mavar13") .setRelativeDepthLimit(1)); update.addQueries(and().add(search("mavar13", "ceci est une phrase"), regex("mavar14", "^start?aa.*"))); update.addQueries(and() .add(term("mavar14", "motMajuscule").add("mavar15", "simplemot"))); update.addQueries( and().add(term("mavar16", "motMajuscule").add("mavar17", "simplemot"), or().add(eq("mavar19", "abcd"), match("mavar18", "quelques mots")))); update.addQueries(regex("mavar14", "^start?aa.*")); update.setMult(false); update.addActions(set("mavar1", 1).add("mavar2", 1.2).add("mavar3", true) .add("mavar4", "ma chaine")); update.addActions(unset("mavar5", "mavar6")); update.addActions(inc("mavar7", 2), min("mavar8", 3), min("mavar16", 12), max("mavar9", 3)); update.addActions(rename("mavar10", "mavar11")); update.addActions(push("mavar12", 1, 2), add("mavar13", 1, 2)); update.addActions(pop("mavar14", -1), pull("mavar15", 1, 2)); final UpdateParserMultiple request2 = new UpdateParserMultiple(); request2.parse(exampleBothEsMd.deepCopy()); assertNotNull(request2); final List<Query> query1 = request1.getRequest().getQueries(); final List<Query> query2 = request2.getRequest().getQueries(); for (int i = 0; i < query1.size(); i++) { assertEquals("TypeRequest should be equal", query1.get(i).toString(), query2.get(i).toString()); } final List<Action> actions1 = request1.getRequest().getActions(); final List<Action> actions2 = request2.getRequest().getActions(); assertEquals("Action should be equal", actions1.size(), actions2.size()); for (int i = 0; i < actions1.size(); i++) { if (!actions1.get(i).toString() .equals(actions2.get(i).toString())) { System.out.println(actions1.get(i).toString() + " != " + actions2.get(i).toString()); } assertTrue("Action should be equal: " + i, actions1.get(i).toString() .equals(actions2.get(i).toString())); } assertTrue("OrderBy should be equal", request1.getRequest().getFilter().toString() .equals(request2.getRequest().getFilter().toString())); assertEquals(request1.getLastDepth(), request2.getLastDepth()); assertEquals(request1.hasFullTextQuery(), request2.hasFullTextQuery()); assertEquals(request1.getRequest().getRoots().toString(), request2.getRequest().getRoots().toString()); assertEquals(request1.getRequest().getFinalUpdate().toString(), request2.getRequest().getFinalUpdate().toString()); assertTrue("Command should be equal", request1.toString().equals(request2.toString())); } catch (final Exception e) { e.printStackTrace(); fail(e.getMessage()); } }
@Override public void parse(final JsonNode request) throws InvalidParseOperationException { parseJson(request); internalParseUpdate(); }
UpdateParserMultiple extends RequestParserMultiple { @Override public void parse(final JsonNode request) throws InvalidParseOperationException { parseJson(request); internalParseUpdate(); } }
UpdateParserMultiple extends RequestParserMultiple { @Override public void parse(final JsonNode request) throws InvalidParseOperationException { parseJson(request); internalParseUpdate(); } UpdateParserMultiple();  UpdateParserMultiple(VarNameAdapter adapter); }
UpdateParserMultiple extends RequestParserMultiple { @Override public void parse(final JsonNode request) throws InvalidParseOperationException { parseJson(request); internalParseUpdate(); } UpdateParserMultiple();  UpdateParserMultiple(VarNameAdapter adapter); @Override void parse(final JsonNode request); @Override String toString(); @Override UpdateMultiQuery getRequest(); }
UpdateParserMultiple extends RequestParserMultiple { @Override public void parse(final JsonNode request) throws InvalidParseOperationException { parseJson(request); internalParseUpdate(); } UpdateParserMultiple();  UpdateParserMultiple(VarNameAdapter adapter); @Override void parse(final JsonNode request); @Override String toString(); @Override UpdateMultiQuery getRequest();  }