</property>\r
</bean>\r
\r
- <bean id="basic.ref" factory-bean="basic.spec" factory-method="createRef"\r
- abstract="true" />\r
+<!-- <bean id="basic.ref" factory-bean="basic.spec" factory-method="createRef"\r
+ abstract="true" />-->\r
\r
<bean id="basic.flowTemplate" parent="slcTemplate.simpleFlow"\r
abstract="true">\r
<bean parent="testRun">\r
<property name="testDefinition" ref="testDef" />\r
<property name="testData">\r
- <bean parent="basic.ref">\r
+ <bean parent="parameterRef">\r
<constructor-arg value="testData1" />\r
</bean>\r
</property>\r
</property>\r
</bean>\r
\r
- <bean id="ref1" parent="basic.ref" scope="prototype">\r
+ <bean id="ref1" parent="parameterRef" scope="prototype">\r
<constructor-arg value="testData2" />\r
</bean>\r
\r
\r
<bean id="canonic.flowTemplate" parent="slcTemplate.simpleFlow"\r
abstract="true">\r
- <constructor-arg ref="basic.spec" />\r
+ <constructor-arg ref="canonic.spec" />\r
<property name="executables">\r
<list>\r
<bean parent="task.echo"\r
throws BeansException {
-// boolean inFlowInitialization = DefaultExecutionSpec.isInFlowInitialization();
+ 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);
-// }
+ 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);
+ }
Properties props = new Properties();
CustomPpc ppc = new CustomPpc(props);
setSystemPropertiesMode(SYSTEM_PROPERTIES_MODE_NEVER);
}
+ //TODO: could be removed as well as props
public String process(String strVal) {
String value = parseStringValue(strVal, this.props,
new HashSet<String>());
@Override
protected String resolvePlaceholder(String placeholder, Properties props) {
- if ((executionScope != null) && (executionScope.hasExecutionContext())) {
- // if we have an execution context, look there for the placeholder
+ //log.info("Try convert placeholder " + placeholder);
+ if ((executionScope != null) && (executionScope.hasExecutionContext()))
return executionContext.getVariable(placeholder).toString();
- }
- else {
- // TODO: check scope of the bean
- // throw exception if trying to resolve placeholder on bean of scope singleton
-
- if (instantiationManager.isInFlowInitialization()) {
- String resolved = instantiationManager.getInitializingFlowParameter(
- placeholder).toString();
-// log.info("Initialization placeholder resolution " + placeholder
-// + ">>" + resolved);
- return resolved;
- }
- else {
- // return super.resolvePlaceholder(placeholder, props);
- throw new SlcException("Placeholder '" + placeholder
- + "' can not be resolved outside of Flow Initialization or Flow Execution.");
- }
- }
+ else if (instantiationManager.isInFlowInitialization())
+ return instantiationManager.getInitializingFlowParameter(
+ placeholder).toString();
+ else
+ return super.resolvePlaceholder(placeholder, props);
}
}
}
import org.argeo.slc.test.TestStatus;\r
import org.argeo.slc.unit.AbstractSpringTestCase;\r
import org.springframework.beans.factory.BeanCreationException;\r
-import org.springframework.beans.factory.config.BeanDefinition;\r
import org.springframework.context.ConfigurableApplicationContext;\r
import org.springframework.context.support.ClassPathXmlApplicationContext;\r
\r
public class ExecutionFlowTest extends AbstractSpringTestCase {\r
\r
public void testSimpleExecution() throws Exception {\r
-// prepareExecution("applicationContext.xml");\r
- configureAndExecuteSlcFlow("applicationContext.xml", "main_2");\r
- \r
-// ConfigurableApplicationContext applicationContext = new ClassPathXmlApplicationContext(inPackage("applicationContext.xml"));\r
-// String[] beanNames = applicationContext.getBeanDefinitionNames();\r
-// for(String beanName : beanNames) {\r
-// log.info("beanName='" + beanName + "'");\r
-//// if(beanName.equals("main_temp")) {\r
-// BeanDefinition beanDef = applicationContext.getBeanFactory().getBeanDefinition(beanName);\r
-// String scope = beanDef.getScope();\r
-// String[] attrs = beanDef.();\r
-// log.info("scope=" + scope + ", nbAttr=" + attrs.length);\r
-// for(String attr : attrs) {\r
-// log.info(attr + "=" + beanDef.getAttribute(attr));\r
-// }\r
-//// }\r
-// }\r
- \r
+ configureAndExecuteSlcFlow("applicationContext.xml", "main");\r
}\r
\r
public void testCanonic() throws Exception {\r
// Parameter without default value in specification\r
-// configureAndExecuteSlcFlow("canonic-001.xml", "canonic.001");\r
-// configureAndExecuteSlcFlow("canonic-002.xml", "canonic.002");\r
-//\r
-// try {\r
-// prepareExecution("canonic-003.error.xml");\r
-// fail("Parameter not set - should be rejected.");\r
-// } catch (BeanCreationException e) {\r
-// // exception expected\r
-// logException(e);\r
-// }\r
+/* configureAndExecuteSlcFlow("canonic-001.xml", "canonic.001");\r
+ configureAndExecuteSlcFlow("canonic-002.xml", "canonic.002");\r
+\r
+ try {\r
+ configureAndExecuteSlcFlow("canonic-003.error.xml", "canonic.003");\r
+ fail("Parameter not set - should be rejected.");\r
+ } catch (BeanCreationException e) {\r
+ // exception expected\r
+ logException(e);\r
+ }*/\r
\r
/* try {\r
configureAndExecuteSlcFlow("canonic-004.error.xml", "canonic.004");\r
} */\r
} \r
\r
- public void testRecursive() throws Exception {\r
-// ConfigurableApplicationContext applicationContext = prepareExecution("test.xml");\r
-// ExecutionFlow executionFlow = (ExecutionFlow) applicationContext.getBean("first");\r
-// executionFlow.execute(); \r
-// SimpleTestResult res = (SimpleTestResult) applicationContext.getBean("basicTestResult");\r
-// if(res.getParts().get(0).getStatus() != TestStatus.PASSED) {\r
-// fail("Unexpected string returned");\r
-// }\r
-// applicationContext.close(); \r
- }\r
- \r
- public void testCreateRef() throws Exception {\r
-// configureAndExecuteSlcFlow("createRef.xml", "basic.001");\r
- }\r
+/* public void testRecursive() throws Exception {\r
+ ConfigurableApplicationContext applicationContext = prepareExecution("test.xml");\r
+ ExecutionFlow executionFlow = (ExecutionFlow) applicationContext.getBean("first");\r
+ executionFlow.execute(); \r
+ SimpleTestResult res = (SimpleTestResult) applicationContext.getBean("basicTestResult");\r
+ if(res.getParts().get(0).getStatus() != TestStatus.PASSED) {\r
+ fail("Unexpected string returned");\r
+ }\r
+ applicationContext.close(); \r
+ }*/\r
\r
protected void logException(Throwable ex) {\r
log.info("Got Exception of class " + ex.getClass().toString()\r
<property name="version" value="dummyversion" />\r
</bean>\r
\r
- <bean id="echoNonExecution" parent="task.echo" scope="prototype">\r
- <property name="message"\r
- value="echoNonExecution @{testKey}" />\r
- </bean>\r
- \r
- <bean id="main_temp" parent="slcTemplate.simpleFlow" abstract="true">\r
- <constructor-arg >\r
+ <bean id="main" parent="slcTemplate.simpleFlow">\r
+ <constructor-arg>\r
<bean parent="slcTemplate.simpleSpec">\r
<property name="attributes">\r
<map>\r
</entry>\r
</map>\r
</property>\r
- </bean> \r
+ </bean>\r
</constructor-arg>\r
-\r
<property name="executables">\r
<list>\r
- <ref local="echoExecution" />\r
- <ref local="echoNonExecution" />\r
- <bean parent="task.echo">\r
- <property name="message"\r
- value="echoNonExecutionEmbedded @{testKey}" />\r
- </bean> \r
+ <ref local="echo1" />\r
</list>\r
</property>\r
</bean>\r
\r
- <bean id="main" parent="main_temp">\r
- <constructor-arg >\r
- <map>\r
- <entry key="testKey" value="666" />\r
- </map> \r
- </constructor-arg> \r
- </bean>\r
-\r
- <bean id="main_2" parent="main_temp">\r
- <constructor-arg >\r
- <map>\r
- <entry key="testKey" value="main_2" />\r
- </map> \r
- </constructor-arg> \r
- </bean>\r
-\r
- <bean id="echoExecution" parent="task.echo" scope="execution">\r
+ <bean id="echo1" parent="task.echo" scope="execution">\r
<property name="message"\r
- value="echoExecution @{testKey}" />\r
+ value="From main! @{testKey}" />\r
<aop:scoped-proxy />\r
</bean>\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="testDef" class="org.argeo.slc.core.test.BasicTestDefinition"\r
- scope="prototype" />\r
-\r
- <bean id="testResult" parent="slcDefault.test.basicTreeTestResult" />\r
-\r
- <bean id="testRun" class="org.argeo.slc.core.test.SimpleTestRun"\r
- abstract="true">\r
- <property name="testResult" ref="testResult" />\r
- </bean>\r
-\r
- <bean id="basic.spec" parent="slcTemplate.simpleSpec">\r
- <property name="attributes">\r
- <map>\r
- <entry key="testedComponentId">\r
- <bean parent="specAttr.primitive">\r
- <property name="value" value="100" />\r
- <property name="isParameter" value="true" />\r
- <property name="type" value="integer" />\r
- </bean>\r
- </entry>\r
- <entry key="testData1">\r
- <bean parent="specAttr.ref">\r
- <property name="isParameter" value="true" />\r
- <property name="targetClass" value="org.argeo.slc.core.test.BasicTestData" />\r
- <property name="isFrozen" value="true" /> \r
- </bean>\r
- </entry>\r
- <entry key="testData2">\r
- <bean parent="specAttr.ref">\r
- <property name="isParameter" value="true" />\r
- <property name="targetClass" value="org.argeo.slc.core.test.BasicTestData" />\r
- <property name="isFrozen" value="true" /> \r
- </bean>\r
- </entry>\r
- </map>\r
- </property>\r
- </bean>\r
-\r
- <bean id="basic.flowTemplate" parent="slcTemplate.simpleFlow"\r
- abstract="true">\r
- <constructor-arg >\r
- <ref bean="basic.spec" />\r
- </constructor-arg>\r
- <property name="executables">\r
- <list>\r
- <bean parent="task.echo">\r
- <property name="message" value="From basic @{testedComponentId}" />\r
- <!-- <aop:scoped-proxy /> -->\r
- </bean>\r
- <bean parent="testRun">\r
- <property name="path" value="/test/basic" />\r
- <property name="testDefinition" ref="testDef" />\r
- <property name="testData">\r
- <bean parent="parameterRef">\r
- <constructor-arg value="testData1" />\r
- </bean>\r
- </property>\r
- </bean>\r
- <bean parent="testRun">\r
- <property name="testDefinition" ref="testDef" />\r
- <property name="testData" ref="ref1" />\r
- </bean>\r
- </list>\r
- </property>\r
- </bean>\r
-\r
- <bean id="ref1" parent="parameterRef" scope="prototype">\r
- <constructor-arg value="testData2" />\r
- </bean>\r
-\r
-\r
- <bean id="basic.testData" class="org.argeo.slc.core.test.BasicTestData">\r
-<!-- <aop:scoped-proxy /> -->\r
- <property name="expected" value="tata" />\r
- <property name="reached" value="tata" />\r
- </bean>\r
-\r
- <bean id="basic.001" parent="basic.flowTemplate">\r
- <constructor-arg>\r
- <map>\r
- <entry key="testData1" value-ref="basic.001.testData" />\r
- <entry key="testData2">\r
- <bean class="org.argeo.slc.core.test.BasicTestData" scope="prototype">\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="basic.001.testData" class="org.argeo.slc.core.test.BasicTestData"\r
- scope="prototype">\r
- <aop:scoped-proxy />\r
- <property name="expected" value="tata100" />\r
- <property name="reached" value="tata@{testedComponentId}" />\r
- </bean>\r
-\r
-</beans>
\ No newline at end of file
\r
<import resource="imports.xml" /> \r
\r
- <bean id="second" parent="slcTemplate.simpleFlow" scope="prototype">\r
- <constructor-arg>\r
+ <bean id="second" parent="slcTemplate.simpleFlow">\r
+ <property name="executionSpec">\r
<bean parent="slcTemplate.simpleSpec">\r
<property name="attributes">\r
<map>\r
</map>\r
</property>\r
</bean>\r
- </constructor-arg> \r
+ </property>\r
<property name="executables">\r
<list>\r
<ref local="echo1" />\r
</property>\r
</bean>\r
\r
+\r
<bean id="first" parent="slcTemplate.simpleFlow">\r
- <constructor-arg>\r
+ <property name="executionSpec">\r
<bean parent="slcTemplate.simpleSpec">\r
<property name="attributes">\r
<map>\r
</map>\r
</property>\r
</bean>\r
- </constructor-arg> \r
+ </property>\r
<property name="executables">\r
<list>\r
<ref local="second" />\r
- <ref local="echo1" />\r
- <bean parent="task.echo" scope="prototype">\r
- <property name="message"\r
- value="In flow first, emebedded - testKey=@{testKey}" />\r
- </bean>\r
</list>\r
</property>\r
</bean>\r
\r
- <bean id="echo1" parent="task.echo" scope="prototype">\r
- <property name="message"\r
- value="testKey=@{testKey}" />\r
- </bean>\r
-\r
- <bean id="basic.testData" class="org.argeo.slc.core.test.BasicTestData" scope="prototype">\r
+ <bean id="basic.testData" class="org.argeo.slc.core.test.BasicTestData" scope="execution">\r
+ <aop:scoped-proxy />\r
<property name="expected" value="first" />\r
<property name="reached" value="@{testKey}" />\r
</bean>\r
\r
<bean id="basic.testDef" class="org.argeo.slc.core.test.BasicTestDefinition">\r
+ <aop:scoped-proxy />\r
</bean> \r
\r
+\r
+ <bean id="echo1" parent="task.echo" scope="execution">\r
+ <property name="message"\r
+ value="testKey=@{testKey}" />\r
+ <aop:scoped-proxy />\r
+ </bean>\r
+ \r
<bean id="basicTestResult" class="org.argeo.slc.core.test.SimpleTestResult" />\r
\r
</beans>
\ No newline at end of file