@Test public void testGetMessageRoutingInformationReturnsEmptyOptionalFromNonAxonServiceInstanceRequestWhichThrowsAnHttpClientErrorException() { ServiceInstance nonAxonInstance = mock(ServiceInstance.class); when(nonAxonInstance.getServiceId()).thenReturn(SERVICE_INSTANCE_ID); when(nonAxonInstance.getUri()).thenReturn(URI.create("http: URI testRemoteUri = URI.create("http: when(restTemplate.exchange( eq(testRemoteUri), eq(HttpMethod.GET), eq(HttpEntity.EMPTY), eq(MessageRoutingInformation.class) )).thenThrow(new HttpClientErrorException(HttpStatus.BAD_REQUEST)); Optional<MessageRoutingInformation> result = testSubject.getMessageRoutingInformation(nonAxonInstance); assertFalse(result.isPresent()); verify(restTemplate).exchange(uriArgumentCaptor.capture(), eq(HttpMethod.GET), eq(HttpEntity.EMPTY), eq(MessageRoutingInformation.class)); URI resultUri = uriArgumentCaptor.getValue(); assertEquals(messageRoutingInformationEndpoint, resultUri.getPath()); }
@Override protected Optional<MessageRoutingInformation> getMessageRoutingInformation(ServiceInstance serviceInstance) { if (enforceHttpDiscovery) { return requestMessageRoutingInformation(serviceInstance); } Optional<MessageRoutingInformation> defaultMessageRoutingInfo = super.getMessageRoutingInformation(serviceInstance); return defaultMessageRoutingInfo.isPresent() ? defaultMessageRoutingInfo : requestMessageRoutingInformation(serviceInstance); }
SpringCloudHttpBackupCommandRouter extends SpringCloudCommandRouter { @Override protected Optional<MessageRoutingInformation> getMessageRoutingInformation(ServiceInstance serviceInstance) { if (enforceHttpDiscovery) { return requestMessageRoutingInformation(serviceInstance); } Optional<MessageRoutingInformation> defaultMessageRoutingInfo = super.getMessageRoutingInformation(serviceInstance); return defaultMessageRoutingInfo.isPresent() ? defaultMessageRoutingInfo : requestMessageRoutingInformation(serviceInstance); } }
SpringCloudHttpBackupCommandRouter extends SpringCloudCommandRouter { @Override protected Optional<MessageRoutingInformation> getMessageRoutingInformation(ServiceInstance serviceInstance) { if (enforceHttpDiscovery) { return requestMessageRoutingInformation(serviceInstance); } Optional<MessageRoutingInformation> defaultMessageRoutingInfo = super.getMessageRoutingInformation(serviceInstance); return defaultMessageRoutingInfo.isPresent() ? defaultMessageRoutingInfo : requestMessageRoutingInformation(serviceInstance); } protected  SpringCloudHttpBackupCommandRouter(Builder builder); }
SpringCloudHttpBackupCommandRouter extends SpringCloudCommandRouter { @Override protected Optional<MessageRoutingInformation> getMessageRoutingInformation(ServiceInstance serviceInstance) { if (enforceHttpDiscovery) { return requestMessageRoutingInformation(serviceInstance); } Optional<MessageRoutingInformation> defaultMessageRoutingInfo = super.getMessageRoutingInformation(serviceInstance); return defaultMessageRoutingInfo.isPresent() ? defaultMessageRoutingInfo : requestMessageRoutingInformation(serviceInstance); } protected  SpringCloudHttpBackupCommandRouter(Builder builder); static Builder builder(); @Override void updateMembership(int loadFactor, CommandMessageFilter commandFilter); @GetMapping MessageRoutingInformation getLocalMessageRoutingInformation(); }
SpringCloudHttpBackupCommandRouter extends SpringCloudCommandRouter { @Override protected Optional<MessageRoutingInformation> getMessageRoutingInformation(ServiceInstance serviceInstance) { if (enforceHttpDiscovery) { return requestMessageRoutingInformation(serviceInstance); } Optional<MessageRoutingInformation> defaultMessageRoutingInfo = super.getMessageRoutingInformation(serviceInstance); return defaultMessageRoutingInfo.isPresent() ? defaultMessageRoutingInfo : requestMessageRoutingInformation(serviceInstance); } protected  SpringCloudHttpBackupCommandRouter(Builder builder); static Builder builder(); @Override void updateMembership(int loadFactor, CommandMessageFilter commandFilter); @GetMapping MessageRoutingInformation getLocalMessageRoutingInformation();  }