示例#1
0
        public virtual void testMigrateWithSubTask()
        {
            //given
            ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(ProcessModels.ONE_TASK_PROCESS);
            ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(ProcessModels.ONE_TASK_PROCESS);

            MigrationPlan migrationPlan = runtimeService.createMigrationPlan(sourceProcessDefinition.Id, targetProcessDefinition.Id).mapEqualActivities().build();

            ProcessInstance processInstance = runtimeService.startProcessInstanceById(sourceProcessDefinition.Id);

            Task task    = taskService.createTaskQuery().singleResult();
            Task subTask = taskService.newTask();

            subTask.ParentTaskId = task.Id;
            taskService.saveTask(subTask);

            // when
            runtimeService.newMigration(migrationPlan).processInstanceIds(Arrays.asList(processInstance.Id)).execute();

            // then the historic sub task instance is still the same
            HistoricTaskInstance historicSubTaskAfterMigration = historyService.createHistoricTaskInstanceQuery().taskId(subTask.Id).singleResult();

            Assert.assertNotNull(historicSubTaskAfterMigration);
            Assert.assertNull(historicSubTaskAfterMigration.ProcessDefinitionId);
            Assert.assertNull(historicSubTaskAfterMigration.ProcessDefinitionKey);
            Assert.assertNull(historicSubTaskAfterMigration.ExecutionId);
            Assert.assertNull(historicSubTaskAfterMigration.ActivityInstanceId);
        }
示例#2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testExecuteExclusiveFollowUpJobInDifferentProcessInstance()
        public virtual void testExecuteExclusiveFollowUpJobInDifferentProcessInstance()
        {
            testHelper.deploy(CALL_ACTIVITY_PROCESS, ONE_TASK_PROCESS);

            // given
            // a process instance with a single job
            ProcessInstance processInstance = engineRule.RuntimeService.startProcessInstanceByKey("callActivityProcess");

            jobExecutor.start();

            // and first job acquisition that acquires the job
            acquisitionThread.waitForSync();
            acquisitionThread.makeContinueAndWaitForSync();
            // and job is executed
            acquisitionThread.makeContinueAndWaitForSync();

            // then
            // the called instance has been created
            ProcessInstance calledInstance = engineRule.RuntimeService.createProcessInstanceQuery().superProcessInstanceId(processInstance.Id).singleResult();

            Assert.assertNotNull(calledInstance);

            // and there is a transition instance for the service task
            ActivityInstance activityInstance = engineRule.RuntimeService.getActivityInstance(calledInstance.Id);

            Assert.assertEquals(1, activityInstance.getTransitionInstances("serviceTask").Length);

            // but the corresponding job is not locked
            JobEntity followUpJob = (JobEntity)engineRule.ManagementService.createJobQuery().singleResult();

            Assert.assertNotNull(followUpJob);
            Assert.assertNull(followUpJob.LockOwner);
            Assert.assertNull(followUpJob.LockExpirationTime);
        }
示例#3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test @OperateOnDeployment("test1") public void testNonExistingEngineRetrieval()
        public virtual void testNonExistingEngineRetrieval()
        {
            ProcessEngineService engineService = BpmPlatform.ProcessEngineService;
            ProcessEngine        engine        = engineService.getProcessEngine("aNonExistingEngineName");

            Assert.assertNull(engine);
        }
