@Test public void testExactlyTwoDifferentExternalResourceNames() { Operation op1 = createOperation(); Operation op2 = createOperation(); OperationMap map = op2.createMap(JMSPluginUtils.CONNECTION_DATA); map.put("host", "127.0.0.2"); map.put("port", 1111); Operation dummyOp = new Operation(); SimpleFrameBuilder builder = new SimpleFrameBuilder(); builder.enter(new Operation().type(OperationType.HTTP)); builder.enter(op2); builder.exit(); builder.enter(dummyOp); builder.enter(op1); builder.exit(); builder.exit(); Frame frame = builder.exit(); Trace trace = Trace.newInstance(ApplicationName.valueOf("app"), TraceId.valueOf("0"), frame); List<ExternalResourceDescriptor> externalResourceDescriptors = (List<ExternalResourceDescriptor>) analyzer.locateExternalResourceName(trace); assertEquals(2, externalResourceDescriptors.size()); ExternalResourceDescriptor descriptor = externalResourceDescriptors.get(0); assertEquals(op2, descriptor.getFrame().getOperation()); assertEquals("JMS-Queue#test.queue", descriptor.getLabel()); assertEquals(ExternalResourceType.QUEUE.name(), descriptor.getType()); assertEquals("JMS", descriptor.getVendor()); assertEquals("127.0.0.2", descriptor.getHost()); assertEquals(1111, descriptor.getPort()); String expectedHash = MD5NameGenerator.getName("Queue#test.queue127.0.0.21111"); assertEquals("JMS:" + expectedHash, descriptor.getName()); assertEquals(Boolean.valueOf(isIncoming), Boolean.valueOf(descriptor.isIncoming())); descriptor = externalResourceDescriptors.get(1); assertEquals(op1, descriptor.getFrame().getOperation()); assertEquals("JMS-Queue#test.queue", descriptor.getLabel()); assertEquals(ExternalResourceType.QUEUE.name(), descriptor.getType()); assertEquals("JMS", descriptor.getVendor()); assertEquals(null, descriptor.getHost()); assertEquals(-1, descriptor.getPort()); expectedHash = MD5NameGenerator.getName("Queue#test.queuenull-1"); assertEquals("JMS:" + expectedHash, descriptor.getName()); assertEquals(Boolean.valueOf(isIncoming), Boolean.valueOf(descriptor.isIncoming())); }
public Collection<ExternalResourceDescriptor> locateExternalResourceName(Trace trace) { return locateExternalResourceName(trace, locateFrames(trace)); }
AbstractJMSResourceAnalyzer implements ExternalResourceAnalyzer { public Collection<ExternalResourceDescriptor> locateExternalResourceName(Trace trace) { return locateExternalResourceName(trace, locateFrames(trace)); } }
AbstractJMSResourceAnalyzer implements ExternalResourceAnalyzer { public Collection<ExternalResourceDescriptor> locateExternalResourceName(Trace trace) { return locateExternalResourceName(trace, locateFrames(trace)); } protected  AbstractJMSResourceAnalyzer(JMSPluginOperationType type, boolean incoming); }
AbstractJMSResourceAnalyzer implements ExternalResourceAnalyzer { public Collection<ExternalResourceDescriptor> locateExternalResourceName(Trace trace) { return locateExternalResourceName(trace, locateFrames(trace)); } protected  AbstractJMSResourceAnalyzer(JMSPluginOperationType type, boolean incoming); OperationType getOperationType(); Collection<ExternalResourceDescriptor> locateExternalResourceName(Trace trace); Collection<Frame> locateFrames(Trace trace); Collection<ExternalResourceDescriptor> locateExternalResourceName(Trace trace, Collection<Frame> queueFrames); static String buildLabel(Operation op); static String buildLabel(String destType, String destName); static String buildNameHash(String label, String host, int port); }
AbstractJMSResourceAnalyzer implements ExternalResourceAnalyzer { public Collection<ExternalResourceDescriptor> locateExternalResourceName(Trace trace) { return locateExternalResourceName(trace, locateFrames(trace)); } protected  AbstractJMSResourceAnalyzer(JMSPluginOperationType type, boolean incoming); OperationType getOperationType(); Collection<ExternalResourceDescriptor> locateExternalResourceName(Trace trace); Collection<Frame> locateFrames(Trace trace); Collection<ExternalResourceDescriptor> locateExternalResourceName(Trace trace, Collection<Frame> queueFrames); static String buildLabel(Operation op); static String buildLabel(String destType, String destName); static String buildNameHash(String label, String host, int port); static final String JMS; static final int DEFAULT_SCORE; }