@Test public void nonEmptyListTest() { DataTransformer appendTransformer = new DataTransformer() { public void transform(DataPipe cr) { cr.getDataMap().put("Test", "Lorum"); } }; HashMap<String, DataTransformer> transformerNames = new HashMap<>(); transformerNames.put("append", appendTransformer); InLineTransformerExtension transformerExtension = new InLineTransformerExtension(transformerNames); List<Map<String, String>> nonEmptyList = new LinkedList<>(); nonEmptyList.add(new HashMap<String, String>()); nonEmptyList.add(new HashMap<String, String>()); InLineTransformerExtension.TransformTag transformTag = new InLineTransformerExtension.TransformTag(); transformTag.setName("append"); List<Map<String, String>> resultList = transformerExtension.pipelinePossibleStates(transformTag, nonEmptyList); Assert.assertNotNull(resultList); Assert.assertEquals(2, resultList.size()); Map<String, String> resultMap = resultList.get(0); Assert.assertEquals(1, resultMap.keySet().size()); Assert.assertEquals("Lorum", resultMap.get("Test")); resultMap = resultList.get(1); Assert.assertEquals(1, resultMap.keySet().size()); Assert.assertEquals("Lorum", resultMap.get("Test")); }
public List<Map<String, String>> pipelinePossibleStates(TransformTag action, List<Map<String, String>> possibleStateList) { DataTransformer tr = transformers.get(action.getName()); DataPipe pipe = new DataPipe(0, null); for (Map<String, String> possibleState : possibleStateList) { pipe.getDataMap().putAll(possibleState); tr.transform(pipe); possibleState.putAll(pipe.getDataMap()); } return possibleStateList; }
InLineTransformerExtension implements CustomTagExtension<InLineTransformerExtension.TransformTag> { public List<Map<String, String>> pipelinePossibleStates(TransformTag action, List<Map<String, String>> possibleStateList) { DataTransformer tr = transformers.get(action.getName()); DataPipe pipe = new DataPipe(0, null); for (Map<String, String> possibleState : possibleStateList) { pipe.getDataMap().putAll(possibleState); tr.transform(pipe); possibleState.putAll(pipe.getDataMap()); } return possibleStateList; } }
InLineTransformerExtension implements CustomTagExtension<InLineTransformerExtension.TransformTag> { public List<Map<String, String>> pipelinePossibleStates(TransformTag action, List<Map<String, String>> possibleStateList) { DataTransformer tr = transformers.get(action.getName()); DataPipe pipe = new DataPipe(0, null); for (Map<String, String> possibleState : possibleStateList) { pipe.getDataMap().putAll(possibleState); tr.transform(pipe); possibleState.putAll(pipe.getDataMap()); } return possibleStateList; } InLineTransformerExtension(final Map<String, DataTransformer> transformers); }
InLineTransformerExtension implements CustomTagExtension<InLineTransformerExtension.TransformTag> { public List<Map<String, String>> pipelinePossibleStates(TransformTag action, List<Map<String, String>> possibleStateList) { DataTransformer tr = transformers.get(action.getName()); DataPipe pipe = new DataPipe(0, null); for (Map<String, String> possibleState : possibleStateList) { pipe.getDataMap().putAll(possibleState); tr.transform(pipe); possibleState.putAll(pipe.getDataMap()); } return possibleStateList; } InLineTransformerExtension(final Map<String, DataTransformer> transformers); Class<TransformTag> getTagActionClass(); String getTagName(); String getTagNameSpace(); List<Map<String, String>> pipelinePossibleStates(TransformTag action,
                                                            List<Map<String, String>> possibleStateList); }
InLineTransformerExtension implements CustomTagExtension<InLineTransformerExtension.TransformTag> { public List<Map<String, String>> pipelinePossibleStates(TransformTag action, List<Map<String, String>> possibleStateList) { DataTransformer tr = transformers.get(action.getName()); DataPipe pipe = new DataPipe(0, null); for (Map<String, String> possibleState : possibleStateList) { pipe.getDataMap().putAll(possibleState); tr.transform(pipe); possibleState.putAll(pipe.getDataMap()); } return possibleStateList; } InLineTransformerExtension(final Map<String, DataTransformer> transformers); Class<TransformTag> getTagActionClass(); String getTagName(); String getTagNameSpace(); List<Map<String, String>> pipelinePossibleStates(TransformTag action,
                                                            List<Map<String, String>> possibleStateList);  }