Search in sources :

Example 1 with CrossProcessTransactionState

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);
}
Also used : Transaction(com.newrelic.agent.Transaction) CrossProcessTransactionState(com.newrelic.agent.CrossProcessTransactionState) TransactionData(com.newrelic.agent.TransactionData) Dispatcher(com.newrelic.agent.dispatchers.Dispatcher) TransactionTimer(com.newrelic.agent.transaction.TransactionTimer)

Aggregations

CrossProcessTransactionState (com.newrelic.agent.CrossProcessTransactionState)1 Transaction (com.newrelic.agent.Transaction)1 TransactionData (com.newrelic.agent.TransactionData)1 Dispatcher (com.newrelic.agent.dispatchers.Dispatcher)1 TransactionTimer (com.newrelic.agent.transaction.TransactionTimer)1