use of com.navercorp.pinpoint.web.applicationmap.nodes.ServerInstanceList in project pinpoint by naver.
the class LinkSerializer method writeAgentIdNameMap.
private void writeAgentIdNameMap(String fieldName, Node node, JsonGenerator jgen) throws IOException {
if (node.getServiceType().isWas()) {
jgen.writeFieldName(fieldName);
jgen.writeStartObject();
ServerInstanceList serverInstanceList = node.getServerInstanceList();
if (serverInstanceList != null) {
for (Map.Entry<String, String> entry : serverInstanceList.getAgentIdNameMap().entrySet()) {
jgen.writeStringField(entry.getKey(), entry.getValue());
}
}
jgen.writeEndObject();
}
}
use of com.navercorp.pinpoint.web.applicationmap.nodes.ServerInstanceList in project pinpoint by naver.
the class LinkSerializer method writeAgentId.
private void writeAgentId(String fieldName, Node node, JsonGenerator jgen) throws IOException {
if (node.getServiceType().isWas()) {
jgen.writeFieldName(fieldName);
jgen.writeStartArray();
ServerInstanceList serverInstanceList = node.getServerInstanceList();
if (serverInstanceList != null) {
for (String agentId : serverInstanceList.getAgentIdList()) {
jgen.writeObject(agentId);
}
}
jgen.writeEndArray();
}
}
use of com.navercorp.pinpoint.web.applicationmap.nodes.ServerInstanceList in project pinpoint by naver.
the class ApplicationMapBuilder method build.
public ApplicationMap build(Application application, long timeoutMillis) {
logger.info("Building empty application map");
NodeList nodeList = new NodeList();
LinkList emptyLinkList = new LinkList();
NodeType nodeType = this.nodeType;
if (nodeType == null) {
nodeType = NodeType.DETAILED;
}
Node node = new Node(nodeType, application);
if (serverInstanceListFactory != null) {
ServerInstanceList runningInstances = serverInstanceListFactory.createWasNodeInstanceList(node, range.getTo());
if (runningInstances.getInstanceCount() > 0) {
node.setServerInstanceList(runningInstances);
nodeList.addNode(node);
}
}
NodeHistogramFactory nodeHistogramFactory = this.nodeHistogramFactory;
if (nodeHistogramFactory == null) {
nodeHistogramFactory = new EmptyNodeHistogramFactory();
}
NodeHistogramAppender nodeHistogramAppender = nodeHistogramAppenderFactory.create(nodeHistogramFactory);
nodeHistogramAppender.appendNodeHistogram(range, nodeList, emptyLinkList, timeoutMillis);
return new DefaultApplicationMap(range, nodeList, emptyLinkList);
}
use of com.navercorp.pinpoint.web.applicationmap.nodes.ServerInstanceList in project pinpoint by naver.
the class ServerInfoAppenderTest method wasNode.
@Test
public void wasNode() {
// Given
Range range = Range.newRange(0, 60 * 1000);
NodeList nodeList = new NodeList();
LinkDataDuplexMap linkDataDuplexMap = mock(LinkDataDuplexMap.class);
Node wasNode = new Node(new Application("Was", ServiceType.TEST_STAND_ALONE));
nodeList.addNode(wasNode);
ServerInstanceList serverInstanceList = new ServerInstanceList();
when(serverInstanceListDataSource.createServerInstanceList(wasNode, range.getTo())).thenReturn(serverInstanceList);
// When
serverInfoAppender.appendServerInfo(range, nodeList, linkDataDuplexMap, timeoutMillis);
// Then
Assert.assertSame(serverInstanceList, wasNode.getServerInstanceList());
verifyZeroInteractions(linkDataDuplexMap);
}
use of com.navercorp.pinpoint.web.applicationmap.nodes.ServerInstanceList in project pinpoint by naver.
the class ServerInfoAppenderTest method wasNodes.
@Test
public void wasNodes() {
// Given
Range range = Range.newRange(0, 60 * 1000);
NodeList nodeList = new NodeList();
LinkDataDuplexMap linkDataDuplexMap = mock(LinkDataDuplexMap.class);
Node wasNode1 = new Node(new Application("Was1", ServiceType.TEST_STAND_ALONE));
nodeList.addNode(wasNode1);
Node wasNode2 = new Node(new Application("Was2", ServiceType.TEST_STAND_ALONE));
nodeList.addNode(wasNode2);
ServerInstanceList serverInstanceList1 = new ServerInstanceList();
when(serverInstanceListDataSource.createServerInstanceList(wasNode1, range.getTo())).thenReturn(serverInstanceList1);
ServerInstanceList serverInstanceList2 = new ServerInstanceList();
when(serverInstanceListDataSource.createServerInstanceList(wasNode2, range.getTo())).thenReturn(serverInstanceList2);
// When
serverInfoAppender.appendServerInfo(range, nodeList, linkDataDuplexMap, timeoutMillis);
// Then
Assert.assertSame(serverInstanceList1, wasNode1.getServerInstanceList());
Assert.assertSame(serverInstanceList2, wasNode2.getServerInstanceList());
verifyZeroInteractions(linkDataDuplexMap);
}
Aggregations