use of de.codecentric.boot.admin.server.domain.entities.Instance 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.entities.Instance in project spring-boot-admin by codecentric.
the class ApplicationRegistryTest method deregister.
@Test
public void deregister() {
Instance instance1 = getInstance("App1");
InstanceId instance1Id = instance1.getId();
when(this.instanceRegistry.getInstances("App1")).thenReturn(Flux.just(instance1));
when(this.instanceRegistry.deregister(instance1Id)).thenReturn(Mono.just(instance1Id));
StepVerifier.create(this.applicationRegistry.deregister("App1")).assertNext((instanceId) -> assertThat(instanceId).isEqualTo(instance1Id)).verifyComplete();
verify(this.instanceRegistry).deregister(instance1Id);
}
use of de.codecentric.boot.admin.server.domain.entities.Instance in project spring-boot-admin by codecentric.
the class ApplicationRegistryTest method getApplications_oneRegisteredAndOneUnregisteredApplication.
@Test
public void getApplications_oneRegisteredAndOneUnregisteredApplication() {
Instance instance1 = getInstance("App1");
Instance instance2 = getInstance("App2").deregister();
when(this.instanceRegistry.getInstances()).thenReturn(Flux.just(instance1, instance2));
StepVerifier.create(this.applicationRegistry.getApplications()).assertNext((app) -> assertThat(app.getName()).isEqualTo("App1")).verifyComplete();
}
use of de.codecentric.boot.admin.server.domain.entities.Instance in project spring-boot-admin by codecentric.
the class ApplicationRegistryTest method getApplication_matchingUnregisteredApplications.
@Test
public void getApplication_matchingUnregisteredApplications() {
Instance instance = getInstance("App1").deregister();
when(this.instanceRegistry.getInstances("App1")).thenReturn(Flux.just(instance));
StepVerifier.create(this.applicationRegistry.getApplication("App1")).verifyComplete();
}
use of de.codecentric.boot.admin.server.domain.entities.Instance in project spring-boot-admin by codecentric.
the class ApplicationRegistryTest method getBuildVersion.
@Test
public void getBuildVersion() {
Instance instance1 = getInstance("App1", "0.1");
Instance instance2 = getInstance("App2", "0.2");
// Empty list should return null:
assertThat(this.applicationRegistry.getBuildVersion(Collections.emptyList())).isNull();
// Single instance should return the version number:
assertThat(this.applicationRegistry.getBuildVersion(Collections.singletonList(instance1))).isEqualTo(BuildVersion.valueOf("0.1"));
// Multiple instances should return the version number range:
assertThat(this.applicationRegistry.getBuildVersion(Arrays.asList(instance1, instance2))).isEqualTo(BuildVersion.valueOf("0.1 ... 0.2"));
}
Aggregations