@Test public void pipelinePossibleStatesTest() { NWiseExtension.NWiseAction nWiseAction = new NWiseExtension.NWiseAction(); nWiseAction.setCoVariables("A,B,C,D,E"); nWiseAction.setN("3"); Map<String, String> inputState = new HashMap<>(); inputState.put("A", "1,2,3,4"); inputState.put("B", "1,2,3,4"); inputState.put("C", "1,2,3,4"); inputState.put("D", "1,2,3,4"); inputState.put("E", "1,2,3,4"); List<Map<String, String>> pipelineStates = new LinkedList<>(); pipelineStates.add(inputState); NWiseExtension nWiseExtension = new NWiseExtension(); List<Map<String, String>> resultStates = nWiseExtension.pipelinePossibleStates(nWiseAction, pipelineStates); Assert.assertEquals(640, resultStates.size()); }
public List<Map<String, String>> pipelinePossibleStates(NWiseAction action, List<Map<String, String>> possibleStateList) { String[] coVariables = action.getCoVariables().split(","); int n = Integer.valueOf(action.getN()); List<Map<String, String>> newPossibleStateList = new ArrayList<>(); for (Map<String, String> possibleState : possibleStateList) { Map<String, String[]> variableDomains = new HashMap<>(); Map<String, String> defaultVariableValues = new HashMap<>(); for (String variable : coVariables) { String variableMetaInfo = possibleState.get(variable); String[] variableDomain = variableMetaInfo.split(","); variableDomains.put(variable, variableDomain); defaultVariableValues.put(variable, variableDomain[0]); } List<Map<String, String>> nWiseCombinations = produceNWise(n, coVariables, variableDomains); for (Map<String, String> nWiseCombination : nWiseCombinations) { Map<String, String> newPossibleState = new HashMap<>(possibleState); newPossibleState.putAll(defaultVariableValues); newPossibleState.putAll(nWiseCombination); newPossibleStateList.add(newPossibleState); } } return newPossibleStateList; }
NWiseExtension implements CustomTagExtension<NWiseExtension.NWiseAction> { public List<Map<String, String>> pipelinePossibleStates(NWiseAction action, List<Map<String, String>> possibleStateList) { String[] coVariables = action.getCoVariables().split(","); int n = Integer.valueOf(action.getN()); List<Map<String, String>> newPossibleStateList = new ArrayList<>(); for (Map<String, String> possibleState : possibleStateList) { Map<String, String[]> variableDomains = new HashMap<>(); Map<String, String> defaultVariableValues = new HashMap<>(); for (String variable : coVariables) { String variableMetaInfo = possibleState.get(variable); String[] variableDomain = variableMetaInfo.split(","); variableDomains.put(variable, variableDomain); defaultVariableValues.put(variable, variableDomain[0]); } List<Map<String, String>> nWiseCombinations = produceNWise(n, coVariables, variableDomains); for (Map<String, String> nWiseCombination : nWiseCombinations) { Map<String, String> newPossibleState = new HashMap<>(possibleState); newPossibleState.putAll(defaultVariableValues); newPossibleState.putAll(nWiseCombination); newPossibleStateList.add(newPossibleState); } } return newPossibleStateList; } }
NWiseExtension implements CustomTagExtension<NWiseExtension.NWiseAction> { public List<Map<String, String>> pipelinePossibleStates(NWiseAction action, List<Map<String, String>> possibleStateList) { String[] coVariables = action.getCoVariables().split(","); int n = Integer.valueOf(action.getN()); List<Map<String, String>> newPossibleStateList = new ArrayList<>(); for (Map<String, String> possibleState : possibleStateList) { Map<String, String[]> variableDomains = new HashMap<>(); Map<String, String> defaultVariableValues = new HashMap<>(); for (String variable : coVariables) { String variableMetaInfo = possibleState.get(variable); String[] variableDomain = variableMetaInfo.split(","); variableDomains.put(variable, variableDomain); defaultVariableValues.put(variable, variableDomain[0]); } List<Map<String, String>> nWiseCombinations = produceNWise(n, coVariables, variableDomains); for (Map<String, String> nWiseCombination : nWiseCombinations) { Map<String, String> newPossibleState = new HashMap<>(possibleState); newPossibleState.putAll(defaultVariableValues); newPossibleState.putAll(nWiseCombination); newPossibleStateList.add(newPossibleState); } } return newPossibleStateList; }  }
NWiseExtension implements CustomTagExtension<NWiseExtension.NWiseAction> { public List<Map<String, String>> pipelinePossibleStates(NWiseAction action, List<Map<String, String>> possibleStateList) { String[] coVariables = action.getCoVariables().split(","); int n = Integer.valueOf(action.getN()); List<Map<String, String>> newPossibleStateList = new ArrayList<>(); for (Map<String, String> possibleState : possibleStateList) { Map<String, String[]> variableDomains = new HashMap<>(); Map<String, String> defaultVariableValues = new HashMap<>(); for (String variable : coVariables) { String variableMetaInfo = possibleState.get(variable); String[] variableDomain = variableMetaInfo.split(","); variableDomains.put(variable, variableDomain); defaultVariableValues.put(variable, variableDomain[0]); } List<Map<String, String>> nWiseCombinations = produceNWise(n, coVariables, variableDomains); for (Map<String, String> nWiseCombination : nWiseCombinations) { Map<String, String> newPossibleState = new HashMap<>(possibleState); newPossibleState.putAll(defaultVariableValues); newPossibleState.putAll(nWiseCombination); newPossibleStateList.add(newPossibleState); } } return newPossibleStateList; }  Class<NWiseAction> getTagActionClass(); String getTagName(); String getTagNameSpace(); List<Set<String>> makeNWiseTuples(String[] variables, int nWise); List<Map<String, String>> expandTupleIntoTestCases(Set<String> tuple, Map<String, String[]> variableDomains); List<Map<String, String>> produceNWise(int nWise, String[] coVariables, Map<String, String[]> variableDomains); List<Map<String, String>> pipelinePossibleStates(NWiseAction action, List<Map<String, String>> possibleStateList); }
NWiseExtension implements CustomTagExtension<NWiseExtension.NWiseAction> { public List<Map<String, String>> pipelinePossibleStates(NWiseAction action, List<Map<String, String>> possibleStateList) { String[] coVariables = action.getCoVariables().split(","); int n = Integer.valueOf(action.getN()); List<Map<String, String>> newPossibleStateList = new ArrayList<>(); for (Map<String, String> possibleState : possibleStateList) { Map<String, String[]> variableDomains = new HashMap<>(); Map<String, String> defaultVariableValues = new HashMap<>(); for (String variable : coVariables) { String variableMetaInfo = possibleState.get(variable); String[] variableDomain = variableMetaInfo.split(","); variableDomains.put(variable, variableDomain); defaultVariableValues.put(variable, variableDomain[0]); } List<Map<String, String>> nWiseCombinations = produceNWise(n, coVariables, variableDomains); for (Map<String, String> nWiseCombination : nWiseCombinations) { Map<String, String> newPossibleState = new HashMap<>(possibleState); newPossibleState.putAll(defaultVariableValues); newPossibleState.putAll(nWiseCombination); newPossibleStateList.add(newPossibleState); } } return newPossibleStateList; }  Class<NWiseAction> getTagActionClass(); String getTagName(); String getTagNameSpace(); List<Set<String>> makeNWiseTuples(String[] variables, int nWise); List<Map<String, String>> expandTupleIntoTestCases(Set<String> tuple, Map<String, String[]> variableDomains); List<Map<String, String>> produceNWise(int nWise, String[] coVariables, Map<String, String[]> variableDomains); List<Map<String, String>> pipelinePossibleStates(NWiseAction action, List<Map<String, String>> possibleStateList);  }