Search in sources :

Example 11 with AssertionErrorBuilder

use of com.navercorp.pinpoint.test.util.AssertionErrorBuilder in project pinpoint by naver.

the class PluginVerifierExternalAdaptor method verifyService.

@Override
public void verifyService(String serverName, List<String> libs) {
    List<ServiceInfo> serviceInfos = getServerMetaData().getServiceInfos();
    for (ServiceInfo serviceInfo : serviceInfos) {
        if (serviceInfo.getServiceName().equals(serverName)) {
            List<String> actualLibs = serviceInfo.getServiceLibs();
            if (actualLibs.size() != libs.size()) {
                AssertionErrorBuilder builder = new AssertionErrorBuilder("serviceName " + serverName, libs, actualLibs);
                builder.throwAssertionError();
            }
            for (String lib : libs) {
                if (!actualLibs.contains(lib)) {
                    AssertionErrorBuilder builder = new AssertionErrorBuilder("serviceName " + serverName, libs, actualLibs);
                    builder.throwAssertionError();
                }
            }
            // OK
            return;
        }
    }
    AssertionErrorBuilder builder = new AssertionErrorBuilder("serviceName " + serverName, libs, "no such service");
    builder.throwAssertionError();
}
Also used : ServiceInfo(com.navercorp.pinpoint.bootstrap.context.ServiceInfo) AssertionErrorBuilder(com.navercorp.pinpoint.test.util.AssertionErrorBuilder)

Example 12 with AssertionErrorBuilder

use of com.navercorp.pinpoint.test.util.AssertionErrorBuilder in project pinpoint by naver.

the class PluginVerifierExternalAdaptor method verifyConnector.

@Override
public void verifyConnector(String protocol, int port) {
    Map<Integer, String> connectorMap = getServerMetaData().getConnectors();
    String actualProtocol = connectorMap.get(port);
    if (actualProtocol == null || !actualProtocol.equals(protocol)) {
        // port validation??
        AssertionErrorBuilder builder = new AssertionErrorBuilder("protocol", protocol + ":" + port, actualProtocol);
        builder.throwAssertionError();
    }
}
Also used : AssertionErrorBuilder(com.navercorp.pinpoint.test.util.AssertionErrorBuilder)

Example 13 with AssertionErrorBuilder

use of com.navercorp.pinpoint.test.util.AssertionErrorBuilder in project pinpoint by naver.

the class PluginVerifierExternalAdaptor method verifyException.

private void verifyException(Exception expectedException, String actualExceptionClassName, String actualExceptionMessage) {
    String expectedExceptionClassName = expectedException.getClass().getName();
    String expectedExceptionMessage = StringUtils.abbreviate(expectedException.getMessage(), 256);
    if (!ObjectUtils.equals(actualExceptionClassName, expectedExceptionClassName)) {
        AssertionErrorBuilder builder = new AssertionErrorBuilder("ExceptionClassName", expectedExceptionClassName, actualExceptionClassName);
        builder.throwAssertionError();
    }
    if (!ObjectUtils.equals(actualExceptionMessage, expectedExceptionMessage)) {
        AssertionErrorBuilder builder = new AssertionErrorBuilder("Exception Message", expectedExceptionMessage, actualExceptionMessage);
        builder.throwAssertionError();
    }
}
Also used : AssertionErrorBuilder(com.navercorp.pinpoint.test.util.AssertionErrorBuilder)

Aggregations

AssertionErrorBuilder (com.navercorp.pinpoint.test.util.AssertionErrorBuilder)13 ExpectedAnnotation (com.navercorp.pinpoint.bootstrap.plugin.test.ExpectedAnnotation)2 ExpectedTrace (com.navercorp.pinpoint.bootstrap.plugin.test.ExpectedTrace)2 DataType (com.navercorp.pinpoint.common.util.DataType)2 SpanType (com.navercorp.pinpoint.profiler.context.SpanType)2 ServiceInfo (com.navercorp.pinpoint.bootstrap.context.ServiceInfo)1 ExpectedSql (com.navercorp.pinpoint.bootstrap.plugin.test.ExpectedSql)1 AnnotationKey (com.navercorp.pinpoint.common.trace.AnnotationKey)1 LoggingInfo (com.navercorp.pinpoint.common.trace.LoggingInfo)1 ServiceType (com.navercorp.pinpoint.common.trace.ServiceType)1 IntStringStringValue (com.navercorp.pinpoint.common.util.IntStringStringValue)1 IntStringValue (com.navercorp.pinpoint.common.util.IntStringValue)1 Annotation (com.navercorp.pinpoint.profiler.context.Annotation)1 TraceRoot (com.navercorp.pinpoint.profiler.context.id.TraceRoot)1 DefaultApplicationContext (com.navercorp.pinpoint.profiler.context.module.DefaultApplicationContext)1 ActualTrace (com.navercorp.pinpoint.test.wrapper.ActualTrace)1