@Test public void pipelineOverwriteTest() { List<Map<String, String>> listWithNonEmptyMap = new LinkedList<>(); HashMap<String, String> nonEmptyMap = new HashMap<>(); nonEmptyMap.put("var_out_test", "3"); listWithNonEmptyMap.add(nonEmptyMap); SetAssignExtension setAssign = new SetAssignExtension(); SetAssignExtension.SetAssignTag setAssignTag = new SetAssignExtension.SetAssignTag(); setAssignTag.setName("var_out_test"); setAssignTag.setSet("A,B,C"); List<Map<String, String>> processedList = setAssign.pipelinePossibleStates(setAssignTag, listWithNonEmptyMap); Assert.assertEquals(3, processedList.size()); Map<String, String> resultMap = processedList.get(0); Assert.assertEquals(1, resultMap.keySet().size()); Assert.assertEquals("A", resultMap.get("var_out_test")); resultMap = processedList.get(1); Assert.assertEquals(1, resultMap.keySet().size()); Assert.assertEquals("B", resultMap.get("var_out_test")); resultMap = processedList.get(2); Assert.assertEquals(1, resultMap.keySet().size()); Assert.assertEquals("C", resultMap.get("var_out_test")); }
public List<Map<String, String>> pipelinePossibleStates(SetAssignTag action, List<Map<String, String>> possibleStateList) { if (action == null) { throw new NullActionException("Called with a null action, and possibleStateList = " + possibleStateList.toString()); } String variable = action.getName(); String set = action.getSet(); String[] domain; if (set == null) { throw new NullSetException("Called with a null set, action name=" + action.getName() + " and possibleStateList = " + possibleStateList.toString()); } if (StringUtils.splitByWholeSeparator(set, action.getSeparator()).length == 0) { domain = new String[]{""}; } else { domain = StringUtils.splitByWholeSeparator(set, action.getSeparator()); } List<Map<String, String>> productTemp = new LinkedList<>(); for (Map<String, String> p : possibleStateList) { for (String value : domain) { HashMap<String, String> n = new HashMap<>(p); n.put(variable, value); productTemp.add(n); } } return productTemp; }
SetAssignExtension implements CustomTagExtension<SetAssignExtension.SetAssignTag> { public List<Map<String, String>> pipelinePossibleStates(SetAssignTag action, List<Map<String, String>> possibleStateList) { if (action == null) { throw new NullActionException("Called with a null action, and possibleStateList = " + possibleStateList.toString()); } String variable = action.getName(); String set = action.getSet(); String[] domain; if (set == null) { throw new NullSetException("Called with a null set, action name=" + action.getName() + " and possibleStateList = " + possibleStateList.toString()); } if (StringUtils.splitByWholeSeparator(set, action.getSeparator()).length == 0) { domain = new String[]{""}; } else { domain = StringUtils.splitByWholeSeparator(set, action.getSeparator()); } List<Map<String, String>> productTemp = new LinkedList<>(); for (Map<String, String> p : possibleStateList) { for (String value : domain) { HashMap<String, String> n = new HashMap<>(p); n.put(variable, value); productTemp.add(n); } } return productTemp; } }
SetAssignExtension implements CustomTagExtension<SetAssignExtension.SetAssignTag> { public List<Map<String, String>> pipelinePossibleStates(SetAssignTag action, List<Map<String, String>> possibleStateList) { if (action == null) { throw new NullActionException("Called with a null action, and possibleStateList = " + possibleStateList.toString()); } String variable = action.getName(); String set = action.getSet(); String[] domain; if (set == null) { throw new NullSetException("Called with a null set, action name=" + action.getName() + " and possibleStateList = " + possibleStateList.toString()); } if (StringUtils.splitByWholeSeparator(set, action.getSeparator()).length == 0) { domain = new String[]{""}; } else { domain = StringUtils.splitByWholeSeparator(set, action.getSeparator()); } List<Map<String, String>> productTemp = new LinkedList<>(); for (Map<String, String> p : possibleStateList) { for (String value : domain) { HashMap<String, String> n = new HashMap<>(p); n.put(variable, value); productTemp.add(n); } } return productTemp; }  }
SetAssignExtension implements CustomTagExtension<SetAssignExtension.SetAssignTag> { public List<Map<String, String>> pipelinePossibleStates(SetAssignTag action, List<Map<String, String>> possibleStateList) { if (action == null) { throw new NullActionException("Called with a null action, and possibleStateList = " + possibleStateList.toString()); } String variable = action.getName(); String set = action.getSet(); String[] domain; if (set == null) { throw new NullSetException("Called with a null set, action name=" + action.getName() + " and possibleStateList = " + possibleStateList.toString()); } if (StringUtils.splitByWholeSeparator(set, action.getSeparator()).length == 0) { domain = new String[]{""}; } else { domain = StringUtils.splitByWholeSeparator(set, action.getSeparator()); } List<Map<String, String>> productTemp = new LinkedList<>(); for (Map<String, String> p : possibleStateList) { for (String value : domain) { HashMap<String, String> n = new HashMap<>(p); n.put(variable, value); productTemp.add(n); } } return productTemp; }  Class<SetAssignTag> getTagActionClass(); String getTagName(); String getTagNameSpace(); List<Map<String, String>> pipelinePossibleStates(SetAssignTag action,
                                                            List<Map<String, String>> possibleStateList); }
SetAssignExtension implements CustomTagExtension<SetAssignExtension.SetAssignTag> { public List<Map<String, String>> pipelinePossibleStates(SetAssignTag action, List<Map<String, String>> possibleStateList) { if (action == null) { throw new NullActionException("Called with a null action, and possibleStateList = " + possibleStateList.toString()); } String variable = action.getName(); String set = action.getSet(); String[] domain; if (set == null) { throw new NullSetException("Called with a null set, action name=" + action.getName() + " and possibleStateList = " + possibleStateList.toString()); } if (StringUtils.splitByWholeSeparator(set, action.getSeparator()).length == 0) { domain = new String[]{""}; } else { domain = StringUtils.splitByWholeSeparator(set, action.getSeparator()); } List<Map<String, String>> productTemp = new LinkedList<>(); for (Map<String, String> p : possibleStateList) { for (String value : domain) { HashMap<String, String> n = new HashMap<>(p); n.put(variable, value); productTemp.add(n); } } return productTemp; }  Class<SetAssignTag> getTagActionClass(); String getTagName(); String getTagNameSpace(); List<Map<String, String>> pipelinePossibleStates(SetAssignTag action,
                                                            List<Map<String, String>> possibleStateList);  }