Search in sources :

Example 96 with TransactionEvent

use of com.newrelic.agent.introspec.TransactionEvent in project newrelic-java-agent by newrelic.

the class AkkaHttpRoutesTest method testRegexRoute.

@Test
public void testRegexRoute() {
    given().baseUri("http://localhost:" + server.getPort()).when().get("/regex/5").then().body(containsString("Regex: 5"));
    Introspector introspector = InstrumentationTestRunner.getIntrospector();
    Assert.assertEquals(1, introspector.getFinishedTransactionCount(TIMEOUT));
    Assert.assertTrue(introspector.getTransactionNames().toString(), introspector.getTransactionNames().contains(getTransactionPrefix() + "/regex/\\d+"));
    Collection<TransactionEvent> transactionEvents = introspector.getTransactionEvents(introspector.getTransactionNames().toArray()[0].toString());
    assertResponseCodeOnTxEvents(transactionEvents, 1, "200");
}
Also used : TransactionEvent(com.newrelic.agent.introspec.TransactionEvent) Introspector(com.newrelic.agent.introspec.Introspector) Test(org.junit.Test)

Example 97 with TransactionEvent

use of com.newrelic.agent.introspec.TransactionEvent in project newrelic-java-agent by newrelic.

the class AkkaHttpRoutesTest method testIntNumberRoute.

@Test
public void testIntNumberRoute() {
    given().baseUri("http://localhost:" + server.getPort()).when().get("/int/10").then().body(containsString("IntNumber: 10"));
    Introspector introspector = InstrumentationTestRunner.getIntrospector();
    Assert.assertEquals(1, introspector.getFinishedTransactionCount(TIMEOUT));
    Assert.assertTrue(introspector.getTransactionNames().toString(), introspector.getTransactionNames().contains(getTransactionPrefix() + "/int/IntNumber"));
    Collection<TransactionEvent> transactionEvents = introspector.getTransactionEvents(introspector.getTransactionNames().toArray()[0].toString());
    assertResponseCodeOnTxEvents(transactionEvents, 1, "200");
}
Also used : TransactionEvent(com.newrelic.agent.introspec.TransactionEvent) Introspector(com.newrelic.agent.introspec.Introspector) Test(org.junit.Test)

Example 98 with TransactionEvent

use of com.newrelic.agent.introspec.TransactionEvent in project newrelic-java-agent by newrelic.

the class AkkaHttpRoutesTest method testPathEndFutureRoute.

@Test
public void testPathEndFutureRoute() {
    given().baseUri("http://localhost:" + server.getPort()).when().get("/pathendfuture").then().body(containsString("PathEndFuture"));
    Introspector introspector = InstrumentationTestRunner.getIntrospector();
    Assert.assertEquals(1, introspector.getFinishedTransactionCount(TIMEOUT));
    Assert.assertTrue(introspector.getTransactionNames().toString(), introspector.getTransactionNames().contains(getTransactionPrefix() + "/pathendfuture"));
    Collection<TransactionEvent> transactionEvents = introspector.getTransactionEvents(introspector.getTransactionNames().toArray()[0].toString());
    assertResponseCodeOnTxEvents(transactionEvents, 1, "200");
}
Also used : TransactionEvent(com.newrelic.agent.introspec.TransactionEvent) Introspector(com.newrelic.agent.introspec.Introspector) Test(org.junit.Test)

Example 99 with TransactionEvent

use of com.newrelic.agent.introspec.TransactionEvent in project newrelic-java-agent by newrelic.

the class AkkaHttpRoutesTest method testRemainingFutureRoute.

@Test
public void testRemainingFutureRoute() {
    given().baseUri("http://localhost:" + server.getPort()).when().get("/futureremaining").then().body(containsString("FutureRemain: ing"));
    Introspector introspector = InstrumentationTestRunner.getIntrospector();
    Assert.assertEquals(1, introspector.getFinishedTransactionCount(TIMEOUT));
    Assert.assertTrue(introspector.getTransactionNames().toString(), introspector.getTransactionNames().contains(getTransactionPrefix() + "/futureremain~Remaining"));
    Collection<TransactionEvent> transactionEvents = introspector.getTransactionEvents(introspector.getTransactionNames().toArray()[0].toString());
    assertResponseCodeOnTxEvents(transactionEvents, 1, "200");
}
Also used : TransactionEvent(com.newrelic.agent.introspec.TransactionEvent) Introspector(com.newrelic.agent.introspec.Introspector) Test(org.junit.Test)

Example 100 with TransactionEvent

use of com.newrelic.agent.introspec.TransactionEvent in project newrelic-java-agent by newrelic.

the class AkkaHttpRoutesTest method testDoublePrefixNoParam.

@Test
public void testDoublePrefixNoParam() {
    given().baseUri("http://localhost:" + server.getPort()).when().get("/v1/containers").then().body(containsString("Request is missing required query parameter 'parameter'"));
    Introspector introspector = InstrumentationTestRunner.getIntrospector();
    Assert.assertEquals(1, introspector.getFinishedTransactionCount(TIMEOUT));
    Assert.assertTrue(introspector.getTransactionNames().toString(), introspector.getTransactionNames().contains(getTransactionPrefix() + "/Unknown Route"));
    Collection<TransactionEvent> transactionEvents = introspector.getTransactionEvents(introspector.getTransactionNames().toArray()[0].toString());
    assertResponseCodeOnTxEvents(transactionEvents, 1, "404");
}
Also used : TransactionEvent(com.newrelic.agent.introspec.TransactionEvent) Introspector(com.newrelic.agent.introspec.Introspector) Test(org.junit.Test)

Aggregations

TransactionEvent (com.newrelic.agent.introspec.TransactionEvent)155 Introspector (com.newrelic.agent.introspec.Introspector)150 Test (org.junit.Test)143 ExternalRequest (com.newrelic.agent.introspec.ExternalRequest)44 URI (java.net.URI)31 TransactionTrace (com.newrelic.agent.introspec.TransactionTrace)17 TraceSegment (com.newrelic.agent.introspec.TraceSegment)14 TracedMetricData (com.newrelic.agent.introspec.TracedMetricData)10 Matchers.containsString (org.hamcrest.Matchers.containsString)9 Java10IncompatibleTest (com.newrelic.test.marker.Java10IncompatibleTest)6 Java11IncompatibleTest (com.newrelic.test.marker.Java11IncompatibleTest)6 Java12IncompatibleTest (com.newrelic.test.marker.Java12IncompatibleTest)6 Java13IncompatibleTest (com.newrelic.test.marker.Java13IncompatibleTest)6 Java14IncompatibleTest (com.newrelic.test.marker.Java14IncompatibleTest)6 Java15IncompatibleTest (com.newrelic.test.marker.Java15IncompatibleTest)6 Java16IncompatibleTest (com.newrelic.test.marker.Java16IncompatibleTest)6 Java17IncompatibleTest (com.newrelic.test.marker.Java17IncompatibleTest)6 Java7IncompatibleTest (com.newrelic.test.marker.Java7IncompatibleTest)6 Java9IncompatibleTest (com.newrelic.test.marker.Java9IncompatibleTest)6 CountDownLatch (java.util.concurrent.CountDownLatch)5