use of com.newrelic.agent.tracers.servlet.BasicRequestRootTracer in project newrelic-java-agent by newrelic.
the class ApiTest method testGetBrowserTimingHeaderForIgnoredTransaction.
@Test
public void testGetBrowserTimingHeaderForIgnoredTransaction() throws Exception {
ApiTestHelper.mockOutServiceManager();
Transaction tx = Transaction.getTransaction();
BasicRequestRootTracer tracer = createDispatcherTracer();
tx.getTransactionActivity().tracerStarted(tracer);
tx.setIgnore(true);
String browserTimingHeader = NewRelic.getBrowserTimingHeader();
Assert.assertEquals("Incorrect header", "", browserTimingHeader);
tx.getTransactionActivity().tracerFinished(tracer, 0);
}
use of com.newrelic.agent.tracers.servlet.BasicRequestRootTracer in project newrelic-java-agent by newrelic.
the class ApiTest method testNoticeErrorMsgParamsInsideTransaction.
@Test
public void testNoticeErrorMsgParamsInsideTransaction() {
Transaction tx = Transaction.getTransaction();
BasicRequestRootTracer tracer = createDispatcherTracer();
tx.getTransactionActivity().tracerStarted(tracer);
NewRelic.noticeError("boom", new HashMap<String, String>());
try {
Class<? extends Transaction> c = tx.getClass();
Method m = c.getDeclaredMethod("getThrowable");
TransactionThrowable transactionThrowable = (TransactionThrowable) m.invoke(tx);
Assert.assertEquals("boom", transactionThrowable.throwable.getMessage());
} catch (SecurityException | InvocationTargetException | IllegalArgumentException | NoSuchMethodException | IllegalAccessException e) {
}
tx.getTransactionActivity().tracerFinished(tracer, 0);
}
use of com.newrelic.agent.tracers.servlet.BasicRequestRootTracer in project newrelic-java-agent by newrelic.
the class ApiTest method testNoticeErrorNullMsgParamsInsideTransaction.
@Test
public void testNoticeErrorNullMsgParamsInsideTransaction() {
Transaction tx = Transaction.getTransaction();
BasicRequestRootTracer tracer = createDispatcherTracer();
tx.getTransactionActivity().tracerStarted(tracer);
NewRelic.noticeError((String) null, new HashMap<String, String>());
try {
Class<? extends Transaction> c = tx.getClass();
Method m = c.getDeclaredMethod("getThrowable");
TransactionThrowable transactionThrowable = (TransactionThrowable) m.invoke(tx);
Assert.assertNull(transactionThrowable.throwable.getMessage());
} catch (SecurityException | InvocationTargetException | IllegalArgumentException | NoSuchMethodException | IllegalAccessException e) {
}
tx.getTransactionActivity().tracerFinished(tracer, 0);
}
use of com.newrelic.agent.tracers.servlet.BasicRequestRootTracer in project newrelic-java-agent by newrelic.
the class ApiTest method testGetBrowserTimingHeaderTwice.
@Test
public void testGetBrowserTimingHeaderTwice() throws Exception {
ApiTestHelper.mockOutServiceManager();
Transaction tx = Transaction.getTransaction();
BasicRequestRootTracer tracer = createDispatcherTracer();
tx.getTransactionActivity().tracerStarted(tracer);
String browserTimingHeader = NewRelic.getBrowserTimingHeader();
browserTimingHeader = NewRelic.getBrowserTimingHeader();
Assert.assertEquals("Incorrect header", "", browserTimingHeader);
tx.getTransactionActivity().tracerFinished(tracer, 0);
}
use of com.newrelic.agent.tracers.servlet.BasicRequestRootTracer in project newrelic-java-agent by newrelic.
the class ApiTest method testGetBrowserTimingFooterNoBeaconConfiguration.
@Test
public void testGetBrowserTimingFooterNoBeaconConfiguration() {
Transaction tx = Transaction.getTransaction();
BasicRequestRootTracer tracer = createDispatcherTracer();
tx.getTransactionActivity().tracerStarted(tracer);
String browserTimingFooter = NewRelic.getBrowserTimingFooter();
Assert.assertEquals("No beacon configuration, the timing footer should be empty", "", browserTimingFooter);
tx.getTransactionActivity().tracerFinished(tracer, 0);
}
Aggregations