Search in sources :

Example 6 with TransactionNamePriority

use of com.newrelic.agent.bridge.TransactionNamePriority in project newrelic-java-agent by newrelic.

the class BrowserConfigTest method testFooterCaptureParamsNoParams.

@Test
public void testFooterCaptureParamsNoParams() throws Exception {
    setupManager(true, false);
    Transaction tx = Transaction.getTransaction();
    BasicRequestRootTracer tracer = createDispatcherTracer();
    tx.getTransactionActivity().tracerStarted(tracer);
    TransactionNamePriority expectedPriority = TransactionNamePriority.FILTER_NAME;
    PriorityTransactionName ptn = PriorityTransactionName.create("name", null, expectedPriority);
    tx.setPriorityTransactionName(ptn);
    Map<String, Object> beaconSettings = createBeaconSettings(true);
    BrowserConfig beaconConfig = BrowserConfig.createBrowserConfig("appName", beaconSettings);
    BrowserTransactionState bts = BrowserTransactionStateImpl.create(tx);
    Assert.assertEquals(HEADER, beaconConfig.getBrowserTimingHeader());
    String value = beaconConfig.getBrowserTimingFooter(bts);
    List<String> matched = new ArrayList<>(15);
    checkFooter(value, matched);
    List<String> expectedFooterProperties = Arrays.asList(EXPECTED_FOOTER_PROPERTIES);
    checkStrings(value, expectedFooterProperties, matched);
}
Also used : Transaction(com.newrelic.agent.Transaction) PriorityTransactionName(com.newrelic.agent.transaction.PriorityTransactionName) ArrayList(java.util.ArrayList) BasicRequestRootTracer(com.newrelic.agent.tracers.servlet.BasicRequestRootTracer) TransactionNamePriority(com.newrelic.agent.bridge.TransactionNamePriority) Test(org.junit.Test)

Example 7 with TransactionNamePriority

use of com.newrelic.agent.bridge.TransactionNamePriority in project newrelic-java-agent by newrelic.

the class ApiTest method testGetBrowserTimingFooterNoHeader.

@Test
public void testGetBrowserTimingFooterNoHeader() throws Exception {
    ApiTestHelper.mockOutServiceManager();
    Transaction tx = Transaction.getTransaction();
    TransactionNamePriority expectedPriority = TransactionNamePriority.FILTER_NAME;
    PriorityTransactionName ptn = PriorityTransactionName.create("name", null, expectedPriority);
    tx.setPriorityTransactionName(ptn);
    BasicRequestRootTracer tracer = createDispatcherTracer();
    tx.getTransactionActivity().tracerStarted(tracer);
    String browserTimingFooter = NewRelic.getBrowserTimingFooter();
    Assert.assertEquals("Incorrect header", "", browserTimingFooter);
    tx.getTransactionActivity().tracerFinished(tracer, 0);
}
Also used : Transaction(com.newrelic.agent.Transaction) PriorityTransactionName(com.newrelic.agent.transaction.PriorityTransactionName) BasicRequestRootTracer(com.newrelic.agent.tracers.servlet.BasicRequestRootTracer) TransactionNamePriority(com.newrelic.agent.bridge.TransactionNamePriority) BrowserConfigTest(com.newrelic.agent.browser.BrowserConfigTest) Test(org.junit.Test)

Example 8 with TransactionNamePriority

use of com.newrelic.agent.bridge.TransactionNamePriority in project newrelic-java-agent by newrelic.

the class ApiTest method testGetBrowserTimingShortFooterForIgnoredTransaction.

@Test
public void testGetBrowserTimingShortFooterForIgnoredTransaction() throws Exception {
    ApiTestHelper.mockOutServiceManager();
    Transaction tx = Transaction.getTransaction();
    TransactionNamePriority expectedPriority = TransactionNamePriority.FILTER_NAME;
    PriorityTransactionName ptn = PriorityTransactionName.create("name", null, expectedPriority);
    tx.setPriorityTransactionName(ptn);
    BasicRequestRootTracer tracer = createDispatcherTracer();
    tx.getTransactionActivity().tracerStarted(tracer);
    tx.setIgnore(true);
    NewRelic.getBrowserTimingHeader();
    String browserTimingFooter = NewRelic.getBrowserTimingFooter();
    Assert.assertEquals("Incorrect short header", "", browserTimingFooter);
    tx.getTransactionActivity().tracerFinished(tracer, 0);
}
Also used : Transaction(com.newrelic.agent.Transaction) PriorityTransactionName(com.newrelic.agent.transaction.PriorityTransactionName) BasicRequestRootTracer(com.newrelic.agent.tracers.servlet.BasicRequestRootTracer) TransactionNamePriority(com.newrelic.agent.bridge.TransactionNamePriority) BrowserConfigTest(com.newrelic.agent.browser.BrowserConfigTest) Test(org.junit.Test)

Example 9 with TransactionNamePriority

use of com.newrelic.agent.bridge.TransactionNamePriority in project newrelic-java-agent by newrelic.

the class PriorityTransactionNameTest method category.

@Test
public void category() {
    String expectedName = "MyTransactionName";
    TransactionNamePriority expectedPriority = TransactionNamePriority.FILTER_NAME;
    PriorityTransactionName txName = PriorityTransactionName.create(expectedName, "MyCategory", expectedPriority);
    Assert.assertEquals("MyCategory", txName.getCategory());
}
Also used : TransactionNamePriority(com.newrelic.agent.bridge.TransactionNamePriority) Test(org.junit.Test)

Example 10 with TransactionNamePriority

use of com.newrelic.agent.bridge.TransactionNamePriority in project newrelic-java-agent by newrelic.

the class ApiTest method testGetBrowserTimingFooter.

@Test
public void testGetBrowserTimingFooter() throws Exception {
    ApiTestHelper.mockOutServiceManager();
    Transaction tx = Transaction.getTransaction();
    TransactionNamePriority expectedPriority = TransactionNamePriority.FILTER_NAME;
    PriorityTransactionName ptn = PriorityTransactionName.create("name", null, expectedPriority);
    tx.setPriorityTransactionName(ptn);
    BasicRequestRootTracer tracer = createDispatcherTracer();
    tx.getTransactionActivity().tracerStarted(tracer);
    NewRelic.getBrowserTimingHeader();
    String browserTimingFooter = NewRelic.getBrowserTimingFooter();
    Assert.assertTrue("Incorrect footer.  Was " + browserTimingFooter + ", but expected it to start with " + getTimingFooterStart(), browserTimingFooter.startsWith(getTimingFooterStart()));
    tx.getTransactionActivity().tracerFinished(tracer, 0);
}
Also used : Transaction(com.newrelic.agent.Transaction) PriorityTransactionName(com.newrelic.agent.transaction.PriorityTransactionName) BasicRequestRootTracer(com.newrelic.agent.tracers.servlet.BasicRequestRootTracer) TransactionNamePriority(com.newrelic.agent.bridge.TransactionNamePriority) BrowserConfigTest(com.newrelic.agent.browser.BrowserConfigTest) Test(org.junit.Test)

Aggregations

TransactionNamePriority (com.newrelic.agent.bridge.TransactionNamePriority)16 Test (org.junit.Test)16 Transaction (com.newrelic.agent.Transaction)14 BasicRequestRootTracer (com.newrelic.agent.tracers.servlet.BasicRequestRootTracer)14 PriorityTransactionName (com.newrelic.agent.transaction.PriorityTransactionName)14 ArrayList (java.util.ArrayList)7 BrowserConfigTest (com.newrelic.agent.browser.BrowserConfigTest)5