@Test @OperateOnDeployment("clientDeployment") public void testResolveClass() { // assert that we cannot load the delegate here: try { Class.forName("org.camunda.bpm.integrationtest.functional.classloading.ExampleDelegate"); Assert.fail("CNFE expected"); }catch (ClassNotFoundException e) { // expected } // but the process can since it performs context switch to the process archive for execution runtimeService.startProcessInstanceByKey("testResolveClass"); }
@Test @OperateOnDeployment("clientDeployment") public void testResolveClass() { // assert that we cannot load the delegate here: try { Class.forName("org.camunda.bpm.integrationtest.functional.classloading.ExampleDelegate"); Assert.fail("CNFE expected"); }catch (ClassNotFoundException e) { // expected } // but the process can since it performs context switch to the process archive vor execution runtimeService.startProcessInstanceByKey("testResolveClass"); }
@Test @OperateOnDeployment("mainDeployment") public void testDelegateVariableMapping() { //given runtimeService.startProcessInstanceByKey("callSimpleSubProcess"); testDelegation(); }
@Test @OperateOnDeployment("mainDeployment") public void testDelegateVariableMappingExpression() { runtimeService.startProcessInstanceByKey("callSubProcessExpr"); testDelegation(); }
@Test @OperateOnDeployment("checkDeployment") public void testNoProcessApplicationIsDeployed() { Set<String> registeredPAs = BpmPlatform.getProcessApplicationService().getProcessApplicationNames(); Assert.assertTrue(registeredPAs.isEmpty()); } }
@Test @OperateOnDeployment("app") public void testInvokeProcessApplicationWithContextOnStart() { ProcessInstance pi = runtimeService.startProcessInstanceByKey("messageProcess"); InvocationContext invocationContext = ProcessApplicationWithInvocationContext.getInvocationContext(); assertThat(invocationContext, is(notNullValue())); assertThat(invocationContext.getExecution(), is(notNullValue())); assertThat(invocationContext.getExecution().getId(), is(pi.getId())); }
@Test @OperateOnDeployment("test1") public void testNonExistingEngineRetrieval() { ProcessEngineService engineService = BpmPlatform.getProcessEngineService(); ProcessEngine engine = engineService.getProcessEngine("aNonExistingEngineName"); Assert.assertNull(engine); } }
@Test @OperateOnDeployment("clientDeployment") public void testResolveClass() { // assert that we cannot load the delegate here: try { Class.forName("org.camunda.bpm.integrationtest.functional.classloading.beans.ExampleSignallableActivityBehavior"); Assert.fail("CNFE expected"); }catch (ClassNotFoundException e) { // expected } // but the process can since it performs context switch to the process archive for execution ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("testResolveClass"); runtimeService.signal(processInstance.getId()); }
@Test @OperateOnDeployment("clientDeployment") public void testTimerStartWithBeanExpression() { ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().singleResult(); Assert.assertNotNull(processDefinition); } }
@Test @OperateOnDeployment("test1") public void testProcessApplicationsDeployed() { ProcessApplicationService processApplicationService = BpmPlatform.getProcessApplicationService(); Set<String> processApplicationNames = processApplicationService.getProcessApplicationNames(); // check if the new applications are deployed with allowed names processApplicationNames.retainAll(Arrays.asList(new String [] {"test1", "test2", "/test1", "/test2"})); Assert.assertEquals(2, processApplicationNames.size()); for (String appName : processApplicationNames) { ProcessApplicationInfo processApplicationInfo = processApplicationService.getProcessApplicationInfo(appName); Assert.assertNotNull(processApplicationInfo); Assert.assertNotNull(processApplicationInfo.getName()); Assert.assertEquals(1, processApplicationInfo.getDeploymentInfo().size()); } }
@Test @OperateOnDeployment("app") public void testInvokeProcessApplicationWithContextOnSignalTask() { runtimeService.startProcessInstanceByKey("signalableProcess"); ProcessApplicationWithInvocationContext.clearInvocationContext(); Execution execution = runtimeService.createExecutionQuery().activityId("waitingTask").singleResult(); assertThat(execution, is(notNullValue())); runtimeService.signal(execution.getId()); InvocationContext invocationContext = ProcessApplicationWithInvocationContext.getInvocationContext(); assertThat(invocationContext, is(notNullValue())); assertThat(invocationContext.getExecution(), is(notNullValue())); assertThat(invocationContext.getExecution().getId(), is(execution.getId())); }
@Test @OperateOnDeployment("app") public void testInvokeProcessApplicationWithContextOnAsyncExecution() { runtimeService.startProcessInstanceByKey("timerProcess"); ProcessApplicationWithInvocationContext.clearInvocationContext(); Job timer = managementService.createJobQuery().timers().singleResult(); assertThat(timer, is(notNullValue())); long dueDate = timer.getDuedate().getTime(); Date afterDueDate = new Date(dueDate + 1000 * 60); ClockUtil.setCurrentTime(afterDueDate); waitForJobExecutorToProcessAllJobs(); InvocationContext invocationContext = ProcessApplicationWithInvocationContext.getInvocationContext(); assertThat(invocationContext, is(notNullValue())); assertThat(invocationContext.getExecution(), is(notNullValue())); assertThat(invocationContext.getExecution().getId(), is(timer.getExecutionId())); }
@Test @OperateOnDeployment("clientDeployment") public void testStartInstanceWithBeanCondition() { ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("process"); assertEquals("okay", runtimeService.getVariable(processInstance.getId(), "result")); } }
@Test @SuppressWarnings("unchecked") @OperateOnDeployment("clientDeployment") public void shouldSwitchContextWhenCallingFromBpmn() { ProcessInstance pi = runtimeService.startProcessInstanceByKey("testProcess"); VariableInstance decisionResult = runtimeService.createVariableInstanceQuery() .processInstanceIdIn(pi.getId()) .variableName("result").singleResult(); List<Map<String, Object>> result = (List<Map<String, Object>>) decisionResult.getValue(); assertEquals("ok", result.get(0).get("result")); }
@Test @OperateOnDeployment("checker") public void test() { // make sure the deployment of the first app was rolled back long count = processEngine.getRepositoryService() .createDeploymentQuery() .count(); Assert.assertEquals(1, count); }
@Test @OperateOnDeployment("pa") public void testNullElResolverIsIgnored() { // The expression should be resolved correctly although the NullElResolver // is present runtimeService.startProcessInstanceByKey("elServiceTaskProcess"); Assert.assertNotNull(taskService.createTaskQuery().singleResult()); } }
@OperateOnDeployment("pa1") @Test public void testDeploymentRegistration() { Set<String> registeredDeploymentsForEngine1 = engine1.getManagementService().getRegisteredDeployments(); Set<String> registeredDeploymentsForDefaultEngine = processEngine.getManagementService().getRegisteredDeployments(); ProcessApplicationInfo pa1Info = getProcessApplicationDeploymentInfo("pa1"); List<ProcessApplicationDeploymentInfo> pa1DeploymentInfo = pa1Info.getDeploymentInfo(); Assert.assertEquals(1, pa1DeploymentInfo.size()); Assert.assertTrue(registeredDeploymentsForEngine1.contains(pa1DeploymentInfo.get(0).getDeploymentId())); ProcessApplicationInfo pa2Info = getProcessApplicationDeploymentInfo("pa2"); List<ProcessApplicationDeploymentInfo> pa2DeploymentInfo = pa2Info.getDeploymentInfo(); Assert.assertEquals(1, pa2DeploymentInfo.size()); Assert.assertTrue(registeredDeploymentsForDefaultEngine.contains(pa2DeploymentInfo.get(0).getDeploymentId())); }
@Test @OperateOnDeployment("app") public void testInvokeProcessApplicationWithContextOnMessageReceived() { ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("messageProcess"); ProcessApplicationWithInvocationContext.clearInvocationContext(); EventSubscription messageSubscription = runtimeService.createEventSubscriptionQuery().eventType("message").processInstanceId(processInstance.getId()).singleResult(); assertThat(messageSubscription, is(notNullValue())); runtimeService.messageEventReceived(messageSubscription.getEventName(), messageSubscription.getExecutionId()); InvocationContext invocationContext = ProcessApplicationWithInvocationContext.getInvocationContext(); assertThat(invocationContext, is(notNullValue())); assertThat(invocationContext.getExecution(), is(notNullValue())); assertThat(invocationContext.getExecution().getId(), is(messageSubscription.getExecutionId())); }
@Test @OperateOnDeployment("clientDeployment") public void testResolveClass() { // assert that we cannot resolve the bean here: Assert.assertNull(ProgrammaticBeanLookup.lookup("exampleSignallableActivityBehaviorBean")); // but the process can since it performs context switch to the process archive for execution ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("testResolveBean"); runtimeService.signal(processInstance.getId()); }
@Test @OperateOnDeployment("dummy-client") public void testGracefulDegradationOnMissingBean() { // when processInstance = runtimeService.startProcessInstanceByKey("priorityProcess"); // then the job was created successfully and has the default priority on bean evaluation failure Job job = managementService.createJobQuery().singleResult(); Assert.assertEquals(DefaultJobPriorityProvider.DEFAULT_PRIORITY_ON_RESOLUTION_FAILURE, job.getPriority()); }