use of com.navercorp.pinpoint.web.service.map.AcceptApplication in project pinpoint by naver.
the class HostApplicationMapperVer2 method mapRow.
@Override
public List<AcceptApplication> mapRow(Result result, int rowNum) throws Exception {
if (result.isEmpty()) {
return Collections.emptyList();
}
// readRowKey(result.getRow());
final List<AcceptApplication> acceptApplicationList = new ArrayList<>(result.size());
for (Cell cell : result.rawCells()) {
AcceptApplication acceptedApplication = createAcceptedApplication(cell);
acceptApplicationList.add(acceptedApplication);
}
return acceptApplicationList;
}
use of com.navercorp.pinpoint.web.service.map.AcceptApplication in project pinpoint by naver.
the class HostApplicationMapperVer2 method createAcceptedApplication.
// private void readRowKey(byte[] rowKey) {
// final Buffer rowKeyBuffer= new FixedBuffer(rowKey);
// final String parentApplicationName = rowKeyBuffer.readPadStringAndRightTrim(HBaseTableConstants.APPLICATION_NAME_MAX_LEN);
// final short parentApplicationServiceType = rowKeyBuffer.readShort();
// final long timeSlot = TimeUtils.recoveryTimeMillis(rowKeyBuffer.readLong());
//
// if (logger.isDebugEnabled()) {
// logger.debug("parentApplicationName:{}/{} time:{}", parentApplicationName, parentApplicationServiceType, timeSlot);
// }
// }
private AcceptApplication createAcceptedApplication(Cell cell) {
Buffer reader = new OffsetFixedBuffer(cell.getQualifierArray(), cell.getQualifierOffset(), cell.getQualifierLength());
String host = reader.readPrefixedString();
String bindApplicationName = reader.readPrefixedString();
short bindServiceTypeCode = reader.readShort();
final Application bindApplication = applicationFactory.createApplication(bindApplicationName, bindServiceTypeCode);
return new AcceptApplication(host, bindApplication);
}
use of com.navercorp.pinpoint.web.service.map.AcceptApplication in project pinpoint by naver.
the class RpcCallProcessorTest method multipleAcceptApplications.
@Test
public void multipleAcceptApplications() {
// 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("ACCEPT_WAS1", ServiceType.TEST_STAND_ALONE);
Application expectedToApplication2 = new Application("ACCEPT_WAS2", ServiceType.TEST_STAND_ALONE);
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 replacedLinkKey1 = new LinkKey(fromApplication, expectedToApplication1);
LinkData replacedLinkData1 = replacedLinkDataMap.getLinkData(replacedLinkKey1);
Assert.assertNotNull(replacedLinkData1);
Assert.assertEquals(fromApplication, replacedLinkData1.getFromApplication());
Assert.assertEquals(expectedToApplication1, replacedLinkData1.getToApplication());
LinkKey replacedLinkKey2 = new LinkKey(fromApplication, expectedToApplication2);
LinkData replacedLinkData2 = replacedLinkDataMap.getLinkData(replacedLinkKey2);
Assert.assertNotNull(replacedLinkData2);
Assert.assertEquals(fromApplication, replacedLinkData2.getFromApplication());
Assert.assertEquals(expectedToApplication2, replacedLinkData2.getToApplication());
Set<LinkData> virtualLinkDatas = virtualLinkMarker.getVirtualLinkData();
Assert.assertTrue(virtualLinkDatas.contains(replacedLinkData1));
Assert.assertTrue(virtualLinkDatas.contains(replacedLinkData2));
}
use of com.navercorp.pinpoint.web.service.map.AcceptApplication in project pinpoint by naver.
the class RpcCallProcessorTest method oneAcceptApplication.
@Test
public void oneAcceptApplication() {
// 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 expectedToApplication = new Application("ACCEPT_WAS", ServiceType.TEST_STAND_ALONE);
when(hostApplicationMapDao.findAcceptApplicationName(fromApplication, testRange)).thenReturn(Sets.newHashSet(new AcceptApplication(rpcUri, expectedToApplication)));
// 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 replacedLinkKey = new LinkKey(fromApplication, expectedToApplication);
LinkData replacedLinkData = replacedLinkDataMap.getLinkData(replacedLinkKey);
Assert.assertNotNull(replacedLinkData);
Assert.assertEquals(fromApplication, replacedLinkData.getFromApplication());
Assert.assertEquals(expectedToApplication, replacedLinkData.getToApplication());
Assert.assertTrue(virtualLinkMarker.getVirtualLinkData().isEmpty());
}
use of com.navercorp.pinpoint.web.service.map.AcceptApplication in project pinpoint by naver.
the class AcceptApplicationLocalCacheTest method createAcceptApplication.
private Set<AcceptApplication> createAcceptApplication() {
AcceptApplication naver = new AcceptApplication("www.naver.com", new Application("Naver", ServiceType.STAND_ALONE));
AcceptApplication daum = new AcceptApplication("www.daum.com", new Application("Daum", ServiceType.STAND_ALONE));
AcceptApplication nate = new AcceptApplication("www.nate.com", new Application("Nate", ServiceType.STAND_ALONE));
Set<AcceptApplication> result = new HashSet<AcceptApplication>();
result.add(naver);
result.add(daum);
result.add(nate);
result.add(localhost);
return result;
}
Aggregations