Ejemplo n.º 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testActivtyStatisticsByIdThrowsAuthorizationException()
        public virtual void testActivtyStatisticsByIdThrowsAuthorizationException()
        {
            string message = "expected exception";

            when(activityQueryMock.list()).thenThrow(new AuthorizationException(message));

            given().pathParam("id", "aDefinitionId").then().expect().statusCode(Status.FORBIDDEN.StatusCode).contentType(ContentType.JSON).body("type", equalTo(typeof(AuthorizationException).Name)).body("message", equalTo(message)).when().get(ACTIVITY_STATISTICS_URL);
        }
Ejemplo n.º 2
0
        private void setupActivityStatisticsMock()
        {
            IList <ActivityStatistics> mocks = MockProvider.createMockActivityStatistics();

            activityQueryMock = mock(typeof(ActivityStatisticsQuery));
            when(activityQueryMock.list()).thenReturn(mocks);
            when(processEngine.ManagementService.createActivityStatisticsQuery(any(typeof(string)))).thenReturn(activityQueryMock);
        }
Ejemplo n.º 3
0
        public virtual IList <StatisticsResultDto> getActivityStatistics(bool?includeFailedJobs, bool?includeIncidents, string includeIncidentsForType)
        {
            if (includeIncidents != null && !string.ReferenceEquals(includeIncidentsForType, null))
            {
                throw new InvalidRequestException(Response.Status.BAD_REQUEST, "Only one of the query parameter includeIncidents or includeIncidentsForType can be set.");
            }

            ManagementService       mgmtService = engine.ManagementService;
            ActivityStatisticsQuery query       = mgmtService.createActivityStatisticsQuery(processDefinitionId);

            if (includeFailedJobs != null && includeFailedJobs)
            {
                query.includeFailedJobs();
            }

            if (includeIncidents != null && includeIncidents)
            {
                query.includeIncidents();
            }
            else if (!string.ReferenceEquals(includeIncidentsForType, null))
            {
                query.includeIncidentsForType(includeIncidentsForType);
            }

            IList <ActivityStatistics> queryResults = query.list();

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

            foreach (ActivityStatistics queryResult in queryResults)
            {
                StatisticsResultDto dto = ActivityStatisticsResultDto.fromActivityStatistics(queryResult);
                results.Add(dto);
            }

            return(results);
        }