Exemplo n.º 1
0
        public virtual void testQueryWithReadPermissionOnProcessInstance()
        {
            // given
            startProcessInstanceByKey(ONE_TASK_PROCESS_KEY);
            startProcessInstanceByKey(ONE_TASK_PROCESS_KEY);
            string processInstanceId = startProcessInstanceByKey(ONE_TASK_PROCESS_KEY).Id;

            startProcessInstanceByKey(SIGNAL_BOUNDARY_PROCESS_KEY);
            startProcessInstanceByKey(SIGNAL_BOUNDARY_PROCESS_KEY);
            startProcessInstanceByKey(SIGNAL_BOUNDARY_PROCESS_KEY);
            startProcessInstanceByKey(SIGNAL_BOUNDARY_PROCESS_KEY);

            createGrantAuthorization(PROCESS_INSTANCE, processInstanceId, userId, READ);

            // when
            EventSubscriptionQuery query = runtimeService.createEventSubscriptionQuery();

            // then
            verifyQueryResults(query, 1);

            EventSubscription eventSubscription = query.singleResult();

            assertNotNull(eventSubscription);
            assertEquals(processInstanceId, eventSubscription.ProcessInstanceId);
        }
Exemplo n.º 2
0
        protected internal virtual void assertEventSubscriptionMigrated(EventSubscription eventSubscriptionBefore, string activityIdAfter, string eventName)
        {
            EventSubscription eventSubscriptionAfter = runtimeService.createEventSubscriptionQuery().singleResult();

            assertNotNull("Expected that an event subscription with id '" + eventSubscriptionBefore.Id + "' " + "exists after migration", eventSubscriptionAfter);

            assertEquals(eventSubscriptionBefore.EventType, eventSubscriptionAfter.EventType);
            assertEquals(activityIdAfter, eventSubscriptionAfter.ActivityId);
            assertEquals(eventName, eventSubscriptionAfter.EventName);
        }
Exemplo n.º 3
0
        public virtual void testCreateTimeConversion()
        {
            // when
            EventSubscription eventSubscription = runtimeService.createEventSubscriptionQuery().eventName(EVENT_NAME).singleResult();

            // assume
            assertNotNull(eventSubscription);

            // then
            assertThat(eventSubscription.Created, @is(TIMESTAMP));
        }
Exemplo n.º 4
0
        public virtual void testSimpleQueryWithReadInstancesPermissionOnAnyProcessDefinition()
        {
            // given
            string processInstanceId = startProcessInstanceByKey(ONE_TASK_PROCESS_KEY).Id;

            createGrantAuthorization(PROCESS_DEFINITION, ANY, userId, READ_INSTANCE);

            // when
            EventSubscriptionQuery query = runtimeService.createEventSubscriptionQuery();

            // then
            verifyQueryResults(query, 1);

            EventSubscription eventSubscription = query.singleResult();

            assertNotNull(eventSubscription);
            assertEquals(processInstanceId, eventSubscription.ProcessInstanceId);
        }
Exemplo n.º 5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testMigrateEventSubscription()
        public virtual void testMigrateEventSubscription()
        {
            // given
            ProcessDefinition sourceProcessDefinition   = testHelper.deployAndGetDefinition(MessageReceiveModels.MESSAGE_START_PROCESS);
            string            sourceProcessDefinitionId = sourceProcessDefinition.Id;

            MigrationPlan migrationPlan = runtimeService.createMigrationPlan(sourceProcessDefinitionId, sourceProcessDefinitionId).mapEqualActivities().build();

            ProcessInstance   processInstance   = runtimeService.startProcessInstanceById(sourceProcessDefinitionId);
            EventSubscription eventSubscription = runtimeService.createEventSubscriptionQuery().activityId("startEvent").eventName(MessageReceiveModels.MESSAGE_NAME).singleResult();

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

            // then
            assertEventSubscriptionMigrated(eventSubscription, "startEvent", MessageReceiveModels.MESSAGE_NAME);

            testHelper.completeTask("userTask");
            testHelper.assertProcessEnded(processInstance.Id);
        }
Exemplo n.º 6
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testMigrateEventSubscriptionWithEventSubProcess()
        public virtual void testMigrateEventSubscriptionWithEventSubProcess()
        {
            // given
            ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(ProcessModels.ONE_TASK_PROCESS);
            ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(EventSubProcessModels.MESSAGE_EVENT_SUBPROCESS_PROCESS);

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

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

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

            // then
            EventSubscription eventSubscriptionAfter = runtimeService.createEventSubscriptionQuery().singleResult();

            assertNotNull(eventSubscriptionAfter);
            assertEquals(EventSubProcessModels.MESSAGE_NAME, eventSubscriptionAfter.EventName);

            runtimeService.correlateMessage(EventSubProcessModels.MESSAGE_NAME);
            testHelper.completeTask("eventSubProcessTask");
            testHelper.assertProcessEnded(processInstance.Id);
        }