Ejemplo n.º 1
0
        public virtual IList <HistoricExternalTaskLogDto> queryHistoricExternalTaskLogs(HistoricExternalTaskLogQueryDto queryDto, int?firstResult, int?maxResults)
        {
            queryDto.ObjectMapper = objectMapper;
            HistoricExternalTaskLogQuery query = queryDto.toQuery(processEngine);

            IList <HistoricExternalTaskLog> matchingHistoricExternalTaskLogs;

            if (firstResult != null || maxResults != null)
            {
                matchingHistoricExternalTaskLogs = executePaginatedQuery(query, firstResult, maxResults);
            }
            else
            {
                matchingHistoricExternalTaskLogs = query.list();
            }

            IList <HistoricExternalTaskLogDto> results = new List <HistoricExternalTaskLogDto>();

            foreach (HistoricExternalTaskLog historicExternalTaskLog in matchingHistoricExternalTaskLogs)
            {
                HistoricExternalTaskLogDto result = HistoricExternalTaskLogDto.fromHistoricExternalTaskLog(historicExternalTaskLog);
                results.Add(result);
            }

            return(results);
        }
Ejemplo n.º 2
0
        private void createHistoricExternalTaskLogMock()
        {
            HistoricExternalTaskLogQuery    mockHistoricExternalTaskLogQuery = mock(typeof(HistoricExternalTaskLogQuery));
            IList <HistoricExternalTaskLog> historicExternalTaskLogs         = MockProvider.createMockHistoricExternalTaskLogs();

            when(mockHistoricExternalTaskLogQuery.list()).thenReturn(historicExternalTaskLogs);
            when(mockHistoryService.createHistoricExternalTaskLogQuery()).thenReturn(mockHistoricExternalTaskLogQuery);
        }
Ejemplo n.º 3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testQueryWithoutTenantId()
        public virtual void testQueryWithoutTenantId()
        {
            //given two process with different tenants

            // when
            HistoricExternalTaskLogQuery query = historyService.createHistoricExternalTaskLogQuery();

            // then
            assertThat(query.count(), @is(5L));
        }
Ejemplo n.º 4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testQueryByTenantIds()
        public virtual void testQueryByTenantIds()
        {
            //given two process with different tenants

            // when
            HistoricExternalTaskLogQuery query = historyService.createHistoricExternalTaskLogQuery().tenantIdIn(TENANT_ONE, TENANT_TWO);

            // then
            assertThat(query.count(), @is(5L));
        }
Ejemplo n.º 5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testQueryByNonExistingTenantId()
        public virtual void testQueryByNonExistingTenantId()
        {
            //given two process with different tenants

            // when
            HistoricExternalTaskLogQuery query = historyService.createHistoricExternalTaskLogQuery().tenantIdIn("nonExisting");

            // then
            assertThat(query.count(), @is(0L));
        }
Ejemplo n.º 6
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testQueryNoAuthenticatedTenants()
        public virtual void testQueryNoAuthenticatedTenants()
        {
            // given
            identityService.setAuthentication("user", null, null);

            // when
            HistoricExternalTaskLogQuery query = historyService.createHistoricExternalTaskLogQuery();

            // then
            assertThat(query.count(), @is(0L));
        }
Ejemplo n.º 7
0
        protected internal virtual HistoricExternalTaskLogQuery setUpMockHistoricExternalTaskLogQuery(IList <HistoricExternalTaskLog> mockedHistoricExternalTaskLogs)
        {
            HistoricExternalTaskLogQuery mockedHistoricExternalTaskLogQuery = mock(typeof(HistoricExternalTaskLogQuery));

            when(mockedHistoricExternalTaskLogQuery.list()).thenReturn(mockedHistoricExternalTaskLogs);
            when(mockedHistoricExternalTaskLogQuery.count()).thenReturn((long)mockedHistoricExternalTaskLogs.Count);

            when(processEngine.HistoryService.createHistoricExternalTaskLogQuery()).thenReturn(mockedHistoricExternalTaskLogQuery);

            return(mockedHistoricExternalTaskLogQuery);
        }
Ejemplo n.º 8
0
        public virtual void testQueryWithoutAuthorization()
        {
            // given
            startThreeProcessInstancesDeleteOneAndCompleteTwoWithFailure();

            // when
            HistoricExternalTaskLogQuery query = historyService.createHistoricExternalTaskLogQuery();

            // then
            verifyQueryResults(query, 0);
        }
Ejemplo n.º 9
0
        public virtual void testSimpleQueryWithoutAuthorization()
        {
            // given
            startProcessInstanceByKey(DEFAULT_PROCESS_KEY);

            // when
            HistoricExternalTaskLogQuery query = historyService.createHistoricExternalTaskLogQuery();

            // then
            verifyQueryResults(query, 0);
        }
