use of com.microsoft.applicationinsights.smoketest.telemetry.Duration in project ApplicationInsights-Java by microsoft.
the class JsonHelperTests method testMinuteDuration.
@Test
public void testMinuteDuration() {
Duration expected = new Duration(0, 0, 25, 50, 0);
String json = getJsonDurationInHolder(expected);
System.out.println(json);
DurationHolder actual = JsonHelper.GSON.fromJson(json, DurationHolder.class);
assertThat(actual.getData()).isEqualTo(expected);
json = getJsonDurationInHolder(new Duration(25 * 60000L + 50000L));
System.out.println(json);
actual = JsonHelper.GSON.fromJson(json, DurationHolder.class);
assertThat(actual.getData()).isEqualTo(expected);
}
use of com.microsoft.applicationinsights.smoketest.telemetry.Duration in project ApplicationInsights-Java by microsoft.
the class JsonHelperTests method testDaysAndMilliseconds.
@Test
public void testDaysAndMilliseconds() {
Duration expected = new Duration(5, 0, 1, 0, 213);
String json = getJsonDurationInHolder(expected);
System.out.println(json);
DurationHolder actual = JsonHelper.GSON.fromJson(json, DurationHolder.class);
assertThat(actual.getData()).isEqualTo(expected);
json = getJsonDurationInHolder(new Duration(60213L + 5 * 86400000L));
System.out.println(json);
actual = JsonHelper.GSON.fromJson(json, DurationHolder.class);
assertThat(actual.getData()).isEqualTo(expected);
}
use of com.microsoft.applicationinsights.smoketest.telemetry.Duration in project ApplicationInsights-Java by microsoft.
the class JsonHelperTests method testDayDuration.
@Test
public void testDayDuration() {
Duration expected = new Duration(2, 0, 0, 0, 0);
String json = getJsonDurationInHolder(expected);
System.out.println(json);
DurationHolder actual = JsonHelper.GSON.fromJson(json, DurationHolder.class);
assertThat(actual.getData()).isEqualTo(expected);
expected = new Duration(2L * 86400000L);
json = getJsonDurationInHolder(expected);
System.out.println(json);
actual = JsonHelper.GSON.fromJson(json, DurationHolder.class);
assertThat(actual.getData()).isEqualTo(expected);
}
use of com.microsoft.applicationinsights.smoketest.telemetry.Duration in project ApplicationInsights-Java by microsoft.
the class JsonHelperTests method testMillisecondDuration.
@Test
public void testMillisecondDuration() {
Duration expected = new Duration(1);
String json = getJsonDurationInHolder(expected);
System.out.println(json);
DurationHolder actual = JsonHelper.GSON.fromJson(json, DurationHolder.class);
assertThat(actual.getData()).isEqualTo(expected);
expected = new Duration(0, 0, 0, 0, 1);
json = getJsonDurationInHolder(expected);
System.out.println(json);
actual = JsonHelper.GSON.fromJson(json, DurationHolder.class);
assertThat(actual.getData()).isEqualTo(expected);
}
use of com.microsoft.applicationinsights.smoketest.telemetry.Duration in project ApplicationInsights-Java by microsoft.
the class CoreAndFilterTests method testTrackPageViewJsp.
@Test
@TargetUri("/doPageView.jsp")
public void testTrackPageViewJsp() throws Exception {
List<Envelope> rdList = mockedIngestion.waitForItems("RequestData", 1);
Envelope rdEnvelope = rdList.get(0);
String operationId = rdEnvelope.getTags().get("ai.operation.id");
List<Envelope> pvdList = mockedIngestion.waitForItemsInOperation("PageViewData", 1, operationId);
assertEquals(0, mockedIngestion.getCountForType("EventData"));
Envelope pvdEnvelope = pvdList.get(0);
RequestData rd = (RequestData) ((Data<?>) rdEnvelope.getData()).getBaseData();
PageViewData pv = (PageViewData) ((Data<?>) pvdEnvelope.getData()).getBaseData();
assertEquals("doPageView", pv.getName());
assertEquals(new Duration(0), pv.getDuration());
assertParentChild(rd, rdEnvelope, pvdEnvelope, "GET /CoreAndFilter/doPageView.jsp");
}
Aggregations