use of com.newrelic.agent.trace.TransactionTrace in project newrelic-java-agent by newrelic.
the class RPMServiceTest method doTestTransactionTraces.
private void doTestTransactionTraces() throws Exception {
MockDataSenderFactory dataSenderFactory = new MockDataSenderFactory();
DataSenderFactory.setDataSenderFactory(dataSenderFactory);
Transaction.clearTransaction();
List<String> appNames = singletonList("MyApplication");
RPMService svc = new RPMService(appNames, null, null, Collections.<AgentConnectionEstablishedListener>emptyList());
svc.launch();
ClassMethodSignature sig = new ClassMethodSignature(getClass().getName(), "test", "()V");
Tracer rootTracer = new BasicRequestRootTracer(Transaction.getTransaction(), sig, this, null, null, new SimpleMetricNameFormat("/test"));
AgentConfig iAgentConfig = mock(AgentConfig.class);
TransactionData data = new TransactionDataTestBuilder("unittest", iAgentConfig, rootTracer).setRequestUri("/unittest").build();
List<TransactionTrace> traces = singletonList(TransactionTrace.getTransactionTrace(data));
try {
System.err.println("Transaction trace. JSON: " + DataSenderWriter.toJSONString(traces));
svc.sendTransactionTraceData(traces);
} catch (Exception e) {
System.err.println("Error sending transaction trace. JSON: " + DataSenderWriter.toJSONString(traces));
throw e;
}
assertEquals(traces, dataSenderFactory.getLastDataSender().getTraces());
svc.shutdown();
}
use of com.newrelic.agent.trace.TransactionTrace in project newrelic-java-agent by newrelic.
the class RequestUriConfigTests method runTransactionTraceTest.
public void runTransactionTraceTest(RequestUriConfigTransactionTest test) throws Exception {
setupConfig(test);
// run a transaction
Tracer requestDispatcherTracer = startDispatcherTracer(test.getTxnName());
startTracer().finish(Opcodes.RETURN, null);
requestDispatcherTracer.finish(Opcodes.RETURN, null);
MockRPMService mockRPMService = runHarvest();
// verify results
List<TransactionTrace> transactionTraces = mockRPMService.getTraces();
assertFalse(transactionTraces.isEmpty());
matchUri(test.getExpectedUriValues(), transactionTraces.get(0).getRequestUri());
}
use of com.newrelic.agent.trace.TransactionTrace in project newrelic-java-agent by newrelic.
the class OneTestForCriticalPath method verifyTransactionTrace.
private void verifyTransactionTrace() {
if (trace != null) {
TransactionTrace actualTrace = TransactionTrace.getTransactionTrace(dataList.get(0));
trace.validateTransactionTrace(actualTrace);
}
}
Aggregations