use of com.newrelic.agent.CrossProcessTransactionState in project newrelic-java-agent by newrelic.
the class DistributedTraceServiceImplTest method createTransactionData.
private TransactionData createTransactionData(Map<String, Object> intrinsicAttributes, long startTimeInMillis, long responseTimeInNanos, DistributedTracePayloadImpl payload) {
long payloadTimestamp = payload != null ? payload.timestamp : 0;
Transaction tx = Mockito.mock(Transaction.class);
SpanProxy spanProxy = new SpanProxy();
spanProxy.acceptDistributedTracePayload(payload);
CrossProcessTransactionState crossProcessTransactionState = Mockito.mock(CrossProcessTransactionState.class);
Dispatcher dispatcher = Mockito.mock(Dispatcher.class);
TransactionTimer timer = Mockito.mock(TransactionTimer.class);
when(tx.getIntrinsicAttributes()).thenReturn(intrinsicAttributes);
when(tx.getSpanProxy()).thenReturn(spanProxy);
when(crossProcessTransactionState.getTripId()).thenReturn("abc123");
when(tx.getCrossProcessTransactionState()).thenReturn(crossProcessTransactionState);
when(dispatcher.isWebTransaction()).thenReturn(true);
when(tx.getDispatcher()).thenReturn(dispatcher);
when((tx.getTransportDurationInMillis())).thenReturn(startTimeInMillis - payloadTimestamp);
when(timer.getResponseTimeInNanos()).thenReturn(responseTimeInNanos);
when(tx.getTransactionTimer()).thenReturn(timer);
when(tx.isErrorReportableAndNotIgnored()).thenReturn(true);
when(tx.getTransportType()).thenReturn(TransportType.HTTPS);
return new TransactionData(tx, 0);
}
Aggregations