Search in sources :

Example 6 with TargetUri

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

the class CustomInstrumentationTest method customInstrumentationFour.

@Test
@TargetUri("/customInstrumentationFour")
public void customInstrumentationFour() throws Exception {
    List<Envelope> rdList = mockedIngestion.waitForItems("RequestData", 1);
    List<Envelope> rddList = mockedIngestion.waitForItemsInRequest("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.getSuccess());
    assertEquals(rdd.getName(), "com/microsoft/applicationinsights/smoketestapp/TargetObject$NestedObject.four");
    assertEquals(rdd.getType(), "OTHER");
    assertEquals(rdd.getSuccess(), true);
    assertParentChild(rd, rdEnvelope, rddEnvelope, "GET /CustomInstrumentation/*");
}
Also used : RequestData(com.microsoft.applicationinsights.smoketest.schemav2.RequestData) RemoteDependencyData(com.microsoft.applicationinsights.smoketest.schemav2.RemoteDependencyData) Envelope(com.microsoft.applicationinsights.smoketest.schemav2.Envelope) AiSmokeTest(com.microsoft.applicationinsights.smoketest.AiSmokeTest) Test(org.junit.Test) TargetUri(com.microsoft.applicationinsights.smoketest.TargetUri)

Example 7 with TargetUri

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

the class CustomInstrumentationTest method customInstrumentationEight.

@Test
@TargetUri("/customInstrumentationEight")
public void customInstrumentationEight() throws Exception {
    List<Envelope> rdList = mockedIngestion.waitForItems("RequestData", 1);
    List<Envelope> rddList = mockedIngestion.waitForItemsInRequest("RemoteDependencyData", 2);
    Envelope rdEnvelope = rdList.get(0);
    Envelope rddEnvelope1 = rddList.get(0);
    Envelope rddEnvelope2 = rddList.get(1);
    RequestData rd = (RequestData) ((Data<?>) rdEnvelope.getData()).getBaseData();
    RemoteDependencyData rdd1 = (RemoteDependencyData) ((Data<?>) rddEnvelope1.getData()).getBaseData();
    RemoteDependencyData rdd2 = (RemoteDependencyData) ((Data<?>) rddEnvelope2.getData()).getBaseData();
    assertTrue(rd.getSuccess());
    assertEquals(rdd1.getName(), "com/microsoft/applicationinsights/smoketestapp/TargetObject.eight");
    assertEquals(rdd1.getType(), "OTHER");
    assertEquals(rdd1.getSuccess(), true);
    assertParentChild(rd, rdEnvelope, rddEnvelope1, "GET /CustomInstrumentation/*");
    assertEquals(rdd2.getName(), "com/microsoft/applicationinsights/smoketestapp/TargetObject.eight");
    assertEquals(rdd2.getType(), "OTHER");
    assertEquals(rdd2.getSuccess(), true);
    assertParentChild(rd, rdEnvelope, rddEnvelope2, "GET /CustomInstrumentation/*");
}
Also used : RequestData(com.microsoft.applicationinsights.smoketest.schemav2.RequestData) RemoteDependencyData(com.microsoft.applicationinsights.smoketest.schemav2.RemoteDependencyData) Envelope(com.microsoft.applicationinsights.smoketest.schemav2.Envelope) AiSmokeTest(com.microsoft.applicationinsights.smoketest.AiSmokeTest) Test(org.junit.Test) TargetUri(com.microsoft.applicationinsights.smoketest.TargetUri)

Example 8 with TargetUri

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

the class CustomInstrumentationTest method customInstrumentationThree.

@Test
@TargetUri("/customInstrumentationThree")
public void customInstrumentationThree() throws Exception {
    List<Envelope> rdList = mockedIngestion.waitForItems("RequestData", 1);
    List<Envelope> rddList = mockedIngestion.waitForItemsInRequest("RemoteDependencyData", 1);
    List<Envelope> edList = mockedIngestion.waitForItemsInRequest("ExceptionData", 1);
    Envelope rdEnvelope = rdList.get(0);
    Envelope rddEnvelope = rddList.get(0);
    Envelope edEnvelope = edList.get(0);
    RequestData rd = (RequestData) ((Data<?>) rdEnvelope.getData()).getBaseData();
    RemoteDependencyData rdd = (RemoteDependencyData) ((Data<?>) rddEnvelope.getData()).getBaseData();
    ExceptionData ed = (ExceptionData) ((Data<?>) edEnvelope.getData()).getBaseData();
    assertTrue(rd.getSuccess());
    assertEquals(rdd.getName(), "com/microsoft/applicationinsights/smoketestapp/TargetObject.three");
    assertEquals(rdd.getType(), "OTHER");
    assertEquals(rdd.getSuccess(), false);
    List<ExceptionDetails> exceptions = ed.getExceptions();
    assertEquals(exceptions.size(), 1);
    assertEquals(exceptions.get(0).getMessage(), "Three");
    assertParentChild(rd, rdEnvelope, rddEnvelope, "GET /CustomInstrumentation/*");
    assertParentChild(rd, rdEnvelope, edEnvelope, "GET /CustomInstrumentation/*");
}
Also used : RequestData(com.microsoft.applicationinsights.smoketest.schemav2.RequestData) RemoteDependencyData(com.microsoft.applicationinsights.smoketest.schemav2.RemoteDependencyData) ExceptionData(com.microsoft.applicationinsights.smoketest.schemav2.ExceptionData) ExceptionDetails(com.microsoft.applicationinsights.smoketest.schemav2.ExceptionDetails) Envelope(com.microsoft.applicationinsights.smoketest.schemav2.Envelope) AiSmokeTest(com.microsoft.applicationinsights.smoketest.AiSmokeTest) Test(org.junit.Test) TargetUri(com.microsoft.applicationinsights.smoketest.TargetUri)

Example 9 with TargetUri

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

the class TelemetryFilteringSmokeTest method testRegularJdbc.

@Test
@TargetUri("/regular-jdbc")
public void testRegularJdbc() throws Exception {
    List<Envelope> rdList = mockedIngestion.waitForItems("RequestData", 1);
    Envelope rdEnvelope = rdList.get(0);
    String operationId = rdEnvelope.getTags().get("ai.operation.id");
    List<Envelope> rddList = mockedIngestion.waitForItemsInOperation("RemoteDependencyData", 1, operationId);
    assertEquals(0, mockedIngestion.getCountForType("EventData"));
    Envelope rddEnvelope = rddList.get(0);
    RequestData rd = (RequestData) ((Data<?>) rdEnvelope.getData()).getBaseData();
    RemoteDependencyData rdd = (RemoteDependencyData) ((Data<?>) rddEnvelope.getData()).getBaseData();
    assertEquals("87654321-0000-0000-0000-0FEEDDADBEEF", rdEnvelope.getIKey());
    assertTrue(rd.getSuccess());
    assertEquals("SQL", rdd.getType());
    assertEquals("testdb", rdd.getTarget());
    assertEquals("SELECT testdb.abc", rdd.getName());
    assertEquals("select * from abc", rdd.getData());
    assertEquals("87654321-0000-0000-0000-0FEEDDADBEEF", rddEnvelope.getIKey());
    assertTrue(rdd.getSuccess());
    assertParentChild(rd, rdEnvelope, rddEnvelope, "GET /TelemetryFiltering/*");
}
Also used : RequestData(com.microsoft.applicationinsights.smoketest.schemav2.RequestData) RemoteDependencyData(com.microsoft.applicationinsights.smoketest.schemav2.RemoteDependencyData) Envelope(com.microsoft.applicationinsights.smoketest.schemav2.Envelope) AiSmokeTest(com.microsoft.applicationinsights.smoketest.AiSmokeTest) Test(org.junit.Test) TargetUri(com.microsoft.applicationinsights.smoketest.TargetUri)

Example 10 with TargetUri

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

the class TelemetryFilteringSmokeTest method testNoisyJdbc.

@Test
@TargetUri("/noisy-jdbc")
public void testNoisyJdbc() throws Exception {
    List<Envelope> rdList = mockedIngestion.waitForItems("RequestData", 1);
    Thread.sleep(10000);
    assertEquals(0, mockedIngestion.getCountForType("RemoteDependencyData"));
    Envelope rdEnvelope = rdList.get(0);
    RequestData rd = (RequestData) ((Data<?>) rdEnvelope.getData()).getBaseData();
    assertEquals("00000000-0000-0000-0000-0FEEDDADBEEF", rdEnvelope.getIKey());
    assertTrue(rd.getSuccess());
}
Also used : RequestData(com.microsoft.applicationinsights.smoketest.schemav2.RequestData) Envelope(com.microsoft.applicationinsights.smoketest.schemav2.Envelope) AiSmokeTest(com.microsoft.applicationinsights.smoketest.AiSmokeTest) Test(org.junit.Test) TargetUri(com.microsoft.applicationinsights.smoketest.TargetUri)

Aggregations

AiSmokeTest (com.microsoft.applicationinsights.smoketest.AiSmokeTest)10 TargetUri (com.microsoft.applicationinsights.smoketest.TargetUri)10 Envelope (com.microsoft.applicationinsights.smoketest.schemav2.Envelope)10 RequestData (com.microsoft.applicationinsights.smoketest.schemav2.RequestData)10 Test (org.junit.Test)10 RemoteDependencyData (com.microsoft.applicationinsights.smoketest.schemav2.RemoteDependencyData)9 ExceptionData (com.microsoft.applicationinsights.smoketest.schemav2.ExceptionData)1 ExceptionDetails (com.microsoft.applicationinsights.smoketest.schemav2.ExceptionDetails)1