-package org.argeo.slc.core.execution;
-
-import java.beans.PropertyDescriptor;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.argeo.slc.SlcException;
-import org.argeo.slc.execution.ExecutionContext;
-import org.springframework.beans.BeansException;
-import org.springframework.beans.MutablePropertyValues;
-import org.springframework.beans.PropertyValue;
-import org.springframework.beans.PropertyValues;
-import org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessorAdapter;
-import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
-import org.springframework.beans.factory.config.TypedStringValue;
-import org.springframework.beans.factory.support.ManagedList;
-import org.springframework.beans.factory.support.ManagedMap;
-import org.springframework.beans.factory.support.ManagedSet;
-import org.springframework.util.ObjectUtils;
-
-public class ExecutionParameterPostProcessor extends
- InstantiationAwareBeanPostProcessorAdapter {
-
- private final static Log log = LogFactory
- .getLog(ExecutionParameterPostProcessor.class);
-
-// private CustomPpc ppc = new CustomPpc(new Properties());
-
- private ExecutionContext executionContext;
-
- private ExecutionScope executionScope;
-
- private InstantiationManager instantiationManager;
-
- public InstantiationManager getInstantiationManager() {
- return instantiationManager;
- }
-
- public void setInstantiationManager(
- InstantiationManager instantiationManager) {
- this.instantiationManager = instantiationManager;
- }
-
- public void setExecutionScope(ExecutionScope executionScope) {
- this.executionScope = executionScope;
- }
-
- public ExecutionContext getExecutionContext() {
- return executionContext;
- }
-
- public void setExecutionContext(ExecutionContext executionContext) {
- this.executionContext = executionContext;
- }
-
- private String placeholderPrefix = "@{";
- private String placeholderSuffix = "}";
- private String nullValue;
-
- protected Object resolveValue(Object value, CustomPpc ppc) {
- if (value instanceof TypedStringValue) {
- TypedStringValue tsv = (TypedStringValue) value;
- return ppc.process(tsv.getValue());
- }
- else if (value instanceof String) {
- return ppc.process(value.toString());
- }
- else if (value instanceof Map) {
- Map mapVal = (Map) value;
-
- Map newContent = new LinkedHashMap();
- boolean entriesModified = false;
- for (Iterator it = mapVal.entrySet().iterator(); it.hasNext();) {
- Map.Entry entry = (Map.Entry) it.next();
- Object key = entry.getKey();
- int keyHash = (key != null ? key.hashCode() : 0);
- Object newKey = resolveValue(key,ppc);
- int newKeyHash = (newKey != null ? newKey.hashCode() : 0);
- Object val = entry.getValue();
- Object newVal = resolveValue(val,ppc);
- newContent.put(newKey, newVal);
- entriesModified = entriesModified || (newVal != val || newKey != key || newKeyHash != keyHash);
- }
- if (entriesModified) {
- mapVal.clear();
- mapVal.putAll(newContent);
- }
- return mapVal;
- }
- else if (value instanceof List) {
- List listVal = (List) value;
- for (int i = 0; i < listVal.size(); i++) {
- Object elem = listVal.get(i);
- Object newVal = resolveValue(elem,ppc);
- if (!ObjectUtils.nullSafeEquals(newVal, elem)) {
- listVal.set(i, newVal);
- }
- }
- return value;
- }
- else if (value instanceof Set) {
- Set setVal = (Set) value;
- Set newContent = new LinkedHashSet();
- boolean entriesModified = false;
- for (Iterator it = setVal.iterator(); it.hasNext();) {
- Object elem = it.next();
- int elemHash = (elem != null ? elem.hashCode() : 0);
- Object newVal = resolveValue(elem,ppc);
- int newValHash = (newVal != null ? newVal.hashCode() : 0);
- newContent.add(newVal);
- entriesModified = entriesModified || (newVal != elem || newValHash != elemHash);
- }
- if (entriesModified) {
- setVal.clear();
- setVal.addAll(newContent);
- }
- return value;
- }
- else {
- return value;
- }
- }
-
- @Override
- public PropertyValues postProcessPropertyValues(PropertyValues pvs,
- PropertyDescriptor[] pds, Object bean, String beanName)
- throws BeansException {
-
- //TODO: resolve at execution only if scope is execution
-
-// boolean inFlowInitialization = instantiationManager
-// .isInFlowInitialization();
-//
-// if (((executionScope == null) || (!executionScope.hasExecutionContext()))
-// && !inFlowInitialization) {
-// // log.info("Skip parameter conversion for bean " + beanName);
-// return pvs;
-// } else {
-// // log.info("Execute parameter conversion for bean " + beanName);
-// }
-
- // copy the property values
- //MutablePropertyValues newPv = new MutablePropertyValues(pvs);
-
- Properties props = new Properties();
- CustomPpc ppc = new CustomPpc(props);
-
- for (PropertyValue pv : pvs.getPropertyValues()) {
- // log.info(" PropertyValue pv " + pv.getValue() + " - "
- // + pv.getValue().getClass());
- String originalValue = null;
- String convertedValue = null;
-
- if (pv.getValue() instanceof TypedStringValue) {
- TypedStringValue tsv = (TypedStringValue) pv.getValue();
- originalValue = tsv.getValue();
- convertedValue = ppc.process(originalValue);
- if (!convertedValue.equals(originalValue))
- tsv.setValue(convertedValue);
- }
- else if (pv.getValue() instanceof String) {
- originalValue = pv.getValue().toString();
- convertedValue = ppc.process(originalValue);
- // Setting the convertedValue can be problematic since
- // calling setConvertedValue also sets a flag setConvertedValue
- if (!convertedValue.equals(originalValue))
- pv.setConvertedValue(convertedValue);
- }
-
- else if ((pv.getValue() instanceof ManagedMap)
- ||(pv.getValue() instanceof ManagedList)
- ||(pv.getValue() instanceof ManagedSet)){
- resolveValue(pv.getValue(),ppc);
- }
-
- if (convertedValue != null && log.isTraceEnabled()) {
- if (!originalValue.equals(convertedValue))
- log.trace("Converted field '" + pv.getName() + "': '"
- + originalValue + "' to '" + convertedValue
- + "' in bean " + beanName);
- }
- }
-
- return pvs;
- }
-
- public void setPlaceholderPrefix(String placeholderPrefix) {
- this.placeholderPrefix = placeholderPrefix;
- }
-
- public void setPlaceholderSuffix(String placeholderSuffix) {
- this.placeholderSuffix = placeholderSuffix;
- }
-
- public void setNullValue(String nullValue) {
- this.nullValue = nullValue;
- }
-
- private class CustomPpc extends PropertyPlaceholderConfigurer {
- private final Properties props;
-
- public CustomPpc(Properties props) {
- super();
- this.props = props;
- setPlaceholderPrefix(placeholderPrefix);
- setPlaceholderSuffix(placeholderSuffix);
- setSystemPropertiesMode(SYSTEM_PROPERTIES_MODE_NEVER);
- }
-
- /** Public access to the internals of PropertyPlaceholderConfigurer*/
- public String process(String strVal) {
- String value = parseStringValue(strVal, this.props,
- new HashSet<String>());
- return (value.equals(nullValue) ? null : value);
- }
-
- @Override
- protected String resolvePlaceholder(String placeholder, Properties props) {
- // log.info("Try convert placeholder " + placeholder);
- if ((executionScope != null)
- && (executionScope.hasExecutionContext()))
- return executionContext.getVariable(placeholder).toString();
- else if (instantiationManager.isInFlowInitialization())
- return instantiationManager.getInitializingFlowParameter(
- placeholder).toString();
- else
- return super.resolvePlaceholder(placeholder, props);
- }
- }
-}
+package org.argeo.slc.core.execution;\r
+\r
+import java.beans.PropertyDescriptor;\r
+import java.util.ArrayList;\r
+import java.util.HashMap;\r
+import java.util.HashSet;\r
+import java.util.Iterator;\r
+import java.util.LinkedHashMap;\r
+import java.util.LinkedHashSet;\r
+import java.util.List;\r
+import java.util.Map;\r
+import java.util.Properties;\r
+import java.util.Set;\r
+\r
+import org.apache.commons.logging.Log;\r
+import org.apache.commons.logging.LogFactory;\r
+import org.argeo.slc.SlcException;\r
+import org.argeo.slc.execution.ExecutionContext;\r
+import org.springframework.beans.BeansException;\r
+import org.springframework.beans.MutablePropertyValues;\r
+import org.springframework.beans.PropertyValue;\r
+import org.springframework.beans.PropertyValues;\r
+import org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessorAdapter;\r
+import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;\r
+import org.springframework.beans.factory.config.TypedStringValue;\r
+import org.springframework.beans.factory.support.ManagedList;\r
+import org.springframework.beans.factory.support.ManagedMap;\r
+import org.springframework.beans.factory.support.ManagedSet;\r
+import org.springframework.util.ObjectUtils;\r
+\r
+public class ExecutionParameterPostProcessor extends\r
+ InstantiationAwareBeanPostProcessorAdapter {\r
+\r
+ private final static Log log = LogFactory\r
+ .getLog(ExecutionParameterPostProcessor.class);\r
+ \r
+ private ExecutionContext executionContext;\r
+\r
+ private ExecutionScope executionScope;\r
+\r
+ private InstantiationManager instantiationManager;\r
+ \r
+ private Map<String, PropertyValues> storedPvsMap = new HashMap<String, PropertyValues>();\r
+\r
+ public InstantiationManager getInstantiationManager() {\r
+ return instantiationManager;\r
+ }\r
+\r
+ public void setInstantiationManager(\r
+ InstantiationManager instantiationManager) {\r
+ this.instantiationManager = instantiationManager;\r
+ }\r
+\r
+ public void setExecutionScope(ExecutionScope executionScope) {\r
+ this.executionScope = executionScope;\r
+ }\r
+\r
+ public ExecutionContext getExecutionContext() {\r
+ return executionContext;\r
+ }\r
+\r
+ public void setExecutionContext(ExecutionContext executionContext) {\r
+ this.executionContext = executionContext;\r
+ }\r
+\r
+ private String placeholderPrefix = "@{";\r
+ private String placeholderSuffix = "}";\r
+ private String nullValue;\r
+\r
+ @Override\r
+ public PropertyValues postProcessPropertyValues(PropertyValues pvs,\r
+ PropertyDescriptor[] pds, Object bean, String beanName)\r
+ throws BeansException {\r
+\r
+ //TODO: resolve at execution only if scope is execution\r
+ \r
+ // if \r
+ PropertyValues sourcePvs = pvs;\r
+ if(storedPvsMap.containsKey(beanName)) {\r
+ sourcePvs = storedPvsMap.get(beanName);\r
+ log.info("Use storedPvsMap for bean " + beanName);\r
+ }\r
+ \r
+ MutablePropertyValues newPvs = new MutablePropertyValues();\r
+ \r
+ boolean changesOccured = false;\r
+ \r
+ CustomPpc ppc = new CustomPpc(beanName);\r
+ \r
+ for(int i=0; i<sourcePvs.getPropertyValues().length; i++) {\r
+ \r
+ PropertyValue pv = pvs.getPropertyValues()[i];\r
+ \r
+ if (pv.getValue() instanceof TypedStringValue) {\r
+ TypedStringValue tsv = (TypedStringValue) pv.getValue();\r
+ String originalValue = tsv.getValue();\r
+ String convertedValue = ppc.resolveString(originalValue);\r
+ // add a new Property value to newPvs, identical to pv\r
+ // except for the value\r
+ newPvs.addPropertyValue(new PropertyValue(pv, new TypedStringValue(convertedValue)));\r
+ if (!convertedValue.equals(originalValue)) {\r
+ changesOccured = true;\r
+ }\r
+ }\r
+ else if (pv.getValue() instanceof String) {\r
+ String originalValue = pv.getValue().toString(); \r
+ String convertedValue = ppc.resolveString(originalValue);\r
+ newPvs.addPropertyValue(new PropertyValue(pv, convertedValue));\r
+ if (!convertedValue.equals(originalValue)) {\r
+ changesOccured = true;\r
+ }\r
+ } \r
+ else if ((pv.getValue() instanceof ManagedMap)\r
+ ||(pv.getValue() instanceof ManagedList)\r
+ ||(pv.getValue() instanceof ManagedSet)){\r
+\r
+ Object convertedValue = ppc.resolveValue(pv.getValue());\r
+ newPvs.addPropertyValue(new PropertyValue(pv, convertedValue));\r
+ if(convertedValue != pv.getValue()) {\r
+ changesOccured = true;\r
+ }\r
+ } \r
+ else {\r
+ newPvs.addPropertyValue(new PropertyValue(pv));\r
+ }\r
+ }\r
+ \r
+ if(changesOccured) {\r
+ storedPvsMap.put(beanName, pvs);\r
+ log.info("Add storedPvsMap for Bean " + beanName);\r
+ return newPvs;\r
+ }\r
+ else {\r
+ // no change, return pvs\r
+ return pvs;\r
+ }\r
+ }\r
+\r
+ public void setPlaceholderPrefix(String placeholderPrefix) {\r
+ this.placeholderPrefix = placeholderPrefix;\r
+ }\r
+\r
+ public void setPlaceholderSuffix(String placeholderSuffix) {\r
+ this.placeholderSuffix = placeholderSuffix;\r
+ }\r
+\r
+ public void setNullValue(String nullValue) {\r
+ this.nullValue = nullValue;\r
+ }\r
+ \r
+ private class CustomPpc extends PropertyPlaceholderConfigurer {\r
+ private final Properties props;\r
+ String beanName;\r
+ \r
+ public CustomPpc(String beanName) {\r
+ super();\r
+ this.props = new Properties();\r
+ this.beanName = beanName;\r
+ setPlaceholderPrefix(placeholderPrefix);\r
+ setPlaceholderSuffix(placeholderSuffix);\r
+ setSystemPropertiesMode(SYSTEM_PROPERTIES_MODE_NEVER);\r
+ }\r
+\r
+ /** Public access to the internals of PropertyPlaceholderConfigurer*/\r
+ public String resolveString(String strVal) {\r
+ String value = parseStringValue(strVal, this.props,\r
+ new HashSet<String>());\r
+ return (value.equals(nullValue) ? null : value);\r
+ }\r
+ \r
+ public Object resolveValue(Object value) {\r
+ if (value instanceof TypedStringValue) {\r
+ TypedStringValue tsv = (TypedStringValue) value;\r
+ String originalValue = tsv.getValue();\r
+\r
+ String convertedValue = resolveString(originalValue);\r
+ return convertedValue.equals(originalValue) ? value : new TypedStringValue(convertedValue);\r
+ }\r
+ else if (value instanceof String) {\r
+ String originalValue = value.toString(); \r
+ String convertedValue = resolveString(originalValue);\r
+ return convertedValue.equals(originalValue) ? value : convertedValue;\r
+ } \r
+ else if (value instanceof Map) {\r
+ Map mapVal = (Map) value;\r
+ \r
+ Map newContent = new ManagedMap();\r
+ boolean entriesModified = false;\r
+ for (Iterator it = mapVal.entrySet().iterator(); it.hasNext();) {\r
+ Map.Entry entry = (Map.Entry) it.next();\r
+ Object key = entry.getKey();\r
+ int keyHash = (key != null ? key.hashCode() : 0);\r
+ Object newKey = resolveValue(key);\r
+ int newKeyHash = (newKey != null ? newKey.hashCode() : 0);\r
+ Object val = entry.getValue();\r
+ Object newVal = resolveValue(val);\r
+ newContent.put(newKey, newVal);\r
+ entriesModified = entriesModified || (newVal != val || newKey != key || newKeyHash != keyHash);\r
+ }\r
+ \r
+ return entriesModified ? newContent : value;\r
+ }\r
+ else if (value instanceof List) {\r
+ List listVal = (List) value;\r
+ List newContent = new ManagedList();\r
+ boolean valueModified = false;\r
+ \r
+ for (int i = 0; i < listVal.size(); i++) {\r
+ Object elem = listVal.get(i);\r
+ Object newVal = resolveValue(elem);\r
+ newContent.add(newVal);\r
+ if (!ObjectUtils.nullSafeEquals(newVal, elem)) {\r
+ valueModified = true;\r
+ }\r
+ } \r
+ return valueModified ? newContent : value;\r
+ }\r
+ else if (value instanceof Set) {\r
+ Set setVal = (Set) value;\r
+ Set newContent = new ManagedSet();\r
+ boolean entriesModified = false;\r
+ for (Iterator it = setVal.iterator(); it.hasNext();) {\r
+ Object elem = it.next();\r
+ int elemHash = (elem != null ? elem.hashCode() : 0);\r
+ Object newVal = resolveValue(elem);\r
+ int newValHash = (newVal != null ? newVal.hashCode() : 0);\r
+ newContent.add(newVal);\r
+ entriesModified = entriesModified || (newVal != elem || newValHash != elemHash);\r
+ } \r
+ return entriesModified ? newContent : value;\r
+ }\r
+ else {\r
+ return value;\r
+ } \r
+ }\r
+\r
+ @Override\r
+ protected String resolvePlaceholder(String placeholder, Properties props) { \r
+ if ((executionScope != null)\r
+ && (executionScope.hasExecutionContext())) {\r
+ Object obj = executionContext.findVariable(placeholder);\r
+ if(obj != null) {\r
+ return obj.toString();\r
+ }\r
+ }\r
+ if (instantiationManager.isInFlowInitialization())\r
+ return instantiationManager.getInitializingFlowParameter(\r
+ placeholder).toString();\r
+ else\r
+ throw new SlcException("Could not resolve placeholder '" \r
+ + placeholder + "' in bean '" + beanName + "'");\r
+ }\r
+ }\r
+}\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<beans xmlns="http://www.springframework.org/schema/beans"\r
+ xmlns:p="http://www.springframework.org/schema/p" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
+ xmlns:aop="http://www.springframework.org/schema/aop"\r
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd\r
+ http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">\r
+\r
+ <import resource="imports.xml" /> \r
+\r
+ <bean id="myTestRunTemplate" class="org.argeo.slc.core.test.SimpleTestRun" abstract="true">\r
+ <property name="testDefinition" ref="basic.testDef" />\r
+ <property name="testResult" ref="myTestResult"/>\r
+ </bean> \r
+\r
+ <bean id="abstractFlow" parent="slcTemplate.simpleFlow" abstract="true">\r
+ <property name="executables">\r
+ <list>\r
+ <ref local="echo1" />\r
+ <bean parent="myTestRunTemplate">\r
+ <property name="testData" ref="simpleMap.testData" />\r
+ </bean> \r
+ <bean parent="myTestRunTemplate">\r
+ <property name="testData" ref="cascadingMap.testData" />\r
+ </bean> \r
+ \r
+ <bean parent="myTestRunTemplate">\r
+ <property name="testData" ref="simpleList.testData" />\r
+ </bean> \r
+ <bean parent="myTestRunTemplate">\r
+ <property name="testData" ref="cascadingList.testData" />\r
+ </bean> \r
+ \r
+ <bean parent="myTestRunTemplate">\r
+ <property name="testData" ref="simpleSet.testData" />\r
+ </bean> \r
+ <bean parent="myTestRunTemplate">\r
+ <property name="testData" ref="cascadingSet.testData" />\r
+ </bean> \r
+ \r
+ <bean parent="myTestRunTemplate">\r
+ <property name="testData" ref="cascadingListMap.testData" />\r
+ </bean> \r
+ <bean parent="myTestRunTemplate">\r
+ <property name="testData" ref="cascadingSetMap.testData" />\r
+ </bean> \r
+ <bean parent="myTestRunTemplate">\r
+ <property name="testData" ref="cascadingComplex.testData" />\r
+ </bean> \r
+ \r
+ </list>\r
+ </property>\r
+ </bean>\r
+\r
+ <bean id="flow1" parent="abstractFlow" scope="prototype">\r
+ <constructor-arg>\r
+ <bean parent="slcTemplate.simpleSpec">\r
+ <property name="attributes">\r
+ <map>\r
+ <entry key="testKey">\r
+ <bean parent="specAttr.primitive" p:value="myValue" />\r
+ </entry>\r
+ </map>\r
+ </property>\r
+ </bean>\r
+ </constructor-arg>\r
+ </bean> \r
+\r
+ <bean id="flow2" parent="abstractFlow" scope="prototype">\r
+ <constructor-arg>\r
+ <bean parent="slcTemplate.simpleSpec">\r
+ <property name="attributes">\r
+ <map>\r
+ <entry key="testKey">\r
+ <bean parent="specAttr.primitive" p:value="myValue2" />\r
+ </entry>\r
+ </map>\r
+ </property>\r
+ </bean>\r
+ </constructor-arg>\r
+ </bean> \r
+\r
+\r
+ <bean id="simpleMap.testData" class="org.argeo.slc.core.test.BasicTestData" scope="prototype">\r
+ <property name="expected">\r
+ <map>\r
+ <entry key="key1" value="myValue_myValue" />\r
+ </map>\r
+ </property>\r
+ <property name="reached">\r
+ <map>\r
+ <entry key="key1" value="@{testKey}_@{testKey}" />\r
+ </map>\r
+ </property>\r
+ </bean>\r
+ \r
+ <bean id="cascadingMap.testData" class="org.argeo.slc.core.test.BasicTestData" scope="prototype">\r
+ <property name="expected">\r
+ <map>\r
+ <entry key="key3">\r
+ <map>\r
+ <entry key="key2">\r
+ <map>\r
+ <entry key="key1" value="myValue" />\r
+ </map>\r
+ </entry>\r
+ <entry key="key2bis" value="myValue" />\r
+ </map>\r
+ </entry>\r
+ </map>\r
+ </property>\r
+ <property name="reached">\r
+ <map>\r
+ <entry key="key3">\r
+ <map>\r
+ <entry key="key2">\r
+ <map>\r
+ <entry key="key1" value="@{testKey}" />\r
+ </map>\r
+ </entry>\r
+ <entry key="key2bis" value="@{testKey}" />\r
+ </map>\r
+ </entry>\r
+ </map>\r
+ </property>\r
+ </bean> \r
+ \r
+ <bean id="simpleList.testData" class="org.argeo.slc.core.test.BasicTestData" scope="prototype">\r
+ <property name="expected">\r
+ <list>\r
+ <value>myValue</value>\r
+ <value>_myValue_</value>\r
+ </list>\r
+ </property>\r
+ <property name="reached">\r
+ <list>\r
+ <value>@{testKey}</value>\r
+ <value>_@{testKey}_</value> \r
+ </list>\r
+ </property>\r
+ </bean> \r
+ \r
+ <bean id="cascadingList.testData" class="org.argeo.slc.core.test.BasicTestData" scope="prototype">\r
+ <property name="expected">\r
+ <list>\r
+ <list>\r
+ <value>myValue</value>\r
+ <value>_myValue_</value>\r
+ </list>\r
+ <value>myValue</value>\r
+ </list>\r
+ </property>\r
+ <property name="reached">\r
+ <list>\r
+ <list>\r
+ <value>@{testKey}</value>\r
+ <value>_@{testKey}_</value>\r
+ </list>\r
+ <value>@{testKey}</value>\r
+ </list>\r
+ </property>\r
+ </bean> \r
+ \r
+ <bean id="simpleSet.testData" class="org.argeo.slc.core.test.BasicTestData" scope="prototype">\r
+ <property name="expected">\r
+ <set>\r
+ <value>myValue</value>\r
+ <value>_myValue_</value>\r
+ </set>\r
+ </property>\r
+ <property name="reached">\r
+ <set>\r
+ <value>@{testKey}</value>\r
+ <value>_@{testKey}_</value> \r
+ </set>\r
+ </property>\r
+ </bean> \r
+ \r
+ <bean id="cascadingSet.testData" class="org.argeo.slc.core.test.BasicTestData" scope="prototype">\r
+ <property name="expected">\r
+ <set>\r
+ <set>\r
+ <value>myValue</value>\r
+ <value>_myValue_</value>\r
+ </set>\r
+ <value>myValue</value>\r
+ </set>\r
+ </property>\r
+ <property name="reached">\r
+ <set>\r
+ <set>\r
+ <value>@{testKey}</value>\r
+ <value>_@{testKey}_</value>\r
+ </set>\r
+ <value>@{testKey}</value>\r
+ </set>\r
+ </property>\r
+ </bean> \r
+ \r
+ <bean id="cascadingListMap.testData" class="org.argeo.slc.core.test.BasicTestData" scope="prototype">\r
+ <property name="expected">\r
+ <list>\r
+ <map>\r
+ <entry key="key1" value="myValue" />\r
+ </map> \r
+ </list>\r
+ </property>\r
+ <property name="reached">\r
+ <list>\r
+ <map>\r
+ <entry key="key1" value="@{testKey}" />\r
+ </map> \r
+ </list>\r
+ </property>\r
+ </bean> \r
+ \r
+ <bean id="cascadingSetMap.testData" class="org.argeo.slc.core.test.BasicTestData" scope="prototype">\r
+ <property name="expected">\r
+ <set>\r
+ <map>\r
+ <entry key="key1" value="myValue" />\r
+ </map> \r
+ </set>\r
+ </property>\r
+ <property name="reached">\r
+ <set>\r
+ <map>\r
+ <entry key="key1" value="@{testKey}" />\r
+ </map> \r
+ </set>\r
+ </property>\r
+ </bean> \r
+ \r
+ <bean id="cascadingComplex.testData" class="org.argeo.slc.core.test.BasicTestData" scope="prototype">\r
+ <property name="expected">\r
+ <set>\r
+ <map>\r
+ <entry key="key1" value="myValue" />\r
+ </map> \r
+ <list>\r
+ <map>\r
+ <entry key="key1" value="myValue" />\r
+ </map> \r
+ <set>\r
+ <set>\r
+ <value>myValue</value>\r
+ <value>_myValue_</value>\r
+ <list>\r
+ <list>\r
+ <value>myValue</value>\r
+ <value>_myValue_</value>\r
+ </list>\r
+ <value>myValue</value>\r
+ </list> \r
+ </set>\r
+ <value>myValue</value>\r
+ </set> \r
+ </list> \r
+ <set>\r
+ <map>\r
+ <entry key="key1" value="myValue" />\r
+ </map> \r
+ </set> \r
+ </set>\r
+ </property>\r
+ <property name="reached">\r
+ <set>\r
+ <map>\r
+ <entry key="key1" value="@{testKey}" />\r
+ </map> \r
+ <list>\r
+ <map>\r
+ <entry key="key1" value="@{testKey}" />\r
+ </map> \r
+ <set>\r
+ <set>\r
+ <value>@{testKey}</value>\r
+ <value>_@{testKey}_</value>\r
+ <list>\r
+ <list>\r
+ <value>@{testKey}</value>\r
+ <value>_@{testKey}_</value>\r
+ </list>\r
+ <value>@{testKey}</value>\r
+ </list> \r
+ </set>\r
+ <value>@{testKey}</value>\r
+ </set> \r
+ </list> \r
+ <set>\r
+ <map>\r
+ <entry key="key1" value="@{testKey}" />\r
+ </map> \r
+ </set> \r
+ </set>\r
+ </property>\r
+ </bean> \r
+ \r
+ <bean id="basic.testDef" class="org.argeo.slc.core.test.BasicTestDefinition">\r
+ </bean> \r
+\r
+\r
+ <bean id="echo1" parent="task.echo" scope="prototype">\r
+ <property name="message"\r
+ value="testKey=@{testKey}" />\r
+ </bean>\r
+ \r
+ <bean id="myTestResult" class="org.argeo.slc.core.test.SimpleTestResult" />\r
+\r
+</beans>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>\r
<beans xmlns="http://www.springframework.org/schema/beans"\r
- xmlns:p="http://www.springframework.org/schema/p" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"\r
xmlns:aop="http://www.springframework.org/schema/aop"\r
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd\r
+ xsi:schemaLocation="\r
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd\r
+ http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-2.5.xsd\r
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">\r
\r
<import resource="imports.xml" /> \r
\r
- <bean id="second" parent="slcTemplate.simpleFlow">\r
- <constructor-arg>\r
- <bean parent="slcTemplate.simpleSpec">\r
- <property name="attributes">\r
- <map>\r
- <entry key="testKey">\r
- <bean parent="specAttr.primitive" p:value="second" />\r
- </entry>\r
- </map>\r
- </property>\r
- </bean>\r
- </constructor-arg>\r
- <property name="executables">\r
- <list>\r
- <ref local="echo1" />\r
- <bean class="org.argeo.slc.core.test.SimpleTestRun">\r
- <property name="testDefinition" ref="basic.testDef" />\r
- <property name="testData" ref="basic.testData" />\r
- <property name="testResult" ref="basicTestResult"/>\r
- </bean> \r
- </list>\r
+ <bean id="fileDiff.spec" parent="slcTemplate.simpleSpec">\r
+ <property name="attributes">\r
+ <map>\r
+ <entry key="fileName">\r
+ <bean parent="specAttr.primitive" p:isParameter="true" p:type="string"\r
+ p:isFrozen="true" />\r
+ </entry>\r
+ </map>\r
</property>\r
</bean>\r
\r
-<!-- \r
- <bean id="first" parent="slcTemplate.simpleFlow">\r
- <constructor-arg>\r
- <bean parent="slcTemplate.simpleSpec">\r
- <property name="attributes">\r
- <map>\r
- <entry key="testKey">\r
- <bean parent="specAttr.primitive" p:value="first" />\r
- </entry>\r
- </map>\r
- </property>\r
- </bean>\r
- </constructor-arg>\r
+ <bean id="fileDiff.flowTemplate" parent="slcTemplate.simpleFlow"\r
+ abstract="true">\r
+ <property name="path" value="/fileDiff/testcases" />\r
+ <constructor-arg ref="fileDiff.spec" />\r
<property name="executables">\r
<list>\r
- <ref local="second" />\r
- <ref local="echo1" />\r
+ <bean parent="task.echo" scope="execution">\r
+ <property name="message" value="From FileDiff @{fileName}" />\r
+ <aop:scoped-proxy />\r
+ </bean>\r
+\r
+\r
+ <bean class="org.argeo.slc.core.test.SimpleTestRun">\r
+ <property name="testDefinition">\r
+ <bean class="org.argeo.slc.core.test.BasicTestDefinition" />\r
+ </property>\r
+ <property name="testData">\r
+ <bean id="simpleList.testData" class="org.argeo.slc.core.test.BasicTestData" scope="prototype">\r
+ <property name="expected">\r
+ <value>myValue</value>\r
+ </property>\r
+ <property name="reached">\r
+ <value>myValue2</value>\r
+ </property>\r
+ </bean> \r
+ </property>\r
+ <property name="testResult" ref="fileDiff.testResult" />\r
+ </bean>\r
+\r
+ <bean class="org.argeo.slc.core.execution.tasks.CloseTestResultTask" scope="execution">\r
+ <property name="testResult" ref="fileDiff.testResult" />\r
+ </bean>\r
</list>\r
</property>\r
</bean>\r
- -->\r
- <bean id="basic.testData" class="org.argeo.slc.core.test.BasicTestData" scope="prototype">\r
- <property name="expected">\r
+\r
+ <bean id="fileDiff.testResult" parent="slcDefault.test.basicTreeTestResult"\r
+ scope="execution">\r
+ <aop:scoped-proxy />\r
+ <property name="attributes">\r
<map>\r
- <entry key="test" value="second" />\r
+ <entry key="testCase" value="@{fileName}" />\r
+ <entry key="testCaseType" value="csvdiff" />\r
</map>\r
</property>\r
- <property name="reached">\r
+ <property name="listeners" ref="resultListeners" /> \r
+ </bean>\r
+\r
+ <bean id="fileDiff.SimulationView_Risk" parent="fileDiff.flowTemplate">\r
+ <constructor-arg>\r
<map>\r
- <entry key="test" value="@{testKey}" />\r
+ <entry key="fileName" value="SimulationView_Risk" />\r
</map>\r
- </property>\r
+ </constructor-arg>\r
</bean>\r
- \r
- <bean id="basic.testDef" class="org.argeo.slc.core.test.BasicTestDefinition">\r
- </bean> \r
-\r
\r
- <bean id="echo1" parent="task.echo" scope="prototype">\r
- <property name="message"\r
- value="testKey=@{testKey}" />\r
+ <bean id="fileDiff.SimulationView_Risk2" parent="fileDiff.flowTemplate">\r
+ <constructor-arg>\r
+ <map>\r
+ <entry key="fileName" value="SimulationView_Risk2" />\r
+ </map>\r
+ </constructor-arg>\r
</bean>\r
- \r
- <bean id="basicTestResult" class="org.argeo.slc.core.test.SimpleTestResult" />\r
\r
</beans>
\ No newline at end of file