use of com.newrelic.agent.tracers.OtherRootTracer in project newrelic-java-agent by newrelic.
the class ApiTest method testSetProductName.
@Test
public void testSetProductName() {
Transaction tx = Transaction.getTransaction();
tx.getTransactionActivity().tracerStarted(new OtherRootTracer(tx, new ClassMethodSignature("", "", ""), this, new SimpleMetricNameFormat("dude")));
Request request = new ApiTestHelper.RequestWrapper(new MockHttpServletRequest("/", "mytest", "", "&test=dude"));
Response response = new ApiTestHelper.ResponseWrapper(new MockHttpServletResponse());
NewRelic.setRequestAndResponse(request, response);
NewRelic.setProductName("prodName");
Assert.assertEquals("prodName", tx.getUserAttributes().get("product"));
}
use of com.newrelic.agent.tracers.OtherRootTracer in project newrelic-java-agent by newrelic.
the class ApiTest method testSetTxNameThenSetRequestAndResponse.
@Test
public void testSetTxNameThenSetRequestAndResponse() {
TransactionDataList txList = new TransactionDataList();
ServiceFactory.getTransactionService().addTransactionListener(txList);
Transaction tx = Transaction.getTransaction();
OtherRootTracer tracer = new OtherRootTracer(tx, new ClassMethodSignature("", "", ""), this, new SimpleMetricNameFormat("blah"));
Assert.assertEquals(tracer, tx.getTransactionActivity().tracerStarted(tracer));
NewRelic.setTransactionName("Test", "Foo");
Request request = new ApiTestHelper.RequestWrapper(new MockHttpServletRequest("/", "mytest", "", "&test=dude"));
Response response = new ApiTestHelper.ResponseWrapper(new MockHttpServletResponse());
NewRelic.setRequestAndResponse(request, response);
tracer.finish(0, null);
Assert.assertEquals("WebTransaction/Test/Foo", tx.getPriorityTransactionName().getName());
}
use of com.newrelic.agent.tracers.OtherRootTracer in project newrelic-java-agent by newrelic.
the class ApiTest method testSetAccountName.
@Test
public void testSetAccountName() {
Transaction tx = Transaction.getTransaction();
tx.getTransactionActivity().tracerStarted(new OtherRootTracer(tx, new ClassMethodSignature("", "", ""), this, new SimpleMetricNameFormat("dude")));
Request request = new ApiTestHelper.RequestWrapper(new MockHttpServletRequest("/", "mytest", "", "&test=dude"));
Response response = new ApiTestHelper.ResponseWrapper(new MockHttpServletResponse());
NewRelic.setRequestAndResponse(request, response);
NewRelic.setAccountName("accountName");
Assert.assertEquals("accountName", tx.getUserAttributes().get("account"));
}
use of com.newrelic.agent.tracers.OtherRootTracer in project newrelic-java-agent by newrelic.
the class ApiTest method testSetTransactionName.
@Test
public void testSetTransactionName() {
Transaction tx = Transaction.getTransaction();
tx.getTransactionActivity().tracerStarted(new OtherRootTracer(tx, new ClassMethodSignature("", "", ""), this, new SimpleMetricNameFormat("dude")));
NewRelic.setTransactionName("Test", "/foo");
Assert.assertEquals("OtherTransaction/Test/foo", tx.getPriorityTransactionName().getName());
}
use of com.newrelic.agent.tracers.OtherRootTracer in project newrelic-java-agent by newrelic.
the class ApiTest method testSetTransactionNameNoCategory.
@Test
public void testSetTransactionNameNoCategory() {
Transaction tx = Transaction.getTransaction();
tx.getTransactionActivity().tracerStarted(new OtherRootTracer(tx, new ClassMethodSignature("", "", ""), this, new SimpleMetricNameFormat("dude")));
NewRelic.setTransactionName(null, "/foo");
Assert.assertEquals("OtherTransaction/" + MetricNames.CUSTOM + "/foo", tx.getPriorityTransactionName().getName());
}
Aggregations