AbstractMongoDBExternalResourceAnalyzer analyzer = createMongoAnalyzer();
List<ExternalResourceDescriptor> externalResourceDescriptors =
(List<ExternalResourceDescriptor>) analyzer.locateExternalResourceName(trace);
assertEquals(2, externalResourceDescriptors.size());
ExternalResourceDescriptor descriptor = externalResourceDescriptors.get(0);
assertEquals(op2, descriptor.getFrame().getOperation());
assertEquals("dbName2", descriptor.getLabel());
assertEquals(ExternalResourceType.DATABASE.name(), descriptor.getType());
assertEquals("MongoDB", descriptor.getVendor());
assertEquals(null, descriptor.getHost());
assertEquals(6379, descriptor.getPort());
String expectedHash = MD5NameGenerator.getName("dbName2" + null + 6379);
assertEquals("mongo:" + expectedHash, descriptor.getName());
assertEquals(Boolean.FALSE, Boolean.valueOf(descriptor.isIncoming()));
descriptor = externalResourceDescriptors.get(1);
assertEquals(op1, descriptor.getFrame().getOperation());
assertEquals("dbName", descriptor.getLabel());
assertEquals(ExternalResourceType.DATABASE.name(), descriptor.getType());
assertEquals("MongoDB", descriptor.getVendor());
assertEquals("127.0.0.1", descriptor.getHost());
assertEquals(6379, descriptor.getPort());
expectedHash = MD5NameGenerator.getName("dbName127.0.0.1" + 6379);
assertEquals("mongo:" + expectedHash, descriptor.getName());
assertEquals(Boolean.FALSE, Boolean.valueOf(descriptor.isIncoming()));
}