use of de.codecentric.boot.admin.client.registration.ApplicationRegistrator in project spring-boot-admin by codecentric.
the class ApplicationRegistratorTest method setup.
@Before
public void setup() {
restTemplate = mock(RestTemplate.class);
adminProps = new AdminProperties();
adminProps.setUrl(new String[] { "http://sba:8080", "http://sba2:8080" });
ApplicationFactory factory = mock(ApplicationFactory.class);
when(factory.createApplication()).thenReturn(Application.create("AppName").withManagementUrl("http://localhost:8080/mgmt").withHealthUrl("http://localhost:8080/health").withServiceUrl("http://localhost:8080").build());
registrator = new ApplicationRegistrator(restTemplate, adminProps, factory);
headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
headers.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON));
}
use of de.codecentric.boot.admin.client.registration.ApplicationRegistrator in project spring-boot-admin by codecentric.
the class RegistrationApplicationListenerTest method test_no_register.
@Test
public void test_no_register() throws Exception {
ApplicationRegistrator registrator = mock(ApplicationRegistrator.class);
TaskScheduler scheduler = mock(TaskScheduler.class);
RegistrationApplicationListener listener = new RegistrationApplicationListener(registrator, scheduler);
listener.setAutoRegister(false);
listener.onApplicationReady(new ApplicationReadyEvent(mock(SpringApplication.class), null, mock(ConfigurableWebApplicationContext.class)));
verify(scheduler, never()).scheduleAtFixedRate(isA(Runnable.class), eq(10_000L));
}
use of de.codecentric.boot.admin.client.registration.ApplicationRegistrator in project spring-boot-admin by codecentric.
the class RegistrationApplicationListenerTest method test_no_deregister.
@Test
public void test_no_deregister() throws Exception {
ApplicationRegistrator registrator = mock(ApplicationRegistrator.class);
TaskScheduler scheduler = mock(TaskScheduler.class);
RegistrationApplicationListener listener = new RegistrationApplicationListener(registrator, scheduler);
listener.onClosedContext(new ContextClosedEvent(mock(EmbeddedWebApplicationContext.class)));
verify(registrator, never()).deregister();
}
use of de.codecentric.boot.admin.client.registration.ApplicationRegistrator in project spring-boot-admin by codecentric.
the class RegistrationApplicationListenerTest method test_deregister.
@Test
public void test_deregister() throws Exception {
ApplicationRegistrator registrator = mock(ApplicationRegistrator.class);
TaskScheduler scheduler = mock(TaskScheduler.class);
RegistrationApplicationListener listener = new RegistrationApplicationListener(registrator, scheduler);
listener.setAutoDeregister(true);
listener.onClosedContext(new ContextClosedEvent(mock(EmbeddedWebApplicationContext.class)));
verify(registrator).deregister();
}
use of de.codecentric.boot.admin.client.registration.ApplicationRegistrator in project spring-boot-admin by codecentric.
the class RegistrationApplicationListenerTest method test_register.
@Test
public void test_register() throws Exception {
ApplicationRegistrator registrator = mock(ApplicationRegistrator.class);
TaskScheduler scheduler = mock(TaskScheduler.class);
RegistrationApplicationListener listener = new RegistrationApplicationListener(registrator, scheduler);
listener.onApplicationReady(new ApplicationReadyEvent(mock(SpringApplication.class), null, mock(ConfigurableWebApplicationContext.class)));
verify(scheduler).scheduleAtFixedRate(isA(Runnable.class), eq(10_000L));
}
Aggregations