Dom4JFPDLParser parser = new Dom4JFPDLParser();
for (int i = 0; i < workflowProcessFileNames.size(); i++) {
try {
InputStream inStream = this.getClass().getResourceAsStream(workflowProcessFileNames.get(i).trim());
WorkflowProcess workflowProcess = parser.parse(inStream);
WorkflowDefinition workflowDef = new WorkflowDefinition();
workflowDef.setWorkflowProcess(workflowProcess);
ids.add(workflowProcess.getId());
persistenceService.saveOrUpdateWorkflowDefinition(workflowDef);
} catch (IOException ex) {
Logger.getLogger(PersistenceServiceHibernateImplTest.class.getName()).log(Level.SEVERE, null, ex);
} catch (FPDLParserException ex) {
Logger.getLogger(PersistenceServiceHibernateImplTest.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
return ids;
}
});
assertNotNull(workflowProcessIds);
assertEquals(2,workflowProcessIds.size());
Goods_Deliver_Process_ID = workflowProcessIds.get(0);
JumpTo_ID = workflowProcessIds.get(1);
WorkflowDefinition def1 = persistenceService.findTheLatestVersionOfWorkflowDefinitionByProcessId(Goods_Deliver_Process_ID);
assertNotNull(def1);
workflowDefinitionId4Goods_Deliver_Process_ID = def1.getId();
theLatestVersionNumber4Goods_Deliver_Process_ID = def1.getVersion();
System.out.println("The latest version number of "+Goods_Deliver_Process_ID+" is "+def1.getVersion());
System.out.println("======================The workflow process is ===========");
System.out.println(def1.getProcessContent());
assertNotNull(def1.getWorkflowProcess());
assertEquals(Goods_Deliver_Process_ID,def1.getWorkflowProcess().getId());
WorkflowDefinition def2 = persistenceService.findTheLatestVersionOfWorkflowDefinitionByProcessId(JumpTo_ID);
assertNotNull(def2);
System.out.println("The latest version number of "+JumpTo_ID+" is "+def2.getVersion());
System.out.println("======================The workflow process is ===========");
System.out.println(def2.getProcessContent());
assertNotNull(def2.getWorkflowProcess());
assertEquals(JumpTo_ID,def2.getWorkflowProcess().getId());
}