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 [3/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...
Added: oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/cli/UseMockClientCmdLineActionStore.java
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/cli/UseMockClientCmdLineActionStore.java?rev=1201233&view=auto
==============================================================================
--- oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/cli/UseMockClientCmdLineActionStore.java (added)
+++ oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/cli/UseMockClientCmdLineActionStore.java Sat Nov 12 09:52:57 2011
@@ -0,0 +1,61 @@
+/*
+ * 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;
+
+//JDK imports
+import java.util.Set;
+
+//OODT imports
+import org.apache.oodt.cas.cli.action.CmdLineAction;
+import org.apache.oodt.cas.cli.action.store.spring.SpringCmdLineActionStore;
+import org.apache.oodt.cas.cli.exception.CmdLineActionStoreException;
+import org.apache.oodt.cas.workflow.cli.action.WorkflowCliAction;
+import org.apache.oodt.cas.workflow.system.MockXmlRpcWorkflowManagerClient;
+
+/**
+ * A {@link SpringCmdLineActionStore} which sets {@link WorkflowCliAction}s
+ * to use a {@link MockXmlRpcWorkflowManagerClient}.
+ *
+ * @author bfoster (Brian Foster)
+ */
+public class UseMockClientCmdLineActionStore extends SpringCmdLineActionStore {
+
+ private MockXmlRpcWorkflowManagerClient client;
+
+ public UseMockClientCmdLineActionStore() {
+ super(System.getProperty("org.apache.oodt.cas.cli.action.spring.config"));
+ try {
+ client = new MockXmlRpcWorkflowManagerClient();
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public Set<CmdLineAction> loadSupportedActions() throws CmdLineActionStoreException {
+ Set<CmdLineAction> actions = super.loadSupportedActions();
+ for (CmdLineAction action : actions) {
+ if (action instanceof WorkflowCliAction) {
+ ((WorkflowCliAction) action).setClient(client);
+ }
+ }
+ return actions;
+ }
+
+ public MockXmlRpcWorkflowManagerClient getClient() {
+ return client;
+ }
+}
Propchange: oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/cli/UseMockClientCmdLineActionStore.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/repository/MockWorkflowRepository.java
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/repository/MockWorkflowRepository.java?rev=1201233&view=auto
==============================================================================
--- oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/repository/MockWorkflowRepository.java (added)
+++ oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/repository/MockWorkflowRepository.java Sat Nov 12 09:52:57 2011
@@ -0,0 +1,314 @@
+/*
+ * 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.repository;
+
+//JDK imports
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+//OODT imports
+import org.apache.commons.lang.Validate;
+import org.apache.oodt.cas.workflow.structs.Workflow;
+import org.apache.oodt.cas.workflow.structs.WorkflowCondition;
+import org.apache.oodt.cas.workflow.structs.WorkflowConditionConfiguration;
+import org.apache.oodt.cas.workflow.structs.WorkflowTask;
+import org.apache.oodt.cas.workflow.structs.WorkflowTaskConfiguration;
+import org.apache.oodt.cas.workflow.structs.exceptions.RepositoryException;
+
+//Google imports
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+
+/**
+ * A mock {@link WorkflowRepository}.
+ *
+ * @author bfoster (Brian Foster)
+ */
+public class MockWorkflowRepository implements WorkflowRepository {
+
+ private Map<String, List<Workflow>> eventToWorkflowsMap;
+ private Map<String, Workflow> workflows;
+ private Map<String, WorkflowTask> tasks;
+ private Map<String, WorkflowCondition> conditions;
+
+ public final static String EVENT1_NAME = "Event1_Name";
+ public final static String EVENT2_NAME = "Event2_Name";
+
+ public final static String WORKFLOW1_ID = "Workflow1_Id";
+ public final static String WORKFLOW2_ID = "Workflow2_Id";
+ public final static String WORKFLOW3_ID = "Workflow3_Id";
+
+ public final static String WORKFLOW1_NAME = "Workflow1_Name";
+ public final static String WORKFLOW2_NAME = "Workflow2_Name";
+ public final static String WORKFLOW3_NAME = "Workflow3_Name";
+
+ public final static String TASK1_ID = "Task1_Id";
+ public final static String TASK2_ID = "Task2_Id";
+ public final static String TASK3_ID = "Task3_Id";
+ public final static String TASK4_ID = "Task4_Id";
+
+ public final static String TASK1_NAME = "Task1_Name";
+ public final static String TASK2_NAME = "Task2_Name";
+ public final static String TASK3_NAME = "Task3_Name";
+ public final static String TASK4_NAME = "Task4_Name";
+
+ public final static String CONDITION1_ID = "Condition1_Id";
+ public final static String CONDITION2_ID = "Condition2_Id";
+ public final static String CONDITION3_ID = "Condition3_Id";
+ public final static String CONDITION4_ID = "Condition4_Id";
+
+ public final static String CONDITION1_NAME = "Condition1_Name";
+ public final static String CONDITION2_NAME = "Condition2_Name";
+ public final static String CONDITION3_NAME = "Condition3_Name";
+ public final static String CONDITION4_NAME = "Condition4_Name";
+
+ public final static WorkflowTaskConfiguration tConf = new WorkflowTaskConfiguration();
+ public final static WorkflowConditionConfiguration cConf = new WorkflowConditionConfiguration();
+
+ public MockWorkflowRepository() {
+ eventToWorkflowsMap = Maps.newHashMap();
+ workflows = Maps.newHashMap();
+ tasks = Maps.newHashMap();
+ conditions = Maps.newHashMap();
+
+ WorkflowCondition condition1 = new WorkflowCondition();
+ condition1.setConditionId(CONDITION1_ID);
+ condition1.setConditionName(CONDITION1_NAME);
+ condition1.setConditionInstanceClassName("some.class.path");
+ condition1.setCondConfig(cConf);
+ conditions.put(condition1.getConditionId(), condition1);
+
+ WorkflowCondition condition2 = new WorkflowCondition();
+ condition2.setConditionId(CONDITION2_ID);
+ condition2.setConditionName(CONDITION2_NAME);
+ condition2.setCondConfig(cConf);
+ condition2.setConditionInstanceClassName("some.class.path");
+ conditions.put(condition2.getConditionId(), condition2);
+
+ WorkflowCondition condition3 = new WorkflowCondition();
+ condition3.setConditionId(CONDITION3_ID);
+ condition3.setConditionName(CONDITION3_NAME);
+ condition3.setCondConfig(cConf);
+ condition3.setConditionInstanceClassName("some.class.path");
+ conditions.put(condition3.getConditionId(), condition3);
+
+ WorkflowCondition condition4 = new WorkflowCondition();
+ condition4.setConditionId(CONDITION4_ID);
+ condition4.setConditionName(CONDITION4_NAME);
+ condition4.setCondConfig(cConf);
+ condition4.setConditionInstanceClassName("some.class.path");
+ conditions.put(condition4.getConditionId(), condition4);
+
+ WorkflowTask task1 = new WorkflowTask();
+ task1.setTaskId(TASK1_ID);
+ task1.setTaskName(TASK1_NAME);
+ task1.setTaskConfig(tConf);
+ task1.setConditions(Lists.newArrayList(condition1, condition2));
+ tasks.put(task1.getTaskId(), task1);
+
+ WorkflowTask task2 = new WorkflowTask();
+ task2.setTaskId(TASK2_ID);
+ task2.setTaskName(TASK2_NAME);
+ task2.setTaskConfig(tConf);
+ task2.setConditions(Lists.newArrayList());
+ tasks.put(task2.getTaskId(), task2);
+
+ WorkflowTask task3 = new WorkflowTask();
+ task3.setTaskId(TASK3_ID);
+ task3.setTaskName(TASK3_NAME);
+ task3.setTaskConfig(tConf);
+ task3.setConditions(Lists.newArrayList());
+ tasks.put(task3.getTaskId(), task3);
+
+ WorkflowTask task4 = new WorkflowTask();
+ task4.setTaskId(TASK4_ID);
+ task4.setTaskName(TASK4_NAME);
+ task4.setTaskConfig(tConf);
+ task4.setConditions(Lists.newArrayList(condition4));
+ tasks.put(task4.getTaskId(), task4);
+
+ Workflow workflow1 = new Workflow();
+ workflow1.setId(WORKFLOW1_ID);
+ workflow1.setName(WORKFLOW1_NAME);
+ workflow1.setTasks(Lists.newArrayList(task1, task2));
+ workflow1.setConditions(Lists.newArrayList(condition1));
+ workflows.put(workflow1.getId(), workflow1);
+
+ Workflow workflow2 = new Workflow();
+ workflow2.setId(WORKFLOW2_ID);
+ workflow2.setName(WORKFLOW2_NAME);
+ workflow2.setTasks(Lists.newArrayList(task1, task2, task4));
+ workflow2.setConditions(Lists.newArrayList(condition1, condition4));
+ workflows.put(workflow2.getId(), workflow2);
+
+ Workflow workflow3 = new Workflow();
+ workflow3.setId(WORKFLOW3_ID);
+ workflow3.setName(WORKFLOW3_NAME);
+ workflow3.setTasks(Lists.newArrayList(task3));
+ workflow3.setConditions(new ArrayList<WorkflowCondition>());
+ workflows.put(workflow3.getId(), workflow3);
+
+ eventToWorkflowsMap.put(EVENT1_NAME, Lists.newArrayList(workflow1));
+ eventToWorkflowsMap.put(EVENT2_NAME, Lists.newArrayList(workflow1,
+ workflow2));
+ }
+
+ @Override
+ public Workflow getWorkflowByName(String workflowName)
+ throws RepositoryException {
+ Validate.notNull(workflowName);
+
+ for (Workflow workflow : workflows.values()) {
+ if (workflow.getName().equals(workflowName)) {
+ return workflow;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public Workflow getWorkflowById(String workflowId)
+ throws RepositoryException {
+ Validate.notNull(workflowId);
+
+ return workflows.get(workflowId);
+ }
+
+ @Override
+ public List<Workflow> getWorkflows() throws RepositoryException {
+ return Lists.newArrayList(workflows.values());
+ }
+
+ @Override
+ public List<WorkflowTask> getTasksByWorkflowId(String workflowId)
+ throws RepositoryException {
+ Workflow workflow = getWorkflowById(workflowId);
+ List<WorkflowTask> tasks = Lists.newArrayList();
+ if (workflow != null) {
+ tasks.addAll(workflow.getTasks());
+ }
+ return tasks;
+ }
+
+ @Override
+ public List<WorkflowTask> getTasksByWorkflowName(String workflowName)
+ throws RepositoryException {
+ List<WorkflowTask> tasks = Lists.newArrayList();
+ Workflow workflow = getWorkflowByName(workflowName);
+ if (workflow != null) {
+ tasks.addAll(workflow.getTasks());
+ }
+ return tasks;
+ }
+
+ @Override
+ public List<Workflow> getWorkflowsForEvent(String eventName)
+ throws RepositoryException {
+ Validate.notNull(eventName);
+
+ List<Workflow> workflows = eventToWorkflowsMap.get(eventName);
+ if (workflows == null) {
+ return Lists.newArrayList();
+ }
+ return workflows;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<WorkflowCondition> getConditionsByTaskName(String taskName)
+ throws RepositoryException {
+ List<WorkflowCondition> conditions = Lists.newArrayList();
+ WorkflowTask task = getWorkflowTaskByName(taskName);
+ if (task != null) {
+ conditions.addAll(task.getConditions());
+ }
+ return conditions;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<WorkflowCondition> getConditionsByTaskId(String taskId)
+ throws RepositoryException {
+ List<WorkflowCondition> conditions = Lists.newArrayList();
+ WorkflowTask task = getWorkflowTaskById(taskId);
+ if (task != null) {
+ conditions.addAll(Lists.newArrayList(task.getConditions()));
+ }
+ return conditions;
+ }
+
+ @Override
+ public WorkflowTaskConfiguration getConfigurationByTaskId(String taskId)
+ throws RepositoryException {
+ WorkflowTask task = getWorkflowTaskById(taskId);
+ if (task != null) {
+ return task.getTaskConfig();
+ }
+ return null;
+ }
+
+ @Override
+ public WorkflowTask getWorkflowTaskById(String taskId)
+ throws RepositoryException {
+ Validate.notNull(taskId);
+
+ return tasks.get(taskId);
+ }
+
+ public WorkflowTask getWorkflowTaskByName(String taskName)
+ throws RepositoryException {
+ Validate.notNull(taskName);
+
+ for (WorkflowTask task : tasks.values()) {
+ if (task.getTaskName().equals(taskName)) {
+ return task;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public WorkflowCondition getWorkflowConditionById(String conditionId)
+ throws RepositoryException {
+ Validate.notNull(conditionId);
+
+ return conditions.get(conditionId);
+ }
+
+ @Override
+ public List<String> getRegisteredEvents() throws RepositoryException {
+ return Lists.newArrayList(eventToWorkflowsMap.keySet());
+ }
+
+ @Override
+ public String addWorkflow(Workflow workflow) throws RepositoryException {
+ workflows.put(workflow.getId(), workflow);
+ return workflow.getId();
+ }
+
+ @Override
+ public List<WorkflowCondition> getConditionsByWorkflowId(String workflowId)
+ throws RepositoryException {
+ List<WorkflowCondition> conditions = Lists.newArrayList();
+ Workflow workflow = getWorkflowById(workflowId);
+ if (workflow != null) {
+ conditions.addAll(workflow.getConditions());
+ }
+ return conditions;
+ }
+}
Propchange: oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/repository/MockWorkflowRepository.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/system/MockXmlRpcWorkflowManagerClient.java
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/system/MockXmlRpcWorkflowManagerClient.java?rev=1201233&view=auto
==============================================================================
--- oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/system/MockXmlRpcWorkflowManagerClient.java (added)
+++ oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/system/MockXmlRpcWorkflowManagerClient.java Sat Nov 12 09:52:57 2011
@@ -0,0 +1,327 @@
+/*
+ * 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.system;
+
+//JDK imports
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.List;
+import java.util.Vector;
+
+//OODT imports
+import org.apache.oodt.cas.metadata.Metadata;
+import org.apache.oodt.cas.workflow.repository.MockWorkflowRepository;
+import org.apache.oodt.cas.workflow.structs.Workflow;
+import org.apache.oodt.cas.workflow.structs.WorkflowCondition;
+import org.apache.oodt.cas.workflow.structs.WorkflowInstance;
+import org.apache.oodt.cas.workflow.structs.WorkflowInstancePage;
+import org.apache.oodt.cas.workflow.structs.WorkflowTask;
+
+//Google imports
+import com.google.common.collect.Lists;
+
+/**
+ * A Mock {@link XmlRpcWorkflowManagerClient}.
+ *
+ * @author bfoster (Brian Foster)
+ */
+public class MockXmlRpcWorkflowManagerClient extends
+ XmlRpcWorkflowManagerClient {
+
+ private MethodCallDetails lastMethodCallDetails;
+ private MockWorkflowRepository workflowRepo;
+
+ public MockXmlRpcWorkflowManagerClient() throws MalformedURLException {
+ super(new URL("http://localhost:9000"));
+ workflowRepo = new MockWorkflowRepository();
+ }
+
+ public MethodCallDetails getLastMethodCallDetails() {
+ return lastMethodCallDetails;
+ }
+
+ public String executeDynamicWorkflow(List<String> taskIds, Metadata metadata)
+ throws Exception {
+ lastMethodCallDetails = new MethodCallDetails("executeDynamicWorkflow",
+ Lists.newArrayList(taskIds, metadata));
+ return "TestId1";
+ }
+
+ public List<String> getRegisteredEvents() throws Exception {
+ lastMethodCallDetails = new MethodCallDetails("getRegisteredEvents",
+ Lists.newArrayList());
+ return workflowRepo.getRegisteredEvents();
+ }
+
+ public WorkflowInstancePage getFirstPage() throws Exception {
+ lastMethodCallDetails = new MethodCallDetails("getFirstPage",
+ Lists.newArrayList());
+ WorkflowInstancePage page = new WorkflowInstancePage();
+ page.setPageNum(1);
+ page.setPageSize(0);
+ page.setTotalPages(0);
+ page.setPageWorkflows(Lists.newArrayList());
+ return page;
+ }
+
+ public WorkflowInstancePage getNextPage(WorkflowInstancePage currentPage)
+ throws Exception {
+ lastMethodCallDetails = new MethodCallDetails("getNextPage",
+ Lists.newArrayList((Object) currentPage));
+ WorkflowInstancePage page = new WorkflowInstancePage();
+ page.setPageNum(1);
+ page.setPageSize(0);
+ page.setTotalPages(0);
+ page.setPageWorkflows(Lists.newArrayList());
+ return page;
+ }
+
+ public WorkflowInstancePage getPrevPage(WorkflowInstancePage currentPage)
+ throws Exception {
+ lastMethodCallDetails = new MethodCallDetails("getPrevPage",
+ Lists.newArrayList((Object) currentPage));
+ WorkflowInstancePage page = new WorkflowInstancePage();
+ page.setPageNum(1);
+ page.setPageSize(0);
+ page.setTotalPages(0);
+ page.setPageWorkflows(Lists.newArrayList());
+ return page;
+ }
+
+ public WorkflowInstancePage getLastPage() throws Exception {
+ lastMethodCallDetails = new MethodCallDetails("getLastPage", null);
+ WorkflowInstancePage page = new WorkflowInstancePage();
+ page.setPageNum(1);
+ page.setPageSize(0);
+ page.setTotalPages(0);
+ page.setPageWorkflows(Lists.newArrayList());
+ return page;
+ }
+
+ public WorkflowInstancePage paginateWorkflowInstances(int pageNum,
+ String status) throws Exception {
+ lastMethodCallDetails = new MethodCallDetails("paginateWorkflowInstances",
+ Lists.newArrayList(pageNum, (Object) status));
+ WorkflowInstancePage page = new WorkflowInstancePage();
+ page.setPageNum(1);
+ page.setPageSize(0);
+ page.setTotalPages(0);
+ page.setPageWorkflows(Lists.newArrayList());
+ return page;
+ }
+
+ public WorkflowInstancePage paginateWorkflowInstances(int pageNum)
+ throws Exception {
+ lastMethodCallDetails = new MethodCallDetails("paginateWorkflowInstances",
+ Lists.newArrayList((Object) pageNum));
+ WorkflowInstancePage page = new WorkflowInstancePage();
+ page.setPageNum(1);
+ page.setPageSize(0);
+ page.setTotalPages(0);
+ page.setPageWorkflows(Lists.newArrayList());
+ return page;
+ }
+
+ public List<Workflow> getWorkflowsByEvent(String eventName) throws Exception {
+ lastMethodCallDetails = new MethodCallDetails("getWorkflowsByEvent",
+ Lists.newArrayList((Object) eventName));
+ return workflowRepo.getWorkflowsForEvent(eventName);
+ }
+
+ public Metadata getWorkflowInstanceMetadata(String wInstId) throws Exception {
+ lastMethodCallDetails = new MethodCallDetails("getWorkflowInstanceMetadata",
+ Lists.newArrayList((Object) wInstId));
+ return new Metadata();
+ }
+
+ public synchronized boolean setWorkflowInstanceCurrentTaskStartDateTime(
+ String wInstId, String startDateTimeIsoStr) throws Exception {
+ lastMethodCallDetails = new MethodCallDetails(
+ "setWorkflowInstanceCurrentTaskStartDateTime",
+ Lists.newArrayList((Object) wInstId, startDateTimeIsoStr));
+ return true;
+ }
+
+ public double getWorkflowCurrentTaskWallClockMinutes(String workflowInstId)
+ throws Exception {
+ lastMethodCallDetails = new MethodCallDetails(
+ "getWorkflowCurrentTaskWallClockMinutes",
+ Lists.newArrayList((Object) workflowInstId));
+ return 0.0;
+ }
+
+ public double getWorkflowWallClockMinutes(String workflowInstId)
+ throws Exception {
+ lastMethodCallDetails = new MethodCallDetails(
+ "getWorkflowWallClockMinutes",
+ Lists.newArrayList((Object) workflowInstId));
+ return 0.0;
+ }
+
+ public synchronized boolean stopWorkflowInstance(String workflowInstId)
+ throws Exception {
+ lastMethodCallDetails = new MethodCallDetails(
+ "stopWorkflowInstance",
+ Lists.newArrayList((Object) workflowInstId));
+ return true;
+ }
+
+ public synchronized boolean pauseWorkflowInstance(String workflowInstId)
+ throws Exception {
+ lastMethodCallDetails = new MethodCallDetails(
+ "pauseWorkflowInstance",
+ Lists.newArrayList((Object) workflowInstId));
+ return true;
+ }
+
+ public synchronized boolean resumeWorkflowInstance(String workflowInstId)
+ throws Exception {
+ lastMethodCallDetails = new MethodCallDetails(
+ "resumeWorkflowInstance",
+ Lists.newArrayList((Object) workflowInstId));
+ return true;
+ }
+
+ public synchronized boolean setWorkflowInstanceCurrentTaskEndDateTime(
+ String wInstId, String endDateTimeIsoStr) throws Exception {
+ lastMethodCallDetails = new MethodCallDetails(
+ "setWorkflowInstanceCurrentTaskEndDateTime",
+ Lists.newArrayList((Object) wInstId, endDateTimeIsoStr));
+ return true;
+ }
+
+ public synchronized boolean updateWorkflowInstanceStatus(
+ String workflowInstId, String status) throws Exception {
+ lastMethodCallDetails = new MethodCallDetails(
+ "updateWorkflowInstanceStatus",
+ Lists.newArrayList((Object) workflowInstId, status));
+ return true;
+ }
+
+ public synchronized boolean updateWorkflowInstance(WorkflowInstance instance)
+ throws Exception {
+ lastMethodCallDetails = new MethodCallDetails(
+ "updateWorkflowInstance",
+ Lists.newArrayList((Object) instance));
+ return true;
+ }
+
+ public synchronized boolean updateMetadataForWorkflow(String workflowInstId,
+ Metadata metadata) throws Exception {
+ lastMethodCallDetails = new MethodCallDetails(
+ "updateMetadataForWorkflow",
+ Lists.newArrayList((Object) workflowInstId, metadata));
+ return true;
+ }
+
+ public boolean sendEvent(String eventName, Metadata metadata)
+ throws Exception {
+ lastMethodCallDetails = new MethodCallDetails(
+ "sendEvent",
+ Lists.newArrayList((Object) eventName, metadata));
+ return true;
+ }
+
+ public WorkflowTask getTaskById(String taskId) throws Exception {
+ lastMethodCallDetails = new MethodCallDetails(
+ "getTaskById",
+ Lists.newArrayList((Object) taskId));
+ return workflowRepo.getWorkflowTaskById(taskId);
+ }
+
+ public WorkflowCondition getConditionById(String conditionId)
+ throws Exception {
+ lastMethodCallDetails = new MethodCallDetails(
+ "getConditionById",
+ Lists.newArrayList((Object) conditionId));
+ return workflowRepo.getWorkflowConditionById(conditionId);
+ }
+
+ public WorkflowInstance getWorkflowInstanceById(String wInstId)
+ throws Exception {
+ lastMethodCallDetails = new MethodCallDetails(
+ "getWorkflowInstanceById",
+ Lists.newArrayList((Object) wInstId));
+ WorkflowInstance wInst = new WorkflowInstance();
+ wInst.setStatus("Running");
+ wInst.setId("TestId");
+ wInst.setWorkflow(workflowRepo.getWorkflowById(
+ MockWorkflowRepository.WORKFLOW1_ID));
+ wInst.setCurrentTaskId(MockWorkflowRepository.TASK1_ID);
+ return wInst;
+ }
+
+ public Workflow getWorkflowById(String workflowId) throws Exception {
+ lastMethodCallDetails = new MethodCallDetails(
+ "getWorkflowById",
+ Lists.newArrayList((Object) workflowId));
+ return workflowRepo.getWorkflowById(workflowId);
+ }
+
+ public Vector<Workflow> getWorkflows() throws Exception {
+ lastMethodCallDetails = new MethodCallDetails(
+ "getWorkflows",
+ Lists.newArrayList());
+ return new Vector<Workflow>(workflowRepo.getWorkflows());
+ }
+
+ public int getNumWorkflowInstancesByStatus(String status) throws Exception {
+ lastMethodCallDetails = new MethodCallDetails(
+ "getNumWorkflowInstancesByStatus",
+ Lists.newArrayList((Object) status));
+ return 1;
+ }
+
+ public int getNumWorkflowInstances() throws Exception {
+ lastMethodCallDetails = new MethodCallDetails(
+ "getNumWorkflowInstances",
+ Lists.newArrayList());
+ return 1;
+ }
+
+ public Vector<WorkflowInstance> getWorkflowInstancesByStatus(String status) throws Exception {
+ lastMethodCallDetails = new MethodCallDetails(
+ "getWorkflowInstancesByStatus",
+ Lists.newArrayList((Object) status));
+ return new Vector<WorkflowInstance>();
+ }
+
+ public Vector<WorkflowInstance> getWorkflowInstances() throws Exception {
+ lastMethodCallDetails = new MethodCallDetails(
+ "getWorkflowInstances",
+ Lists.newArrayList());
+ return new Vector<WorkflowInstance>();
+ }
+
+ public class MethodCallDetails {
+ private String methodName;
+ private List<Object> args;
+
+ public MethodCallDetails(String methodName, List<Object> args) {
+ this.methodName = methodName;
+ this.args = args;
+ }
+
+ public String getMethodName() {
+ return methodName;
+ }
+
+ public List<Object> getArgs() {
+ return args;
+ }
+ }
+}
Propchange: oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/system/MockXmlRpcWorkflowManagerClient.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/system/TestXmlRpcWorkflowManagerClient.java
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/system/TestXmlRpcWorkflowManagerClient.java?rev=1201233&r1=1201232&r2=1201233&view=diff
==============================================================================
--- oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/system/TestXmlRpcWorkflowManagerClient.java (original)
+++ oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/system/TestXmlRpcWorkflowManagerClient.java Sat Nov 12 09:52:57 2011
@@ -160,15 +160,13 @@ public class TestXmlRpcWorkflowManagerCl
for (Iterator i = met.getAllMetadata("key2").iterator(); i.hasNext();) {
String val = (String) i.next();
- if (val.equals("val1")) {
+ if (val.equals("val4")) {
checkVal4 = true;
- } else if (val.equals("val2")) {
+ } else if (val.equals("val5")) {
checkVal5 = true;
}
}
- assert (checkVal4 && checkVal5);
-
+ assertTrue(checkVal4 && checkVal5);
}
-
}