@Test public void testReplaceReferences() throws Exception { final String AGENDA_ID = "456-789"; JsonNode paramsNode = getJsonNodeFromFile("/testParams.json"); JsonNode referencesNode = getJsonNodeFromFile("/testReferences.json"); JsonNode expectedNode = getJsonNodeFromFile("/testExpectedResult.json"); JsonContext jsonContext = new JsonContext(); jsonContext.setContextMap(getParameterMap(paramsNode)); jsonContext.addData("agendaId", TextNode.valueOf(AGENDA_ID).toString()); ReferenceReplacementResult result = jsonReferenceReplacer.replaceReferences ( referencesNode, jsonContext.getContextMap() ); Assert.assertEquals(objectMapper.readTree(result.getResult()), expectedNode); }
public ReferenceReplacementResult replaceReferences(JsonNode rootNode, Map<String, JsonNode> referenceMap) { ReferenceReplacementResult referenceReplacementResult = new ReferenceReplacementResult(); traverseNodeForTokenReplacement(rootNode, referenceMap, referenceReplacementResult); referenceReplacementResult.setResult(rootNode.toString()); return referenceReplacementResult; }
JsonReferenceReplacer { public ReferenceReplacementResult replaceReferences(JsonNode rootNode, Map<String, JsonNode> referenceMap) { ReferenceReplacementResult referenceReplacementResult = new ReferenceReplacementResult(); traverseNodeForTokenReplacement(rootNode, referenceMap, referenceReplacementResult); referenceReplacementResult.setResult(rootNode.toString()); return referenceReplacementResult; } }
JsonReferenceReplacer { public ReferenceReplacementResult replaceReferences(JsonNode rootNode, Map<String, JsonNode> referenceMap) { ReferenceReplacementResult referenceReplacementResult = new ReferenceReplacementResult(); traverseNodeForTokenReplacement(rootNode, referenceMap, referenceReplacementResult); referenceReplacementResult.setResult(rootNode.toString()); return referenceReplacementResult; } JsonReferenceReplacer();  JsonReferenceReplacer(String referencePrefix, String referenceSeparator, String referenceSuffix, String fallbackValueSeparator); }
JsonReferenceReplacer { public ReferenceReplacementResult replaceReferences(JsonNode rootNode, Map<String, JsonNode> referenceMap) { ReferenceReplacementResult referenceReplacementResult = new ReferenceReplacementResult(); traverseNodeForTokenReplacement(rootNode, referenceMap, referenceReplacementResult); referenceReplacementResult.setResult(rootNode.toString()); return referenceReplacementResult; } JsonReferenceReplacer();  JsonReferenceReplacer(String referencePrefix, String referenceSeparator, String referenceSuffix, String fallbackValueSeparator); String getPrefix(); String getSuffix(); String getSeparator(); String generateReference(String referenceName, String jsonPtrExpr); JsonReferenceComponents extractComponents(String input); ReferenceReplacementResult replaceReferences(JsonNode rootNode, Map<String, JsonNode> referenceMap); ArrayNodeReplacer getArrayNodeReplacer(); void setArrayNodeReplacer(ArrayNodeReplacer arrayNodeReplacer); ObjectNodeReplacer getObjectNodeReplacer(); void setObjectNodeReplacer(ObjectNodeReplacer objectNodeReplacer); String getReferenceName(String reference); }
JsonReferenceReplacer { public ReferenceReplacementResult replaceReferences(JsonNode rootNode, Map<String, JsonNode> referenceMap) { ReferenceReplacementResult referenceReplacementResult = new ReferenceReplacementResult(); traverseNodeForTokenReplacement(rootNode, referenceMap, referenceReplacementResult); referenceReplacementResult.setResult(rootNode.toString()); return referenceReplacementResult; } JsonReferenceReplacer();  JsonReferenceReplacer(String referencePrefix, String referenceSeparator, String referenceSuffix, String fallbackValueSeparator); String getPrefix(); String getSuffix(); String getSeparator(); String generateReference(String referenceName, String jsonPtrExpr); JsonReferenceComponents extractComponents(String input); ReferenceReplacementResult replaceReferences(JsonNode rootNode, Map<String, JsonNode> referenceMap); ArrayNodeReplacer getArrayNodeReplacer(); void setArrayNodeReplacer(ArrayNodeReplacer arrayNodeReplacer); ObjectNodeReplacer getObjectNodeReplacer(); void setObjectNodeReplacer(ObjectNodeReplacer objectNodeReplacer); String getReferenceName(String reference); static final String DEFAULT_REFERENCE_PREFIX; static final String DEFAULT_REFERENCE_SUFFIX; static final String DEFAULT_REFERENCE_SEPARATOR; static final String DEFAULT_FALLBACK_VALUE_SEPARATOR; static final String JACKSON_PATH_SEPARATOR; static final String REFERENCE_GROUP_NAME; static final String PATH_GROUP_NAME; }