use of com.navercorp.pinpoint.test.util.AssertionErrorBuilder in project pinpoint by naver.
the class PluginVerifierExternalAdaptor method verifySql.
private void verifySql(int index, ExpectedSql expected, Annotation<?> actual) {
int id = this.handler.getTcpDataSender().getSqlId(expected.getQuery());
IntStringStringValue actualSql = (IntStringStringValue) actual.getValue();
if (actualSql.getIntValue() != id) {
String actualQuery = this.handler.getTcpDataSender().getSql(actualSql.getIntValue());
AssertionErrorBuilder builder = new AssertionErrorBuilder(String.format("Annotation[%s].sqlId", index), id + ":" + expected.getQuery(), actualSql.getIntValue() + ": " + actualQuery);
builder.setComparison(expected, actual);
builder.throwAssertionError();
}
if (!ObjectUtils.equals(actualSql.getStringValue1(), expected.getOutput())) {
AssertionErrorBuilder builder = new AssertionErrorBuilder(String.format("Annotation[%s].sql.output", index), expected.getOutput(), actualSql.getStringValue1());
builder.setComparison(expected, actual);
builder.throwAssertionError();
}
if (!ObjectUtils.equals(actualSql.getStringValue2(), expected.getBindValuesAsString())) {
AssertionErrorBuilder builder = new AssertionErrorBuilder(String.format("Annotation[%s].sql.bindValues", index), expected.getBindValuesAsString(), actualSql.getStringValue2());
builder.setComparison(expected, actual);
builder.throwAssertionError();
}
}
use of com.navercorp.pinpoint.test.util.AssertionErrorBuilder 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.util.AssertionErrorBuilder in project pinpoint by naver.
the class PluginVerifierExternalAdaptor method verifyTraceCount.
@Override
public void verifyTraceCount(int expected) {
final int actual = getTraceCount();
if (expected != actual) {
AssertionErrorBuilder builder = new AssertionErrorBuilder("count", expected, actual);
builder.throwAssertionError();
}
}
use of com.navercorp.pinpoint.test.util.AssertionErrorBuilder in project pinpoint by naver.
the class PluginVerifierExternalAdaptor method verifyAsyncTraces.
private void verifyAsyncTraces(ExpectedTrace expected, ActualTrace actual) throws AssertionError {
final ExpectedTrace[] expectedAsyncTraces = expected.getAsyncTraces();
if (expectedAsyncTraces != null && expectedAsyncTraces.length > 0) {
Integer actualAsyncId = actual.getNextAsyncId();
if (actualAsyncId == null) {
AssertionErrorBuilder builder = new AssertionErrorBuilder("async traces triggered but nextAsyncId is null", Arrays.toString(expectedAsyncTraces), actualAsyncId);
builder.setComparison(expected, actual);
builder.throwAssertionError();
}
verifyDiscreteTraceBlock(expectedAsyncTraces, actualAsyncId);
}
}
use of com.navercorp.pinpoint.test.util.AssertionErrorBuilder in project pinpoint by naver.
the class PluginVerifierExternalAdaptor method verifyIsLoggingTransactionInfo.
@Override
public void verifyIsLoggingTransactionInfo(LoggingInfo loggingInfo) {
final Item<SpanType> item = popItem();
if (item == null) {
throw new AssertionError("Expected a Span isLoggingTransactionInfo value with [" + loggingInfo.getName() + "]" + " but loggingTransactionInfo value invalid.");
}
final TraceRoot traceRoot = item.getTraceRoot();
final byte loggingTransactionInfo = traceRoot.getShared().getLoggingInfo();
if (loggingTransactionInfo != loggingInfo.getCode()) {
LoggingInfo code = LoggingInfo.searchByCode(loggingTransactionInfo);
String codeName = getCodeName(code);
AssertionErrorBuilder builder = new AssertionErrorBuilder("Span.isLoggingTransactionInfo value", loggingInfo.getName(), codeName);
builder.setComparison(loggingInfo.getName(), codeName);
builder.throwAssertionError();
}
}
Aggregations