예제 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testGetNonExistingProcessInstance()
        public virtual void testGetNonExistingProcessInstance()
        {
            HistoricProcessInstanceQuery sampleInstanceQuery = mock(typeof(HistoricProcessInstanceQuery));

            when(historyServiceMock.createHistoricProcessInstanceQuery()).thenReturn(sampleInstanceQuery);
            when(sampleInstanceQuery.processInstanceId(anyString())).thenReturn(sampleInstanceQuery);
            when(sampleInstanceQuery.singleResult()).thenReturn(null);

            given().pathParam("id", "aNonExistingInstanceId").then().expect().statusCode(Status.NOT_FOUND.StatusCode).contentType(ContentType.JSON).body("type", equalTo(typeof(InvalidRequestException).Name)).body("message", equalTo("Historic process instance with id aNonExistingInstanceId does not exist")).when().get(HISTORIC_SINGLE_PROCESS_INSTANCE_URL);
        }
예제 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldSetRemovalTimeForRootProcessInstanceOnly()
        public virtual void shouldSetRemovalTimeForRootProcessInstanceOnly()
        {
            // given
            HistoricProcessInstanceQuery query = historyService.createHistoricProcessInstanceQuery().processInstanceBusinessKey("rootProcessInstance");

            HistoricProcessInstance historicRootProcessInstance = query.singleResult();

            HistoricProcessInstance historicChildProcessInstance = historyService.createHistoricProcessInstanceQuery().superProcessInstanceId(historicRootProcessInstance.Id).singleResult();

            // assume
            assertThat(historicRootProcessInstance.RemovalTime, nullValue());
            assertThat(historicChildProcessInstance.RemovalTime, nullValue());

            // when
            syncExec(historyService.setRemovalTimeToHistoricProcessInstances().absoluteRemovalTime(DateTime.Now).byQuery(query).hierarchical().executeAsync());

            historicRootProcessInstance = query.singleResult();

            historicChildProcessInstance = historyService.createHistoricProcessInstanceQuery().superProcessInstanceId(historicRootProcessInstance.Id).singleResult();

            // then
            assertThat(historicRootProcessInstance.RemovalTime, notNullValue());
            assertThat(historicChildProcessInstance.RemovalTime, nullValue());
        }
예제 #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testGetSingleInstance()
        public virtual void testGetSingleInstance()
        {
            HistoricProcessInstance      mockInstance        = MockProvider.createMockHistoricProcessInstance();
            HistoricProcessInstanceQuery sampleInstanceQuery = mock(typeof(HistoricProcessInstanceQuery));

            when(historyServiceMock.createHistoricProcessInstanceQuery()).thenReturn(sampleInstanceQuery);
            when(sampleInstanceQuery.processInstanceId(MockProvider.EXAMPLE_PROCESS_INSTANCE_ID)).thenReturn(sampleInstanceQuery);
            when(sampleInstanceQuery.singleResult()).thenReturn(mockInstance);

            Response response = given().pathParam("id", MockProvider.EXAMPLE_PROCESS_INSTANCE_ID).then().expect().statusCode(Status.OK.StatusCode).when().get(HISTORIC_SINGLE_PROCESS_INSTANCE_URL);

            string content = response.asString();

            string returnedProcessInstanceId          = from(content).getString("id");
            string returnedProcessInstanceBusinessKey = from(content).getString("businessKey");
            string returnedProcessDefinitionId        = from(content).getString("processDefinitionId");
            string returnedProcessDefinitionKey       = from(content).getString("processDefinitionKey");
            string returnedStartTime              = from(content).getString("startTime");
            string returnedEndTime                = from(content).getString("endTime");
            long   returnedDurationInMillis       = from(content).getLong("durationInMillis");
            string returnedStartUserId            = from(content).getString("startUserId");
            string returnedStartActivityId        = from(content).getString("startActivityId");
            string returnedDeleteReason           = from(content).getString(DELETE_REASON);
            string returnedSuperProcessInstanceId = from(content).getString("superProcessInstanceId");
            string returnedSuperCaseInstanceId    = from(content).getString("superCaseInstanceId");
            string returnedCaseInstanceId         = from(content).getString("caseInstanceId");
            string returnedTenantId               = from(content).getString("tenantId");
            string returnedState = from(content).getString("state");

            Assert.assertEquals(MockProvider.EXAMPLE_PROCESS_INSTANCE_ID, returnedProcessInstanceId);
            Assert.assertEquals(MockProvider.EXAMPLE_PROCESS_INSTANCE_BUSINESS_KEY, returnedProcessInstanceBusinessKey);
            Assert.assertEquals(MockProvider.EXAMPLE_PROCESS_DEFINITION_ID, returnedProcessDefinitionId);
            Assert.assertEquals(MockProvider.EXAMPLE_PROCESS_DEFINITION_KEY, returnedProcessDefinitionKey);
            Assert.assertEquals(MockProvider.EXAMPLE_HISTORIC_PROCESS_INSTANCE_START_TIME, returnedStartTime);
            Assert.assertEquals(MockProvider.EXAMPLE_HISTORIC_PROCESS_INSTANCE_END_TIME, returnedEndTime);
            Assert.assertEquals(MockProvider.EXAMPLE_HISTORIC_PROCESS_INSTANCE_DURATION_MILLIS, returnedDurationInMillis);
            Assert.assertEquals(MockProvider.EXAMPLE_HISTORIC_PROCESS_INSTANCE_START_USER_ID, returnedStartUserId);
            Assert.assertEquals(MockProvider.EXAMPLE_HISTORIC_PROCESS_INSTANCE_START_ACTIVITY_ID, returnedStartActivityId);
            Assert.assertEquals(MockProvider.EXAMPLE_HISTORIC_PROCESS_INSTANCE_DELETE_REASON, returnedDeleteReason);
            Assert.assertEquals(MockProvider.EXAMPLE_HISTORIC_PROCESS_INSTANCE_SUPER_PROCESS_INSTANCE_ID, returnedSuperProcessInstanceId);
            Assert.assertEquals(MockProvider.EXAMPLE_HISTORIC_PROCESS_INSTANCE_SUPER_CASE_INSTANCE_ID, returnedSuperCaseInstanceId);
            Assert.assertEquals(MockProvider.EXAMPLE_HISTORIC_PROCESS_INSTANCE_CASE_INSTANCE_ID, returnedCaseInstanceId);
            Assert.assertEquals(MockProvider.EXAMPLE_TENANT_ID, returnedTenantId);
            Assert.assertEquals(MockProvider.EXAMPLE_HISTORIC_PROCESS_INSTANCE_STATE, returnedState);
        }
예제 #4
0
        public virtual void testSimpleQueryWithReadHistoryPermissionOnProcessDefinition()
        {
            // given
            string processInstanceId = startProcessInstanceByKey(PROCESS_KEY).Id;

            createGrantAuthorization(PROCESS_DEFINITION, PROCESS_KEY, userId, READ_HISTORY);

            // when
            HistoricProcessInstanceQuery query = historyService.createHistoricProcessInstanceQuery();

            // then
            verifyQueryResults(query, 1);

            HistoricProcessInstance instance = query.singleResult();

            assertNotNull(instance);
            assertEquals(processInstanceId, instance.Id);
        }