Search in sources :

Example 11 with Instance

use of de.codecentric.boot.admin.server.domain.entities.Instance 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==");
}
Also used : Instance(de.codecentric.boot.admin.server.domain.entities.Instance) Registration(de.codecentric.boot.admin.server.domain.values.Registration) Test(org.junit.jupiter.api.Test)

Example 12 with Instance

use of de.codecentric.boot.admin.server.domain.entities.Instance 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==");
}
Also used : Instance(de.codecentric.boot.admin.server.domain.entities.Instance) Registration(de.codecentric.boot.admin.server.domain.values.Registration) Test(org.junit.jupiter.api.Test)

Example 13 with Instance

use of de.codecentric.boot.admin.server.domain.entities.Instance 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==");
}
Also used : Instance(de.codecentric.boot.admin.server.domain.entities.Instance) Registration(de.codecentric.boot.admin.server.domain.values.Registration) Test(org.junit.jupiter.api.Test)

Example 14 with Instance

use of de.codecentric.boot.admin.server.domain.entities.Instance 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==");
}
Also used : Instance(de.codecentric.boot.admin.server.domain.entities.Instance) Registration(de.codecentric.boot.admin.server.domain.values.Registration) Test(org.junit.jupiter.api.Test)

Example 15 with Instance

use of de.codecentric.boot.admin.server.domain.entities.Instance in project spring-boot-admin by codecentric.

the class BasicAuthHttpHeaderProviderTest method test_auth_instance_enabled_use_service_specific_creds.

@Test
public void test_auth_instance_enabled_use_service_specific_creds() {
    Registration registration = Registration.create("foo", "http://health").name("sb-admin-server").build();
    Instance instance = Instance.create(InstanceId.of("id")).register(registration);
    assertThat(this.headersProviderEnableInstanceAuth.getHeaders(instance).get(HttpHeaders.AUTHORIZATION)).containsOnly("Basic YWRtaW46YWRtaW4=");
}
Also used : Instance(de.codecentric.boot.admin.server.domain.entities.Instance) Registration(de.codecentric.boot.admin.server.domain.values.Registration) Test(org.junit.jupiter.api.Test)

Aggregations

Instance (de.codecentric.boot.admin.server.domain.entities.Instance)44 Test (org.junit.jupiter.api.Test)42 Registration (de.codecentric.boot.admin.server.domain.values.Registration)23 InstanceId (de.codecentric.boot.admin.server.domain.values.InstanceId)16 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)14 StepVerifier (reactor.test.StepVerifier)14 StatusInfo (de.codecentric.boot.admin.server.domain.values.StatusInfo)13 BeforeEach (org.junit.jupiter.api.BeforeEach)13 Mono (reactor.core.publisher.Mono)10 InstanceRepository (de.codecentric.boot.admin.server.domain.entities.InstanceRepository)9 EventsourcingInstanceRepository (de.codecentric.boot.admin.server.domain.entities.EventsourcingInstanceRepository)8 InMemoryEventStore (de.codecentric.boot.admin.server.eventstore.InMemoryEventStore)8 Flux (reactor.core.publisher.Flux)8 ArrayList (java.util.ArrayList)7 Collections.singletonMap (java.util.Collections.singletonMap)7 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)7 Application (de.codecentric.boot.admin.server.domain.entities.Application)6 Info (de.codecentric.boot.admin.server.domain.values.Info)6 ArgumentMatchers.any (org.mockito.ArgumentMatchers.any)6 Mockito.mock (org.mockito.Mockito.mock)6