use of com.navercorp.pinpoint.web.applicationmap.nodes.NodeList in project pinpoint by naver.
the class ServerInfoAppenderTest method nullNodeList.
@Test
public void nullNodeList() {
// Given
Range range = Range.newRange(0, 60 * 1000);
NodeList nodeList = null;
LinkDataDuplexMap linkDataDuplexMap = mock(LinkDataDuplexMap.class);
// When
serverInfoAppender.appendServerInfo(range, nodeList, linkDataDuplexMap, timeoutMillis);
// Then
Assert.assertNull(nodeList);
verifyZeroInteractions(serverInstanceListDataSource);
verifyZeroInteractions(linkDataDuplexMap);
}
use of com.navercorp.pinpoint.web.applicationmap.nodes.NodeList in project pinpoint by naver.
the class ServerInfoAppenderTest method terminalNode.
@Test
public void terminalNode() {
// Given
Range range = Range.newRange(0, 60 * 1000);
NodeList nodeList = new NodeList();
LinkDataDuplexMap linkDataDuplexMap = new LinkDataDuplexMap();
ServiceType terminalType = ServiceTypeFactory.of(2000, "TERMINAL", TERMINAL, INCLUDE_DESTINATION_ID);
Application terminalApplication = new Application("Terminal", terminalType);
Node terminalNode = new Node(terminalApplication);
nodeList.addNode(terminalNode);
Application fromApplication = new Application("FromWas", ServiceType.TEST_STAND_ALONE);
LinkData linkData = new LinkData(fromApplication, terminalApplication);
linkData.addLinkData("wasAgent", ServiceType.TEST_STAND_ALONE, "terminalNodeAddress", terminalType, System.currentTimeMillis(), terminalType.getHistogramSchema().getNormalSlot().getSlotTime(), 1);
linkDataDuplexMap.addSourceLinkData(linkData);
// When
serverInfoAppender.appendServerInfo(range, nodeList, linkDataDuplexMap, timeoutMillis);
// Then
Assert.assertEquals(1, terminalNode.getServerInstanceList().getInstanceCount());
}
use of com.navercorp.pinpoint.web.applicationmap.nodes.NodeList in project pinpoint by naver.
the class ServerInfoAppenderTest method terminalNode_multipleInstances.
@Test
public void terminalNode_multipleInstances() {
// Given
Range range = Range.newRange(0, 60 * 1000);
NodeList nodeList = new NodeList();
LinkDataDuplexMap linkDataDuplexMap = new LinkDataDuplexMap();
ServiceType terminalType = ServiceTypeFactory.of(2000, "TERMINAL", TERMINAL, INCLUDE_DESTINATION_ID);
Application terminalApplication = new Application("Terminal", terminalType);
Node terminalNode = new Node(terminalApplication);
nodeList.addNode(terminalNode);
Application fromApplication = new Application("FromWas", ServiceType.TEST_STAND_ALONE);
LinkData linkData = new LinkData(fromApplication, terminalApplication);
linkData.addLinkData("wasAgent", ServiceType.TEST_STAND_ALONE, "terminalNodeAddress1", terminalType, System.currentTimeMillis(), terminalType.getHistogramSchema().getNormalSlot().getSlotTime(), 1);
linkData.addLinkData("wasAgent", ServiceType.TEST_STAND_ALONE, "terminalNodeAddress2", terminalType, System.currentTimeMillis(), terminalType.getHistogramSchema().getNormalSlot().getSlotTime(), 1);
linkDataDuplexMap.addSourceLinkData(linkData);
// When
serverInfoAppender.appendServerInfo(range, nodeList, linkDataDuplexMap, timeoutMillis);
// Then
Assert.assertEquals(2, terminalNode.getServerInstanceList().getInstanceCount());
}
use of com.navercorp.pinpoint.web.applicationmap.nodes.NodeList in project pinpoint by naver.
the class NodeHistogramAppenderTest method emptyNodeList.
@Test
public void emptyNodeList() {
// Given
Range range = Range.newRange(0, 60 * 1000);
NodeList nodeList = new NodeList();
LinkList linkList = new LinkList();
// When
nodeHistogramAppender.appendNodeHistogram(range, nodeList, linkList, buildTimeoutMillis);
// Then
Assert.assertTrue(nodeList.getNodeList().isEmpty());
verifyZeroInteractions(wasNodeHistogramDataSource);
}
use of com.navercorp.pinpoint.web.applicationmap.nodes.NodeList in project pinpoint by naver.
the class NodeHistogramAppenderTest method terminalNode.
/**
* Checks histograms for a single terminal node.
* <pre>
* fromNode ---> databaseNode
* </pre>
*/
@Test
public void terminalNode() {
// Given
Range range = Range.newRange(0, 60 * 1000);
NodeList nodeList = new NodeList();
LinkList linkList = new LinkList();
// fromNode : [testApp] test-app
Node fromNode = createNode("testApp", ServiceTypeFactory.of(1000, "WAS"));
String fromNodeAgent = "test-app";
// toNode : [testDatabase] test-database
Node toNode = createNode("testDatabase", ServiceTypeFactory.of(2000, "RDB", ServiceTypeProperty.TERMINAL));
String toNodeAgent = "test-database";
nodeList.addNode(toNode);
Link link = new Link(CreateType.Source, fromNode, toNode, range);
HistogramSlot fastSlot = toNode.getServiceType().getHistogramSchema().getFastSlot();
HistogramSlot normalSlot = toNode.getServiceType().getHistogramSchema().getNormalSlot();
HistogramSlot slowSlot = toNode.getServiceType().getHistogramSchema().getSlowSlot();
// [testApp] test-app -> [testDatabase] test-database
long fastCallCount = 200L;
long normalCallCount = 100L;
long slowCallCount = 75L;
link.addSource(createLinkCallDataMap(fromNodeAgent, fromNode.getServiceType(), toNodeAgent, toNode.getServiceType(), fastSlot, fastCallCount));
link.addSource(createLinkCallDataMap(fromNodeAgent, fromNode.getServiceType(), toNodeAgent, toNode.getServiceType(), normalSlot, normalCallCount));
link.addSource(createLinkCallDataMap(fromNodeAgent, fromNode.getServiceType(), toNodeAgent, toNode.getServiceType(), slowSlot, slowCallCount));
linkList.addLink(link);
// When
nodeHistogramAppender.appendNodeHistogram(range, nodeList, linkList, buildTimeoutMillis);
// Then
Node actualNode = nodeList.getNodeList().iterator().next();
NodeHistogram nodeHistogram = actualNode.getNodeHistogram();
// verify application-level histogram
Histogram applicationHistogram = nodeHistogram.getApplicationHistogram();
Assert.assertEquals(fastCallCount, applicationHistogram.getFastCount());
Assert.assertEquals(normalCallCount, applicationHistogram.getNormalCount());
Assert.assertEquals(slowCallCount, applicationHistogram.getSlowCount());
Assert.assertEquals(fastCallCount + normalCallCount + slowCallCount, applicationHistogram.getTotalCount());
// verify agent-level histogram
Map<String, Histogram> agentHistogramMap = nodeHistogram.getAgentHistogramMap();
Histogram agentHistogram = agentHistogramMap.get(toNodeAgent);
Assert.assertEquals(fastCallCount, agentHistogram.getFastCount());
Assert.assertEquals(normalCallCount, agentHistogram.getNormalCount());
Assert.assertEquals(slowCallCount, agentHistogram.getSlowCount());
Assert.assertEquals(fastCallCount + normalCallCount + slowCallCount, agentHistogram.getTotalCount());
}
Aggregations