示例#4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testResolveClass()
        public virtual void testResolveClass()
        {
            string pid = runtimeService.startProcessInstanceByKey("testResolveVariable").Id;

            waitForJobExecutorToProcessAllJobs();

            Assert.assertNull(runtimeService.createProcessInstanceQuery().processInstanceId(pid).singleResult());
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void mapPositionTest()
        public virtual void mapPositionTest()
        {
            FrameBufferModel frameBufferModel = new FrameBufferModel();

            Assert.assertNull(frameBufferModel.MapPosition);

            frameBufferModel.MapPosition = new MapPosition(new LatLong(0, 0, true), (sbyte)0);
            Assert.assertEquals(new MapPosition(new LatLong(0, 0, true), (sbyte)0), frameBufferModel.MapPosition);
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void dimensionTest()
        public virtual void dimensionTest()
        {
            FrameBufferModel frameBufferModel = new FrameBufferModel();

            Assert.assertNull(frameBufferModel.Dimension);

            frameBufferModel.Dimension = new Dimension(0, 0);
            Assert.assertEquals(new Dimension(0, 0), frameBufferModel.Dimension);
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void dimensionTest()
        public virtual void dimensionTest()
        {
            MapViewDimension mapViewDimension = new MapViewDimension();

            Assert.assertNull(mapViewDimension.Dimension);

            mapViewDimension.Dimension = new Dimension(0, 0);
            Assert.assertEquals(new Dimension(0, 0), mapViewDimension.Dimension);
        }
示例#8
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test @OperateOnDeployment("clientDeployment") public void testResolveClass()
        public virtual 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.Id);
        }
示例#9
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void testExecutionInPAContextByName() throws Exception
        public virtual void testExecutionInPAContextByName()
        {
            Assert.assertNull(Context.CurrentProcessApplication);

            ProcessApplicationReference contextPA = ProcessApplicationContext.withProcessApplicationContext(new CallableAnonymousInnerClass(this)
                                                                                                            , pa.Name);

            Assert.assertEquals(contextPA.ProcessApplication, pa);

            Assert.assertNull(Context.CurrentProcessApplication);
        }
示例#10
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test @OperateOnDeployment("clientDeployment") public void testResolveBean()
        public virtual void testResolveBean()
        {
            // assert that we cannot resolve the bean here:
            Assert.assertNull(ProgrammaticBeanLookup.lookup("exampleBean"));

            Assert.assertEquals(0, runtimeService.createProcessInstanceQuery().processDefinitionKey("testResolveBean").count());
            // but the process engine can:
            runtimeService.startProcessInstanceByKey("testResolveBean");

            Assert.assertEquals(0, runtimeService.createProcessInstanceQuery().processDefinitionKey("testResolveBean").count());
        }
示例#11
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void testSetPAContextByRawPA() throws org.camunda.bpm.application.ProcessApplicationUnavailableException
        public virtual void testSetPAContextByRawPA()
        {
            Assert.assertNull(Context.CurrentProcessApplication);

            try
            {
                ProcessApplicationContext.CurrentProcessApplication = pa;

                Assert.assertEquals(pa, CurrentContextApplication.ProcessApplication);
            }
            finally
            {
                ProcessApplicationContext.clear();
            }

            Assert.assertNull(Context.CurrentProcessApplication);
        }
示例#12
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test @OperateOnDeployment("clientDeployment") public void testModificationClassloading()
        public virtual void testModificationClassloading()
        {
            // given
            // process instance is in state "waitState"
            string pi = runtimeService.startProcessInstanceByKey("testProcess").Id;

            Assert.assertNull(runtimeService.getVariable(pi, "executed"));

            // if
            // we modify the process instance to start the next task:
            ProcessInstanceModificationInstantiationBuilder modification = runtimeService.createProcessInstanceModification(pi).startBeforeActivity("ServiceTask_1");

            // then
            // the modification does not fail
            modification.execute();
            Assert.assertTrue((bool?)runtimeService.getVariable(pi, "executed"));
        }
示例#13
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void testSetPAContextByName() throws org.camunda.bpm.application.ProcessApplicationUnavailableException
        public virtual void testSetPAContextByName()
        {
            Assert.assertNull(Context.CurrentProcessApplication);

            try
            {
                ProcessApplicationContext.CurrentProcessApplication = pa.Name;

                Assert.assertEquals(CurrentContextApplication.ProcessApplication, pa);
            }
            finally
            {
                ProcessApplicationContext.clear();
            }

            Assert.assertNull(Context.CurrentProcessApplication);
        }
示例#14
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testDeployProcessArchive()
        public virtual void testDeployProcessArchive()
        {
            // start a spring application context
            AbstractApplicationContext applicationContext = new ClassPathXmlApplicationContext("org/camunda/bpm/engine/spring/test/application/SpringProcessArchiveDeploymentTest-context.xml");

            applicationContext.start();

            // assert the process archive is deployed:
            ProcessEngine processEngine = BpmPlatform.DefaultProcessEngine;

            Assert.assertNotNull(processEngine.RepositoryService.createDeploymentQuery().deploymentName("pa").singleResult());

            applicationContext.close();

            // assert the process is undeployed
            Assert.assertNull(processEngine.RepositoryService.createDeploymentQuery().deploymentName("pa").singleResult());
        }
示例#15
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testProcessApplicationDeployment()
        public virtual void testProcessApplicationDeployment()
        {
            // initially no applications are deployed:
            Assert.assertEquals(0, BpmPlatform.ProcessApplicationService.ProcessApplicationNames.Count);

            // start a spring application context
            AbstractApplicationContext applicationContext = new ClassPathXmlApplicationContext("org/camunda/bpm/engine/spring/test/application/SpringProcessApplicationDeploymentTest-context.xml");

            applicationContext.start();

            // assert that there is a process application deployed with the name of the process application bean
            Assert.assertNotNull(BpmPlatform.ProcessApplicationService.getProcessApplicationInfo("myProcessApplication"));

            // close the spring application context
            applicationContext.close();

            // after closing the application context, the process application is undeployed.
            Assert.assertNull(BpmPlatform.ProcessApplicationService.getProcessApplicationInfo("myProcessApplication"));
        }
示例#16
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void mapLimitTest()
        public virtual void mapLimitTest()
        {
            MapViewPosition mapViewPosition = new MapViewPosition(new DisplayModel());

            Assert.assertNull(mapViewPosition.MapLimit);

            LatLong latLong = new LatLong(10, 20, true);

            mapViewPosition.Center = latLong;
            Assert.assertEquals(latLong, mapViewPosition.Center);

            BoundingBox boundingBox = new BoundingBox(1, 2, 3, 4);

            mapViewPosition.MapLimit = boundingBox;
            Assert.assertEquals(boundingBox, mapViewPosition.MapLimit);
            Assert.assertEquals(latLong, mapViewPosition.Center);

            mapViewPosition.Center = latLong;
            Assert.assertEquals(new LatLong(3, 4, true), mapViewPosition.Center);
        }
示例#17
0
        public virtual void testInitSynchronization()
        {
            // given
            Task eventSubProcessTask1 = rule.taskQuery().taskDefinitionKey("innerEventSubProcessTask1").singleResult();
            Task eventSubProcessTask2 = rule.taskQuery().taskDefinitionKey("innerEventSubProcessTask2").singleResult();

            // when
            CompleteTaskThread completeTaskThread1 = new CompleteTaskThread(eventSubProcessTask1.Id, (ProcessEngineConfigurationImpl)rule.ProcessEngine.ProcessEngineConfiguration);

            CompleteTaskThread completeTaskThread2 = new CompleteTaskThread(eventSubProcessTask2.Id, (ProcessEngineConfigurationImpl)rule.ProcessEngine.ProcessEngineConfiguration);

            completeTaskThread1.startAndWaitUntilControlIsReturned();
            completeTaskThread2.startAndWaitUntilControlIsReturned();

            completeTaskThread1.proceedAndWaitTillDone();
            completeTaskThread2.proceedAndWaitTillDone();

            // then
            Assert.assertNull(completeTaskThread1.Exception);
            Assert.assertNotNull(completeTaskThread2.Exception);
        }
示例#18
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testProcessApplicationDeployment()
        public virtual void testProcessApplicationDeployment()
        {
            // initially, no process engine is registered:
            Assert.assertNull(BpmPlatform.DefaultProcessEngine);
            Assert.assertEquals(0, BpmPlatform.ProcessEngineService.ProcessEngines.Count);

            // start spring application context
            AbstractApplicationContext applicationContext = new ClassPathXmlApplicationContext("org/camunda/bpm/engine/spring/test/container/ManagedProcessEngineFactoryBean-context.xml");

            applicationContext.start();

            // assert that now the process engine is registered:
            Assert.assertNotNull(BpmPlatform.DefaultProcessEngine);

            // close the spring application context
            applicationContext.close();

            // after closing the application context, the process engine is gone
            Assert.assertNull(BpmPlatform.DefaultProcessEngine);
            Assert.assertEquals(0, BpmPlatform.ProcessEngineService.ProcessEngines.Count);
        }