@Test public void multipleEurekaClientsShouldReturnSingleDependencyOnEurekaServer() { EurekaClient eurekaClientMock = Mockito.mock(EurekaClient.class); EurekaServerRelationshipDetector detector = new EurekaServerRelationshipDetector( Arrays.asList(eurekaClientMock)); Dependency dependency = Dependency.on(Component.of("eureka-server", ComponentType.HTTP_APPLICATION_REGISTRY)); Set<Relationship> expected = new HashSet<>(Arrays.asList(dependency)); Assertions.assertThat(detector.detect()).isEqualTo(expected); }
@Override public Set<Relationship> detect() { if (eurekaClients.isEmpty()) { return Collections.emptySet(); } return Dependency.on(Component.of(defaultName, ComponentType.HTTP_APPLICATION_REGISTRY)).asRelationshipSet(); }
EurekaServerRelationshipDetector implements RelationshipDetector { @Override public Set<Relationship> detect() { if (eurekaClients.isEmpty()) { return Collections.emptySet(); } return Dependency.on(Component.of(defaultName, ComponentType.HTTP_APPLICATION_REGISTRY)).asRelationshipSet(); } }
EurekaServerRelationshipDetector implements RelationshipDetector { @Override public Set<Relationship> detect() { if (eurekaClients.isEmpty()) { return Collections.emptySet(); } return Dependency.on(Component.of(defaultName, ComponentType.HTTP_APPLICATION_REGISTRY)).asRelationshipSet(); } EurekaServerRelationshipDetector(List<EurekaClient> eurekaClients); }
EurekaServerRelationshipDetector implements RelationshipDetector { @Override public Set<Relationship> detect() { if (eurekaClients.isEmpty()) { return Collections.emptySet(); } return Dependency.on(Component.of(defaultName, ComponentType.HTTP_APPLICATION_REGISTRY)).asRelationshipSet(); } EurekaServerRelationshipDetector(List<EurekaClient> eurekaClients); @Override Set<Relationship> detect(); }
EurekaServerRelationshipDetector implements RelationshipDetector { @Override public Set<Relationship> detect() { if (eurekaClients.isEmpty()) { return Collections.emptySet(); } return Dependency.on(Component.of(defaultName, ComponentType.HTTP_APPLICATION_REGISTRY)).asRelationshipSet(); } EurekaServerRelationshipDetector(List<EurekaClient> eurekaClients); @Override Set<Relationship> detect();  }