Search in sources :

Example 6 with VirtualLinkMarker

use of com.navercorp.pinpoint.web.service.map.VirtualLinkMarker in project pinpoint by naver.

the class RpcCallProcessorTest method multipleAcceptApplications_with_AliasAndOriginal.

@Test
public void multipleAcceptApplications_with_AliasAndOriginal() {
    ServiceType AliasServiceType = of(1008, "TEST_ALIAS_CLIENT", ALIAS);
    ServiceType ServerServiceType = of(1009, "TEST_ALIAS_SERVER", RECORD_STATISTICS, TERMINAL);
    // Given
    ServiceType rpcClientServiceType = mock(ServiceType.class);
    when(rpcClientServiceType.isRpcClient()).thenReturn(true);
    String rpcUri = "accept.host/foo";
    Application fromApplication = new Application("WAS", ServiceType.TEST_STAND_ALONE);
    Application toApplication = new Application(rpcUri, rpcClientServiceType);
    LinkDataMap linkDataMap = new LinkDataMap();
    linkDataMap.addLinkData(new LinkData(fromApplication, toApplication));
    Application expectedToApplication1 = new Application("AliasClient", AliasServiceType);
    Application expectedToApplication2 = new Application("AliasServer", ServerServiceType);
    when(hostApplicationMapDao.findAcceptApplicationName(fromApplication, testRange)).thenReturn(Sets.newHashSet(new AcceptApplication(rpcUri, expectedToApplication1), new AcceptApplication(rpcUri, expectedToApplication2)));
    // When
    VirtualLinkMarker virtualLinkMarker = new VirtualLinkMarker();
    RpcCallProcessor rpcCallProcessor = new RpcCallProcessor(hostApplicationMapDao, virtualLinkMarker);
    LinkDataMap replacedLinkDataMap = rpcCallProcessor.processLinkDataMap(linkDataMap, testRange);
    // Then
    LinkKey originalLinkKey = new LinkKey(fromApplication, toApplication);
    Assert.assertNull(replacedLinkDataMap.getLinkData(originalLinkKey));
    LinkKey replacedLinkKey2 = new LinkKey(fromApplication, expectedToApplication2);
    LinkData replacedLinkData2 = replacedLinkDataMap.getLinkData(replacedLinkKey2);
    Assert.assertNotNull(replacedLinkData2);
    Assert.assertEquals(fromApplication, replacedLinkData2.getFromApplication());
    Assert.assertEquals(expectedToApplication2, replacedLinkData2.getToApplication());
}
Also used : LinkKey(com.navercorp.pinpoint.web.vo.LinkKey) LinkData(com.navercorp.pinpoint.web.applicationmap.rawdata.LinkData) ServiceType(com.navercorp.pinpoint.common.trace.ServiceType) AcceptApplication(com.navercorp.pinpoint.web.service.map.AcceptApplication) Application(com.navercorp.pinpoint.web.vo.Application) AcceptApplication(com.navercorp.pinpoint.web.service.map.AcceptApplication) VirtualLinkMarker(com.navercorp.pinpoint.web.service.map.VirtualLinkMarker) LinkDataMap(com.navercorp.pinpoint.web.applicationmap.rawdata.LinkDataMap) Test(org.junit.Test)

Aggregations

ServiceType (com.navercorp.pinpoint.common.trace.ServiceType)6 LinkData (com.navercorp.pinpoint.web.applicationmap.rawdata.LinkData)6 LinkDataMap (com.navercorp.pinpoint.web.applicationmap.rawdata.LinkDataMap)6 AcceptApplication (com.navercorp.pinpoint.web.service.map.AcceptApplication)6 VirtualLinkMarker (com.navercorp.pinpoint.web.service.map.VirtualLinkMarker)6 Application (com.navercorp.pinpoint.web.vo.Application)6 LinkKey (com.navercorp.pinpoint.web.vo.LinkKey)6 Test (org.junit.Test)6