@Test public void testActionParse() { final UpdateParserMultiple request = new UpdateParserMultiple(); final UpdateMultiQuery update = new UpdateMultiQuery(); try { request.actionParse(JsonHandler.createArrayNode()); assertEquals("Data should be empty", 0, request.getRequest().getActions().size()); request.actionParse(updateAction); assertNotEquals("Data should not be empty", 0, request.getRequest().getActions().size()); final List<Action> actions = request.getRequest().getActions(); for (final Action action : actions) { update.addActions(action); } assertEquals(request.getRequest().getFinalUpdate().toString(), update.getFinalUpdate().toString()); } catch (final InvalidParseOperationException | InvalidCreateOperationException e) { e.printStackTrace(); fail(e.getMessage()); } JsonNode node; try { node = JsonHandler.getFromString("[ { $set : { var : '#id' } } ]"); } catch (final InvalidParseOperationException e) { e.printStackTrace(); fail(e.getMessage()); return; } try { request.actionParse(node); } catch (final InvalidParseOperationException e) { e.printStackTrace(); fail(e.getMessage()); } try { node = JsonHandler.getFromString("[ { $set : { #id : 1 } } ]"); } catch (final InvalidParseOperationException e) { e.printStackTrace(); fail(e.getMessage()); return; } try { request.actionParse(node); fail("Should Failed"); } catch (final InvalidParseOperationException e) {} }
protected void actionParse(final JsonNode rootNode) throws InvalidParseOperationException { if (rootNode == null) { return; } GlobalDatas.sanityParametersCheck(rootNode.toString(), GlobalDatasParser.NB_ACTIONS); try { for (final JsonNode node : (ArrayNode) rootNode) { Iterator<Entry<String, JsonNode>> iterator = node.fields(); while (iterator.hasNext()) { final Entry<String, JsonNode> entry = iterator.next(); final Action updateAction = analyseOneAction(entry.getKey(), entry.getValue()); ((UpdateMultiQuery) request).addActions(updateAction); } iterator = null; } } catch (final Exception e) { throw new InvalidParseOperationException( "Parse in error for Action: " + rootNode, e); } }
UpdateParserMultiple extends RequestParserMultiple { protected void actionParse(final JsonNode rootNode) throws InvalidParseOperationException { if (rootNode == null) { return; } GlobalDatas.sanityParametersCheck(rootNode.toString(), GlobalDatasParser.NB_ACTIONS); try { for (final JsonNode node : (ArrayNode) rootNode) { Iterator<Entry<String, JsonNode>> iterator = node.fields(); while (iterator.hasNext()) { final Entry<String, JsonNode> entry = iterator.next(); final Action updateAction = analyseOneAction(entry.getKey(), entry.getValue()); ((UpdateMultiQuery) request).addActions(updateAction); } iterator = null; } } catch (final Exception e) { throw new InvalidParseOperationException( "Parse in error for Action: " + rootNode, e); } } }
UpdateParserMultiple extends RequestParserMultiple { protected void actionParse(final JsonNode rootNode) throws InvalidParseOperationException { if (rootNode == null) { return; } GlobalDatas.sanityParametersCheck(rootNode.toString(), GlobalDatasParser.NB_ACTIONS); try { for (final JsonNode node : (ArrayNode) rootNode) { Iterator<Entry<String, JsonNode>> iterator = node.fields(); while (iterator.hasNext()) { final Entry<String, JsonNode> entry = iterator.next(); final Action updateAction = analyseOneAction(entry.getKey(), entry.getValue()); ((UpdateMultiQuery) request).addActions(updateAction); } iterator = null; } } catch (final Exception e) { throw new InvalidParseOperationException( "Parse in error for Action: " + rootNode, e); } } UpdateParserMultiple();  UpdateParserMultiple(VarNameAdapter adapter); }
UpdateParserMultiple extends RequestParserMultiple { protected void actionParse(final JsonNode rootNode) throws InvalidParseOperationException { if (rootNode == null) { return; } GlobalDatas.sanityParametersCheck(rootNode.toString(), GlobalDatasParser.NB_ACTIONS); try { for (final JsonNode node : (ArrayNode) rootNode) { Iterator<Entry<String, JsonNode>> iterator = node.fields(); while (iterator.hasNext()) { final Entry<String, JsonNode> entry = iterator.next(); final Action updateAction = analyseOneAction(entry.getKey(), entry.getValue()); ((UpdateMultiQuery) request).addActions(updateAction); } iterator = null; } } catch (final Exception e) { throw new InvalidParseOperationException( "Parse in error for Action: " + rootNode, e); } } UpdateParserMultiple();  UpdateParserMultiple(VarNameAdapter adapter); @Override void parse(final JsonNode request); @Override String toString(); @Override UpdateMultiQuery getRequest(); }
UpdateParserMultiple extends RequestParserMultiple { protected void actionParse(final JsonNode rootNode) throws InvalidParseOperationException { if (rootNode == null) { return; } GlobalDatas.sanityParametersCheck(rootNode.toString(), GlobalDatasParser.NB_ACTIONS); try { for (final JsonNode node : (ArrayNode) rootNode) { Iterator<Entry<String, JsonNode>> iterator = node.fields(); while (iterator.hasNext()) { final Entry<String, JsonNode> entry = iterator.next(); final Action updateAction = analyseOneAction(entry.getKey(), entry.getValue()); ((UpdateMultiQuery) request).addActions(updateAction); } iterator = null; } } catch (final Exception e) { throw new InvalidParseOperationException( "Parse in error for Action: " + rootNode, e); } } UpdateParserMultiple();  UpdateParserMultiple(VarNameAdapter adapter); @Override void parse(final JsonNode request); @Override String toString(); @Override UpdateMultiQuery getRequest();  }