Ejemplo n.º 10
0
        public virtual CountResultDto queryHistoricExternalTaskLogsCount(HistoricExternalTaskLogQueryDto queryDto)
        {
            queryDto.ObjectMapper = objectMapper;
            HistoricExternalTaskLogQuery query = queryDto.toQuery(processEngine);

            long           count  = query.count();
            CountResultDto result = new CountResultDto();

            result.Count = count;

            return(result);
        }
Ejemplo n.º 11
0
        public virtual void testSimpleQueryWithHistoryReadPermissionOnAnyProcessDefinition()
        {
            // given
            startProcessInstanceByKey(DEFAULT_PROCESS_KEY);
            createGrantAuthorization(PROCESS_DEFINITION, ANY, userId, READ_HISTORY);

            // when
            HistoricExternalTaskLogQuery query = historyService.createHistoricExternalTaskLogQuery();

            // then
            verifyQueryResults(query, 1);
        }
Ejemplo n.º 12
0
        public virtual void testQueryWithHistoryReadPermissionOnAnyProcessDefinition()
        {
            // given
            startThreeProcessInstancesDeleteOneAndCompleteTwoWithFailure();
            createGrantAuthorization(PROCESS_DEFINITION, ANY, userId, READ_HISTORY);

            // when
            HistoricExternalTaskLogQuery query = historyService.createHistoricExternalTaskLogQuery();

            // then
            verifyQueryResults(query, 8);
        }
Ejemplo n.º 13
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testQueryDisabledTenantCheck()
        public virtual void testQueryDisabledTenantCheck()
        {
            // given
            engineRule.ProcessEngineConfiguration.TenantCheckEnabled = false;
            identityService.setAuthentication("user", null, null);

            // when
            HistoricExternalTaskLogQuery query = historyService.createHistoricExternalTaskLogQuery();

            // then
            assertThat(query.count(), @is(5L));
        }
Ejemplo n.º 14
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testQueryAuthenticatedTenants()
        public virtual void testQueryAuthenticatedTenants()
        {
            // given
            identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE, TENANT_TWO));

            // when
            HistoricExternalTaskLogQuery query = historyService.createHistoricExternalTaskLogQuery();

            // then
            assertThat(query.count(), @is(5L));
            assertThat(query.tenantIdIn(TENANT_ONE).count(), @is(2L));
            assertThat(query.tenantIdIn(TENANT_TWO).count(), @is(3L));
        }
Ejemplo n.º 15
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testQuerySortingByProcessInstanceIdDsc()
        public virtual void testQuerySortingByProcessInstanceIdDsc()
        {
            // given
            int taskCount = 10;

            startProcesses(taskCount);

            // when
            HistoricExternalTaskLogQuery query = historyService.createHistoricExternalTaskLogQuery();

            query.orderByProcessInstanceId().desc();

            // then
            verifyQueryWithOrdering(query, taskCount, inverted(historicExternalTaskLogByProcessInstanceId()));
        }
Ejemplo n.º 16
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testQuerySortingByProcessDefinitionIdAsc()
        public virtual void testQuerySortingByProcessDefinitionIdAsc()
        {
            // given
            int taskCount = 8;

            startProcesses(taskCount);

            // when
            HistoricExternalTaskLogQuery query = historyService.createHistoricExternalTaskLogQuery();

            query.orderByProcessDefinitionId().asc();

            // then
            verifyQueryWithOrdering(query, taskCount, historicExternalTaskLogByProcessDefinitionId());
        }
Ejemplo n.º 17
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testQuerySortingByProcessDefinitionKeyDsc()
        public virtual void testQuerySortingByProcessDefinitionKeyDsc()
        {
            // given
            int taskCount = 10;

            startProcessesByProcessDefinitionKey(taskCount);

            // when
            HistoricExternalTaskLogQuery query = historyService.createHistoricExternalTaskLogQuery();

            query.orderByProcessDefinitionKey().desc();

            // then
            verifyQueryWithOrdering(query, taskCount, inverted(historicExternalTaskLogByProcessDefinitionKey(engineRule.ProcessEngine)));
        }
Ejemplo n.º 18
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testQuerySortingByWorkerIdDsc()
        public virtual void testQuerySortingByWorkerIdDsc()
        {
            // given
            int taskCount             = 10;
            IList <ExternalTask> list = startProcesses(taskCount);

            completeExternalTasksWithWorkers(list);

            // when
            HistoricExternalTaskLogQuery query = historyService.createHistoricExternalTaskLogQuery();

            query.successLog().orderByWorkerId().desc();

            // then
            verifyQueryWithOrdering(query, taskCount, inverted(historicExternalTaskLogByWorkerId()));
        }
