use of com.navercorp.pinpoint.test.wrapper.ActualTrace in project pinpoint by naver.
the class PluginVerifierExternalAdaptor method verifyTrace.
@Override
public void verifyTrace(ExpectedTrace... expectations) {
if (ArrayUtils.isEmpty(expectations)) {
throw new IllegalArgumentException("No expectations");
}
for (ExpectedTrace expected : expectations) {
ResolvedExpectedTrace resolved = resolveExpectedTrace(expected, null);
final Item<SpanType> actualItem = popItem();
if (actualItem == null) {
AssertionErrorBuilder builder = new AssertionErrorBuilder("actualItem is null", resolved, "null");
builder.throwAssertionError();
}
final SpanType actual = actualItem.getValue();
ActualTrace wrapped = ActualTraceFactory.wrap(actual);
verifySpan(resolved, wrapped);
verifyAsyncTraces(expected, wrapped);
}
}
use of com.navercorp.pinpoint.test.wrapper.ActualTrace in project pinpoint by naver.
the class PluginVerifierExternalAdaptor method verifyDiscreteTraceBlock.
public void verifyDiscreteTraceBlock(ExpectedTrace[] expectations, Integer asyncId) {
if (ArrayUtils.isEmpty(expectations)) {
throw new IllegalArgumentException("No expectations");
}
ExpectedTrace expected = expectations[0];
ResolvedExpectedTrace resolved = resolveExpectedTrace(expected, asyncId);
int i = 0;
Iterator<SpanType> iterator = this.handler.getOrderedSpanRecorder().iterator();
while (iterator.hasNext()) {
final SpanType next = iterator.next();
ActualTrace actual = ActualTraceFactory.wrap(next);
try {
verifySpan(resolved, actual);
} catch (AssertionError e) {
continue;
}
iterator.remove();
verifyAsyncTraces(expected, actual);
if (++i == expectations.length) {
return;
}
expected = expectations[i];
resolved = resolveExpectedTrace(expected, asyncId);
}
throw new AssertionError("Failed to match " + i + "th expectation: " + resolved);
}
use of com.navercorp.pinpoint.test.wrapper.ActualTrace in project pinpoint by naver.
the class PluginVerifierExternalAdaptor method hasTrace.
private boolean hasTrace(ExpectedTrace expectedTrace) {
if (expectedTrace == null) {
return false;
}
ResolvedExpectedTrace resolvedExpectedTrace = resolveExpectedTrace(expectedTrace, null);
Iterator<SpanType> iterator = this.handler.getOrderedSpanRecorder().iterator();
while (iterator.hasNext()) {
try {
SpanType value = iterator.next();
ActualTrace actualTrace = ActualTraceFactory.wrapOrNull(value);
if (actualTrace == null) {
continue;
}
verifySpan(resolvedExpectedTrace, actualTrace);
return true;
} catch (Throwable ignore) {
}
}
return false;
}
Aggregations