You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sa...@apache.org on 2012/05/26 09:03:27 UTC
svn commit: r1342860 - in /incubator/airavata/trunk/modules/xbaya-gui/src:
main/java/org/apache/airavata/xbaya/interpretor/
test/java/org/apache/airavata/xbaya/interpreter/
Author: samindaw
Date: Sat May 26 07:03:26 2012
New Revision: 1342860
URL: http://svn.apache.org/viewvc?rev=1342860&view=rev
Log:
fixing the test run issue (wrapping the mode details -server/gui- in to the configuration since now the constructors for the xbaya are shared among server/gui invocation of workflow interpreter)
Modified:
incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreter.java
incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreterConfiguration.java
incubator/airavata/trunk/modules/xbaya-gui/src/test/java/org/apache/airavata/xbaya/interpreter/ComplexMathWorkflowTest.java
incubator/airavata/trunk/modules/xbaya-gui/src/test/java/org/apache/airavata/xbaya/interpreter/CrossProductWorkflowTest.java
incubator/airavata/trunk/modules/xbaya-gui/src/test/java/org/apache/airavata/xbaya/interpreter/ForEachWorkflowTest.java
incubator/airavata/trunk/modules/xbaya-gui/src/test/java/org/apache/airavata/xbaya/interpreter/SimpleMathWorkflowTest.java
incubator/airavata/trunk/modules/xbaya-gui/src/test/java/org/apache/airavata/xbaya/interpreter/WorkflowTest.java
Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreter.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreter.java?rev=1342860&r1=1342859&r2=1342860&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreter.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreter.java Sat May 26 07:03:26 2012
@@ -117,9 +117,9 @@ import xsul5.XmlConstants;
public class WorkflowInterpreter {
- private static final int GUI_MODE = 1;
-
- private static final int SERVER_MODE = 2;
+// private static final int WorkflowInterpreterConfiguration.GUI_MODE = 1;
+//
+// private static final int SERVER_MODE = 2;
// private static final int MAXIMUM_RETRY_TIME = 2;
@@ -147,7 +147,7 @@ public class WorkflowInterpreter {
// private XBayaConfiguration configuration;
- private int mode;
+// private int mode;
// private String password;
//
@@ -186,7 +186,7 @@ public class WorkflowInterpreter {
//// this.setTopic(topic);
//// this.config.getNotifier() = new NotificationSender(
//// this.getConfig().getConfiguration().getBrokerURL(), topic);
-// this.mode = SERVER_MODE;
+// this.config.getMode() = SERVER_MODE;
// this.interactor=interactor;
// }
@@ -210,7 +210,7 @@ public class WorkflowInterpreter {
// } else {
// throw new Error("Cannot Initialize workflow with offline false");
// }
-// this.mode = SERVER_MODE;
+// this.config.getMode() = SERVER_MODE;
// }
/**
@@ -239,7 +239,7 @@ public class WorkflowInterpreter {
// this.engine = engine;
this.setConfig(config);
this.isSubWorkflow = subWorkflow;
- this.mode = GUI_MODE;
+// this.config.getMode() = WorkflowInterpreterConfiguration.GUI_MODE;
config.validateNotifier();
// this.setTopic(topic);
this.actOnProvenance = actOnProvenance;
@@ -298,7 +298,7 @@ public class WorkflowInterpreter {
while (this.getWorkflow().getExecutionState() != WorkflowExecutionState.STOPPED) {
if (getRemainNodesDynamically() == 0) {
// notifyViaInteractor(WorkflowExecutionMessage.EXECUTION_STATE_CHANGED, WorkflowExecutionState.PAUSED);
- if (this.mode == GUI_MODE) {
+ if (this.config.getMode() == WorkflowInterpreterConfiguration.GUI_MODE) {
this.notifyPause();
} else {
this.getWorkflow().setExecutionState(
@@ -397,7 +397,7 @@ public class WorkflowInterpreter {
}
}
this.config.getNotifier().workflowTerminated();
- if (this.mode == GUI_MODE) {
+ if (this.config.getMode() == WorkflowInterpreterConfiguration.GUI_MODE) {
final WaitDialog waitDialog = new WaitDialog(new Cancelable() {
@Override
public void cancel() {
@@ -529,7 +529,7 @@ public class WorkflowInterpreter {
public void raiseException(Throwable e) {
// notifyViaInteractor(WorkflowExecutionMessage.EXECUTION_ERROR, e);
// throw new RuntimeException(e);
- if (this.mode == GUI_MODE) {
+ if (this.config.getMode() == WorkflowInterpreterConfiguration.GUI_MODE) {
this.config.getGUI().getErrorWindow().error(e);
} else {
throw new RuntimeException(e);
@@ -545,7 +545,7 @@ public class WorkflowInterpreter {
// throw new WorkflowRuntimeException("Cannot pause when not running");
// }
// notifyViaInteractor(WorkflowExecutionMessage.EXECUTION_STATE_CHANGED, WorkflowExecutionState.PAUSED);
- if (this.mode == GUI_MODE) {
+ if (this.config.getMode() == WorkflowInterpreterConfiguration.GUI_MODE) {
if (this.getWorkflow().getExecutionState() == WorkflowExecutionState.RUNNING
|| this.getWorkflow().getExecutionState() == WorkflowExecutionState.STEP) {
@@ -563,7 +563,7 @@ public class WorkflowInterpreter {
public void cleanup() throws MonitorException {
this.getWorkflow().setExecutionState(WorkflowExecutionState.STOPPED);
notifyViaInteractor(WorkflowExecutionMessage.EXECUTION_CLEANUP, null);
-// if (this.mode == GUI_MODE) {
+// if (this.config.getMode() == WorkflowInterpreterConfiguration.GUI_MODE) {
// this.engine.resetWorkflowInterpreter();
// try {
// this.engine.getMonitor().stop();
@@ -760,7 +760,7 @@ public class WorkflowInterpreter {
private void handleSubWorkComponent(Node node) throws WorkflowException {
// notifyViaInteractor(WorkflowExecutionMessage.OPEN_SUBWORKFLOW, node);
- if ((this.mode == GUI_MODE) && (node instanceof SubWorkflowNodeGUI)) {
+ if ((this.config.getMode() == WorkflowInterpreterConfiguration.GUI_MODE) && (node instanceof SubWorkflowNodeGUI)) {
((SubWorkflowNodeGUI) NodeController.getGUI(node)).openWorkflowTab(this.config.getGUI());
}
// setting the inputs
@@ -803,7 +803,7 @@ public class WorkflowInterpreter {
} catch (Exception e) {
throw new WorkflowException(e);
}
-// if (this.mode == GUI_MODE) {
+// if (this.config.getMode() == WorkflowInterpreterConfiguration.GUI_MODE) {
// new WorkflowInterpreter(getConfig(), this.topic, subWorkflow, true,
// false, new GUIWorkflowInterpreterInteractorImpl(engine, workflow)).scheduleDynamically();
// } else {
@@ -834,7 +834,7 @@ public class WorkflowInterpreter {
// throw new WorkflowException(e1);
// }
try {
- if (this.mode == GUI_MODE) {
+ if (this.config.getMode() == WorkflowInterpreterConfiguration.GUI_MODE) {
leadCtxHeader = XBayaUtil.buildLeadContextHeader(
this.getWorkflow(),
this.getConfig().getConfiguration(),
@@ -927,7 +927,7 @@ public class WorkflowInterpreter {
// this.engine.getMonitor().getConfiguration().getBrokerURL().toASCIIString(), this.config.getNotifier(), this.config.getTopic(),
// this.engine.getConfiguration().getJcrComponentRegistry().getRegistry(),
// portTypeQName.getLocalPart(),this.engine.getConfiguration()));
- if (this.mode == GUI_MODE) {
+ if (this.config.getMode() == WorkflowInterpreterConfiguration.GUI_MODE) {
// if user configure the msgBox url using the UI we have to
// pick the latest one which
// set by the UI
@@ -1409,7 +1409,7 @@ public class WorkflowInterpreter {
if (gfacURLString.startsWith("https")) {
LeadContextHeader leadCtxHeader = null;
try {
- if (this.mode == GUI_MODE) {
+ if (this.config.getMode() == WorkflowInterpreterConfiguration.GUI_MODE) {
leadCtxHeader = XBayaUtil.buildLeadContextHeader(
this.getWorkflow(),
this.getConfig().getConfiguration(),
@@ -1845,7 +1845,7 @@ public class WorkflowInterpreter {
}
- if (this.mode == GUI_MODE) {
+ if (this.config.getMode() == WorkflowInterpreterConfiguration.GUI_MODE) {
ArrayList<Node> waitingNodes = InterpreterUtil.getWaitingNodesDynamically(this.getGraph());
for (Node readyNode : waitingNodes) {
DifferedInputHandler.handleDifferredInputsofDependentNodes(
Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreterConfiguration.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreterConfiguration.java?rev=1342860&r1=1342859&r2=1342860&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreterConfiguration.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreterConfiguration.java Sat May 26 07:03:26 2012
@@ -33,6 +33,9 @@ import org.apache.airavata.xbaya.ui.XBay
import org.apache.airavata.xbaya.ui.utils.MyProxyChecker;
public class WorkflowInterpreterConfiguration {
+ public static final int GUI_MODE = 1;
+ public static final int SERVER_MODE = 2;
+
private URI messageBoxURL;
private URI messageBrokerURL;
private AiravataRegistry registry;
@@ -157,4 +160,8 @@ public class WorkflowInterpreterConfigur
this.topic = topic;
}
+ public int getMode() {
+ return getMonitor()==null? SERVER_MODE:GUI_MODE;
+ }
+
}
Modified: incubator/airavata/trunk/modules/xbaya-gui/src/test/java/org/apache/airavata/xbaya/interpreter/ComplexMathWorkflowTest.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/test/java/org/apache/airavata/xbaya/interpreter/ComplexMathWorkflowTest.java?rev=1342860&r1=1342859&r2=1342860&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/test/java/org/apache/airavata/xbaya/interpreter/ComplexMathWorkflowTest.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/test/java/org/apache/airavata/xbaya/interpreter/ComplexMathWorkflowTest.java Sat May 26 07:03:26 2012
@@ -21,6 +21,7 @@
package org.apache.airavata.xbaya.interpreter;
+import org.apache.airavata.registry.api.AiravataRegistry;
import org.apache.airavata.workflow.model.exceptions.WorkflowException;
import org.apache.airavata.workflow.model.wf.Workflow;
import org.apache.airavata.xbaya.XBayaConfiguration;
@@ -59,7 +60,8 @@ public class ComplexMathWorkflowTest {
URL systemResource = this.getClass().getClassLoader().getSystemResource("ComplexMath.xwf");
Workflow workflow = new Workflow(WorkflowTestUtils.readWorkflow(systemResource));
XBayaConfiguration conf = WorkflowTestUtils.getConfiguration();
- WorkflowInterpreterConfiguration workflowInterpreterConfiguration = new WorkflowInterpreterConfiguration(workflow,UUID.randomUUID().toString(),conf.getMessageBoxURL(), conf.getBrokerURL(), conf.getJcrComponentRegistry().getRegistry(), conf, null,null,null,true);
+ AiravataRegistry registry = conf.getJcrComponentRegistry()==null? null:conf.getJcrComponentRegistry().getRegistry();
+ WorkflowInterpreterConfiguration workflowInterpreterConfiguration = new WorkflowInterpreterConfiguration(workflow, UUID.randomUUID().toString(),conf.getMessageBoxURL(), conf.getBrokerURL(), registry, conf, null,null,null,true);
SSWorkflowInterpreterInteractorImpl ssWorkflowInterpreterInteractorImpl = new SSWorkflowInterpreterInteractorImpl(workflow);
WorkflowInterpreter interpretor = new WorkflowInterpreter(workflowInterpreterConfiguration,ssWorkflowInterpreterInteractorImpl);
interpretor.scheduleDynamically();
Modified: incubator/airavata/trunk/modules/xbaya-gui/src/test/java/org/apache/airavata/xbaya/interpreter/CrossProductWorkflowTest.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/test/java/org/apache/airavata/xbaya/interpreter/CrossProductWorkflowTest.java?rev=1342860&r1=1342859&r2=1342860&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/test/java/org/apache/airavata/xbaya/interpreter/CrossProductWorkflowTest.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/test/java/org/apache/airavata/xbaya/interpreter/CrossProductWorkflowTest.java Sat May 26 07:03:26 2012
@@ -21,6 +21,7 @@
package org.apache.airavata.xbaya.interpreter;
+import org.apache.airavata.registry.api.AiravataRegistry;
import org.apache.airavata.workflow.model.exceptions.WorkflowException;
import org.apache.airavata.workflow.model.wf.Workflow;
import org.apache.airavata.xbaya.XBayaConfiguration;
@@ -57,7 +58,8 @@ public class CrossProductWorkflowTest {
URL systemResource = this.getClass().getClassLoader().getSystemResource("ForeachCrossProductLevenshteinDistance.xwf");
Workflow workflow = new Workflow(WorkflowTestUtils.readWorkflow(systemResource));
XBayaConfiguration conf = WorkflowTestUtils.getConfiguration();
- WorkflowInterpreterConfiguration workflowInterpreterConfiguration = new WorkflowInterpreterConfiguration(workflow, UUID.randomUUID().toString(),conf.getMessageBoxURL(), conf.getBrokerURL(), conf.getJcrComponentRegistry().getRegistry(), conf, null,null,null,true);
+ AiravataRegistry registry = conf.getJcrComponentRegistry()==null? null:conf.getJcrComponentRegistry().getRegistry();
+ WorkflowInterpreterConfiguration workflowInterpreterConfiguration = new WorkflowInterpreterConfiguration(workflow, UUID.randomUUID().toString(),conf.getMessageBoxURL(), conf.getBrokerURL(), registry, conf, null,null,null,true);
WorkflowInterpreter interpretor = new WorkflowInterpreter(workflowInterpreterConfiguration,new SSWorkflowInterpreterInteractorImpl(workflow));
interpretor.scheduleDynamically();
Modified: incubator/airavata/trunk/modules/xbaya-gui/src/test/java/org/apache/airavata/xbaya/interpreter/ForEachWorkflowTest.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/test/java/org/apache/airavata/xbaya/interpreter/ForEachWorkflowTest.java?rev=1342860&r1=1342859&r2=1342860&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/test/java/org/apache/airavata/xbaya/interpreter/ForEachWorkflowTest.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/test/java/org/apache/airavata/xbaya/interpreter/ForEachWorkflowTest.java Sat May 26 07:03:26 2012
@@ -20,6 +20,7 @@
*/
package org.apache.airavata.xbaya.interpreter;
+import org.apache.airavata.registry.api.AiravataRegistry;
import org.apache.airavata.workflow.model.exceptions.WorkflowException;
import org.apache.airavata.workflow.model.graph.system.InputNode;
import org.apache.airavata.workflow.model.wf.Workflow;
@@ -58,7 +59,8 @@ public class ForEachWorkflowTest {
Workflow workflow = new Workflow(WorkflowTestUtils.readWorkflow(systemResource));
((InputNode) workflow.getGraph().getNode("input")).setDefaultValue("1");
XBayaConfiguration conf = WorkflowTestUtils.getConfiguration();
- WorkflowInterpreterConfiguration workflowInterpreterConfiguration = new WorkflowInterpreterConfiguration(workflow,UUID.randomUUID().toString(),conf.getMessageBoxURL(), conf.getBrokerURL(), conf.getJcrComponentRegistry().getRegistry(), conf, null,null,null,true);
+ AiravataRegistry registry = conf.getJcrComponentRegistry()==null? null:conf.getJcrComponentRegistry().getRegistry();
+ WorkflowInterpreterConfiguration workflowInterpreterConfiguration = new WorkflowInterpreterConfiguration(workflow, UUID.randomUUID().toString(),conf.getMessageBoxURL(), conf.getBrokerURL(), registry, conf, null,null,null,true);
SSWorkflowInterpreterInteractorImpl ssWorkflowInterpreterInteractorImpl = new SSWorkflowInterpreterInteractorImpl(workflow);
WorkflowInterpreter interpretor = new WorkflowInterpreter(workflowInterpreterConfiguration,ssWorkflowInterpreterInteractorImpl);
Modified: incubator/airavata/trunk/modules/xbaya-gui/src/test/java/org/apache/airavata/xbaya/interpreter/SimpleMathWorkflowTest.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/test/java/org/apache/airavata/xbaya/interpreter/SimpleMathWorkflowTest.java?rev=1342860&r1=1342859&r2=1342860&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/test/java/org/apache/airavata/xbaya/interpreter/SimpleMathWorkflowTest.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/test/java/org/apache/airavata/xbaya/interpreter/SimpleMathWorkflowTest.java Sat May 26 07:03:26 2012
@@ -21,6 +21,7 @@
package org.apache.airavata.xbaya.interpreter;
+import org.apache.airavata.registry.api.AiravataRegistry;
import org.apache.airavata.workflow.model.exceptions.WorkflowException;
import org.apache.airavata.workflow.model.wf.Workflow;
import org.apache.airavata.xbaya.XBayaConfiguration;
@@ -57,7 +58,8 @@ public class SimpleMathWorkflowTest {
URL systemResource = this.getClass().getClassLoader().getSystemResource("SimpleMath.xwf");
Workflow workflow = new Workflow(WorkflowTestUtils.readWorkflow(systemResource));
XBayaConfiguration conf = WorkflowTestUtils.getConfiguration();
- WorkflowInterpreterConfiguration workflowInterpreterConfiguration = new WorkflowInterpreterConfiguration(workflow, UUID.randomUUID().toString(),conf.getMessageBoxURL(), conf.getBrokerURL(), conf.getJcrComponentRegistry().getRegistry(), conf, null,null,null,true);
+ AiravataRegistry registry = conf.getJcrComponentRegistry()==null? null:conf.getJcrComponentRegistry().getRegistry();
+ WorkflowInterpreterConfiguration workflowInterpreterConfiguration = new WorkflowInterpreterConfiguration(workflow, UUID.randomUUID().toString(),conf.getMessageBoxURL(), conf.getBrokerURL(), registry, conf, null,null,null,true);
SSWorkflowInterpreterInteractorImpl ssWorkflowInterpreterInteractorImpl = new SSWorkflowInterpreterInteractorImpl(workflow);
WorkflowInterpreter interpretor = new WorkflowInterpreter(workflowInterpreterConfiguration,ssWorkflowInterpreterInteractorImpl);
Modified: incubator/airavata/trunk/modules/xbaya-gui/src/test/java/org/apache/airavata/xbaya/interpreter/WorkflowTest.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/test/java/org/apache/airavata/xbaya/interpreter/WorkflowTest.java?rev=1342860&r1=1342859&r2=1342860&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/test/java/org/apache/airavata/xbaya/interpreter/WorkflowTest.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/test/java/org/apache/airavata/xbaya/interpreter/WorkflowTest.java Sat May 26 07:03:26 2012
@@ -21,6 +21,7 @@
package org.apache.airavata.xbaya.interpreter;
+import org.apache.airavata.registry.api.AiravataRegistry;
import org.apache.airavata.workflow.model.exceptions.WorkflowException;
import org.apache.airavata.workflow.model.graph.system.InputNode;
import org.apache.airavata.workflow.model.wf.Workflow;
@@ -59,7 +60,8 @@ public class WorkflowTest{
Workflow workflow = new Workflow(WorkflowTestUtils.readWorkflow(systemResource));
((InputNode) workflow.getGraph().getNode("input")).setDefaultValue("1");
XBayaConfiguration conf = WorkflowTestUtils.getConfiguration();
- WorkflowInterpreterConfiguration workflowInterpreterConfiguration = new WorkflowInterpreterConfiguration(workflow, UUID.randomUUID().toString(),conf.getMessageBoxURL(), conf.getBrokerURL(), conf.getJcrComponentRegistry().getRegistry(), conf, null,null,null,true);
+ AiravataRegistry registry = conf.getJcrComponentRegistry()==null? null:conf.getJcrComponentRegistry().getRegistry();
+ WorkflowInterpreterConfiguration workflowInterpreterConfiguration = new WorkflowInterpreterConfiguration(workflow, UUID.randomUUID().toString(),conf.getMessageBoxURL(), conf.getBrokerURL(), registry, conf, null,null,null,true);
SSWorkflowInterpreterInteractorImpl ssWorkflowInterpreterInteractorImpl = new SSWorkflowInterpreterInteractorImpl(workflow);
WorkflowInterpreter interpretor = new WorkflowInterpreter(workflowInterpreterConfiguration, ssWorkflowInterpreterInteractorImpl);