Search in sources :

Example 26 with RemoteDependencyData

use of com.microsoft.applicationinsights.smoketest.schemav2.RemoteDependencyData in project ApplicationInsights-Java by microsoft.

the class SpringBootAutoTest method spawnAnotherJavaProcess.

@Test
@TargetUri("/spawn-another-java-process")
public void spawnAnotherJavaProcess() throws Exception {
    List<Envelope> rdList = mockedIngestion.waitForItems("RequestData", 1);
    List<Envelope> rddList = mockedIngestion.waitForItems("RemoteDependencyData", 1);
    Envelope rdEnvelope = rdList.get(0);
    Envelope rddEnvelope = rddList.get(0);
    RequestData rd = (RequestData) ((Data<?>) rdEnvelope.getData()).getBaseData();
    RemoteDependencyData rdd = (RemoteDependencyData) ((Data<?>) rddEnvelope.getData()).getBaseData();
    assertTrue(rd.getProperties().isEmpty());
    assertTrue(rd.getSuccess());
    assertEquals("GET /search", rdd.getName());
    assertEquals("Http", rdd.getType());
    assertEquals("www.bing.com", rdd.getTarget());
    assertEquals("https://www.bing.com/search?q=test", rdd.getData());
    assertTrue(rdd.getProperties().isEmpty());
    assertTrue(rdd.getSuccess());
}
Also used : RequestData(com.microsoft.applicationinsights.smoketest.schemav2.RequestData) RemoteDependencyData(com.microsoft.applicationinsights.smoketest.schemav2.RemoteDependencyData) Envelope(com.microsoft.applicationinsights.smoketest.schemav2.Envelope) Test(org.junit.Test)

Example 27 with RemoteDependencyData

use of com.microsoft.applicationinsights.smoketest.schemav2.RemoteDependencyData in project ApplicationInsights-Java by microsoft.

the class OpenTelemetryApiSupportControllerSpansEnabledTest method testAnnotations.

@Test
@TargetUri("/test-annotations")
public void testAnnotations() throws Exception {
    Telemetry telemetry = getTelemetry(2);
    if (!telemetry.rdd1.getName().equals("TestController.testAnnotations")) {
        RemoteDependencyData rddTemp = telemetry.rdd1;
        telemetry.rdd1 = telemetry.rdd2;
        telemetry.rdd2 = rddTemp;
        Envelope rddEnvelopeTemp = telemetry.rddEnvelope1;
        telemetry.rddEnvelope1 = telemetry.rddEnvelope2;
        telemetry.rddEnvelope2 = rddEnvelopeTemp;
    }
    assertEquals("GET /OpenTelemetryApiSupport/test-annotations", telemetry.rd.getName());
    assertTrue(telemetry.rd.getUrl().matches("http://localhost:[0-9]+/OpenTelemetryApiSupport/test-annotations"));
    assertEquals("200", telemetry.rd.getResponseCode());
    assertTrue(telemetry.rd.getSuccess());
    assertNull(telemetry.rd.getSource());
    assertTrue(telemetry.rd.getProperties().isEmpty());
    assertTrue(telemetry.rd.getMeasurements().isEmpty());
    assertEquals("TestController.testAnnotations", telemetry.rdd1.getName());
    assertNull(telemetry.rdd1.getData());
    assertEquals("InProc", telemetry.rdd1.getType());
    assertNull(telemetry.rdd1.getTarget());
    assertTrue(telemetry.rdd1.getProperties().isEmpty());
    assertTrue(telemetry.rdd1.getSuccess());
    assertEquals("TestController.underAnnotation", telemetry.rdd2.getName());
    assertNull(telemetry.rdd2.getData());
    assertEquals("InProc", telemetry.rdd2.getType());
    assertNull(telemetry.rdd2.getTarget());
    assertEquals("a message", telemetry.rdd2.getProperties().get("message"));
    assertEquals(1, telemetry.rdd2.getProperties().size());
    assertTrue(telemetry.rdd2.getSuccess());
    assertParentChild(telemetry.rd, telemetry.rdEnvelope, telemetry.rddEnvelope1, "GET /OpenTelemetryApiSupport/test-annotations");
    assertParentChild(telemetry.rdd1, telemetry.rddEnvelope1, telemetry.rddEnvelope2, "GET /OpenTelemetryApiSupport/test-annotations");
}
Also used : RemoteDependencyData(com.microsoft.applicationinsights.smoketest.schemav2.RemoteDependencyData) Envelope(com.microsoft.applicationinsights.smoketest.schemav2.Envelope) Test(org.junit.Test)

Aggregations

Envelope (com.microsoft.applicationinsights.smoketest.schemav2.Envelope)27 RemoteDependencyData (com.microsoft.applicationinsights.smoketest.schemav2.RemoteDependencyData)26 Test (org.junit.Test)26 RequestData (com.microsoft.applicationinsights.smoketest.schemav2.RequestData)25 AiSmokeTest (com.microsoft.applicationinsights.smoketest.AiSmokeTest)10 TargetUri (com.microsoft.applicationinsights.smoketest.TargetUri)10 Data (com.microsoft.applicationinsights.smoketest.schemav2.Data)2 ExceptionData (com.microsoft.applicationinsights.smoketest.schemav2.ExceptionData)2 EventData (com.microsoft.applicationinsights.smoketest.schemav2.EventData)1 ExceptionDetails (com.microsoft.applicationinsights.smoketest.schemav2.ExceptionDetails)1