use of de.codecentric.boot.admin.server.domain.values.Registration in project spring-boot-admin by codecentric.
the class CloudFoundryHttpHeaderProviderTest method test_no_header.
@Test
public void test_no_header() {
Registration registration = Registration.create("foo", "http://health").build();
Instance instance = Instance.create(InstanceId.of("id")).register(registration);
assertThat(headersProvider.getHeaders(instance)).isEmpty();
}
use of de.codecentric.boot.admin.server.domain.values.Registration in project spring-boot-admin by codecentric.
the class ApplicationRegistryTest method getInstance.
private Instance getInstance(String applicationName, String version) {
Registration registration = Registration.create(applicationName, "http://localhost:8080/health").metadata("version", version).build();
InstanceId id = InstanceId.of("TEST" + applicationName);
return Instance.create(id).register(registration);
}
use of de.codecentric.boot.admin.server.domain.values.Registration in project spring-boot-admin by codecentric.
the class AbstractInstanceRepositoryTest method should_run_compute_with_null.
@Test
public void should_run_compute_with_null() {
InstanceId instanceId = InstanceId.of("app-1");
Registration registration = Registration.create("app", "http://health").build();
// when
StepVerifier.create(this.repository.compute(this.instance1.getId(), (key, application) -> {
assertThat(application).isNull();
return Mono.just(Instance.create(key).register(registration));
})).assertNext((v) -> {
assertThat(v.getId()).isEqualTo(instanceId);
assertThat(v.getRegistration()).isEqualTo(registration);
}).verifyComplete();
// then
StepVerifier.create(this.repository.find(instanceId)).assertNext((v) -> {
assertThat(v.getId()).isEqualTo(instanceId);
assertThat(v.getRegistration()).isEqualTo(registration);
}).verifyComplete();
}
use of de.codecentric.boot.admin.server.domain.values.Registration in project spring-boot-admin by codecentric.
the class InstanceTest method should_yield_same_status_from_replaying.
@Test
public void should_yield_same_status_from_replaying() {
Registration registration = Registration.create("foo-instance", "http://health").metadata("version", "1.0.0").build();
Instance instance = Instance.create(InstanceId.of("id")).register(registration.toBuilder().clearMetadata().build()).register(registration).withEndpoints(Endpoints.single("info", "info")).withStatusInfo(StatusInfo.ofUp()).withInfo(Info.from(singletonMap("foo", "bar")));
Instance loaded = Instance.create(InstanceId.of("id")).apply(instance.getUnsavedEvents());
assertThat(loaded.getUnsavedEvents()).isEmpty();
assertThat(loaded.getRegistration()).isEqualTo(registration);
assertThat(loaded.isRegistered()).isTrue();
assertThat(loaded.getStatusInfo()).isEqualTo(StatusInfo.ofUp());
assertThat(loaded.getStatusTimestamp()).isEqualTo(instance.getStatusTimestamp());
assertThat(loaded.getInfo()).isEqualTo(Info.from(singletonMap("foo", "bar")));
assertThat(loaded.getEndpoints()).isEqualTo(Endpoints.single("info", "info").withEndpoint("health", "http://health"));
assertThat(loaded.getVersion()).isEqualTo(4L);
assertThat(loaded.getBuildVersion()).isEqualTo(BuildVersion.valueOf("1.0.0"));
Instance deregisteredInstance = instance.deregister();
loaded = Instance.create(InstanceId.of("id")).apply(deregisteredInstance.getUnsavedEvents());
assertThat(loaded.getUnsavedEvents()).isEmpty();
assertThat(loaded.isRegistered()).isFalse();
assertThat(loaded.getInfo()).isEqualTo(Info.empty());
assertThat(loaded.getStatusInfo()).isEqualTo(StatusInfo.ofUnknown());
assertThat(loaded.getStatusTimestamp()).isEqualTo(deregisteredInstance.getStatusTimestamp());
assertThat(loaded.getEndpoints()).isEqualTo(Endpoints.empty());
assertThat(loaded.getVersion()).isEqualTo(5L);
assertThat(loaded.getBuildVersion()).isEqualTo(null);
}
use of de.codecentric.boot.admin.server.domain.values.Registration in project spring-boot-admin by codecentric.
the class InstanceTest method should_extract_tags.
@Test
public void should_extract_tags() {
Instance instance = Instance.create(InstanceId.of("id"));
assertThat(instance.getTags().getValues()).isEmpty();
Registration registration = Registration.create("foo-instance", "http://health").metadata("tags.environment", "test").metadata("tags.region", "EU").build();
instance = instance.register(registration);
assertThat(instance.getTags().getValues()).containsExactly(entry("environment", "test"), entry("region", "EU"));
instance = instance.withInfo(Info.from(singletonMap("tags", singletonMap("region", "US-East"))));
assertThat(instance.getTags().getValues()).containsExactly(entry("environment", "test"), entry("region", "US-East"));
instance = instance.deregister();
assertThat(instance.getTags().getValues()).isEmpty();
instance = instance.register(registration.toBuilder().clearMetadata().build());
assertThat(instance.getTags().getValues()).isEmpty();
}
Aggregations