use of de.codecentric.boot.admin.server.domain.entities.Instance in project spring-boot-admin by codecentric.
the class BasicAuthHttpHeaderProviderTest method test_auth_header_with_dashes.
@Test
public void test_auth_header_with_dashes() {
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==");
}
use of de.codecentric.boot.admin.server.domain.entities.Instance in project spring-boot-admin by codecentric.
the class BasicAuthHttpHeaderProviderTest 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(this.headersProvider.getHeaders(instance)).isEmpty();
}
use of de.codecentric.boot.admin.server.domain.entities.Instance in project spring-boot-admin by codecentric.
the class InstanceRegistryTest method refresh.
@Test
public void refresh() {
// Given instance is already reegistered and has status and info.
StatusInfo status = StatusInfo.ofUp();
Info info = Info.from(singletonMap("foo", "bar"));
Registration registration = Registration.create("abc", "http://localhost:8080/health").build();
InstanceId id = idGenerator.generateId(registration);
Instance app = Instance.create(id).register(registration).withStatusInfo(status).withInfo(info);
StepVerifier.create(repository.save(app)).expectNextCount(1).verifyComplete();
// When instance registers second time
InstanceId refreshId = registry.register(Registration.create("abc", "http://localhost:8080/health").build()).block();
assertThat(refreshId).isEqualTo(id);
StepVerifier.create(registry.getInstance(id)).assertNext((registered) -> {
// Then info and status are retained
assertThat(registered.getInfo()).isEqualTo(info);
assertThat(registered.getStatusInfo()).isEqualTo(status);
}).verifyComplete();
}
use of de.codecentric.boot.admin.server.domain.entities.Instance in project spring-boot-admin by codecentric.
the class ChainingStrategyTest method should_return_empty_endpoints_when_all_empty.
@Test
public void should_return_empty_endpoints_when_all_empty() {
// given
Instance instance = Instance.create(InstanceId.of("id"));
ChainingStrategy strategy = new ChainingStrategy((a) -> Mono.empty());
// when/then
StepVerifier.create(strategy.detectEndpoints(instance)).expectNext(Endpoints.empty()).verifyComplete();
}
use of de.codecentric.boot.admin.server.domain.entities.Instance in project spring-boot-admin by codecentric.
the class ChainingStrategyTest method should_chain_on_empty.
@Test
public void should_chain_on_empty() {
// given
Instance instance = Instance.create(InstanceId.of("id"));
ChainingStrategy strategy = new ChainingStrategy((a) -> Mono.empty(), (a) -> Mono.empty(), (a) -> Mono.just(Endpoints.single("id", "path")));
// when/then
StepVerifier.create(strategy.detectEndpoints(instance)).expectNext(Endpoints.single("id", "path")).verifyComplete();
}
Aggregations