AvroRpcWorkflowManager implements WorkflowManager,org.apache.oodt.cas.workflow.struct.avrotypes.WorkflowManager { @Override public List<AvroWorkflowInstance> getWorkflowInstances() throws AvroRemoteException { List workflowInsts = null; List<AvroWorkflowInstance> avroWorkflowInstances = new ArrayList<AvroWorkflowInstance>(); try { workflowInsts = engine.getInstanceRepository() .getWorkflowInstances(); } catch (Exception e) { logger.error("Exception getting workflow instances. Message: {}", e.getMessage()); return avroWorkflowInstances; } if (workflowInsts != null) { logger.debug("Retrieved {} workflow instances", workflowInsts.size()); try { for (WorkflowInstance wi :(List<WorkflowInstance>) workflowInsts){ Workflow wDesc = repo.getWorkflowById(wi.getWorkflow() .getId()); if(wDesc == null){ wDesc = wi.getWorkflow(); repo.addWorkflow(wDesc); } wi.setWorkflow(wDesc); avroWorkflowInstances.add(AvroTypeFactory.getAvroWorkflowInstance(wi)); } return avroWorkflowInstances; } catch (Exception e) { logger.error("Error getting workflow instances", e); throw new AvroRemoteException( "Exception getting workflow instances from workflow engine: Message: " + e.getMessage()); } } else return null; } AvroRpcWorkflowManager();  AvroRpcWorkflowManager(int port); @Override boolean shutdown(); @Override boolean refreshRepository(); @Override String executeDynamicWorkflow(List<String> taskIds, Map<String, Object> metadata); @Override List<String> getRegisteredEvents(); @Override AvroWorkflowInstancePage getFirstPage(); @Override AvroWorkflowInstancePage getNextPage(AvroWorkflowInstancePage currentPage); @Override AvroWorkflowInstancePage getPrevPage(AvroWorkflowInstancePage currentPage); @Override AvroWorkflowInstancePage getLastPage(); @Override AvroWorkflowInstancePage paginateWorkflowInstancesOfStatus(int pageNum, String status); @Override AvroWorkflowInstancePage paginateWorkflowInstances(int pageNum); @Override List<AvroWorkflow> getWorkflowsByEvent(String eventName); @Override Map<String, Object> getWorkflowInstanceMetadata(String wInstId); @Override boolean handleEvent(String eventName, Map<String, Object> metadata); @Override AvroWorkflowInstance getWorkflowInstanceById(String wInstId); @Override boolean stopWorkflowInstance(String workflowInstId); @Override boolean pauseWorkflowInstance(String workflowInstId); @Override boolean resumeWorkflowInstance(String workflowInstId); @Override double getWorkflowWallClockMinutes(String workflowInstId); @Override double getWorkflowCurrentTaskWallClockMinutes(String workflowInstId); @Override int getNumWorkflowInstancesByStatus(String status); @Override int getNumWorkflowInstances(); @Override List<AvroWorkflowInstance> getWorkflowInstancesByStatus(String status); @Override List<AvroWorkflowInstance> getWorkflowInstances(); @Override List<AvroWorkflow> getWorkflows(); @Override AvroWorkflowTask getTaskById(String taskId); @Override AvroWorkflowCondition getConditionById(String conditionId); @Override AvroWorkflow getWorkflowById(String workflowId); @Override synchronized boolean updateMetadataForWorkflow(String workflowInstId, Map<String, Object> metadata); @Override synchronized boolean updateWorkflowInstance(AvroWorkflowInstance instance); @Override boolean setWorkflowInstanceCurrentTaskStartDateTime(String wInstId, String startDateTimeIsoStr); @Override synchronized boolean setWorkflowInstanceCurrentTaskEndDateTime(String wInstId, String endDateTimeIsoStr); static void loadProperties(); @Override synchronized boolean updateWorkflowInstanceStatus(String workflowInstId, String status);  }
@Test public void testGetWorkflowInstances() { Vector workflowInsts = null; try { List list = AvroTypeFactory.getWorkflowInstances(wmgr.getWorkflowInstances()); workflowInsts = new Vector(); for (Object o : list) { workflowInsts.add(o); } } catch (Exception e) { e.printStackTrace(); } assertNotNull(workflowInsts); assertEquals(2, workflowInsts.size()); }