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
if(changesOccured) {\r
storedPvsMap.put(beanName, pvs);\r
- log.info("Add storedPvsMap for Bean " + beanName);\r
return newPvs;\r
}\r
else {\r
private ThreadLocal<Stack<ExecutionFlow> > flowStack = new ThreadLocal<Stack<ExecutionFlow> >();\r
\r
public Object createRef(String name) {\r
- if((flowStack.get() == null) || flowStack.get().empty()) {\r
- throw new SlcException("No flow is currently initializing."\r
- + " Declare flow refs as inner beans or prototypes.");\r
- }\r
-\r
- /*\r
- * RefSpecAttribute refSpecAttribute = (RefSpecAttribute) attributes\r
- * .get(name); Class<?> targetClass = refSpecAttribute.getTargetClass();\r
- * ExecutionTargetSource targetSource = new ExecutionTargetSource(flow,\r
- * targetClass, name); ProxyFactory proxyFactory = new ProxyFactory();\r
- * proxyFactory.setTargetClass(targetClass);\r
- * proxyFactory.setProxyTargetClass(true);\r
- * proxyFactory.setTargetSource(targetSource);\r
- * \r
- * return proxyFactory.getProxy();\r
- */\r
- return flowStack.get().peek().getParameter(name);\r
+ \r
+// if((flowStack.get() == null) || flowStack.get().empty()) {\r
+// throw new SlcException("No flow is currently initializing."\r
+// + " Declare flow refs as inner beans or prototypes.");\r
+// }\r
+//\r
+// /*\r
+// * RefSpecAttribute refSpecAttribute = (RefSpecAttribute) attributes\r
+// * .get(name); Class<?> targetClass = refSpecAttribute.getTargetClass();\r
+// * ExecutionTargetSource targetSource = new ExecutionTargetSource(flow,\r
+// * targetClass, name); ProxyFactory proxyFactory = new ProxyFactory();\r
+// * proxyFactory.setTargetClass(targetClass);\r
+// * proxyFactory.setProxyTargetClass(true);\r
+// * proxyFactory.setTargetSource(targetSource);\r
+// * \r
+// * return proxyFactory.getProxy();\r
+// */\r
+// return flowStack.get().peek().getParameter(name);\r
+ \r
+ return getInitializingFlowParameter(name);\r
} \r
\r
public void flowInitializationStarted(ExecutionFlow flow, String flowName) {\r
// applicationContext.close(); \r
// }\r
// \r
+ \r
+ public void testSpecOverriding() throws Exception {\r
+ ConfigurableApplicationContext applicationContext = createApplicationContext("specOverriding.xml");\r
+ ((ExecutionFlow) applicationContext.getBean("flow2")).execute();\r
+ SimpleTestResult res = (SimpleTestResult) applicationContext.getBean("myTestResult");\r
+ validateTestResult(res);\r
+ }\r
+ \r
public void testMultipleFlows() throws Exception {\r
ConfigurableApplicationContext applicationContext = createApplicationContext("multipleFlow.xml");\r
- log.info("Start Execution");\r
((ExecutionFlow) applicationContext.getBean("flow1")).execute();\r
+ SimpleTestResult res = (SimpleTestResult) applicationContext.getBean("myTestResult");\r
+ validateTestResult(res);\r
+ res.getParts().clear();\r
((ExecutionFlow) applicationContext.getBean("flow2")).execute();\r
- applicationContext.close();\r
+ validateTestResult(res, TestStatus.FAILED); \r
+ applicationContext.close(); \r
} \r
\r
/**\r
applicationContext.close(); \r
} \r
\r
-// public void testListSetMapMultipleFlows() throws Exception {\r
-// ConfigurableApplicationContext applicationContext = createApplicationContext("listSetMapMultipleFlow.xml");\r
-// ((ExecutionFlow) applicationContext.getBean("flow1")).execute();\r
-// SimpleTestResult res = (SimpleTestResult) applicationContext.getBean("myTestResult");\r
-// validateTestResult(res); \r
-// res.getParts().clear();\r
-// ((ExecutionFlow) applicationContext.getBean("flow2")).execute();\r
-// validateTestResult(res, TestStatus.FAILED);\r
-// applicationContext.close(); \r
-// } \r
+ public void testListSetMapMultipleFlows() throws Exception {\r
+ ConfigurableApplicationContext applicationContext = createApplicationContext("listSetMapMultipleFlow.xml");\r
+ ((ExecutionFlow) applicationContext.getBean("flow1")).execute();\r
+ SimpleTestResult res = (SimpleTestResult) applicationContext.getBean("myTestResult");\r
+ validateTestResult(res); \r
+ res.getParts().clear();\r
+ ((ExecutionFlow) applicationContext.getBean("flow2")).execute();\r
+ validateTestResult(res, TestStatus.FAILED);\r
+ applicationContext.close(); \r
+ } \r
\r
protected void logException(Throwable ex) {\r
log.info("Got Exception of class " + ex.getClass().toString()\r
\r
<import resource="imports.xml" /> \r
\r
+ <bean id="myTestResult" class="org.argeo.slc.core.test.SimpleTestResult" />\r
+\r
+ <bean id="myTestDef" class="org.argeo.slc.core.test.BasicTestDefinition" />\r
+\r
+ <bean id="myTestRunTemplate" class="org.argeo.slc.core.test.SimpleTestRun" abstract="true">\r
+ <property name="testDefinition" ref="myTestDef" />\r
+ <property name="testResult" ref="myTestResult"/>\r
+ </bean> \r
+\r
<bean id="fileDiff.spec" parent="slcTemplate.simpleSpec">\r
<property name="attributes">\r
<map>\r
<bean parent="task.echo">\r
<property name="message" value="fileName=@{fileName}" />\r
</bean>\r
+ <bean parent="myTestRunTemplate">\r
+ <property name="testData">\r
+ <bean class="org.argeo.slc.core.test.BasicTestData">\r
+ <property name="expected" value="file1" />\r
+ <property name="reached" value="@{fileName}" />\r
+ </bean>\r
+ </property> \r
+ </bean>\r
</list>\r
</property>\r
</bean>\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="myTestResult" class="org.argeo.slc.core.test.SimpleTestResult" />\r
+\r
+ <bean id="myTestDef" class="org.argeo.slc.core.test.BasicTestDefinition" />\r
+\r
+ <bean id="myTestRunTemplate" class="org.argeo.slc.core.test.SimpleTestRun" abstract="true">\r
+ <property name="testDefinition" ref="myTestDef" />\r
+ <property name="testResult" ref="myTestResult"/>\r
+ </bean> \r
+ \r
+ <bean id="spec1" parent="slcTemplate.simpleSpec">\r
+ <property name="attributes">\r
+ <map>\r
+ <entry key="testedComponentId">\r
+ <bean parent="specAttr.primitive" p:isParameter="true"\r
+ p:type="integer" />\r
+ </entry>\r
+ <entry key="testData1">\r
+ <bean parent="specAttr.ref" p:targetClass="org.argeo.slc.core.test.BasicTestData"\r
+ p:isParameter="true" p:isFrozen="true" />\r
+ </entry>\r
+ </map>\r
+ </property>\r
+ </bean>\r
+\r
+ <bean id="flowTemplate1" parent="slcTemplate.simpleFlow"\r
+ abstract="true">\r
+ <constructor-arg ref="spec1" />\r
+ <property name="executables">\r
+ <list>\r
+ <bean parent="task.echo" scope="execution">\r
+ <property name="message" value="From basic @{testedComponentId}" />\r
+ <aop:scoped-proxy />\r
+ </bean>\r
+ <bean parent="myTestRunTemplate">\r
+ <property name="testData">\r
+ <bean parent="parameterRef">\r
+ <constructor-arg value="testData1" />\r
+ </bean>\r
+ </property>\r
+ </bean>\r
+ </list>\r
+ </property>\r
+ </bean>\r
+\r
+ <bean id="flow1" parent="flowTemplate1" scope="prototype">\r
+ <constructor-arg>\r
+ <map>\r
+ <entry key="testedComponentId" value="200" />\r
+ <entry key="testData1">\r
+ <bean class="org.argeo.slc.core.test.BasicTestData" scope="execution">\r
+ <aop:scoped-proxy/>\r
+ <property name="expected" value="tata101" />\r
+ <property name="reached" value="tata@{testedComponentId}" />\r
+ </bean>\r
+ </entry>\r
+ </map> \r
+ </constructor-arg>\r
+ </bean>\r
+\r
+ <bean id="spec2" parent="slcTemplate.simpleSpec">\r
+ <property name="attributes">\r
+ <map>\r
+ <entry key="testData1">\r
+ <bean parent="specAttr.ref" p:targetClass="org.argeo.slc.core.test.BasicTestData"\r
+ p:isParameter="true" p:isFrozen="true" />\r
+ </entry>\r
+ </map>\r
+ </property>\r
+ </bean>\r
+\r
+ <bean id="flowTemplate2" parent="slcTemplate.simpleFlow" abstract="true">\r
+ <constructor-arg ref="spec2" />\r
+ <property name="executables">\r
+ <list>\r
+ <ref bean="flow1"/>\r
+ </list>\r
+ </property>\r
+ </bean>\r
+ \r
+ <bean id="flow2" parent="flowTemplate2">\r
+ <constructor-arg>\r
+ <map>\r
+ <entry key="testData1">\r
+ <bean class="org.argeo.slc.core.test.BasicTestData">\r
+ <property name="expected" value="tata100" />\r
+ <property name="reached" value="tata100" />\r
+ </bean>\r
+ </entry>\r
+ </map> \r
+ </constructor-arg>\r
+ </bean> \r
+\r
+</beans>
\ No newline at end of file
\r
<import resource="imports.xml" /> \r
\r
- <bean id="fileDiff.spec" parent="slcTemplate.simpleSpec">\r
+ <bean id="mySpec" parent="slcTemplate.simpleSpec">\r
<property name="attributes">\r
<map>\r
- <entry key="fileName">\r
+ <entry key="key">\r
<bean parent="specAttr.primitive" p:isParameter="true" p:type="string"\r
p:isFrozen="true" />\r
</entry>\r
+ <entry key="testResult">\r
+ <bean parent="specAttr.ref" p:targetClass="slcDefault.test.basicTreeTestResult"\r
+ p:isParameter="true" p:isFrozen="true" />\r
+ </entry> \r
</map>\r
</property>\r
</bean>\r
<value>myValue</value>\r
</property>\r
<property name="reached">\r
- <value>myValue2</value>\r
+ <value>@{key}</value>\r
</property>\r
</bean> \r
</property>\r
- <property name="testResult" ref="fileDiff.testResult" />\r
+ <property name="testResult">\r
+ <bean parent="parameterRef">\r
+ <constructor-arg value="testResult" />\r
+ </bean>\r
+ </property>\r
</bean>\r
\r
<bean class="org.argeo.slc.core.execution.tasks.CloseTestResultTask" scope="execution">\r