use of de.codecentric.boot.admin.server.domain.values.Registration in project spring-boot-admin by codecentric.
the class EndpointDetectorTest method should_update_endpoints.
@Test
public void should_update_endpoints() {
// given
Registration registration = Registration.create("foo", "http://health").managementUrl("http://mgmt").build();
Instance instance = Instance.create(InstanceId.of("onl")).register(registration).withStatusInfo(StatusInfo.ofUp());
StepVerifier.create(repository.save(instance)).expectNextCount(1).verifyComplete();
Instance noActuator = Instance.create(InstanceId.of("noActuator")).register(Registration.create("foo", "http://health").build()).withStatusInfo(StatusInfo.ofUp());
StepVerifier.create(repository.save(noActuator)).expectNextCount(1).verifyComplete();
Instance offline = Instance.create(InstanceId.of("off")).register(registration).withStatusInfo(StatusInfo.ofOffline());
StepVerifier.create(repository.save(offline)).expectNextCount(1).verifyComplete();
Instance unknown = Instance.create(InstanceId.of("unk")).register(registration).withStatusInfo(StatusInfo.ofUnknown());
StepVerifier.create(repository.save(unknown)).expectNextCount(1).verifyComplete();
when(strategy.detectEndpoints(any(Instance.class))).thenReturn(Mono.just(Endpoints.single("id", "url")));
// when/then
StepVerifier.create(Flux.from(eventStore).log("FOO", Level.SEVERE)).expectSubscription().then(() -> StepVerifier.create(detector.detectEndpoints(offline.getId())).verifyComplete()).then(() -> StepVerifier.create(detector.detectEndpoints(unknown.getId())).verifyComplete()).then(() -> StepVerifier.create(detector.detectEndpoints(noActuator.getId())).verifyComplete()).expectNoEvent(Duration.ofMillis(100L)).then(() -> StepVerifier.create(detector.detectEndpoints(instance.getId())).verifyComplete()).assertNext((event) -> assertThat(event).isInstanceOf(InstanceEndpointsDetectedEvent.class)).thenCancel().verify();
StepVerifier.create(repository.find(instance.getId())).assertNext((app) -> assertThat(app.getEndpoints()).isEqualTo(Endpoints.single("id", "url").withEndpoint("health", "http://health"))).verifyComplete();
}
use of de.codecentric.boot.admin.server.domain.values.Registration in project spring-boot-admin by codecentric.
the class BasicAuthHttpHeaderProviderTest method test_auth_header_no_separator.
@Test
public void test_auth_header_no_separator() {
Registration registration = Registration.create("foo", "http://health").metadata("username", "test").metadata("userpassword", "drowssap").build();
Instance instance = Instance.create(InstanceId.of("id")).register(registration);
assertThat(this.headersProvider.getHeaders(instance).get(HttpHeaders.AUTHORIZATION)).containsOnly("Basic dGVzdDpkcm93c3NhcA==");
}
use of de.codecentric.boot.admin.server.domain.values.Registration in project spring-boot-admin by codecentric.
the class BasicAuthHttpHeaderProviderTest method test_auth_instance_enabled_use_default_creds.
@Test
public void test_auth_instance_enabled_use_default_creds() {
Registration registration = Registration.create("foo", "http://health").name("xyz-server").build();
Instance instance = Instance.create(InstanceId.of("id")).register(registration);
assertThat(this.headersProviderEnableInstanceAuth.getHeaders(instance).get(HttpHeaders.AUTHORIZATION)).containsOnly("Basic Y2xpZW50OmNsaWVudA==");
}
use of de.codecentric.boot.admin.server.domain.values.Registration in project spring-boot-admin by codecentric.
the class BasicAuthHttpHeaderProviderTest method test_auth_instance_enabled_use_metadata_over_props.
@Test
public void test_auth_instance_enabled_use_metadata_over_props() {
Registration registration = Registration.create("foo", "http://health").metadata("username", "test").metadata("userpassword", "drowssap").name("xyz-server").build();
Instance instance = Instance.create(InstanceId.of("id")).register(registration);
assertThat(this.headersProviderEnableInstanceAuth.getHeaders(instance).get(HttpHeaders.AUTHORIZATION)).containsOnly("Basic dGVzdDpkcm93c3NhcA==");
}
use of de.codecentric.boot.admin.server.domain.values.Registration in project spring-boot-admin by codecentric.
the class BasicAuthHttpHeaderProviderTest method test_auth_header.
@Test
public void test_auth_header() {
Registration registration = Registration.create("foo", "http://health").metadata("user.name", "test").metadata("user.password", "drowssap").build();
Instance instance = Instance.create(InstanceId.of("id")).register(registration);
assertThat(this.headersProvider.getHeaders(instance).get(HttpHeaders.AUTHORIZATION)).containsOnly("Basic dGVzdDpkcm93c3NhcA==");
}
Aggregations