use of com.navercorp.pinpoint.bootstrap.plugin.request.ServerRequestWrapper in project pinpoint by naver.
the class NameSpaceCheckFactoryTest method newNamespace_empty_namespace.
@Test
public void newNamespace_empty_namespace() {
String myNamespace = "myNamespace";
NameSpaceChecker<ServerRequestWrapper> myNamespaceChecker = newNameSpaceChecker(myNamespace);
ServerRequestWrapper serverRequestWrapper = mock(ServerRequestWrapper.class);
when(serverRequestWrapper.getHeader(anyString())).thenReturn(null);
Assert.assertTrue(myNamespaceChecker.checkNamespace(serverRequestWrapper));
}
use of com.navercorp.pinpoint.bootstrap.plugin.request.ServerRequestWrapper in project pinpoint by naver.
the class NameSpaceCheckFactoryTest method newNamespace_empty_config.
@Test
public void newNamespace_empty_config() {
String myNamespace = "";
NameSpaceChecker<ServerRequestWrapper> myNamespaceChecker = newNameSpaceChecker(myNamespace);
ServerRequestWrapper serverRequestWrapper = mock(ServerRequestWrapper.class);
when(serverRequestWrapper.getHeader(anyString())).thenReturn("invalid_namespace");
Assert.assertTrue(myNamespaceChecker.checkNamespace(serverRequestWrapper));
}
use of com.navercorp.pinpoint.bootstrap.plugin.request.ServerRequestWrapper in project pinpoint by naver.
the class NameSpaceCheckFactoryTest method newNamespace_collision.
@Test
public void newNamespace_collision() {
String myNamespace = "myNamespace";
NameSpaceChecker<ServerRequestWrapper> myNamespaceChecker = newNameSpaceChecker(myNamespace);
ServerRequestWrapper serverRequestWrapper = mock(ServerRequestWrapper.class);
when(serverRequestWrapper.getHeader(anyString())).thenReturn("collision_namespace");
Assert.assertFalse(myNamespaceChecker.checkNamespace(serverRequestWrapper));
}
use of com.navercorp.pinpoint.bootstrap.plugin.request.ServerRequestWrapper in project pinpoint by naver.
the class NameSpaceCheckFactoryTest method newNamespace_valid.
@Test
public void newNamespace_valid() {
String myNamespace = "myNamespace";
NameSpaceChecker<ServerRequestWrapper> myNamespaceChecker = newNameSpaceChecker(myNamespace);
ServerRequestWrapper serverRequestWrapper = mock(ServerRequestWrapper.class);
when(serverRequestWrapper.getHeader(anyString())).thenReturn(myNamespace);
Assert.assertTrue(myNamespaceChecker.checkNamespace(serverRequestWrapper));
}
use of com.navercorp.pinpoint.bootstrap.plugin.request.ServerRequestWrapper in project pinpoint by naver.
the class ServerRequestRecorderFactoryTest method record.
@Test
public void record() throws Exception {
RequestAdaptor<ServerRequestWrapper> requestAdaptor = new ServerRequestWrapperAdaptor();
final ServerRequestRecorder<ServerRequestWrapper> recorder = new ServerRequestRecorder<>(requestAdaptor);
// SpanRecorder
SpanRecorder spanRecorder = mock(SpanRecorder.class);
recorder.record(spanRecorder, new MockServerRequestWrapper());
verify(spanRecorder).recordRpcName(RPC_NAME);
verify(spanRecorder).recordEndPoint(END_POINT);
verify(spanRecorder).recordRemoteAddress(REMOTE_ADDRESS);
verify(spanRecorder).recordAcceptorHost(GET_HEADER);
}
Aggregations