Search in sources :

Example 51 with OtherRootTracer

use of com.newrelic.agent.tracers.OtherRootTracer in project newrelic-java-agent by newrelic.

the class NormalizedTransactionTrace method testNormalizedTransactionTraceTest.

@SuppressWarnings({ "unchecked", "serial" })
@Test
public void testNormalizedTransactionTraceTest() {
    final JSONArray rulesData = new JSONArray();
    rulesData.addAll(Arrays.asList(new JSONObject() {

        {
            put("match_expression", "/amq.([0-9]*)$");
            put("replacement", "/amq.*");
            put("eval_order", 1);
        }
    }));
    setUrlRules(rulesData);
    Transaction txn = Transaction.getTransaction();
    ClassMethodSignature sig = new ClassMethodSignature("", "", "");
    MetricNameFormat format = new SimpleMetricNameFormat("");
    Tracer tracer = new OtherRootTracer(txn, sig, this, format);
    txn.getTransactionActivity().tracerStarted(tracer);
    MockDispatcher dispatcher = new MockDispatcher();
    txn.setDispatcher(dispatcher);
    txn.setTransactionName(TransactionNamePriority.FRAMEWORK_HIGH, false, "TEST", "/amq.1234567831415");
    tracer.finish(Opcodes.ARETURN, null);
    Assert.assertEquals("/amq.*", txn.getPriorityTransactionName().getPartialName());
}
Also used : JSONObject(org.json.simple.JSONObject) Transaction(com.newrelic.agent.Transaction) ClassMethodSignature(com.newrelic.agent.tracers.ClassMethodSignature) Tracer(com.newrelic.agent.tracers.Tracer) OtherRootTracer(com.newrelic.agent.tracers.OtherRootTracer) JSONArray(org.json.simple.JSONArray) MockDispatcher(com.newrelic.agent.MockDispatcher) SimpleMetricNameFormat(com.newrelic.agent.tracers.metricname.SimpleMetricNameFormat) MetricNameFormat(com.newrelic.agent.tracers.metricname.MetricNameFormat) SimpleMetricNameFormat(com.newrelic.agent.tracers.metricname.SimpleMetricNameFormat) OtherRootTracer(com.newrelic.agent.tracers.OtherRootTracer) Test(org.junit.Test)

Aggregations

OtherRootTracer (com.newrelic.agent.tracers.OtherRootTracer)51 ClassMethodSignature (com.newrelic.agent.tracers.ClassMethodSignature)45 Transaction (com.newrelic.agent.Transaction)35 SimpleMetricNameFormat (com.newrelic.agent.tracers.metricname.SimpleMetricNameFormat)34 Test (org.junit.Test)31 BrowserConfigTest (com.newrelic.agent.browser.BrowserConfigTest)17 DefaultTracer (com.newrelic.agent.tracers.DefaultTracer)15 Tracer (com.newrelic.agent.tracers.Tracer)15 MockHttpResponse (com.newrelic.agent.tracers.servlet.MockHttpResponse)11 Response (com.newrelic.api.agent.Response)10 MockHttpRequest (com.newrelic.agent.tracers.servlet.MockHttpRequest)9 MetricNameFormat (com.newrelic.agent.tracers.metricname.MetricNameFormat)8 ExtendedRequest (com.newrelic.api.agent.ExtendedRequest)8 Request (com.newrelic.api.agent.Request)8 HttpServletResponse (javax.servlet.http.HttpServletResponse)8 CloseableHttpResponse (org.apache.http.client.methods.CloseableHttpResponse)8 HttpUriRequest (org.apache.http.client.methods.HttpUriRequest)8 MockHttpServletRequest (org.apache.struts.mock.MockHttpServletRequest)8 MockHttpServletResponse (org.apache.struts.mock.MockHttpServletResponse)8 TransactionDataList (com.newrelic.agent.TransactionDataList)6