@Test public void variableInstanceLogTest() throws Exception { Assume.assumeFalse(getType().equals(TestType.YAML)); long processInstanceId = 23; String processId = "org.hospital.intern.rounds"; String variableInstanceId = "patientNum-1"; String variableId = "patientNum"; String value = "33"; String oldValue = "32"; org.jbpm.process.audit.VariableInstanceLog origLog = new org.jbpm.process.audit.VariableInstanceLog( processInstanceId, processId, variableInstanceId, variableId, value, oldValue); origLog.setExternalId("outside-identity-representation"); origLog.setOldValue("previous-data-that-this-variable-contains"); origLog.setValue("the-new-data-that-has-been-put-in-this-variable"); origLog.setVariableId("shortend-representation-of-this-representation"); origLog.setVariableInstanceId("id-instance-variable"); JaxbVariableInstanceLog xmlLog = new JaxbVariableInstanceLog(origLog); xmlLog.setCommandName("test-cmd"); xmlLog.setIndex(2); JaxbVariableInstanceLog newXmlLog = testRoundTrip(xmlLog); ComparePair.compareObjectsViaFields(xmlLog, newXmlLog, "id"); VariableInstanceLog newLog = newXmlLog.getResult(); ComparePair.compareOrig(origLog, newLog, VariableInstanceLog.class); }
@Test public void nodeInstanceLogTest() throws Exception { Assume.assumeFalse(getType().equals(TestType.YAML)); int type = 0; long processInstanceId = 23; String processId = "org.hospital.doctor.review"; String nodeInstanceId = "1-1"; String nodeId = "1"; String nodeName = "notification"; org.jbpm.process.audit.NodeInstanceLog origLog = new org.jbpm.process.audit.NodeInstanceLog( type, processInstanceId, processId, nodeInstanceId, nodeId, nodeName); origLog.setWorkItemId(78l); origLog.setConnection("link"); origLog.setExternalId("not-internal-num"); origLog.setNodeType("the-sort-of-point"); JaxbNodeInstanceLog xmlLog = new JaxbNodeInstanceLog(origLog); xmlLog.setCommandName("test-cmd"); xmlLog.setIndex(2); xmlLog.setId(2l); JaxbNodeInstanceLog newXmlLog = testRoundTrip(xmlLog); ComparePair.compareOrig(xmlLog, newXmlLog, JaxbNodeInstanceLog.class); NodeInstanceLog newLog = newXmlLog.getResult(); ComparePair.compareOrig(origLog, newLog, NodeInstanceLog.class); }
@Test public void deploymentObjectsTest() throws Exception { Assume.assumeFalse(getType().equals(TestType.YAML)); // for test at end, fill during test JaxbDeploymentUnitList depUnitList = new JaxbDeploymentUnitList(); // dep jobs JaxbDeploymentJobResult jaxbJob = new JaxbDeploymentJobResult(); testRoundTrip(jaxbJob); // complex dep jobs KModuleDeploymentUnit kDepUnit = new KModuleDeploymentUnit("org", "jar", "1.0", "kbase", "ksession"); kDepUnit.setStrategy(RuntimeStrategy.PER_PROCESS_INSTANCE); JaxbDeploymentUnit depUnit = new JaxbDeploymentUnit( kDepUnit.getGroupId(), kDepUnit.getArtifactId(), kDepUnit.getArtifactId()); depUnit.setKbaseName(kDepUnit.getKbaseName()); depUnit.setKsessionName(kDepUnit.getKsessionName()); depUnit.setStrategy(kDepUnit.getStrategy()); depUnit.setStatus(JaxbDeploymentStatus.NONEXISTENT); depUnitList.getDeploymentUnitList().add(depUnit); jaxbJob = new JaxbDeploymentJobResult(null, "test", depUnit, "deploy"); jaxbJob.setIdentifier(23L); jaxbJob.setSuccess(false); JaxbDeploymentJobResult copyJaxbJob = testRoundTrip(jaxbJob); ComparePair.compareObjectsViaFields(jaxbJob, copyJaxbJob, "jobId", "identifier"); depUnit = new JaxbDeploymentUnit("g", "a", "v"); depUnit.setKbaseName("kbase"); depUnit.setKsessionName("ksession"); depUnit.setStatus(JaxbDeploymentStatus.DEPLOY_FAILED); depUnit.setStrategy(RuntimeStrategy.PER_PROCESS_INSTANCE); depUnitList.getDeploymentUnitList().add(depUnit); JaxbDeploymentUnit copyDepUnit = testRoundTrip(depUnit); ComparePair.compareObjectsViaFields(depUnit, copyDepUnit, "identifier"); JaxbDeploymentJobResult depJob = new JaxbDeploymentJobResult(null, "testing stuff", copyDepUnit, "test"); depJob.setSuccess(true); JaxbDeploymentJobResult copyDepJob = testRoundTrip(depJob); ComparePair.compareObjectsViaFields(copyDepJob, depJob, "jobId", "identifier"); JaxbDeploymentUnitList roundTripUnitList = testRoundTrip(depUnitList); ComparePair.compareObjectsViaFields( depUnitList.getDeploymentUnitList().get(0), roundTripUnitList.getDeploymentUnitList().get(0), "jobId", "identifier"); }
@Test public void processIdAndProcessDefinitionTest() throws Exception { // JaxbProcessDefinition ProcessAssetDesc assetDesc = new ProcessAssetDesc( "org.test.proc.id", "The Name Of The Process", "1.999.23.Final", "org.test.proc", "RuleFlow", KnowledgeType.PROCESS.toString(), "org.test.proc", "org.test.proc:procs:1.999.Final"); JaxbProcessDefinition jaxbProcDef = new JaxbProcessDefinition(); jaxbProcDef.setDeploymentId(assetDesc.getDeploymentId()); jaxbProcDef.setId(assetDesc.getId()); jaxbProcDef.setName(assetDesc.getName()); jaxbProcDef.setPackageName(assetDesc.getPackageName()); jaxbProcDef.setVersion(assetDesc.getVersion()); Map<String, String> forms = new HashMap<String, String>(); forms.put("locationForm", "GPS: street: post code: city: state: land: planet: universe: "); jaxbProcDef.setForms(forms); JaxbProcessDefinition copyJaxbProcDef = testRoundTrip(jaxbProcDef); ComparePair.compareObjectsViaFields(jaxbProcDef, copyJaxbProcDef); }
@Test public void workItemObjectTest() throws Exception { // Don't run with YAML? Assume.assumeFalse(getType().equals(TestType.YAML)); JaxbWorkItemResponse workitemObject = new JaxbWorkItemResponse(); workitemObject.setId(35l); workitemObject.setName("Clau"); workitemObject.setState(0); workitemObject.setProcessInstanceId(1l); Map<String, Object> params = new HashMap<String, Object>(); params.put("test", "driving"); workitemObject.setParameters(params); JaxbWorkItemResponse roundTripWorkItem = testRoundTrip(workitemObject); ComparePair.compareObjectsViaFields(workitemObject, roundTripWorkItem); }
@Test public void processInstanceLogTest() throws Exception { Assume.assumeFalse(getType().equals(TestType.YAML)); org.jbpm.process.audit.ProcessInstanceLog origLog = new org.jbpm.process.audit.ProcessInstanceLog(54, "org.hospital.patient.triage"); origLog.setDuration(65l); origLog.setDuration(234l); origLog.setEnd(new Date((new Date()).getTime() + 1000)); origLog.setExternalId("testDomainId"); origLog.setIdentity("identityNotMemory"); origLog.setProcessInstanceDescription("What a process, say!"); // nullable origLog.setStatus(2); origLog.setOutcome("descriptiveErrorCodeOfAnError"); origLog.setParentProcessInstanceId(65l); origLog.setProcessName("org.process.not.technical"); origLog.setProcessVersion("v3.14"); JaxbProcessInstanceLog xmlLog = new JaxbProcessInstanceLog(origLog); xmlLog.setCommandName("test-cmd"); xmlLog.setIndex(2); JaxbProcessInstanceLog newXmlLog = testRoundTrip(xmlLog); ComparePair.compareObjectsViaFields(xmlLog, newXmlLog, "id"); ProcessInstanceLog newLog = newXmlLog.getResult(); ProcessInstanceLog origCmpLog = origLog; assertEquals(origLog.getExternalId(), newLog.getExternalId()); assertEquals(origCmpLog.getIdentity(), newLog.getIdentity()); assertEquals(origCmpLog.getOutcome(), newLog.getOutcome()); assertEquals(origCmpLog.getProcessId(), newLog.getProcessId()); assertEquals(origCmpLog.getProcessName(), newLog.getProcessName()); assertEquals(origCmpLog.getProcessVersion(), newLog.getProcessVersion()); assertEquals(origCmpLog.getDuration(), newLog.getDuration()); assertEquals(origCmpLog.getEnd(), newLog.getEnd()); assertEquals(origCmpLog.getParentProcessInstanceId(), newLog.getParentProcessInstanceId()); assertEquals(origCmpLog.getProcessInstanceId(), newLog.getProcessInstanceId()); assertEquals(origCmpLog.getStart(), newLog.getStart()); assertEquals(origCmpLog.getStatus(), newLog.getStatus()); }