package org.argeo.slc.lib.detached;
-import java.util.Map;
import java.util.Properties;
import java.util.UUID;
import org.argeo.slc.detached.DetachedAnswer;
import org.argeo.slc.detached.DetachedClient;
import org.argeo.slc.detached.DetachedRequest;
-import org.argeo.slc.execution.Executable;
-public class DetachedAdminTask implements Executable {
+public class DetachedAdminTask implements Runnable {
private final static Log log = LogFactory.getLog(DetachedAdminTask.class);
private String action;
private DetachedClient client;
private Properties properties;
- public void execute() {
+ public void run() {
// Prepare and send request
DetachedRequest request = new DetachedRequest(UUID.randomUUID()
.toString());
public void start(BundleContext bundleContext) throws Exception {
try {
info("SLC OSGi bootstrap starting...");
-// installUrls(bundleContext, getDevLocationsUrls());
+ // installUrls(bundleContext, getDevLocationsUrls());
installUrls(bundleContext, getLocationsUrls());
}
}
+ /** Key is location */
protected static Map<String, Bundle> getInstalledBundles(
BundleContext bundleContext) {
Map<String, Bundle> installedBundles = new HashMap<String, Bundle>();
for (Bundle bundle : bundleContext.getBundles()) {
- String key = bundle.getSymbolicName();
- if (key == null) {
- key = bundle.getLocation();
- }
- installedBundles.put(key, bundle);
+ installedBundles.put(bundle.getLocation(), bundle);
}
return installedBundles;
}
+ /** Key is symbolic name */
protected static Map<String, Bundle> getBundles(BundleContext bundleContext) {
Map<String, Bundle> installedBundles = new HashMap<String, Bundle>();
for (Bundle bundle : bundleContext.getBundles())
package org.argeo.slc.deploy;\r
\r
import org.argeo.slc.build.Distribution;\r
-import org.argeo.slc.execution.Executable;\r
\r
-public interface Deployment extends Executable{\r
+public interface Deployment extends Runnable{\r
public DeployedSystem getDeployedSystem();\r
\r
public void setTargetData(TargetData targetData);\r
public void setDeploymentData(DeploymentData deploymentData);\r
\r
public void setDistribution(Distribution distribution);\r
-\r
- public void execute();\r
-\r
}\r
+++ /dev/null
-package org.argeo.slc.execution;
-
-/** Any object which can perform processing */
-public interface Executable {
- /** Executes the actions specified by the object */
- public void execute();
-}
package org.argeo.slc.execution;
-public interface ExecutionFlow extends Executable {
+public interface ExecutionFlow extends Runnable {
public Object getParameter(String key);
public Boolean isSetAsParameter(String key);
package org.argeo.slc.test;\r
\r
-import org.argeo.slc.execution.Executable;\r
\r
/** A test run that can be executed */\r
-public interface ExecutableTestRun extends TestRun, Executable {\r
+public interface ExecutableTestRun extends TestRun, Runnable {\r
\r
}\r
log.trace("Overrides target data");\r
}\r
\r
- deployment.execute();\r
+ deployment.run();\r
}\r
\r
/**\r
}\r
\r
try {\r
- ((ExecutableTestRun) testRun).execute();\r
+ ((ExecutableTestRun) testRun).run();\r
} catch (RuntimeException e) {\r
if (result != null) {\r
SimpleResultPart errorPart = new SimpleResultPart(\r
.convertValues(executionFlowDescriptor));
ExecutionFlow flow = (ExecutionFlow) applicationContext.getBean(
executionFlowDescriptor.getName(), ExecutionFlow.class);
- flow.execute();
+ flow.run();
}
public void setApplicationContext(ApplicationContext applicationContext)
import org.argeo.slc.SlcException;
import org.argeo.slc.core.structure.tree.TreeSPath;
import org.argeo.slc.core.structure.tree.TreeSRegistry;
-import org.argeo.slc.execution.Executable;
import org.argeo.slc.execution.ExecutionFlow;
import org.argeo.slc.execution.ExecutionSpec;
import org.argeo.slc.execution.ExecutionSpecAttribute;
private final ExecutionSpec executionSpec;
private String name = null;
private Map<String, Object> parameters = new HashMap<String, Object>();
- private List<Executable> executables = new ArrayList<Executable>();
+ private List<Runnable> executables = new ArrayList<Runnable>();
private String path;
private StructureRegistry<TreeSPath> registry = new TreeSRegistry();
}
- public void execute() {
- for (Executable executable : executables) {
- executable.execute();
+ public void run() {
+ for (Runnable executable : executables) {
+ executable.run();
}
}
public void afterPropertiesSet() throws Exception {
if (path != null) {
- for (Executable executable : executables) {
+ for (Runnable executable : executables) {
if (executable instanceof StructureAware) {
((StructureAware<TreeSPath>) executable).notifyCurrentPath(
registry, new TreeSPath(path));
this.name = name;
}
- public void setExecutables(List<Executable> executables) {
+ public void setExecutables(List<Runnable> executables) {
this.executables = executables;
}
Object paramValue = parameters.get(parameterName);
if (specAttr instanceof ResourceSpecAttribute) {
// deal with resources
- Resource resource = resourceLoader.getResource(paramValue.toString());
- return ((ResourceSpecAttribute) specAttr).convertResource(resource);
+ Resource resource = resourceLoader.getResource(paramValue
+ .toString());
+ return ((ResourceSpecAttribute) specAttr)
+ .convertResource(resource);
} else {
return paramValue;
}
executionContext.leaveFlow(executionFlow);
}
- @Pointcut("execution(void org.argeo.slc.execution.ExecutionFlow.execute())")
+ @Pointcut("execution(void org.argeo.slc.execution.ExecutionFlow.run())")
public void flowExecution() {
}
package org.argeo.slc.core.execution.tasks;
-import org.argeo.slc.execution.Executable;
import org.argeo.slc.test.TestResult;
-public class CloseTestResultTask implements Executable {
+public class CloseTestResultTask implements Runnable {
private TestResult testResult;
- public void execute() {
+ public void run() {
testResult.close();
}
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.argeo.slc.execution.Executable;
-public class Echo implements Executable {
+public class Echo implements Runnable {
private final static Log defaultLog = LogFactory.getLog(Echo.class);
private Log log;
private String message;
- public void execute() {
+ public void run() {
log().info(message);
}
\r
import org.argeo.slc.SlcException;\r
import org.argeo.slc.core.test.context.SimpleContextAware;\r
-import org.argeo.slc.core.test.context.SimpleParentContextAware;\r
-import org.argeo.slc.execution.Executable;\r
import org.argeo.slc.test.context.ContextAware;\r
\r
-public class OverrideContextAware implements Executable {\r
+public class OverrideContextAware implements Runnable {\r
\r
private ContextAware source;\r
\r
}\r
\r
\r
- public void execute() {\r
+ public void run() {\r
// override values\r
if(source.getValues() != null)\r
for(String key : source.getValues().keySet()) {\r
import org.argeo.slc.SlcException;\r
import org.argeo.slc.deploy.DeployedSystem;\r
import org.argeo.slc.deploy.DeployedSystemManager;\r
-import org.argeo.slc.execution.Executable;\r
import org.argeo.slc.process.SlcExecution;\r
import org.argeo.slc.process.SlcExecutionRelated;\r
import org.argeo.slc.process.SlcExecutionStep;\r
import org.argeo.slc.structure.StructureRegistry;\r
\r
-public class SlcManagerTask implements Executable, SlcExecutionRelated {\r
+public class SlcManagerTask implements Runnable, SlcExecutionRelated {\r
private String uuid;\r
private String slcExecutionUuid;\r
private String slcExecutionStepUuid;\r
private String action;\r
private DeployedSystemManager<DeployedSystem> manager;\r
\r
- public final void execute() {\r
+ public final void run() {\r
uuid = UUID.randomUUID().toString();\r
executeActions(StructureRegistry.ALL);\r
}\r
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.argeo.slc.SlcException;
-import org.argeo.slc.execution.Executable;
-public class SystemCall implements Executable {
+public class SystemCall implements Runnable {
// TODO: specify environment variables
private final Log log = LogFactory.getLog(getClass());
private Map<String, List<String>> osCommands = new HashMap<String, List<String>>();
private Map<String, String> osCmds = new HashMap<String, String>();
- public void execute() {
+ public void run() {
try {
if (log.isTraceEnabled()) {
log.debug("os.name=" + System.getProperty("os.name"));
private TestResult testResult;\r
\r
/** Executes the underlying test definition. */\r
- public void execute() {\r
+ public void run() {\r
uuid = UUID.randomUUID().toString();\r
if (testResult != null)\r
testResult.notifyTestRun(this);\r
\r
private DeployEnvironment deployEnvironment;\r
\r
- public void execute() {\r
+ public void run() {\r
try {\r
deployEnvironment.unpackTo(distribution, targetData\r
.getTargetRootLocation(), null);\r
public class HttpdServerDeployment implements Deployment {
private HttpdServerTargetData targetData;
- public void execute() {
+ public void run() {
// TODO Auto-generated method stub
}
private DbUnitDeploymentData deploymentData;\r
private DbModel dbModel;\r
\r
- public void execute() {\r
+ public void run() {\r
try {\r
IDatabaseTester databaseTester = new DataSourceDatabaseTester(\r
mxDatabase.getDataSource());\r
protected void configureAndExecuteSlcFlow(String applicationContextSuffix, String beanName) {\r
ConfigurableApplicationContext applicationContext = createApplicationContext(applicationContextSuffix);\r
ExecutionFlow executionFlow = (ExecutionFlow) applicationContext.getBean(beanName);\r
- executionFlow.execute(); \r
+ executionFlow.run(); \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
+ ((ExecutionFlow) applicationContext.getBean("flow2")).run();\r
SimpleTestResult res = (SimpleTestResult) applicationContext\r
.getBean("myTestResult");\r
validateTestResult(res);\r
\r
public void testMultipleFlows() throws Exception {\r
ConfigurableApplicationContext applicationContext = createApplicationContext("multipleFlow.xml");\r
- ((ExecutionFlow) applicationContext.getBean("flow1")).execute();\r
+ ((ExecutionFlow) applicationContext.getBean("flow1")).run();\r
SimpleTestResult res = (SimpleTestResult) applicationContext\r
.getBean("myTestResult");\r
validateTestResult(res);\r
res.getParts().clear();\r
- ((ExecutionFlow) applicationContext.getBean("flow2")).execute();\r
+ ((ExecutionFlow) applicationContext.getBean("flow2")).run();\r
validateTestResult(res, TestStatus.FAILED);\r
applicationContext.close();\r
}\r
*/\r
public void testPlaceHolders() throws Exception {\r
ConfigurableApplicationContext applicationContext = createApplicationContext("placeHolders.cascading.xml");\r
- ((ExecutionFlow) applicationContext.getBean("flowA")).execute();\r
+ ((ExecutionFlow) applicationContext.getBean("flowA")).run();\r
validateTestResult((SimpleTestResult) applicationContext\r
.getBean("myTestResult"));\r
applicationContext.close();\r
executionParameters.put("p8", "e8");\r
executionContext.addVariables(executionParameters);\r
\r
- ((ExecutionFlow) applicationContext.getBean("flowA")).execute();\r
+ ((ExecutionFlow) applicationContext.getBean("flowA")).run();\r
validateTestResult((SimpleTestResult) applicationContext\r
.getBean("myTestResult"));\r
applicationContext.close();\r
executionParameters.put("p6", "e6");\r
executionContext.addVariables(executionParameters);\r
\r
- ((ExecutionFlow) applicationContext.getBean("flowA")).execute();\r
+ ((ExecutionFlow) applicationContext.getBean("flowA")).run();\r
validateTestResult((SimpleTestResult) applicationContext\r
.getBean("myTestResult"));\r
applicationContext.close();\r
ConfigurableApplicationContext applicationContext = createApplicationContext("listSetMap.xml");\r
ExecutionFlow executionFlow = (ExecutionFlow) applicationContext\r
.getBean("myFlow");\r
- executionFlow.execute();\r
+ executionFlow.run();\r
\r
validateTestResult((SimpleTestResult) applicationContext\r
.getBean("myTestResult"));\r
\r
public void testListSetMapMultipleFlows() throws Exception {\r
ConfigurableApplicationContext applicationContext = createApplicationContext("listSetMapMultipleFlow.xml");\r
- ((ExecutionFlow) applicationContext.getBean("flow1")).execute();\r
+ ((ExecutionFlow) applicationContext.getBean("flow1")).run();\r
SimpleTestResult res = (SimpleTestResult) applicationContext\r
.getBean("myTestResult");\r
validateTestResult(res);\r
res.getParts().clear();\r
- ((ExecutionFlow) applicationContext.getBean("flow2")).execute();\r
+ ((ExecutionFlow) applicationContext.getBean("flow2")).run();\r
validateTestResult(res, TestStatus.FAILED);\r
applicationContext.close();\r
}\r