use of com.newrelic.agent.TransactionDataList in project newrelic-java-agent by newrelic.
the class TraceAccessorApiTest method testAcceptPayloadGetSpanId.
@Test
public void testAcceptPayloadGetSpanId() throws Exception {
EnvironmentHolder holder = setupEnvironemntHolder("all_enabled_test");
try {
DistributedTracePayloadImpl distributedTracePayload = getDistributedTracePayload();
// We don't care about the DT payload transaction, so we will harvest and clear the tx list before continuing
harvestAndCheckTxn(holder);
TransactionDataList transactionList = holder.getTransactionList();
transactionList.clear();
String spanId = startTxAcceptPayloadAndReturnSpanId(distributedTracePayload);
harvestAndCheckTxn(holder);
Tracer rootTracer = transactionList.get(0).getRootTracer();
String expectedGuid = rootTracer.getGuid();
assertEquals(expectedGuid, spanId);
} finally {
holder.close();
}
}
use of com.newrelic.agent.TransactionDataList in project newrelic-java-agent by newrelic.
the class TraceAccessorApiTest method harvestAndCheckTxn.
private void harvestAndCheckTxn(EnvironmentHolder holder) throws InterruptedException {
TransactionDataList transactionList = holder.getTransactionList();
ServiceFactory.getHarvestService().harvestNow();
transactionList.waitFor(1, TimeUnit.SECONDS.toMillis(30));
assertEquals(1, transactionList.size());
}
use of com.newrelic.agent.TransactionDataList in project newrelic-java-agent by newrelic.
the class TraceAccessorApiTest method testDistributedTracingEnabledGetSpanId.
@Test
public void testDistributedTracingEnabledGetSpanId() throws Exception {
EnvironmentHolder holder = setupEnvironemntHolder("all_enabled_test");
try {
String spanId = startTxAndReturnSpanId();
harvestAndCheckTxn(holder);
TransactionDataList transactionList = holder.getTransactionList();
Tracer rootTracer = transactionList.get(0).getRootTracer();
String expectedGuid = rootTracer.getGuid();
assertEquals(expectedGuid, spanId);
} finally {
holder.close();
}
}
use of com.newrelic.agent.TransactionDataList in project newrelic-java-agent by newrelic.
the class TraceAccessorApiTest method testSegmentGetSpanId.
@Test
public void testSegmentGetSpanId() throws Exception {
EnvironmentHolder holder = setupEnvironemntHolder("all_enabled_test");
try {
String spanId = startSegmentAndReturnSpanId();
harvestAndCheckTxn(holder);
TransactionDataList transactionList = holder.getTransactionList();
Tracer rootTracer = transactionList.get(0).getRootTracer();
String expectedGuid = rootTracer.getGuid();
assertEquals(expectedGuid, spanId);
} finally {
holder.close();
}
}
use of com.newrelic.agent.TransactionDataList in project newrelic-java-agent by newrelic.
the class TraceAccessorApiTest method testCreatePayloadGetSpanId.
@Test
public void testCreatePayloadGetSpanId() throws Exception {
EnvironmentHolder holder = setupEnvironemntHolder("all_enabled_test");
try {
String spanId = startTxCreatePayloadAndReturnSpanId();
harvestAndCheckTxn(holder);
TransactionDataList transactionList = holder.getTransactionList();
Tracer rootTracer = transactionList.get(0).getRootTracer();
String expectedGuid = rootTracer.getGuid();
assertEquals(expectedGuid, spanId);
} finally {
holder.close();
}
}
Aggregations