Ejemplo n.º 19
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testQuerySortingByRetriesDsc()
        public virtual void testQuerySortingByRetriesDsc()
        {
            // given
            int taskCount             = 10;
            IList <ExternalTask> list = startProcesses(taskCount);

            reportExternalTaskFailure(list);

            // when
            HistoricExternalTaskLogQuery query = historyService.createHistoricExternalTaskLogQuery();

            query.failureLog().orderByRetries().desc();

            // then
            verifyQueryWithOrdering(query, taskCount, inverted(historicExternalTaskLogByRetries()));
        }
Ejemplo n.º 20
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testTenantIdListParameter()
        public virtual void testTenantIdListParameter()
        {
            mockedQuery = setUpMockHistoricExternalTaskLogQuery(createMockHistoricExternalTaskLogsTwoTenants());

            Response response = given().queryParam("tenantIdIn", MockProvider.EXAMPLE_TENANT_ID_LIST).then().expect().statusCode(Status.OK.StatusCode).when().get(HISTORIC_EXTERNAL_TASK_LOG_RESOURCE_URL);

            verify(mockedQuery).tenantIdIn(MockProvider.EXAMPLE_TENANT_ID, MockProvider.ANOTHER_EXAMPLE_TENANT_ID);
            verify(mockedQuery).list();

            string         content          = response.asString();
            IList <string> externalTaskLogs = from(content).getList("");

            assertThat(externalTaskLogs).hasSize(2);

            string returnedTenantId1 = from(content).getString("[0].tenantId");
            string returnedTenantId2 = from(content).getString("[1].tenantId");

            assertThat(returnedTenantId1).isEqualTo(MockProvider.EXAMPLE_TENANT_ID);
            assertThat(returnedTenantId2).isEqualTo(MockProvider.ANOTHER_EXAMPLE_TENANT_ID);
        }
Ejemplo n.º 21
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testTenantIdListPostParameter()
        public virtual void testTenantIdListPostParameter()
        {
            mockedQuery = setUpMockHistoricExternalTaskLogQuery(createMockHistoricExternalTaskLogsTwoTenants());

            IDictionary <string, object> queryParameters = new Dictionary <string, object>();

            queryParameters["tenantIdIn"] = MockProvider.EXAMPLE_TENANT_ID_LIST.Split(",", true);

            Response response = given().contentType(POST_JSON_CONTENT_TYPE).body(queryParameters).expect().statusCode(Status.OK.StatusCode).when().post(HISTORIC_EXTERNAL_TASK_LOG_RESOURCE_URL);

            verify(mockedQuery).tenantIdIn(MockProvider.EXAMPLE_TENANT_ID, MockProvider.ANOTHER_EXAMPLE_TENANT_ID);
            verify(mockedQuery).list();

            string         content          = response.asString();
            IList <string> externalTaskLogs = from(content).getList("");

            assertThat(externalTaskLogs).hasSize(2);

            string returnedTenantId1 = from(content).getString("[0].tenantId");
            string returnedTenantId2 = from(content).getString("[1].tenantId");

            assertThat(returnedTenantId1).isEqualTo(MockProvider.EXAMPLE_TENANT_ID);
            assertThat(returnedTenantId2).isEqualTo(MockProvider.ANOTHER_EXAMPLE_TENANT_ID);
        }
Ejemplo n.º 22
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setUpRuntimeData() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        public virtual void setUpRuntimeData()
        {
            mockedQuery = setUpMockHistoricExternalTaskLogQuery(MockProvider.createMockHistoricExternalTaskLogs());
        }
Ejemplo n.º 23
0
 protected internal virtual void verifyQueryWithOrdering(HistoricExternalTaskLogQuery query, int countExpected, TestOrderingUtil.NullTolerantComparator <HistoricExternalTaskLog> expectedOrdering)
 {
     assertThat(countExpected, @is(query.list().size()));
     assertThat((long)countExpected, @is(query.count()));
     verifySorting(query.list(), expectedOrdering);
 }
Ejemplo n.º 24
0
 protected internal virtual IList <HistoricExternalTaskLog> executePaginatedQuery(HistoricExternalTaskLogQuery query, int?firstResult, int?maxResults)
 {
     if (firstResult == null)
     {
         firstResult = 0;
     }
     if (maxResults == null)
     {
         maxResults = int.MaxValue;
     }
     return(query.listPage(firstResult, maxResults));
 }