@Test public void connectionsShouldReturnDependenciesOnRabbitMqVhost() { ConnectionFactory factory = Mockito.mock(ConnectionFactory.class); Mockito.when(factory.getVirtualHost()).thenReturn("vhost"); RabbitRelationshipDetector detector = new RabbitRelationshipDetector(Arrays.asList(factory)); Dependency dependency = Dependency.on(Component.of("vhost", ComponentType.RABBITMQ)); Assertions.assertThat(detector.detect()).isEqualTo(new HashSet<>(Arrays.asList(dependency))); }
@Override public Set<Relationship> detect() { if (connectionFactories.isEmpty()) { return Collections.emptySet(); } return connectionFactories.stream().map(factory -> createRabbitDependency(factory.getVirtualHost())) .collect(Collectors.toSet()); }
RabbitRelationshipDetector implements RelationshipDetector { @Override public Set<Relationship> detect() { if (connectionFactories.isEmpty()) { return Collections.emptySet(); } return connectionFactories.stream().map(factory -> createRabbitDependency(factory.getVirtualHost())) .collect(Collectors.toSet()); } }
RabbitRelationshipDetector implements RelationshipDetector { @Override public Set<Relationship> detect() { if (connectionFactories.isEmpty()) { return Collections.emptySet(); } return connectionFactories.stream().map(factory -> createRabbitDependency(factory.getVirtualHost())) .collect(Collectors.toSet()); } RabbitRelationshipDetector(List<ConnectionFactory> rabbitConnectionFactories); }
RabbitRelationshipDetector implements RelationshipDetector { @Override public Set<Relationship> detect() { if (connectionFactories.isEmpty()) { return Collections.emptySet(); } return connectionFactories.stream().map(factory -> createRabbitDependency(factory.getVirtualHost())) .collect(Collectors.toSet()); } RabbitRelationshipDetector(List<ConnectionFactory> rabbitConnectionFactories); @Override Set<Relationship> detect(); }
RabbitRelationshipDetector implements RelationshipDetector { @Override public Set<Relationship> detect() { if (connectionFactories.isEmpty()) { return Collections.emptySet(); } return connectionFactories.stream().map(factory -> createRabbitDependency(factory.getVirtualHost())) .collect(Collectors.toSet()); } RabbitRelationshipDetector(List<ConnectionFactory> rabbitConnectionFactories); @Override Set<Relationship> detect();  }