You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oodt.apache.org by bf...@apache.org on 2011/11/12 10:52:58 UTC
svn commit: r1201233 [2/3] - in /oodt/trunk/workflow: ./ src/main/assembly/
src/main/bin/ src/main/java/org/apache/oodt/cas/workflow/cli/
src/main/java/org/apache/oodt/cas/workflow/cli/action/
src/main/java/org/apache/oodt/cas/workflow/system/ src/main...
Modified: oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/system/XmlRpcWorkflowManagerClient.java
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/system/XmlRpcWorkflowManagerClient.java?rev=1201233&r1=1201232&r2=1201233&view=diff
==============================================================================
--- oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/system/XmlRpcWorkflowManagerClient.java (original)
+++ oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/system/XmlRpcWorkflowManagerClient.java Sat Nov 12 09:52:57 2011
@@ -24,7 +24,6 @@ import org.apache.xmlrpc.XmlRpcException
//JDK imports
import java.net.URL;
-import java.net.MalformedURLException;
import java.util.Hashtable;
import java.util.Vector;
import java.util.List;
@@ -33,14 +32,13 @@ import java.util.logging.Logger;
import java.io.IOException;
//OODT imports
-import org.apache.oodt.cas.workflow.structs.exceptions.RepositoryException;
-import org.apache.oodt.cas.workflow.structs.exceptions.EngineException;
import org.apache.oodt.cas.workflow.structs.WorkflowInstancePage;
import org.apache.oodt.cas.workflow.structs.WorkflowTask;
import org.apache.oodt.cas.workflow.structs.WorkflowCondition;
import org.apache.oodt.cas.workflow.structs.WorkflowInstance;
import org.apache.oodt.cas.workflow.structs.Workflow;
import org.apache.oodt.cas.workflow.util.XmlRpcStructFactory;
+import org.apache.oodt.cas.cli.CmdLineUtility;
import org.apache.oodt.cas.metadata.Metadata;
/**
@@ -675,827 +673,9 @@ public class XmlRpcWorkflowManagerClient
}
}
- public static void main(String[] args) throws MalformedURLException,
- EngineException, RepositoryException {
-
- String sendEventOperation = "--sendEvent --eventName <name> [--metaData --key <key1> <val1> <val2>...<valn>...--keyn <keyn> <val1> <val2>...<valn>]\n";
- String dynWorkflowOperation = "--dynWorkflow --taskIds <task id1> <task id2>...<task idn> [--metaData --key <key1> <val1> <val2>...<valn>...--keyn <keyn> <val1> <val2>...<valn>]\n";
- String getWorkflowInstOperation = "--getWorkflowInsts\n";
- String getWorkflowsOperation = "--getWorkflows\n";
- String getTaskByIdOperation = "--getTaskById --id <taskId>\n";
- String getConditionByIdOperation = "--getConditionById --id <conditionId>\n";
- String getWorkflowByIdOperation = "--getWorkflowById --id <workflowId>\n";
- String getWorkflowsByEventOperation = "--getWorkflowsByEvent --eventName <name>\n";
- String getRegisteredEventsOperation = "--getRegisteredEvents\n";
- String getWorkflowInstByIdOperation = "--getWorkflowInst --id <workflowInstId>\n";
- String getWorkflowWallClockTimeOperation = "--getWallClockTime --id <workflowInstId>\n";
- String getWorkflowTaskWallClockTimeOperation = "--getTaskWallClockTime --id <workflowInstId>\n";
- String stopWorkflowInstanceOperation = "--stopWorkflowInst --id <workflowInstId>\n";
- String pauseWorkflowInstanceOperation = "--pauseWorkflowInst --id <workflowInstId>\n";
- String resumeWorkflowInstanceOperation = "--resumeWorkflowInst --id <workflowInstId>\n";
- String getFirstPageOperation = "--getFirstPage [--status <status>]\n";
- String getNextPageOperation = "--getNextPage --pageNum <num> [--status <status>]\n";
- String getPrevPageOperation = "--getPrevPage --pageNum <num> [--status <status>]\n";
- String getLastPageOperation = "--getLastPage [--status <status>]\n";
- String getWorkflowInstMetOperation = "--getWorkflowInstMet --id <workflowInstId>\n";
-
- String usage = "wmgr-client --url <url to xml rpc service> --operation [<operation> [params]]\n"
- + "operations:\n"
- + sendEventOperation
- + dynWorkflowOperation
- + getWorkflowInstOperation
- + getWorkflowsOperation
- + getTaskByIdOperation
- + getConditionByIdOperation
- + getWorkflowByIdOperation
- + getWorkflowsByEventOperation
- + getRegisteredEventsOperation
- + getWorkflowInstByIdOperation
- + getWorkflowWallClockTimeOperation
- + getWorkflowTaskWallClockTimeOperation
- + stopWorkflowInstanceOperation
- + pauseWorkflowInstanceOperation
- + resumeWorkflowInstanceOperation
- + getFirstPageOperation
- + getNextPageOperation
- + getPrevPageOperation
- + getLastPageOperation
- + getWorkflowInstMetOperation;
-
- String operation = null, url = null;
-
- for (int i = 0; i < args.length; i++) {
- if (args[i].equals("--operation")) {
- operation = args[++i];
- } else if (args[i].equals("--url")) {
- url = args[++i];
- }
- }
-
- if (operation == null) {
- System.err.println(usage);
- System.exit(1);
- }
-
- if (operation.equals("--sendEvent")) {
- // get the event name, and the metadata
- String eventName = null;
- Metadata metadata = new Metadata();
-
- for (int i = 4; i < args.length; i++) {
- if (args[i].equals("--eventName")) {
- eventName = args[++i];
- } else if (args[i].equals("--metaData")) {
- for (int j = i + 1; j < args.length; j++) {
-
- if (args[j].equals("--key")) {
- String key = args[++j];
- List values = new Vector();
-
- boolean endOfList = true;
- for (j++; j < args.length; j++) {
- if (!args[j].equals("--key")) {
- values.add(args[j]);
- } else {
- endOfList = false;
- break;
- }
- }
-
- if (!endOfList) {
- j--;
- }
-
- System.out.println("Picked up metadata: [key="
- + key + ", values=" + values + "]");
- metadata.addMetadata(key, values);
-
- }
- }
- break;
- }
- }
-
- if (eventName == null) {
- System.err.println(sendEventOperation);
- System.exit(1);
- }
-
- // create the client
- XmlRpcWorkflowManagerClient client = new XmlRpcWorkflowManagerClient(
- new URL(url));
-
- try {
- client.sendEvent(eventName, metadata);
- } catch (Exception e) {
- e.printStackTrace();
- throw new RuntimeException(e);
- }
-
- }
-
- else if(operation.equals("--dynWorkflow")){
- Metadata metadata = new Metadata();
- List<String> taskIds = new Vector<String>();
-
- for (int i = 4; i < args.length; i++) {
- if (args[i].equals("--taskIds")) {
- int j = -1;
- for(j = i+1; j < args.length; j++){
-
- if(!args[j].equals("--metaData")){
- System.out.println("Picked up task id: ["+args[j]+"]");
- taskIds.add(args[j]);
- }
- else{
- break;
- }
- }
-
- i = j-1;
- } else if (args[i].equals("--metaData")) {
- for (int j = i + 1; j < args.length; j++) {
-
- if (args[j].equals("--key")) {
- String key = args[++j];
- List values = new Vector();
-
- boolean endOfList = true;
- for (j++; j < args.length; j++) {
- if (!args[j].equals("--key")) {
- values.add(args[j]);
- } else {
- endOfList = false;
- break;
- }
- }
-
- if (!endOfList) {
- j--;
- }
-
- System.out.println("Picked up metadata: [key="
- + key + ", values=" + values + "]");
- metadata.addMetadata(key, values);
-
- }
- }
- break;
- }
- }
-
- // create the client
- XmlRpcWorkflowManagerClient client = new XmlRpcWorkflowManagerClient(
- new URL(url));
-
- try {
- System.out.println(client.executeDynamicWorkflow(taskIds, metadata));
- } catch (Exception e) {
- e.printStackTrace();
- throw new RuntimeException(e);
- }
-
- }
- else if (operation.equals("--getWorkflowInsts")) {
- XmlRpcWorkflowManagerClient client = new XmlRpcWorkflowManagerClient(
- new URL(url));
-
- List insts = null;
-
- try {
- insts = client.getWorkflowInstances();
-
- if (insts != null) {
- for (Iterator i = insts.iterator(); i.hasNext();) {
- WorkflowInstance inst = (WorkflowInstance) i.next();
- System.out
- .println("Instance: [id="
- + inst.getId()
- + ", status="
- + inst.getStatus()
- + ", currentTask="
- + inst.getCurrentTaskId()
- + ", workflow="
- + inst.getWorkflow().getName()
- + ",wallClockTime="
- + client
- .getWorkflowWallClockMinutes(inst
- .getId())
- + ",currentTaskWallClockTime="
- + client
- .getWorkflowCurrentTaskWallClockMinutes(inst
- .getId()) + "]");
- }
- }
- } catch (Exception e) {
- e.printStackTrace();
- throw new RuntimeException(e);
- }
- } else if (operation.equals("--stopWorkflowInst")) {
- XmlRpcWorkflowManagerClient client = new XmlRpcWorkflowManagerClient(
- new URL(url));
-
- String workflowInstId = null;
-
- for (int i = 4; i < args.length; i++) {
- if (args[i].equals("--id")) {
- workflowInstId = args[++i];
- }
- }
-
- try {
- boolean stopped = client.stopWorkflowInstance(workflowInstId);
- if (stopped) {
- System.out.println("Successfully stopped workflow: ["
- + workflowInstId + "]");
- }
- } catch (Exception e) {
- throw new RuntimeException(e.getMessage());
- }
-
- } else if (operation.equals("--pauseWorkflowInst")) {
- XmlRpcWorkflowManagerClient client = new XmlRpcWorkflowManagerClient(
- new URL(url));
-
- String workflowInstId = null;
-
- for (int i = 4; i < args.length; i++) {
- if (args[i].equals("--id")) {
- workflowInstId = args[++i];
- }
- }
-
- try {
- boolean paused = client.pauseWorkflowInstance(workflowInstId);
- if (paused) {
- System.out.println("Successfully paused workflow: ["
- + workflowInstId + "]");
- }
- } catch (Exception e) {
- throw new RuntimeException(e.getMessage());
- }
-
- } else if (operation.equals("--resumeWorkflowInst")) {
- XmlRpcWorkflowManagerClient client = new XmlRpcWorkflowManagerClient(
- new URL(url));
-
- String workflowInstId = null;
-
- for (int i = 4; i < args.length; i++) {
- if (args[i].equals("--id")) {
- workflowInstId = args[++i];
- }
- }
-
- try {
- boolean resumed = client.resumeWorkflowInstance(workflowInstId);
- if (resumed) {
- System.out.println("Successfully resumed workflow: ["
- + workflowInstId + "]");
- }
- } catch (Exception e) {
- throw new RuntimeException(e.getMessage());
- }
-
- }
-
- else if (operation.equals("--getTaskWallClockTime")) {
- XmlRpcWorkflowManagerClient client = new XmlRpcWorkflowManagerClient(
- new URL(url));
-
- String workflowInstId = null;
-
- for (int i = 4; i < args.length; i++) {
- if (args[i].equals("--id")) {
- workflowInstId = args[++i];
- }
- }
-
- try {
- double wallClockTime = client
- .getWorkflowCurrentTaskWallClockMinutes(workflowInstId);
- System.out.println(wallClockTime + " minutes");
- } catch (Exception e) {
- throw new RuntimeException(e.getMessage());
- }
-
- } else if (operation.equals("--getWallClockTime")) {
- XmlRpcWorkflowManagerClient client = new XmlRpcWorkflowManagerClient(
- new URL(url));
-
- String workflowInstId = null;
-
- for (int i = 4; i < args.length; i++) {
- if (args[i].equals("--id")) {
- workflowInstId = args[++i];
- }
- }
-
- try {
- double wallClockTime = client
- .getWorkflowWallClockMinutes(workflowInstId);
- System.out.println(wallClockTime + " minutes");
- } catch (Exception e) {
- throw new RuntimeException(e.getMessage());
- }
-
- }
-
- else if (operation.equals("--getFirstPage")) {
- XmlRpcWorkflowManagerClient client = new XmlRpcWorkflowManagerClient(
- new URL(url));
-
- WorkflowInstancePage page = null;
- String status = null;
-
- for (int i = 4; i < args.length; i++) {
- if (args[i].equals("--status")) {
- status = args[++i];
- }
- }
-
- try {
- if (status != null && !status.equals("")) {
- page = client.paginateWorkflowInstances(1, status);
- } else {
- page = client.getFirstPage();
- }
-
- System.out.println("Page: [num=" + page.getPageNum() + ","
- + "pageSize=" + page.getPageSize() + ",totalPages="
- + page.getTotalPages() + "]");
- if (page.getPageWorkflows() != null
- && page.getPageWorkflows().size() > 0) {
- for (Iterator i = page.getPageWorkflows().iterator(); i
- .hasNext();) {
- WorkflowInstance inst = (WorkflowInstance) i.next();
- System.out
- .println("Instance: [id="
- + inst.getId()
- + ", status="
- + inst.getStatus()
- + ", currentTask="
- + inst.getCurrentTaskId()
- + ", workflow="
- + inst.getWorkflow().getName()
- + ",wallClockTime="
- + client
- .getWorkflowWallClockMinutes(inst
- .getId())
- + ",currentTaskWallClockTime="
- + client
- .getWorkflowCurrentTaskWallClockMinutes(inst
- .getId()) + "]");
- }
- }
-
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
-
- } else if (operation.equals("--getLastPage")) {
- XmlRpcWorkflowManagerClient client = new XmlRpcWorkflowManagerClient(
- new URL(url));
-
- WorkflowInstancePage page = null;
- String status = null;
-
- for (int i = 4; i < args.length; i++) {
- if (args[i].equals("--status")) {
- status = args[++i];
- }
- }
-
- try {
- if (status != null && !status.equals("")) {
- WorkflowInstancePage firstPage = client
- .paginateWorkflowInstances(1, status);
- page = client.paginateWorkflowInstances(firstPage
- .getTotalPages(), status);
- } else {
- page = client.getLastPage();
- }
-
- System.out.println("Page: [num=" + page.getPageNum() + ","
- + "pageSize=" + page.getPageSize() + ",totalPages="
- + page.getTotalPages() + "]");
- if (page.getPageWorkflows() != null
- && page.getPageWorkflows().size() > 0) {
- for (Iterator i = page.getPageWorkflows().iterator(); i
- .hasNext();) {
- WorkflowInstance inst = (WorkflowInstance) i.next();
- System.out
- .println("Instance: [id="
- + inst.getId()
- + ", status="
- + inst.getStatus()
- + ", currentTask="
- + inst.getCurrentTaskId()
- + ", workflow="
- + inst.getWorkflow().getName()
- + ",wallClockTime="
- + client
- .getWorkflowWallClockMinutes(inst
- .getId())
- + ",currentTaskWallClockTime="
- + client
- .getWorkflowCurrentTaskWallClockMinutes(inst
- .getId()) + "]");
- }
- }
-
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
-
- } else if (operation.equals("--getNextPage")) {
- XmlRpcWorkflowManagerClient client = new XmlRpcWorkflowManagerClient(
- new URL(url));
-
- WorkflowInstancePage page = null;
- String status = null;
- int pageNum = -1;
-
- for (int i = 4; i < args.length; i++) {
- if (args[i].equals("--status")) {
- status = args[++i];
- } else if (args[i].equals("--pageNum")) {
- pageNum = Integer.parseInt(args[++i]);
- }
- }
-
- if (pageNum == -1) {
- System.err.println(getNextPageOperation);
- System.exit(1);
- }
-
- try {
- if (status != null && !status.equals("")) {
- page = client
- .paginateWorkflowInstances(pageNum + 1, status);
- } else {
- page = client.paginateWorkflowInstances(pageNum + 1);
- }
-
- System.out.println("Page: [num=" + page.getPageNum() + ","
- + "pageSize=" + page.getPageSize() + ",totalPages="
- + page.getTotalPages() + "]");
- if (page.getPageWorkflows() != null
- && page.getPageWorkflows().size() > 0) {
- for (Iterator i = page.getPageWorkflows().iterator(); i
- .hasNext();) {
- WorkflowInstance inst = (WorkflowInstance) i.next();
- System.out
- .println("Instance: [id="
- + inst.getId()
- + ", status="
- + inst.getStatus()
- + ", currentTask="
- + inst.getCurrentTaskId()
- + ", workflow="
- + inst.getWorkflow().getName()
- + ",wallClockTime="
- + client
- .getWorkflowWallClockMinutes(inst
- .getId())
- + ",currentTaskWallClockTime="
- + client
- .getWorkflowCurrentTaskWallClockMinutes(inst
- .getId()) + "]");
- }
- }
-
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- } else if (operation.equals("--getPrevPage")) {
- XmlRpcWorkflowManagerClient client = new XmlRpcWorkflowManagerClient(
- new URL(url));
-
- WorkflowInstancePage page = null;
- String status = null;
- int pageNum = -1;
-
- for (int i = 4; i < args.length; i++) {
- if (args[i].equals("--status")) {
- status = args[++i];
- } else if (args[i].equals("--pageNum")) {
- pageNum = Integer.parseInt(args[++i]);
- }
- }
-
- if (pageNum == -1) {
- System.err.println(getPrevPageOperation);
- System.exit(1);
- }
-
- try {
- if (status != null && !status.equals("")) {
- page = client
- .paginateWorkflowInstances(pageNum - 1, status);
- } else {
- page = client.paginateWorkflowInstances(pageNum - 1);
- }
-
- System.out.println("Page: [num=" + page.getPageNum() + ","
- + "pageSize=" + page.getPageSize() + ",totalPages="
- + page.getTotalPages() + "]");
- if (page.getPageWorkflows() != null
- && page.getPageWorkflows().size() > 0) {
- for (Iterator i = page.getPageWorkflows().iterator(); i
- .hasNext();) {
- WorkflowInstance inst = (WorkflowInstance) i.next();
- System.out
- .println("Instance: [id="
- + inst.getId()
- + ", status="
- + inst.getStatus()
- + ", currentTask="
- + inst.getCurrentTaskId()
- + ", workflow="
- + inst.getWorkflow().getName()
- + ",wallClockTime="
- + client
- .getWorkflowWallClockMinutes(inst
- .getId())
- + ",currentTaskWallClockTime="
- + client
- .getWorkflowCurrentTaskWallClockMinutes(inst
- .getId()) + "]");
- }
- }
-
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- else if (operation.equals("--getWorkflowInst")) {
- XmlRpcWorkflowManagerClient client = new XmlRpcWorkflowManagerClient(
- new URL(url));
-
- WorkflowInstance inst = null;
-
- String wInstId = null;
-
- for (int i = 4; i < args.length; i++) {
- if (args[i].equals("--id")) {
- wInstId = args[++i];
- }
- }
-
- try {
- inst = client.getWorkflowInstanceById(wInstId);
- if (inst != null) {
- System.out
- .println("Instance: [id="
- + inst.getId()
- + ", status="
- + inst.getStatus()
- + ", currentTask="
- + inst.getCurrentTaskId()
- + ", workflow="
- + inst.getWorkflow().getName()
- + ",wallClockTime="
- + client.getWorkflowWallClockMinutes(inst
- .getId())
- + ",currentTaskWallClockTime="
- + client
- .getWorkflowCurrentTaskWallClockMinutes(inst
- .getId()) + "]");
- }
- } catch (Exception e) {
- e.printStackTrace();
- throw new RuntimeException(e.getMessage());
- }
- } else if (operation.equals("--getWorkflows")) {
- XmlRpcWorkflowManagerClient client = new XmlRpcWorkflowManagerClient(
- new URL(url));
-
- List workflows = null;
-
- try {
- workflows = client.getWorkflows();
-
- if (workflows != null) {
- for (Iterator i = workflows.iterator(); i.hasNext();) {
- Workflow w = (Workflow) i.next();
- System.out.println("Workflow: [id=" + w.getId()
- + ", name=" + w.getName() + ", numTasks="
- + w.getTasks().size() + "]");
- }
- }
- } catch (Exception e) {
- e.printStackTrace();
- throw new RuntimeException(e);
- }
- } else if (operation.equals("--getTaskById")) {
- String taskId = null;
-
- for (int i = 4; i < args.length; i++) {
- if (args[i].equals("--id")) {
- taskId = args[++i];
- }
- }
-
- if (taskId == null) {
- System.err.println(getTaskByIdOperation);
- System.exit(1);
- }
-
- // create the client
- XmlRpcWorkflowManagerClient client = new XmlRpcWorkflowManagerClient(
- new URL(url));
-
- WorkflowTask task = null;
-
- try {
- task = client.getTaskById(taskId);
- System.out.println("Task: [id=" + task.getTaskId() + ", name="
- + task.getTaskName() + ", order=" + task.getOrder()
- + ", class=" + task.getClass().getName()
- + ", numConditions=" + task.getConditions().size()
- + ", configuration="
- + task.getTaskConfig().getProperties() + "]");
- } catch (Exception e) {
- e.printStackTrace();
- throw new RuntimeException(e);
- }
-
- } else if (operation.equals("--getConditionById")) {
- String conditionId = null;
-
- for (int i = 4; i < args.length; i++) {
- if (args[i].equals("--id")) {
- conditionId = args[++i];
- }
- }
-
- if (conditionId == null) {
- System.err.println(getConditionByIdOperation);
- System.exit(1);
- }
-
- // create the client
- XmlRpcWorkflowManagerClient client = new XmlRpcWorkflowManagerClient(
- new URL(url));
-
- WorkflowCondition condition = null;
-
- try {
- condition = client.getConditionById(conditionId);
- System.out.println("Condition: [id="
- + condition.getConditionId() + ", name="
- + condition.getConditionName() + ", order="
- + condition.getOrder() + ", class="
- + condition.getClass().getName() + "]");
- } catch (Exception e) {
- e.printStackTrace();
- throw new RuntimeException(e);
- }
- } else if (operation.equals("--getWorkflowById")) {
- String workflowId = null;
-
- for (int i = 4; i < args.length; i++) {
- if (args[i].equals("--id")) {
- workflowId = args[++i];
- }
- }
-
- if (workflowId == null) {
- System.err.println(getWorkflowByIdOperation);
- System.exit(1);
- }
-
- // create the client
- XmlRpcWorkflowManagerClient client = new XmlRpcWorkflowManagerClient(
- new URL(url));
-
- Workflow workflow = null;
-
- try {
- workflow = client.getWorkflowById(workflowId);
- System.out.println("Workflow: [id=" + workflow.getId()
- + ", name=" + workflow.getName() + ", numTasks="
- + workflow.getTasks().size() + "]");
- } catch (Exception e) {
- e.printStackTrace();
- throw new RuntimeException(e);
- }
- } else if (operation.equals("--getRegisteredEvents")) {
- XmlRpcWorkflowManagerClient client = new XmlRpcWorkflowManagerClient(
- new URL(url));
-
- List events = null;
-
- try {
- events = client.getRegisteredEvents();
-
- if (events != null) {
- for (Iterator i = events.iterator(); i.hasNext();) {
- String event = (String) i.next();
- System.out.println("Event: [name=" + event + "]");
- }
- }
- } catch (Exception e) {
- e.printStackTrace();
- throw new RuntimeException(e);
- }
- } else if (operation.equals("--getWorkflowsByEvent")) {
- XmlRpcWorkflowManagerClient client = new XmlRpcWorkflowManagerClient(
- new URL(url));
-
- List workflows = null;
-
- String eventName = null;
-
- for (int i = 4; i < args.length; i++) {
- if (args[i].equals("--eventName")) {
- eventName = args[++i];
- }
- }
-
- if (eventName == null) {
- System.err.println(getWorkflowsByEventOperation);
- System.exit(1);
- }
-
- try {
- workflows = client.getWorkflowsByEvent(eventName);
-
- if (workflows != null) {
- for (Iterator i = workflows.iterator(); i.hasNext();) {
- Workflow w = (Workflow) i.next();
- System.out.println("Workflow: [id=" + w.getId()
- + ", name=" + w.getName() + ", numTasks="
- + w.getTasks().size() + "]");
- }
- }
- } catch (Exception e) {
- e.printStackTrace();
- throw new RuntimeException(e);
- }
-
- } else if (operation.equals("--getWorkflowInstMet")){
-
- String wInstId = null;
- List keys = null;
- List values = null;
-
- for (int i = 4; i < args.length; i++) {
- if (args[i].equals("--id")) {
- wInstId = args[++i];
- }
- }
-
- if (wInstId == null) {
- System.err.println(getWorkflowInstMetOperation);
- System.exit(1);
- }
- //create client
- XmlRpcWorkflowManagerClient client = new XmlRpcWorkflowManagerClient(
- new URL(url));
- Metadata met = null;
- //get workflowInstanceMetadata
- try {
-
- met = client.getWorkflowInstanceMetadata(wInstId);
- System.out.println("[id=" + wInstId + ", met={");
-
- //get all keys for the wInstId
- keys = met.getKeys();
- if(keys != null){
- for (Iterator i = keys.iterator(); i.hasNext();) {
- String key = (String) i.next();
- System.out.print(key + ":[");
-
- //get all values for the key
- values = met.getAllMetadata(key);
- if(values != null){
- for(Iterator j = values.iterator(); j.hasNext();){
- String value = (String) j.next();
- System.out.print(value);
- if (j.hasNext())
- System.out.print(", ");
- }
- }
- System.out.print("]");
- if(i.hasNext())
- System.out.print(", ");
- }
- System.out.print("}]");
- }
-
-
- } catch (Exception e) {
- e.printStackTrace();
- throw new RuntimeException(e);
- }
-
-
- } else throw new IllegalArgumentException("Unknown operation: "
- + operation);
-
+ public static void main(String[] args) {
+ CmdLineUtility cmdLineUtility = new CmdLineUtility();
+ cmdLineUtility.run(args);
}
/**
Added: oodt/trunk/workflow/src/main/resources/cmd-line-actions.xml
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/main/resources/cmd-line-actions.xml?rev=1201233&view=auto
==============================================================================
--- oodt/trunk/workflow/src/main/resources/cmd-line-actions.xml (added)
+++ oodt/trunk/workflow/src/main/resources/cmd-line-actions.xml Sat Nov 12 09:52:57 2011
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ Author: bfoster (Brian Foster)
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
+
+ <bean id="SendEvent" class="org.apache.oodt.cas.workflow.cli.action.SendEventCliAction">
+ <property name="description" value="Triggers an event" />
+ </bean>
+ <bean id="DynWorkflow" class="org.apache.oodt.cas.workflow.cli.action.DynWorkflowCliAction">
+ <property name="description" value="Creates a workflow using the given tasks and then executes it" />
+ </bean>
+ <bean id="GetWorkflowInsts" class="org.apache.oodt.cas.workflow.cli.action.GetWorkflowInstsCliAction">
+ <property name="description" value="List all workflow instances" />
+ </bean>
+ <bean id="GetWorkflows" class="org.apache.oodt.cas.workflow.cli.action.GetWorkflowsCliAction">
+ <property name="description" value="List all workflow models" />
+ </bean>
+ <bean id="GetTaskById" class="org.apache.oodt.cas.workflow.cli.action.GetTaskByIdCliAction">
+ <property name="description" value="Gets task information for task with given ID" />
+ </bean>
+ <bean id="GetConditionById" class="org.apache.oodt.cas.workflow.cli.action.GetConditionByIdCliAction">
+ <property name="description" value="Gets condition information for condition with given ID" />
+ </bean>
+ <bean id="GetWorkflowById" class="org.apache.oodt.cas.workflow.cli.action.GetWorkflowByIdCliAction">
+ <property name="description" value="Gets workflow information for workflow with given ID" />
+ </bean>
+ <bean id="GetWorkflowsByEvent" class="org.apache.oodt.cas.workflow.cli.action.GetWorkflowsByEventCliAction">
+ <property name="description" value="List workflow information for workflows with attached to event" />
+ </bean>
+ <bean id="GetRegisteredEvents" class="org.apache.oodt.cas.workflow.cli.action.GetRegisteredEventsCliAction">
+ <property name="description" value="List registered events" />
+ </bean>
+ <bean id="GetWorkflowInst" class="org.apache.oodt.cas.workflow.cli.action.GetWorkflowInstCliAction">
+ <property name="description" value="Gets workflow instance by instance ID" />
+ </bean>
+ <bean id="GetWallClockTime" class="org.apache.oodt.cas.workflow.cli.action.GetWallClockTimeCliAction">
+ <property name="description" value="Gets wall clock time for workflow instance" />
+ </bean>
+ <bean id="GetTaskWallClockTime" class="org.apache.oodt.cas.workflow.cli.action.GetTaskWallClockTimeCliAction">
+ <property name="description" value="Gets wall clock time for workflow instance's current task" />
+ </bean>
+ <bean id="StopWorkflowInst" class="org.apache.oodt.cas.workflow.cli.action.StopWorkflowInstCliAction">
+ <property name="description" value="Stops a workflow instance" />
+ </bean>
+ <bean id="PauseWorkflowInst" class="org.apache.oodt.cas.workflow.cli.action.PauseWorkflowInstCliAction">
+ <property name="description" value="Pauses a workflow instance" />
+ </bean>
+ <bean id="ResumeWorkflowInst" class="org.apache.oodt.cas.workflow.cli.action.ResumeWorkflowInstCliAction">
+ <property name="description" value="Resumes a paused workflow instance" />
+ </bean>
+ <bean id="GetFirstPage" class="org.apache.oodt.cas.workflow.cli.action.GetFirstPageCliAction">
+ <property name="description" value="Gets first page of workflows" />
+ </bean>
+ <bean id="GetNextPage" class="org.apache.oodt.cas.workflow.cli.action.GetNextPageCliAction">
+ <property name="description" value="Gets next page of workflows" />
+ </bean>
+ <bean id="GetPrevPage" class="org.apache.oodt.cas.workflow.cli.action.GetPrevPageCliAction">
+ <property name="description" value="Gets prev page of workflows" />
+ </bean>
+ <bean id="GetLastPage" class="org.apache.oodt.cas.workflow.cli.action.GetLastPageCliAction">
+ <property name="description" value="Gets last page of workflows" />
+ </bean>
+ <bean id="GetWorkflowInstMet" class="org.apache.oodt.cas.workflow.cli.action.GetWorkflowInstMetCliAction">
+ <property name="description" value="Gets workflow instance metadata" />
+ </bean>
+
+</beans>
Propchange: oodt/trunk/workflow/src/main/resources/cmd-line-actions.xml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: oodt/trunk/workflow/src/main/resources/cmd-line-options.xml
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/main/resources/cmd-line-options.xml?rev=1201233&view=auto
==============================================================================
--- oodt/trunk/workflow/src/main/resources/cmd-line-options.xml (added)
+++ oodt/trunk/workflow/src/main/resources/cmd-line-options.xml Sat Nov 12 09:52:57 2011
@@ -0,0 +1,683 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
+ license agreements. See the NOTICE file distributed with this work for additional
+ information regarding copyright ownership. The ASF licenses this file to
+ You under the Apache License, Version 2.0 (the "License"); you may not use
+ this file except in compliance with the License. You may obtain a copy of
+ the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required
+ by applicable law or agreed to in writing, software distributed under the
+ License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+ OF ANY KIND, either express or implied. See the License for the specific
+ language governing permissions and limitations under the License. Author:
+ bfoster (Brian Foster) -->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
+
+ <bean id="url" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
+ <property name="shortOption" value="u" />
+ <property name="longOption" value="url" />
+ <property name="description" value="Workflow Manager URL" />
+ <property name="hasArgs" value="true" />
+ <property name="argsDescription" value="url" />
+ <property name="required" value="true" />
+ <property name="handler">
+ <bean
+ class="org.apache.oodt.cas.cli.option.handler.SetJavaPropertiesHandler">
+ <property name="propertyNames">
+ <list>
+ <value>org.apache.oodt.cas.workflow.url</value>
+ </list>
+ </property>
+ </bean>
+ </property>
+ </bean>
+
+ <bean id="operation" class="org.apache.oodt.cas.cli.option.GroupCmdLineOption">
+ <property name="shortOption" value="op" />
+ <property name="longOption" value="operation" />
+ <property name="description"
+ value="Declare that you wish to present an operation" />
+ <property name="hasArgs" value="false" />
+ <property name="required" value="true" />
+ <property name="subOptions">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.GroupSubOption"
+ p:option-ref="sendEvent" p:required="false" />
+ <bean class="org.apache.oodt.cas.cli.option.GroupSubOption"
+ p:option-ref="dynWorkflow" p:required="false" />
+ <bean class="org.apache.oodt.cas.cli.option.GroupSubOption"
+ p:option-ref="getWorkflowInsts" p:required="false" />
+ <bean class="org.apache.oodt.cas.cli.option.GroupSubOption"
+ p:option-ref="getWorkflows" p:required="false" />
+ <bean class="org.apache.oodt.cas.cli.option.GroupSubOption"
+ p:option-ref="getTaskById" p:required="false" />
+ <bean class="org.apache.oodt.cas.cli.option.GroupSubOption"
+ p:option-ref="getConditionById" p:required="false" />
+ <bean class="org.apache.oodt.cas.cli.option.GroupSubOption"
+ p:option-ref="getWorkflowById" p:required="false" />
+ <bean class="org.apache.oodt.cas.cli.option.GroupSubOption"
+ p:option-ref="getWorkflowsByEvent" p:required="false" />
+ <bean class="org.apache.oodt.cas.cli.option.GroupSubOption"
+ p:option-ref="getRegisteredEvents" p:required="false" />
+ <bean class="org.apache.oodt.cas.cli.option.GroupSubOption"
+ p:option-ref="getWorkflowInst" p:required="false" />
+ <bean class="org.apache.oodt.cas.cli.option.GroupSubOption"
+ p:option-ref="getWallClockTime" p:required="false" />
+ <bean class="org.apache.oodt.cas.cli.option.GroupSubOption"
+ p:option-ref="getTaskWallClockTime" p:required="false" />
+ <bean class="org.apache.oodt.cas.cli.option.GroupSubOption"
+ p:option-ref="stopWorkflowInst" p:required="false" />
+ <bean class="org.apache.oodt.cas.cli.option.GroupSubOption"
+ p:option-ref="pauseWorkflowInst" p:required="false" />
+ <bean class="org.apache.oodt.cas.cli.option.GroupSubOption"
+ p:option-ref="resumeWorkflowInst" p:required="false" />
+ <bean class="org.apache.oodt.cas.cli.option.GroupSubOption"
+ p:option-ref="getFirstPage" p:required="false" />
+ <bean class="org.apache.oodt.cas.cli.option.GroupSubOption"
+ p:option-ref="getNextPage" p:required="false" />
+ <bean class="org.apache.oodt.cas.cli.option.GroupSubOption"
+ p:option-ref="getPrevPage" p:required="false" />
+ <bean class="org.apache.oodt.cas.cli.option.GroupSubOption"
+ p:option-ref="getLastPage" p:required="false" />
+ <bean class="org.apache.oodt.cas.cli.option.GroupSubOption"
+ p:option-ref="getWorkflowInstMet" p:required="false" />
+ </list>
+ </property>
+ </bean>
+
+ <!-- SendEvent Options -->
+ <bean id="sendEvent" class="org.apache.oodt.cas.cli.option.ActionCmdLineOption"
+ p:isSubOption="true">
+ <property name="shortOption" value="se" />
+ <property name="longOption" value="sendEvent" />
+ <property name="description" value="Triggers SendEvent Action" />
+ <property name="hasArgs" value="false" />
+ <property name="staticArgs">
+ <list>
+ <value>SendEvent</value>
+ </list>
+ </property>
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="SendEvent" p:relation="REQUIRED" />
+ </list>
+ </property>
+ </bean>
+
+ <!-- DynWorkflow Options -->
+ <bean id="dynWorkflow" class="org.apache.oodt.cas.cli.option.ActionCmdLineOption"
+ p:isSubOption="true">
+ <property name="shortOption" value="dw" />
+ <property name="longOption" value="dynWorkflow" />
+ <property name="description" value="Triggers DynWorkflow Action" />
+ <property name="hasArgs" value="false" />
+ <property name="staticArgs">
+ <list>
+ <value>DynWorkflow</value>
+ </list>
+ </property>
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="DynWorkflow" p:relation="REQUIRED" />
+ </list>
+ </property>
+ </bean>
+
+ <bean id="taskIds" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
+ <property name="shortOption" value="tids" />
+ <property name="longOption" value="taskIds" />
+ <property name="description" value="List of workflow task ids" />
+ <property name="type" value="java.util.List" />
+ <property name="hasArgs" value="true" />
+ <property name="argsDescription" value="task-ids" />
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="DynWorkflow" p:relation="REQUIRED" />
+ </list>
+ </property>
+ <property name="handler">
+ <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToActionHandler" />
+ </property>
+ </bean>
+
+ <!-- GetWorkflowInsts Options -->
+ <bean id="getWorkflowInsts" class="org.apache.oodt.cas.cli.option.ActionCmdLineOption"
+ p:isSubOption="true">
+ <property name="shortOption" value="winsts" />
+ <property name="longOption" value="getWorkflowInsts" />
+ <property name="description" value="Triggers GetWorkflowInsts Action" />
+ <property name="hasArgs" value="false" />
+ <property name="staticArgs">
+ <list>
+ <value>GetWorkflowInsts</value>
+ </list>
+ </property>
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="GetWorkflowInsts" p:relation="REQUIRED" />
+ </list>
+ </property>
+ </bean>
+
+ <!-- GetWorkflows Options -->
+ <bean id="getWorkflows" class="org.apache.oodt.cas.cli.option.ActionCmdLineOption"
+ p:isSubOption="true">
+ <property name="shortOption" value="wflows" />
+ <property name="longOption" value="getWorkflows" />
+ <property name="description" value="Triggers GetWorkflows Action" />
+ <property name="hasArgs" value="false" />
+ <property name="staticArgs">
+ <list>
+ <value>GetWorkflows</value>
+ </list>
+ </property>
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="GetWorkflows" p:relation="REQUIRED" />
+ </list>
+ </property>
+ </bean>
+
+ <!-- GetTaskById Options -->
+ <bean id="getTaskById" class="org.apache.oodt.cas.cli.option.ActionCmdLineOption"
+ p:isSubOption="true">
+ <property name="shortOption" value="tbyid" />
+ <property name="longOption" value="getTaskById" />
+ <property name="description" value="Triggers GetTaskById Action" />
+ <property name="hasArgs" value="false" />
+ <property name="staticArgs">
+ <list>
+ <value>GetTaskById</value>
+ </list>
+ </property>
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="GetTaskById" p:relation="REQUIRED" />
+ </list>
+ </property>
+ </bean>
+
+ <!-- GetTaskById Options -->
+ <bean id="getConditionById" class="org.apache.oodt.cas.cli.option.ActionCmdLineOption"
+ p:isSubOption="true">
+ <property name="shortOption" value="cbyid" />
+ <property name="longOption" value="getConditionById" />
+ <property name="description" value="Triggers GetConditionById Action" />
+ <property name="hasArgs" value="false" />
+ <property name="staticArgs">
+ <list>
+ <value>GetConditionById</value>
+ </list>
+ </property>
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="GetConditionById" p:relation="REQUIRED" />
+ </list>
+ </property>
+ </bean>
+
+ <!-- GetWorkflowById Options -->
+ <bean id="getWorkflowById" class="org.apache.oodt.cas.cli.option.ActionCmdLineOption"
+ p:isSubOption="true">
+ <property name="shortOption" value="wbyid" />
+ <property name="longOption" value="getWorkflowById" />
+ <property name="description" value="Triggers GetWorkflowById Action" />
+ <property name="hasArgs" value="false" />
+ <property name="staticArgs">
+ <list>
+ <value>GetWorkflowById</value>
+ </list>
+ </property>
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="GetWorkflowById" p:relation="REQUIRED" />
+ </list>
+ </property>
+ </bean>
+
+ <!-- GetWorkflowsByEvent Options -->
+ <bean id="getWorkflowsByEvent" class="org.apache.oodt.cas.cli.option.ActionCmdLineOption"
+ p:isSubOption="true">
+ <property name="shortOption" value="wbye" />
+ <property name="longOption" value="getWorkflowsByEvent" />
+ <property name="description" value="Triggers GetWorkflowsByEvent Action" />
+ <property name="hasArgs" value="false" />
+ <property name="staticArgs">
+ <list>
+ <value>GetWorkflowsByEvent</value>
+ </list>
+ </property>
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="GetWorkflowsByEvent" p:relation="REQUIRED" />
+ </list>
+ </property>
+ </bean>
+
+ <!-- GetRegisteredEvents Options -->
+ <bean id="getRegisteredEvents" class="org.apache.oodt.cas.cli.option.ActionCmdLineOption"
+ p:isSubOption="true">
+ <property name="shortOption" value="events" />
+ <property name="longOption" value="getRegisteredEvents" />
+ <property name="description" value="Triggers GetRegisteredEvents Action" />
+ <property name="hasArgs" value="false" />
+ <property name="staticArgs">
+ <list>
+ <value>GetRegisteredEvents</value>
+ </list>
+ </property>
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="GetRegisteredEvents" p:relation="REQUIRED" />
+ </list>
+ </property>
+ </bean>
+
+ <!-- GetWorkflowInst Options -->
+ <bean id="getWorkflowInst" class="org.apache.oodt.cas.cli.option.ActionCmdLineOption"
+ p:isSubOption="true">
+ <property name="shortOption" value="inst" />
+ <property name="longOption" value="getWorkflowInst" />
+ <property name="description" value="Triggers GetWorkflowInst Action" />
+ <property name="hasArgs" value="false" />
+ <property name="staticArgs">
+ <list>
+ <value>GetWorkflowInst</value>
+ </list>
+ </property>
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="GetWorkflowInst" p:relation="REQUIRED" />
+ </list>
+ </property>
+ </bean>
+
+ <!-- GetWallClockTime Options -->
+ <bean id="getWallClockTime" class="org.apache.oodt.cas.cli.option.ActionCmdLineOption"
+ p:isSubOption="true">
+ <property name="shortOption" value="time" />
+ <property name="longOption" value="getWallClockTime" />
+ <property name="description" value="Triggers GetWallClockTime Action" />
+ <property name="hasArgs" value="false" />
+ <property name="staticArgs">
+ <list>
+ <value>GetWallClockTime</value>
+ </list>
+ </property>
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="GetWallClockTime" p:relation="REQUIRED" />
+ </list>
+ </property>
+ </bean>
+
+ <!-- GetTaskWallClockTime Options -->
+ <bean id="getTaskWallClockTime" class="org.apache.oodt.cas.cli.option.ActionCmdLineOption"
+ p:isSubOption="true">
+ <property name="shortOption" value="ttime" />
+ <property name="longOption" value="getTaskWallClockTime" />
+ <property name="description" value="Triggers GetWallClockTime Action" />
+ <property name="hasArgs" value="false" />
+ <property name="staticArgs">
+ <list>
+ <value>GetTaskWallClockTime</value>
+ </list>
+ </property>
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="GetTaskWallClockTime" p:relation="REQUIRED" />
+ </list>
+ </property>
+ </bean>
+
+ <!-- StopWorkflowInst Options -->
+ <bean id="stopWorkflowInst" class="org.apache.oodt.cas.cli.option.ActionCmdLineOption"
+ p:isSubOption="true">
+ <property name="shortOption" value="stop" />
+ <property name="longOption" value="stopWorkflowInst" />
+ <property name="description" value="Triggers StopWorkflowInst Action" />
+ <property name="hasArgs" value="false" />
+ <property name="staticArgs">
+ <list>
+ <value>StopWorkflowInst</value>
+ </list>
+ </property>
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="StopWorkflowInst" p:relation="REQUIRED" />
+ </list>
+ </property>
+ </bean>
+
+ <!-- PauseWorkflowInst Options -->
+ <bean id="pauseWorkflowInst" class="org.apache.oodt.cas.cli.option.ActionCmdLineOption"
+ p:isSubOption="true">
+ <property name="shortOption" value="pause" />
+ <property name="longOption" value="pauseWorkflowInst" />
+ <property name="description" value="Triggers PauseWorkflowInst Action" />
+ <property name="hasArgs" value="false" />
+ <property name="staticArgs">
+ <list>
+ <value>PauseWorkflowInst</value>
+ </list>
+ </property>
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="PauseWorkflowInst" p:relation="REQUIRED" />
+ </list>
+ </property>
+ </bean>
+
+ <!-- ResumeWorkflowInst Options -->
+ <bean id="resumeWorkflowInst" class="org.apache.oodt.cas.cli.option.ActionCmdLineOption"
+ p:isSubOption="true">
+ <property name="shortOption" value="resume" />
+ <property name="longOption" value="resumeWorkflowInst" />
+ <property name="description" value="Triggers ResumeWorkflowInst Action" />
+ <property name="hasArgs" value="false" />
+ <property name="staticArgs">
+ <list>
+ <value>ResumeWorkflowInst</value>
+ </list>
+ </property>
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="ResumeWorkflowInst" p:relation="REQUIRED" />
+ </list>
+ </property>
+ </bean>
+
+ <!-- GetFirstPage Options -->
+ <bean id="getFirstPage" class="org.apache.oodt.cas.cli.option.ActionCmdLineOption"
+ p:isSubOption="true">
+ <property name="shortOption" value="page1" />
+ <property name="longOption" value="getFirstPage" />
+ <property name="description" value="Triggers GetFirstPage Action" />
+ <property name="hasArgs" value="false" />
+ <property name="staticArgs">
+ <list>
+ <value>GetFirstPage</value>
+ </list>
+ </property>
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="GetFirstPage" p:relation="REQUIRED" />
+ </list>
+ </property>
+ </bean>
+
+ <!-- GetNextPage Options -->
+ <bean id="getNextPage" class="org.apache.oodt.cas.cli.option.ActionCmdLineOption"
+ p:isSubOption="true">
+ <property name="shortOption" value="next" />
+ <property name="longOption" value="getNextPage" />
+ <property name="description" value="Triggers GetNextPage Action" />
+ <property name="hasArgs" value="false" />
+ <property name="staticArgs">
+ <list>
+ <value>GetNextPage</value>
+ </list>
+ </property>
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="GetNextPage" p:relation="REQUIRED" />
+ </list>
+ </property>
+ </bean>
+
+ <!-- GetPrevPage Options -->
+ <bean id="getPrevPage" class="org.apache.oodt.cas.cli.option.ActionCmdLineOption"
+ p:isSubOption="true">
+ <property name="shortOption" value="prev" />
+ <property name="longOption" value="getPrevPage" />
+ <property name="description" value="Triggers GetPrevPage Action" />
+ <property name="hasArgs" value="false" />
+ <property name="staticArgs">
+ <list>
+ <value>GetPrevPage</value>
+ </list>
+ </property>
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="GetPrevPage" p:relation="REQUIRED" />
+ </list>
+ </property>
+ </bean>
+
+ <!-- GetLastPage Options -->
+ <bean id="getLastPage" class="org.apache.oodt.cas.cli.option.ActionCmdLineOption"
+ p:isSubOption="true">
+ <property name="shortOption" value="last" />
+ <property name="longOption" value="getLastPage" />
+ <property name="description" value="Triggers GetLastPage Action" />
+ <property name="hasArgs" value="false" />
+ <property name="staticArgs">
+ <list>
+ <value>GetLastPage</value>
+ </list>
+ </property>
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="GetLastPage" p:relation="REQUIRED" />
+ </list>
+ </property>
+ </bean>
+
+ <!-- GetWorkflowInstMet Options -->
+ <bean id="getWorkflowInstMet" class="org.apache.oodt.cas.cli.option.ActionCmdLineOption"
+ p:isSubOption="true">
+ <property name="shortOption" value="getMet" />
+ <property name="longOption" value="getWorkflowInstMet" />
+ <property name="description" value="Triggers GetWorkflowInstMet Action" />
+ <property name="hasArgs" value="false" />
+ <property name="staticArgs">
+ <list>
+ <value>GetWorkflowInstMet</value>
+ </list>
+ </property>
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="GetWorkflowInstMet" p:relation="REQUIRED" />
+ </list>
+ </property>
+ </bean>
+
+ <!-- Options used for multiple Actions -->
+ <bean id="eventName" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
+ <property name="shortOption" value="en" />
+ <property name="longOption" value="eventName" />
+ <property name="description" value="Name of the Event to trigger" />
+ <property name="hasArgs" value="true" />
+ <property name="argsDescription" value="event-name" />
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="SendEvent" p:relation="REQUIRED" />
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="GetWorkflowsByEvent" p:relation="REQUIRED" />
+ </list>
+ </property>
+ <property name="handler">
+ <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToActionHandler" />
+ </property>
+ </bean>
+
+ <bean id="metaData" class="org.apache.oodt.cas.cli.option.GroupCmdLineOption">
+ <property name="shortOption" value="m" />
+ <property name="longOption" value="metaData" />
+ <property name="description" value="Declare that you wish to present metadata" />
+ <property name="hasArgs" value="false" />
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="SendEvent" p:relation="OPTIONAL" />
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="DynMetadata" p:relation="OPTIONAL" />
+ </list>
+ </property>
+ <property name="subOptions">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.GroupSubOption"
+ p:option-ref="key" p:required="true" />
+ </list>
+ </property>
+ </bean>
+
+ <bean id="key" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption"
+ p:isSubOption="true">
+ <property name="shortOption" value="k" />
+ <property name="longOption" value="key" />
+ <property name="description" value="Workflow Metadata: key val val..." />
+ <property name="type" value="java.util.List" />
+ <property name="hasArgs" value="true" />
+ <property name="argsDescription" value="key-vals" />
+ <property name="repeating" value="true" />
+ <property name="handler">
+ <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToActionHandler">
+ <property name="applyToActions">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToAction"
+ p:actionName="SendEvent" p:methodName="addMetadata" />
+ <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToAction"
+ p:actionName="DynWorkflow" p:methodName="addMetadata" />
+ </list>
+ </property>
+ </bean>
+ </property>
+ </bean>
+
+ <bean id="id" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
+ <property name="shortOption" value="id" />
+ <property name="longOption" value="id" />
+ <property name="description" value="ID" />
+ <property name="hasArgs" value="true" />
+ <property name="argsDescription" value="id" />
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="GetTaskById" p:relation="REQUIRED" />
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="GetConditionById" p:relation="REQUIRED" />
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="GetWorkflowById" p:relation="REQUIRED" />
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="GetWorkflowInst" p:relation="REQUIRED" />
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="GetWallClockTime" p:relation="REQUIRED" />
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="GetTaskWallClockTime" p:relation="REQUIRED" />
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="StopWorkflowInst" p:relation="REQUIRED" />
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="PauseWorkflowInst" p:relation="REQUIRED" />
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="ResumeWorkflowInst" p:relation="REQUIRED" />
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="GetWorkflowInstMet" p:relation="REQUIRED" />
+ </list>
+ </property>
+ <property name="handler">
+ <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToActionHandler">
+ <property name="applyToActions">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToAction"
+ p:actionName="GetTaskById" p:methodName="setTaskId"
+ p:argDescription="task-id" />
+ <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToAction"
+ p:actionName="GetConditionById" p:methodName="setConditionId"
+ p:argDescription="condition-id" />
+ <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToAction"
+ p:actionName="GetWorkflowById" p:methodName="setWorkflowId"
+ p:argDescription="workflow-id" />
+ <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToAction"
+ p:actionName="GetWorkflowInst" p:methodName="setInstanceId"
+ p:argDescription="instance-id" />
+ <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToAction"
+ p:actionName="GetWallClockTime" p:methodName="setInstanceId"
+ p:argDescription="instance-id" />
+ <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToAction"
+ p:actionName="GetTaskWallClockTime" p:methodName="setInstanceId"
+ p:argDescription="instance-id" />
+ <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToAction"
+ p:actionName="StopWorkflowInst" p:methodName="setInstanceId"
+ p:argDescription="instance-id" />
+ <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToAction"
+ p:actionName="PauseWorkflowInst" p:methodName="setInstanceId"
+ p:argDescription="instance-id" />
+ <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToAction"
+ p:actionName="ResumeWorkflowInst" p:methodName="setInstanceId"
+ p:argDescription="instance-id" />
+ <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToAction"
+ p:actionName="GetWorkflowInstMet" p:methodName="setInstanceId"
+ p:argDescription="instance-id" />
+ </list>
+ </property>
+ </bean>
+ </property>
+ </bean>
+
+ <bean id="status" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
+ <property name="shortOption" value="s" />
+ <property name="longOption" value="status" />
+ <property name="description" value="Workflow status" />
+ <property name="hasArgs" value="true" />
+ <property name="argsDescription" value="status" />
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="GetFirstPage" p:relation="OPTIONAL" />
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="GetNextPage" p:relation="OPTIONAL" />
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="GetPrevPage" p:relation="OPTIONAL" />
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="GetLastPage" p:relation="OPTIONAL" />
+ </list>
+ </property>
+ <property name="handler">
+ <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToActionHandler" />
+ </property>
+ </bean>
+
+ <bean id="pageNum" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
+ <property name="shortOption" value="p" />
+ <property name="longOption" value="pageNum" />
+ <property name="description" value="Page Number" />
+ <property name="type" value="int" />
+ <property name="hasArgs" value="true" />
+ <property name="argsDescription" value="page" />
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="GetNextPage" p:relation="REQUIRED" />
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="GetPrevPage" p:relation="REQUIRED" />
+ </list>
+ </property>
+ <property name="handler">
+ <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToActionHandler" />
+ </property>
+ </bean>
+</beans>
Propchange: oodt/trunk/workflow/src/main/resources/cmd-line-options.xml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: oodt/trunk/workflow/src/main/resources/logging.properties
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/main/resources/logging.properties?rev=1201233&r1=1201232&r2=1201233&view=diff
==============================================================================
--- oodt/trunk/workflow/src/main/resources/logging.properties (original)
+++ oodt/trunk/workflow/src/main/resources/logging.properties Sat Nov 12 09:52:57 2011
@@ -58,4 +58,10 @@ httpclient.wire.header.level = INFO
httpclient.wire.level = INFO
sun.net.level = OFF
-
+# spring framework logging
+org.springframework.beans.level = WARNING
+org.springframework.core.level = WARNING
+org.springframework.level = WARNING
+org.springframework.beans.factory.level = WARNING
+org.springframework.beans.factory.config.level = WARNING
+org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.level = WARNING
Modified: oodt/trunk/workflow/src/main/resources/workflow.properties
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/main/resources/workflow.properties?rev=1201233&r1=1201232&r2=1201233&view=diff
==============================================================================
--- oodt/trunk/workflow/src/main/resources/workflow.properties (original)
+++ oodt/trunk/workflow/src/main/resources/workflow.properties Sat Nov 12 09:52:57 2011
@@ -64,3 +64,7 @@ org.apache.oodt.cas.workflow.repo.dataso
org.apache.oodt.cas.workflow.repo.datasource.jdbc.user=user
org.apache.oodt.cas.workflow.repo.datasource.jdbc.pass=pass
org.apache.oodt.cas.workflow.repo.datasource.jdbc.driver=your.jdbc.Driver
+
+# Spring command line option and action store properties
+org.apache.oodt.cas.cli.action.spring.config=src/main/resources/cmd-line-actions.xml
+org.apache.oodt.cas.cli.option.spring.config=src/main/resources/cmd-line-options.xml
Added: oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/cli/TestWorkflowCli.java
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/cli/TestWorkflowCli.java?rev=1201233&view=auto
==============================================================================
--- oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/cli/TestWorkflowCli.java (added)
+++ oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/cli/TestWorkflowCli.java Sat Nov 12 09:52:57 2011
@@ -0,0 +1,278 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.oodt.cas.workflow.cli;
+
+//OODT imports
+import org.apache.oodt.cas.cli.CmdLineUtility;
+import org.apache.oodt.cas.metadata.Metadata;
+import org.apache.oodt.cas.workflow.repository.MockWorkflowRepository;
+import org.apache.oodt.cas.workflow.system.MockXmlRpcWorkflowManagerClient;
+import org.apache.oodt.cas.workflow.system.MockXmlRpcWorkflowManagerClient.MethodCallDetails;
+
+//Google imports
+import com.google.common.collect.Lists;
+
+//JUnit imports
+import junit.framework.TestCase;
+
+/**
+ * Tests Workflow Manager Clients Command-line interface.
+ *
+ * @author bfoster (Brian Foster)
+ */
+public class TestWorkflowCli extends TestCase {
+
+ static {
+ System.setProperty("org.apache.oodt.cas.cli.debug", "true");
+ System.setProperty("org.apache.oodt.cas.cli.action.spring.config", "src/main/resources/cmd-line-actions.xml");
+ System.setProperty("org.apache.oodt.cas.cli.option.spring.config", "src/main/resources/cmd-line-options.xml");
+ System.setProperty("workflow.engine.factory", "org.apache.oodt.cas.workflow.engine.MockWorkflowEngineFactory");
+ System.setProperty("workflow.engine.instanceRep.factory", "org.apache.oodt.cas.workflow.instrepo.MemoryWorkflowInstanceRepositoryFactory");
+ System.setProperty("workflow.repo.factory", "org.apache.oodt.cas.workflow.repository.MockWorkflowRepositoryFactory");
+ }
+
+ private CmdLineUtility cmdLineUtility;
+ private MockXmlRpcWorkflowManagerClient client;
+
+ public void setUp() {
+ cmdLineUtility = new CmdLineUtility();
+ UseMockClientCmdLineActionStore actionStore = new UseMockClientCmdLineActionStore();
+ client = actionStore.getClient();
+ cmdLineUtility.setActionStore(actionStore);
+ }
+
+ public void testDynWorkflow() throws Exception {
+ cmdLineUtility
+ .run(("--url http://localhost:9000"
+ + " --operation --dynWorkflow --taskIds "
+ + MockWorkflowRepository.TASK1_ID + " "
+ + MockWorkflowRepository.TASK2_ID + " "
+ + MockWorkflowRepository.TASK3_ID
+ + " --metaData --key Filename data.dat --key NominalDate 2001-02-20")
+ .split(" "));
+ MethodCallDetails methodCallDetails = client.getLastMethodCallDetails();
+ assertEquals("executeDynamicWorkflow", methodCallDetails.getMethodName());
+ assertEquals(Lists.newArrayList(MockWorkflowRepository.TASK1_ID,
+ MockWorkflowRepository.TASK2_ID, MockWorkflowRepository.TASK3_ID),
+ methodCallDetails.getArgs().get(0));
+ Metadata m = new Metadata();
+ m.addMetadata("NominalDate", Lists.newArrayList("2001-02-20"));
+ m.addMetadata("Filename", Lists.newArrayList("data.dat"));
+ assertEquals(m, methodCallDetails.getArgs().get(1));
+ }
+
+ public void testGetConditionById() {
+ cmdLineUtility
+ .run(("--url http://localhost:9000"
+ + " --operation --getConditionById --id "
+ + MockWorkflowRepository.CONDITION1_ID)
+ .split(" "));
+ MethodCallDetails methodCallDetails = client.getLastMethodCallDetails();
+ assertEquals("getConditionById", methodCallDetails.getMethodName());
+ assertEquals(MockWorkflowRepository.CONDITION1_ID, methodCallDetails.getArgs().get(0));
+ }
+
+ public void testGetFirstPage() {
+ cmdLineUtility.run(("--url http://localhost:9000"
+ + " --operation --getFirstPage").split(" "));
+ MethodCallDetails methodCallDetails = client.getLastMethodCallDetails();
+ assertEquals("getFirstPage", methodCallDetails.getMethodName());
+ String status = "DONE";
+ cmdLineUtility.run(("--url http://localhost:9000"
+ + " --operation --getFirstPage --status " + status).split(" "));
+ methodCallDetails = client.getLastMethodCallDetails();
+ assertEquals("paginateWorkflowInstances", methodCallDetails.getMethodName());
+ assertEquals(1, methodCallDetails.getArgs().get(0));
+ assertEquals(status, methodCallDetails.getArgs().get(1));
+ }
+
+ public void testGetLastPage() {
+ cmdLineUtility.run(("--url http://localhost:9000"
+ + " --operation --getLastPage").split(" "));
+ MethodCallDetails methodCallDetails = client.getLastMethodCallDetails();
+ assertEquals("getLastPage", methodCallDetails.getMethodName());
+ String status = "DONE";
+ cmdLineUtility.run(("--url http://localhost:9000"
+ + " --operation --getLastPage --status " + status).split(" "));
+ methodCallDetails = client.getLastMethodCallDetails();
+ assertEquals("paginateWorkflowInstances", methodCallDetails.getMethodName());
+ assertEquals(0, methodCallDetails.getArgs().get(0));
+ assertEquals(status, methodCallDetails.getArgs().get(1));
+ }
+
+ public void testGetNextPage() {
+ cmdLineUtility.run(("--url http://localhost:9000"
+ + " --operation --getNextPage --pageNum 1").split(" "));
+ MethodCallDetails methodCallDetails = client.getLastMethodCallDetails();
+ assertEquals("paginateWorkflowInstances", methodCallDetails.getMethodName());
+ String status = "DONE";
+ cmdLineUtility.run(("--url http://localhost:9000"
+ + " --operation --getNextPage --pageNum 1 --status " + status).split(" "));
+ methodCallDetails = client.getLastMethodCallDetails();
+ assertEquals("paginateWorkflowInstances", methodCallDetails.getMethodName());
+ assertEquals(2, methodCallDetails.getArgs().get(0));
+ assertEquals(status, methodCallDetails.getArgs().get(1));
+ }
+
+ public void testGetPrevPage() {
+ cmdLineUtility.run(("--url http://localhost:9000"
+ + " --operation --getPrevPage --pageNum 1").split(" "));
+ MethodCallDetails methodCallDetails = client.getLastMethodCallDetails();
+ assertEquals("paginateWorkflowInstances", methodCallDetails.getMethodName());
+ String status = "DONE";
+ cmdLineUtility.run(("--url http://localhost:9000"
+ + " --operation --getPrevPage --pageNum 1 --status " + status).split(" "));
+ methodCallDetails = client.getLastMethodCallDetails();
+ assertEquals("paginateWorkflowInstances", methodCallDetails.getMethodName());
+ assertEquals(0, methodCallDetails.getArgs().get(0));
+ assertEquals(status, methodCallDetails.getArgs().get(1));
+ }
+
+ public void testGetRegisteredEvents() {
+ cmdLineUtility.run(("--url http://localhost:9000"
+ + " --operation --getRegisteredEvents").split(" "));
+ MethodCallDetails methodCallDetails = client.getLastMethodCallDetails();
+ assertEquals("getRegisteredEvents", methodCallDetails.getMethodName());
+ assertTrue(methodCallDetails.getArgs().isEmpty());
+ }
+
+ public void testGetTaskById() {
+ String taskId = MockWorkflowRepository.TASK1_ID;
+ cmdLineUtility.run(("--url http://localhost:9000"
+ + " --operation --getTaskById --id " + taskId).split(" "));
+ MethodCallDetails methodCallDetails = client.getLastMethodCallDetails();
+ assertEquals("getTaskById", methodCallDetails.getMethodName());
+ assertEquals(taskId, methodCallDetails.getArgs().get(0));
+ }
+
+ public void testGetTaskWallClockTime() {
+ String taskId = MockWorkflowRepository.TASK1_ID;
+ cmdLineUtility.run(("--url http://localhost:9000"
+ + " --operation --getTaskWallClockTime --id " + taskId).split(" "));
+ MethodCallDetails methodCallDetails = client.getLastMethodCallDetails();
+ assertEquals("getWorkflowCurrentTaskWallClockMinutes", methodCallDetails.getMethodName());
+ assertEquals(taskId, methodCallDetails.getArgs().get(0));
+ }
+
+ public void testGetWallClockTime() {
+ String taskId = MockWorkflowRepository.TASK1_ID;
+ cmdLineUtility.run(("--url http://localhost:9000"
+ + " --operation --getWallClockTime --id " + taskId).split(" "));
+ MethodCallDetails methodCallDetails = client.getLastMethodCallDetails();
+ assertEquals("getWorkflowWallClockMinutes", methodCallDetails.getMethodName());
+ assertEquals(taskId, methodCallDetails.getArgs().get(0));
+ }
+
+ public void testGetWorkflowById() {
+ String workflowId = MockWorkflowRepository.WORKFLOW1_ID;
+ cmdLineUtility.run(("--url http://localhost:9000"
+ + " --operation --getWorkflowById --id " + workflowId).split(" "));
+ MethodCallDetails methodCallDetails = client.getLastMethodCallDetails();
+ assertEquals("getWorkflowById", methodCallDetails.getMethodName());
+ assertEquals(workflowId, methodCallDetails.getArgs().get(0));
+ }
+
+ public void testGetWorkflowInst() {
+ String instId = "TestId";
+ cmdLineUtility.run(("--url http://localhost:9000"
+ + " --operation --getWorkflowInst --id " + instId).split(" "));
+ MethodCallDetails methodCallDetails = client.getLastMethodCallDetails();
+ assertEquals("getWorkflowCurrentTaskWallClockMinutes", methodCallDetails.getMethodName());
+ assertEquals(instId, methodCallDetails.getArgs().get(0));
+ }
+
+ public void testGetWorkflowInstMet() {
+ String instId = "TestId";
+ cmdLineUtility.run(("--url http://localhost:9000"
+ + " --operation --getWorkflowInstMet --id " + instId).split(" "));
+ MethodCallDetails methodCallDetails = client.getLastMethodCallDetails();
+ assertEquals("getWorkflowInstanceMetadata", methodCallDetails.getMethodName());
+ assertEquals(instId, methodCallDetails.getArgs().get(0));
+ }
+
+ public void testGetWorkflowInsts() {
+ cmdLineUtility.run(("--url http://localhost:9000"
+ + " --operation --getWorkflowInsts").split(" "));
+ MethodCallDetails methodCallDetails = client.getLastMethodCallDetails();
+ assertEquals("getWorkflowInstances", methodCallDetails.getMethodName());
+ assertTrue(methodCallDetails.getArgs().isEmpty());
+ }
+
+ public void testGetWorkflowsByEvent() {
+ String eventName = "TestEventName";
+ cmdLineUtility.run(("--url http://localhost:9000"
+ + " --operation --getWorkflowsByEvent --eventName " + eventName).split(" "));
+ MethodCallDetails methodCallDetails = client.getLastMethodCallDetails();
+ assertEquals("getWorkflowsByEvent", methodCallDetails.getMethodName());
+ assertEquals(eventName, methodCallDetails.getArgs().get(0));
+ }
+
+ public void testGetWorkflows() {
+ cmdLineUtility.run(("--url http://localhost:9000"
+ + " --operation --getWorkflows").split(" "));
+ MethodCallDetails methodCallDetails = client.getLastMethodCallDetails();
+ assertEquals("getWorkflows", methodCallDetails.getMethodName());
+ assertTrue(methodCallDetails.getArgs().isEmpty());
+ }
+
+ public void testPauseWorkflowInst() {
+ String instId = "TestId";
+ cmdLineUtility.run(("--url http://localhost:9000"
+ + " --operation --pauseWorkflowInst --id " + instId).split(" "));
+ MethodCallDetails methodCallDetails = client.getLastMethodCallDetails();
+ assertEquals("pauseWorkflowInstance", methodCallDetails.getMethodName());
+ assertEquals(instId, methodCallDetails.getArgs().get(0));
+ }
+
+ public void testResumeWorkflowInst() {
+ String instId = "TestId";
+ cmdLineUtility.run(("--url http://localhost:9000"
+ + " --operation --resumeWorkflowInst --id " + instId).split(" "));
+ MethodCallDetails methodCallDetails = client.getLastMethodCallDetails();
+ assertEquals("resumeWorkflowInstance", methodCallDetails.getMethodName());
+ assertEquals(instId, methodCallDetails.getArgs().get(0));
+ }
+
+ public void testSendEvent() {
+ String eventName = "TestEventName";
+ cmdLineUtility.run(("--url http://localhost:9000"
+ + " --operation --sendEvent --eventName " + eventName).split(" "));
+ MethodCallDetails methodCallDetails = client.getLastMethodCallDetails();
+ assertEquals("sendEvent", methodCallDetails.getMethodName());
+ assertEquals(eventName, methodCallDetails.getArgs().get(0));
+
+ cmdLineUtility.run(("--url http://localhost:9000"
+ + " --operation --sendEvent --eventName " + eventName
+ + " --metaData --key Filename data.dat --key NominalDate 2001-02-20").split(" "));
+ methodCallDetails = client.getLastMethodCallDetails();
+ assertEquals("sendEvent", methodCallDetails.getMethodName());
+ assertEquals(eventName, methodCallDetails.getArgs().get(0));
+ Metadata m = new Metadata();
+ m.addMetadata("Filename", Lists.newArrayList("data.dat"));
+ m.addMetadata("NominalDate", Lists.newArrayList("2001-02-20"));
+ assertEquals(m, methodCallDetails.getArgs().get(1));
+ }
+
+ public void testStopWorkflowInstance() {
+ String instId = "TestId";
+ cmdLineUtility.run(("--url http://localhost:9000"
+ + " --operation --stopWorkflowInst --id " + instId).split(" "));
+ MethodCallDetails methodCallDetails = client.getLastMethodCallDetails();
+ assertEquals("stopWorkflowInstance", methodCallDetails.getMethodName());
+ assertEquals(instId, methodCallDetails.getArgs().get(0));
+ }
+}
Propchange: oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/cli/TestWorkflowCli.java
------------------------------------------------------------------------------
svn:mime-type = text/plain