use of com.newrelic.agent.MockDispatcher 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());
}
use of com.newrelic.agent.MockDispatcher in project newrelic-java-agent by newrelic.
the class TransactionTraceBucketTest method createTransactionData.
private TransactionData createTransactionData(String transactionName, long durationInMillis) {
AgentConfig agentConfig = ServiceFactory.getConfigService().getDefaultAgentConfig();
MockDispatcher dispatcher = new MockDispatcher();
dispatcher.setWebTransaction(true);
MockDispatcherTracer rootTracer = new MockDispatcherTracer();
rootTracer.setDurationInMilliseconds(durationInMillis);
rootTracer.setStartTime(System.nanoTime());
rootTracer.setEndTime(rootTracer.getStartTime() + TimeUnit.NANOSECONDS.convert(durationInMillis, TimeUnit.MILLISECONDS));
return new TransactionDataTestBuilder(APP_NAME, agentConfig, rootTracer).setDispatcher(dispatcher).setRequestUri(transactionName).setFrontendMetricName(transactionName).build();
}
Aggregations