Search in sources :

Example 1 with TargetUri

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

the class CustomInstrumentationTest method customInstrumentationSeven.

@Test
@TargetUri("/customInstrumentationSeven")
public void customInstrumentationSeven() 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.seven");
    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 2 with TargetUri

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

the class CustomInstrumentationTest method customInstrumentationOne.

@Test
@TargetUri("/customInstrumentationOne")
public void customInstrumentationOne() 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.one");
    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 3 with TargetUri

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

the class CustomInstrumentationTest method customInstrumentationNine.

@Test
@TargetUri("/customInstrumentationNine")
public void customInstrumentationNine() throws Exception {
    List<Envelope> rdList = mockedIngestion.waitForItems("RequestData", 1);
    List<Envelope> rddList = mockedIngestion.waitForItemsInRequest("RemoteDependencyData", 2);
    Envelope rdEnvelope = rdList.get(0);
    RequestData rd = (RequestData) ((Data<?>) rdEnvelope.getData()).getBaseData();
    Envelope nineEnvelope = null;
    Envelope httpEnvelope = null;
    RemoteDependencyData nineRdd = null;
    RemoteDependencyData httpRdd = null;
    for (Envelope loopEnvelope : rddList) {
        RemoteDependencyData loopData = (RemoteDependencyData) ((Data<?>) loopEnvelope.getData()).getBaseData();
        if (loopData.getType().equals("OTHER")) {
            nineEnvelope = loopEnvelope;
            nineRdd = loopData;
        } else if (loopData.getType().equals("Http (tracked component)")) {
            httpEnvelope = loopEnvelope;
            httpRdd = loopData;
        } else {
            throw new IllegalStateException("Unexpected remote dependency type: " + loopData.getType());
        }
    }
    assertTrue(rd.getSuccess());
    assertNotNull(nineRdd);
    assertEquals(nineRdd.getName(), "com/microsoft/applicationinsights/smoketestapp/TargetObject.nine");
    assertEquals(nineRdd.getType(), "OTHER");
    assertEquals(nineRdd.getSuccess(), true);
    assertParentChild(rd, rdEnvelope, nineEnvelope, "GET /CustomInstrumentation/*");
    assertNotNull(httpRdd);
    assertParentChild(rd, rdEnvelope, httpEnvelope, "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 4 with TargetUri

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

the class CustomInstrumentationTest method customInstrumentationFive.

@Test
@TargetUri("/customInstrumentationFive")
public void customInstrumentationFive() throws Exception {
    List<Envelope> rdList = mockedIngestion.waitForItems("RequestData", 1);
    List<Envelope> rddList = mockedIngestion.waitForItemsInRequest("RemoteDependencyData", 4);
    Envelope rdEnvelope = rdList.get(0);
    RequestData rd = (RequestData) ((Data<?>) rdEnvelope.getData()).getBaseData();
    Envelope fiveEnvelope = null;
    Envelope sixEnvelope = null;
    Envelope oneEnvelope = null;
    Envelope twoEnvelope = null;
    RemoteDependencyData fiveRdd = null;
    RemoteDependencyData sixRdd = null;
    RemoteDependencyData oneRdd = null;
    RemoteDependencyData twoRdd = null;
    for (Envelope loopEnvelope : rddList) {
        RemoteDependencyData loopData = (RemoteDependencyData) ((Data<?>) loopEnvelope.getData()).getBaseData();
        if (loopData.getName().endsWith(".five")) {
            fiveEnvelope = loopEnvelope;
            fiveRdd = loopData;
        } else if (loopData.getName().endsWith(".six")) {
            sixEnvelope = loopEnvelope;
            sixRdd = loopData;
        } else if (loopData.getName().endsWith(".one")) {
            oneEnvelope = loopEnvelope;
            oneRdd = loopData;
        } else if (loopData.getName().endsWith(".two")) {
            twoEnvelope = loopEnvelope;
            twoRdd = loopData;
        } else {
            throw new IllegalStateException("Unexpected remote dependency: " + loopData.getName());
        }
    }
    assertTrue(rd.getSuccess());
    assertNotNull(fiveRdd);
    assertEquals(fiveRdd.getName(), "com/microsoft/applicationinsights/smoketestapp/TargetObject.five");
    assertEquals(fiveRdd.getType(), "OTHER");
    assertEquals(fiveRdd.getSuccess(), true);
    assertParentChild(rd, rdEnvelope, fiveEnvelope, "GET /CustomInstrumentation/*");
    assertNotNull(sixRdd);
    assertEquals(sixRdd.getName(), "com/microsoft/applicationinsights/smoketestapp/TargetObject.six");
    assertEquals(sixRdd.getType(), "OTHER");
    assertEquals(sixRdd.getSuccess(), true);
    assertParentChild(rd, rdEnvelope, sixEnvelope, "GET /CustomInstrumentation/*");
    assertNotNull(oneRdd);
    assertEquals(oneRdd.getName(), "com/microsoft/applicationinsights/smoketestapp/TargetObject.one");
    assertEquals(oneRdd.getType(), "OTHER");
    assertEquals(oneRdd.getSuccess(), true);
    assertParentChild(rd, rdEnvelope, oneEnvelope, "GET /CustomInstrumentation/*");
    assertNotNull(twoRdd);
    assertEquals(twoRdd.getName(), "com/microsoft/applicationinsights/smoketestapp/TargetObject.two");
    assertEquals(twoRdd.getType(), "OTHER");
    assertEquals(twoRdd.getSuccess(), true);
    assertParentChild(rd, rdEnvelope, twoEnvelope, "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 5 with TargetUri

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

the class CustomInstrumentationTest method customInstrumentationTwo.

@Test
@TargetUri("/customInstrumentationTwo")
public void customInstrumentationTwo() 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.two");
    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)

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