@Test public void should_clear_info_on_http_error() { Instance instance = Instance.create(InstanceId.of("onl")) .register(Registration.create("foo", wireMock.url("/health")).build()) .withEndpoints(Endpoints.single("info", wireMock.url("/info"))) .withStatusInfo(StatusInfo.ofUp()) .withInfo(Info.from(singletonMap("foo", "bar"))); StepVerifier.create(repository.save(instance)).expectNextCount(1).verifyComplete(); wireMock.stubFor(get("/info").willReturn(serverError())); StepVerifier.create(eventStore) .expectSubscription() .then(() -> StepVerifier.create(updater.updateInfo(instance.getId())).verifyComplete()) .assertNext(event -> assertThat(event).isInstanceOf(InstanceInfoChangedEvent.class)) .thenCancel() .verify(); StepVerifier.create(repository.find(instance.getId())) .assertNext(app -> assertThat(app.getInfo()).isEqualTo(Info.empty())) .verifyComplete(); }
public Mono<Void> updateInfo(InstanceId id) { return repository.computeIfPresent(id, (key, instance) -> this.doUpdateInfo(instance)).then(); }
InfoUpdater { public Mono<Void> updateInfo(InstanceId id) { return repository.computeIfPresent(id, (key, instance) -> this.doUpdateInfo(instance)).then(); } }
InfoUpdater { public Mono<Void> updateInfo(InstanceId id) { return repository.computeIfPresent(id, (key, instance) -> this.doUpdateInfo(instance)).then(); } InfoUpdater(InstanceRepository repository, InstanceWebClient instanceWebClient); }
InfoUpdater { public Mono<Void> updateInfo(InstanceId id) { return repository.computeIfPresent(id, (key, instance) -> this.doUpdateInfo(instance)).then(); } InfoUpdater(InstanceRepository repository, InstanceWebClient instanceWebClient); Mono<Void> updateInfo(InstanceId id); }
InfoUpdater { public Mono<Void> updateInfo(InstanceId id) { return repository.computeIfPresent(id, (key, instance) -> this.doUpdateInfo(instance)).then(); } InfoUpdater(InstanceRepository repository, InstanceWebClient instanceWebClient); Mono<Void> updateInfo(InstanceId id);  }