//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testGetInterval() public virtual void testGetInterval() { when(meterQueryMock.interval()).thenReturn(MockProvider.createMockMetricIntervalResult()); given().then().expect().body("[0].name", equalTo("metricName")).body("[0].timestamp", equalTo(withTimezone(new DateTime(15 * 60 * 1000 * 3)))).body("[0].reporter", equalTo("REPORTER")).body("[0].value", equalTo(23)).body("[1].name", equalTo("metricName")).body("[1].timestamp", equalTo(withTimezone(new DateTime(15 * 60 * 1000 * 2)))).body("[1].reporter", equalTo("REPORTER")).body("[1].value", equalTo(22)).body("[2].name", equalTo("metricName")).body("[2].timestamp", equalTo(withTimezone(new DateTime(15 * 60 * 1000 * 1)))).body("[2].reporter", equalTo("REPORTER")).body("[2].value", equalTo(21)).statusCode(Status.OK.StatusCode).when().get(METRICS_URL); verify(meterQueryMock).name(null); verify(meterQueryMock).reporter(null); verify(meterQueryMock, times(1)).interval(); verifyNoMoreInteractions(meterQueryMock); }
public virtual IList <MetricsIntervalResultDto> interval(UriInfo uriInfo) { MultivaluedMap <string, string> queryParameters = uriInfo.QueryParameters; MetricsQuery query = processEngine.ManagementService.createMetricsQuery().name(queryParameters.getFirst(QUERY_PARAM_NAME)).reporter(queryParameters.getFirst(QUERY_PARAM_REPORTER)); applyQueryParams(query, queryParameters); IList <MetricIntervalValue> metrics; LongConverter longConverter = new LongConverter(); longConverter.ObjectMapper = objectMapper; if (queryParameters.getFirst(QUERY_PARAM_INTERVAL) != null) { long interval = longConverter.convertQueryParameterToType(queryParameters.getFirst(QUERY_PARAM_INTERVAL)).Value; metrics = query.interval(interval); } else { metrics = query.interval(); } return(convertToDtos(metrics)); }
// VALUE ////////////////////////////////////////////////////////////////////// //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testMeterQueryDefaultIntervalCalculatedValue() public virtual void testMeterQueryDefaultIntervalCalculatedValue() { //given metric data created for 15 min intervals //when query metric interval data with custom interval, start and end date in where clause DateTime endDate = firstInterval.plusMinutes(DEFAULT_INTERVAL); DateTime startDate = firstInterval; MetricsQuery metricQuery = managementService.createMetricsQuery().startDate(startDate.toDate()).endDate(endDate.toDate()).name(ACTIVTY_INSTANCE_START); IList <MetricIntervalValue> metrics = metricQuery.interval(); long sum = metricQuery.sum(); //then result contains 1 entries //sum should be equal to the sum which is calculated by the metric query assertEquals(1, metrics.Count); assertEquals(sum, metrics[0].Value); }
public override void execute(PerfTestRunContext context) { MetricsQuery metricsQuery = this.processEngine.ManagementService.createMetricsQuery(); if (!string.ReferenceEquals(name, null)) { metricsQuery.name(name); } if (startDate != null) { metricsQuery.startDate(startDate); } if (endDate != null) { metricsQuery.endDate(endDate); } metricsQuery.interval(); }