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());
}
Aggregations