Commit ad70d6cd by Johannes Edmeier Committed by Johannes Edmeier

Clean up sources

parent eb8b9709
...@@ -22,7 +22,6 @@ import org.springframework.context.annotation.Configuration; ...@@ -22,7 +22,6 @@ import org.springframework.context.annotation.Configuration;
import de.codecentric.boot.admin.config.EnableAdminServer; import de.codecentric.boot.admin.config.EnableAdminServer;
// tag::application-eureka[] // tag::application-eureka[]
@Configuration @Configuration
@EnableAutoConfiguration @EnableAutoConfiguration
......
...@@ -69,27 +69,27 @@ public class SpringBootAdminApplication { ...@@ -69,27 +69,27 @@ public class SpringBootAdminApplication {
@Configuration @Configuration
public static class NotifierConfig { public static class NotifierConfig {
@Bean @Bean
@Primary @Primary
public RemindingNotifier remindingNotifier() { public RemindingNotifier remindingNotifier() {
RemindingNotifier notifier = new RemindingNotifier(filteringNotifier(loggerNotifier())); RemindingNotifier notifier = new RemindingNotifier(filteringNotifier(loggerNotifier()));
notifier.setReminderPeriod(TimeUnit.SECONDS.toMillis(10)); notifier.setReminderPeriod(TimeUnit.SECONDS.toMillis(10));
return notifier; return notifier;
} }
@Scheduled(fixedRate = 1_000L) @Scheduled(fixedRate = 1_000L)
public void remind() { public void remind() {
remindingNotifier().sendReminders(); remindingNotifier().sendReminders();
} }
@Bean @Bean
public FilteringNotifier filteringNotifier(Notifier delegate) { public FilteringNotifier filteringNotifier(Notifier delegate) {
return new FilteringNotifier(delegate); return new FilteringNotifier(delegate);
} }
@Bean @Bean
public LoggingNotifier loggerNotifier() { public LoggingNotifier loggerNotifier() {
return new LoggingNotifier(); return new LoggingNotifier();
} }
} }
} }
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -39,7 +39,6 @@ public class TurbineProperties { ...@@ -39,7 +39,6 @@ public class TurbineProperties {
*/ */
private boolean enabled = true; private boolean enabled = true;
public String[] getClusters() { public String[] getClusters() {
return clusters; return clusters;
} }
......
...@@ -27,7 +27,7 @@ import de.codecentric.boot.admin.web.AdminController; ...@@ -27,7 +27,7 @@ import de.codecentric.boot.admin.web.AdminController;
/** /**
* Provides informations for the turbine view. Only available clusters until now. * Provides informations for the turbine view. Only available clusters until now.
* *
* @author Johannes Edmeier * @author Johannes Edmeier
*/ */
@AdminController @AdminController
......
...@@ -36,8 +36,8 @@ public class TurbineRouteLocator extends SimpleRouteLocator { ...@@ -36,8 +36,8 @@ public class TurbineRouteLocator extends SimpleRouteLocator {
private final Map<String, ZuulRoute> routes; private final Map<String, ZuulRoute> routes;
private DiscoveryClient discovery; private DiscoveryClient discovery;
public TurbineRouteLocator(ZuulRoute route, String servletPath, public TurbineRouteLocator(ZuulRoute route, String servletPath, ZuulProperties zuulProperties,
ZuulProperties zuulProperties, DiscoveryClient discovery) { DiscoveryClient discovery) {
super(servletPath, zuulProperties); super(servletPath, zuulProperties);
this.routes = singletonMap(route.getPath(), route); this.routes = singletonMap(route.getPath(), route);
this.discovery = discovery; this.discovery = discovery;
...@@ -68,8 +68,7 @@ public class TurbineRouteLocator extends SimpleRouteLocator { ...@@ -68,8 +68,7 @@ public class TurbineRouteLocator extends SimpleRouteLocator {
private String resolveServiceId(String location) { private String resolveServiceId(String location) {
List<ServiceInstance> instances = discovery.getInstances(location); List<ServiceInstance> instances = discovery.getInstances(location);
if (instances.isEmpty()) { if (instances.isEmpty()) {
throw new IllegalStateException( throw new IllegalStateException("No instance found for serviceId '" + location + "'");
"No instance found for serviceId '" + location + "'");
} }
return instances.get(0).getUri().toString(); return instances.get(0).getUri().toString();
......
...@@ -13,8 +13,7 @@ import org.springframework.test.web.servlet.setup.MockMvcBuilders; ...@@ -13,8 +13,7 @@ import org.springframework.test.web.servlet.setup.MockMvcBuilders;
public class TurbineControllerTest { public class TurbineControllerTest {
private MockMvc mvc = MockMvcBuilders private MockMvc mvc = MockMvcBuilders
.standaloneSetup(new TurbineController(new String[] { "c1", "c2" })) .standaloneSetup(new TurbineController(new String[] { "c1", "c2" })).build();
.build();
@Test @Test
public void test_clusters() throws Exception { public void test_clusters() throws Exception {
......
...@@ -57,8 +57,7 @@ public class DefaultServiceInstanceConverter implements ServiceInstanceConverter ...@@ -57,8 +57,7 @@ public class DefaultServiceInstanceConverter implements ServiceInstanceConverter
@Override @Override
public Application convert(ServiceInstance instance) { public Application convert(ServiceInstance instance) {
LOGGER.debug("Converting service '{}' running at '{}' with metadata {}", LOGGER.debug("Converting service '{}' running at '{}' with metadata {}",
instance.getServiceId(), instance.getServiceId(), instance.getUri(), instance.getMetadata());
instance.getUri(), instance.getMetadata());
Application.Builder builder = Application.create(instance.getServiceId()); Application.Builder builder = Application.create(instance.getServiceId());
URI healthUrl = getHealthUrl(instance); URI healthUrl = getHealthUrl(instance);
......
...@@ -19,7 +19,7 @@ import java.io.Serializable; ...@@ -19,7 +19,7 @@ import java.io.Serializable;
/** /**
* Signals that the routes needs to be recalculated. * Signals that the routes needs to be recalculated.
* *
* @author Johannes Edmeier * @author Johannes Edmeier
*/ */
public class RoutesOutdatedEvent implements Serializable { public class RoutesOutdatedEvent implements Serializable {
......
...@@ -6,7 +6,7 @@ import org.springframework.core.io.ByteArrayResource; ...@@ -6,7 +6,7 @@ import org.springframework.core.io.ByteArrayResource;
/** /**
* Extension of ByteArrayResource with lastModified and filename. * Extension of ByteArrayResource with lastModified and filename.
* *
* @author Johannes Edmeier * @author Johannes Edmeier
*/ */
public class InMemoryFileResource extends ByteArrayResource { public class InMemoryFileResource extends ByteArrayResource {
......
...@@ -198,8 +198,8 @@ public class Application implements Serializable { ...@@ -198,8 +198,8 @@ public class Application implements Serializable {
@Override @Override
public String toString() { public String toString() {
return "Application [id=" + id + ", name=" + name + ", managementUrl=" return "Application [id=" + id + ", name=" + name + ", managementUrl=" + managementUrl
+ managementUrl + ", healthUrl=" + healthUrl + ", serviceUrl=" + serviceUrl + "]"; + ", healthUrl=" + healthUrl + ", serviceUrl=" + serviceUrl + "]";
} }
@Override @Override
......
...@@ -43,7 +43,6 @@ public abstract class AbstractEventNotifier implements Notifier { ...@@ -43,7 +43,6 @@ public abstract class AbstractEventNotifier implements Notifier {
} }
} }
protected boolean shouldNotify(ClientApplicationEvent event) { protected boolean shouldNotify(ClientApplicationEvent event) {
return true; return true;
} }
...@@ -61,4 +60,4 @@ public abstract class AbstractEventNotifier implements Notifier { ...@@ -61,4 +60,4 @@ public abstract class AbstractEventNotifier implements Notifier {
public boolean isEnabled() { public boolean isEnabled() {
return enabled; return enabled;
} }
} }
\ No newline at end of file
...@@ -33,7 +33,8 @@ public class LoggingNotifier extends AbstractStatusChangeNotifier { ...@@ -33,7 +33,8 @@ public class LoggingNotifier extends AbstractStatusChangeNotifier {
protected void doNotify(ClientApplicationEvent event) throws Exception { protected void doNotify(ClientApplicationEvent event) throws Exception {
if (event instanceof ClientApplicationStatusChangedEvent) { if (event instanceof ClientApplicationStatusChangedEvent) {
LOGGER.info("Application {} ({}) is {}", event.getApplication().getName(), LOGGER.info("Application {} ({}) is {}", event.getApplication().getName(),
event.getApplication().getId(), ((ClientApplicationStatusChangedEvent) event).getTo().getStatus()); event.getApplication().getId(),
((ClientApplicationStatusChangedEvent) event).getTo().getStatus());
} else { } else {
LOGGER.info("Application {} ({}) {}", event.getApplication().getName(), LOGGER.info("Application {} ({}) {}", event.getApplication().getName(),
event.getApplication().getId(), event.getType()); event.getApplication().getId(), event.getType());
......
...@@ -92,7 +92,8 @@ public class SlackNotifier extends AbstractStatusChangeNotifier { ...@@ -92,7 +92,8 @@ public class SlackNotifier extends AbstractStatusChangeNotifier {
protected String getColor(ClientApplicationEvent event) { protected String getColor(ClientApplicationEvent event) {
if (event instanceof ClientApplicationStatusChangedEvent) { if (event instanceof ClientApplicationStatusChangedEvent) {
return "UP".equals(((ClientApplicationStatusChangedEvent) event).getTo().getStatus()) ? "good" : "danger"; return "UP".equals(((ClientApplicationStatusChangedEvent) event).getTo().getStatus())
? "good" : "danger";
} else { } else {
return "#439FE0"; return "#439FE0";
} }
......
...@@ -17,7 +17,7 @@ package de.codecentric.boot.admin.notify.filter; ...@@ -17,7 +17,7 @@ package de.codecentric.boot.admin.notify.filter;
import de.codecentric.boot.admin.event.ClientApplicationEvent; import de.codecentric.boot.admin.event.ClientApplicationEvent;
public class ApplicationIdNotificationFilter extends ExpiringNotificationFilter { public class ApplicationIdNotificationFilter extends ExpiringNotificationFilter {
private final String id; private final String id;
public ApplicationIdNotificationFilter(String id, long expiry) { public ApplicationIdNotificationFilter(String id, long expiry) {
......
...@@ -17,7 +17,7 @@ package de.codecentric.boot.admin.notify.filter; ...@@ -17,7 +17,7 @@ package de.codecentric.boot.admin.notify.filter;
import de.codecentric.boot.admin.event.ClientApplicationEvent; import de.codecentric.boot.admin.event.ClientApplicationEvent;
public class ApplicationNameNotificationFilter extends ExpiringNotificationFilter { public class ApplicationNameNotificationFilter extends ExpiringNotificationFilter {
private final String name; private final String name;
public ApplicationNameNotificationFilter(String name, long expiry) { public ApplicationNameNotificationFilter(String name, long expiry) {
......
...@@ -59,12 +59,10 @@ public class ApplicationRegistry implements ApplicationEventPublisherAware { ...@@ -59,12 +59,10 @@ public class ApplicationRegistry implements ApplicationEventPublisherAware {
Assert.hasText(application.getName(), "Name must not be null"); Assert.hasText(application.getName(), "Name must not be null");
Assert.hasText(application.getHealthUrl(), "Health-URL must not be null"); Assert.hasText(application.getHealthUrl(), "Health-URL must not be null");
Assert.isTrue(checkUrl(application.getHealthUrl()), "Health-URL is not valid"); Assert.isTrue(checkUrl(application.getHealthUrl()), "Health-URL is not valid");
Assert.isTrue( Assert.isTrue(StringUtils.isEmpty(application.getManagementUrl())
StringUtils.isEmpty(application.getManagementUrl()) || checkUrl(application.getManagementUrl()), "URL is not valid");
|| checkUrl(application.getManagementUrl()), "URL is not valid"); Assert.isTrue(StringUtils.isEmpty(application.getServiceUrl())
Assert.isTrue( || checkUrl(application.getServiceUrl()), "URL is not valid");
StringUtils.isEmpty(application.getServiceUrl())
|| checkUrl(application.getServiceUrl()), "URL is not valid");
String applicationId = generator.generateId(application); String applicationId = generator.generateId(application);
Assert.notNull(applicationId, "ID must not be null"); Assert.notNull(applicationId, "ID must not be null");
...@@ -91,7 +89,6 @@ public class ApplicationRegistry implements ApplicationEventPublisherAware { ...@@ -91,7 +89,6 @@ public class ApplicationRegistry implements ApplicationEventPublisherAware {
return registering; return registering;
} }
/** /**
* Checks the syntax of the given URL. * Checks the syntax of the given URL.
* *
......
...@@ -25,8 +25,8 @@ import de.codecentric.boot.admin.model.Application; ...@@ -25,8 +25,8 @@ import de.codecentric.boot.admin.model.Application;
* Generates an SHA-1 Hash based on the applications url. * Generates an SHA-1 Hash based on the applications url.
*/ */
public class HashingApplicationUrlIdGenerator implements ApplicationIdGenerator { public class HashingApplicationUrlIdGenerator implements ApplicationIdGenerator {
private static final char[] HEX_CHARS = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', private static final char[] HEX_CHARS = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a',
'a', 'b', 'c', 'd', 'e', 'f' }; 'b', 'c', 'd', 'e', 'f' };
@Override @Override
public String generateId(Application a) { public String generateId(Application a) {
......
...@@ -13,7 +13,8 @@ import org.springframework.web.context.WebApplicationContext; ...@@ -13,7 +13,8 @@ import org.springframework.web.context.WebApplicationContext;
import de.codecentric.boot.admin.event.ClientApplicationRegisteredEvent; import de.codecentric.boot.admin.event.ClientApplicationRegisteredEvent;
public class StatusUpdateApplicationListener { public class StatusUpdateApplicationListener {
private static final Logger LOGGER = LoggerFactory.getLogger(StatusUpdateApplicationListener.class); private static final Logger LOGGER = LoggerFactory
.getLogger(StatusUpdateApplicationListener.class);
private final ThreadPoolTaskScheduler taskScheduler; private final ThreadPoolTaskScheduler taskScheduler;
private final StatusUpdater statusUpdater; private final StatusUpdater statusUpdater;
private long updatePeriod = 10_000L; private long updatePeriod = 10_000L;
......
...@@ -11,7 +11,7 @@ import de.codecentric.boot.admin.model.Application; ...@@ -11,7 +11,7 @@ import de.codecentric.boot.admin.model.Application;
/** /**
* Provides Basic Auth headers for the {@link Application} using the metadata for "user.name" and * Provides Basic Auth headers for the {@link Application} using the metadata for "user.name" and
* "user.password". * "user.password".
* *
* @author Johannes Edmeier * @author Johannes Edmeier
*/ */
public class BasicAuthHttpHeaderProvider implements HttpHeadersProvider { public class BasicAuthHttpHeaderProvider implements HttpHeadersProvider {
......
...@@ -18,7 +18,6 @@ package de.codecentric.boot.admin.config; ...@@ -18,7 +18,6 @@ package de.codecentric.boot.admin.config;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import org.junit.After; import org.junit.After;
......
...@@ -32,8 +32,8 @@ public class ApplicationEventJournalTest { ...@@ -32,8 +32,8 @@ public class ApplicationEventJournalTest {
@Test @Test
public void test_registration() { public void test_registration() {
ClientApplicationEvent emittedEvent = new ClientApplicationRegisteredEvent(Application ClientApplicationEvent emittedEvent = new ClientApplicationRegisteredEvent(
.create("foo").withId("bar").withHealthUrl("http://health").build()); Application.create("foo").withId("bar").withHealthUrl("http://health").build());
journal.onClientApplicationEvent(emittedEvent); journal.onClientApplicationEvent(emittedEvent);
Collection<ClientApplicationEvent> events = journal.getEvents(); Collection<ClientApplicationEvent> events = journal.getEvents();
......
...@@ -42,7 +42,7 @@ public class HazelcastJournaledEventStoreTest { ...@@ -42,7 +42,7 @@ public class HazelcastJournaledEventStoreTest {
public void setup() { public void setup() {
HazelcastInstance hazelcast = HazelcastInstanceFactory.newHazelcastInstance(new Config()); HazelcastInstance hazelcast = HazelcastInstanceFactory.newHazelcastInstance(new Config());
store = new HazelcastJournaledEventStore( store = new HazelcastJournaledEventStore(
hazelcast.<ClientApplicationEvent> getList("testList")); hazelcast.<ClientApplicationEvent>getList("testList"));
} }
@Test @Test
......
package de.codecentric.boot.admin.model; package de.codecentric.boot.admin.model;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import org.junit.Test; import org.junit.Test;
......
...@@ -28,7 +28,8 @@ public class CompositeNotifierTest { ...@@ -28,7 +28,8 @@ public class CompositeNotifierTest {
public void test_all_notifiers_get_notified() throws Exception { public void test_all_notifiers_get_notified() throws Exception {
TestNotifier notifier1 = new TestNotifier(); TestNotifier notifier1 = new TestNotifier();
TestNotifier notifier2 = new TestNotifier(); TestNotifier notifier2 = new TestNotifier();
CompositeNotifier compositeNotifier = new CompositeNotifier(Arrays.<Notifier>asList(notifier1,notifier2)); CompositeNotifier compositeNotifier = new CompositeNotifier(
Arrays.<Notifier>asList(notifier1, notifier2));
compositeNotifier.notify(APP_DOWN); compositeNotifier.notify(APP_DOWN);
......
package de.codecentric.boot.admin.notify; package de.codecentric.boot.admin.notify;
import static java.util.Arrays.asList;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import org.junit.Test; import org.junit.Test;
......
...@@ -13,9 +13,8 @@ public class ApplicationIdNotificationFilterTest { ...@@ -13,9 +13,8 @@ public class ApplicationIdNotificationFilterTest {
public void test_filterByName() { public void test_filterByName() {
NotificationFilter filter = new ApplicationIdNotificationFilter("cafebabe", -1L); NotificationFilter filter = new ApplicationIdNotificationFilter("cafebabe", -1L);
ClientApplicationRegisteredEvent fooEvent = new ClientApplicationRegisteredEvent( ClientApplicationRegisteredEvent fooEvent = new ClientApplicationRegisteredEvent(Application
Application.create("foo").withId("cafebabe").withHealthUrl("http://health") .create("foo").withId("cafebabe").withHealthUrl("http://health").build());
.build());
assertThat(filter.filter(fooEvent)).isTrue(); assertThat(filter.filter(fooEvent)).isTrue();
ClientApplicationRegisteredEvent barEvent = new ClientApplicationRegisteredEvent( ClientApplicationRegisteredEvent barEvent = new ClientApplicationRegisteredEvent(
......
...@@ -48,7 +48,7 @@ public class NotificationFilterControllerTest { ...@@ -48,7 +48,7 @@ public class NotificationFilterControllerTest {
String id = extractId(response); String id = extractId(response);
mvc.perform(get("/api/notifications/filters")).andExpect(status().isOk()) mvc.perform(get("/api/notifications/filters")).andExpect(status().isOk())
.andExpect(jsonPath("$..id").value("1337")); .andExpect(jsonPath("$..id").value("1337"));
mvc.perform(delete("/api/notifications/filters/{id}", id)).andExpect(status().isOk()); mvc.perform(delete("/api/notifications/filters/{id}", id)).andExpect(status().isOk());
......
...@@ -73,8 +73,8 @@ public class ApplicationRegistryTest { ...@@ -73,8 +73,8 @@ public class ApplicationRegistryTest {
@Test @Test
public void register() throws Exception { public void register() throws Exception {
Application app = registry.register(Application.create("abc") Application app = registry.register(
.withHealthUrl("http://localhost:8080/health").build()); Application.create("abc").withHealthUrl("http://localhost:8080/health").build());
assertThat(app.getHealthUrl()).isEqualTo("http://localhost:8080/health"); assertThat(app.getHealthUrl()).isEqualTo("http://localhost:8080/health");
assertThat(app.getName()).isEqualTo("abc"); assertThat(app.getName()).isEqualTo("abc");
...@@ -102,17 +102,17 @@ public class ApplicationRegistryTest { ...@@ -102,17 +102,17 @@ public class ApplicationRegistryTest {
@Test @Test
public void getApplication() throws Exception { public void getApplication() throws Exception {
Application app = registry.register(Application.create("abc") Application app = registry
.withHealthUrl("http://localhost/health") .register(Application.create("abc").withHealthUrl("http://localhost/health")
.withManagementUrl("http://localhost:8080/").build()); .withManagementUrl("http://localhost:8080/").build());
assertThat(registry.getApplication(app.getId())).isEqualTo(app); assertThat(registry.getApplication(app.getId())).isEqualTo(app);
assertThat(app.getManagementUrl()).isEqualTo("http://localhost:8080/"); assertThat(app.getManagementUrl()).isEqualTo("http://localhost:8080/");
} }
@Test @Test
public void getApplications() throws Exception { public void getApplications() throws Exception {
Application app = registry.register(Application.create("abc") Application app = registry.register(
.withHealthUrl("http://localhost/health").build()); Application.create("abc").withHealthUrl("http://localhost/health").build());
Collection<Application> applications = registry.getApplications(); Collection<Application> applications = registry.getApplications();
assertThat(applications).containsOnly(app); assertThat(applications).containsOnly(app);
...@@ -120,12 +120,12 @@ public class ApplicationRegistryTest { ...@@ -120,12 +120,12 @@ public class ApplicationRegistryTest {
@Test @Test
public void getApplicationsByName() throws Exception { public void getApplicationsByName() throws Exception {
Application app = registry.register(Application.create("abc") Application app = registry.register(
.withHealthUrl("http://localhost/health").build()); Application.create("abc").withHealthUrl("http://localhost/health").build());
Application app2 = registry.register(Application.create("abc") Application app2 = registry.register(
.withHealthUrl("http://localhost:8081/health").build()); Application.create("abc").withHealthUrl("http://localhost:8081/health").build());
Application app3 = registry.register(Application.create("zzz") Application app3 = registry.register(
.withHealthUrl("http://localhost:8082/health").build()); Application.create("zzz").withHealthUrl("http://localhost:8082/health").build());
Collection<Application> applications = registry.getApplicationsByName("abc"); Collection<Application> applications = registry.getApplicationsByName("abc");
assertThat(applications).containsOnly(app, app2); assertThat(applications).containsOnly(app, app2);
......
package de.codecentric.boot.admin.registration; package de.codecentric.boot.admin.registration;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import java.io.IOException; import java.io.IOException;
......
...@@ -29,9 +29,8 @@ public class RegistrationApplicationListenerTest { ...@@ -29,9 +29,8 @@ public class RegistrationApplicationListenerTest {
RegistrationApplicationListener listener = new RegistrationApplicationListener(registrator, RegistrationApplicationListener listener = new RegistrationApplicationListener(registrator,
scheduler); scheduler);
listener.onApplicationReady( listener.onApplicationReady(new ApplicationReadyEvent(mock(SpringApplication.class), null,
new ApplicationReadyEvent(mock(SpringApplication.class), null, mock(ConfigurableWebApplicationContext.class)));
mock(ConfigurableWebApplicationContext.class)));
verify(scheduler).scheduleAtFixedRate(isA(Runnable.class), eq(10_000L)); verify(scheduler).scheduleAtFixedRate(isA(Runnable.class), eq(10_000L));
} }
...@@ -44,9 +43,8 @@ public class RegistrationApplicationListenerTest { ...@@ -44,9 +43,8 @@ public class RegistrationApplicationListenerTest {
scheduler); scheduler);
listener.setAutoRegister(false); listener.setAutoRegister(false);
listener.onApplicationReady( listener.onApplicationReady(new ApplicationReadyEvent(mock(SpringApplication.class), null,
new ApplicationReadyEvent(mock(SpringApplication.class), null, mock(ConfigurableWebApplicationContext.class)));
mock(ConfigurableWebApplicationContext.class)));
verify(scheduler, never()).scheduleAtFixedRate(isA(Runnable.class), eq(10_000L)); verify(scheduler, never()).scheduleAtFixedRate(isA(Runnable.class), eq(10_000L));
} }
...@@ -62,9 +60,8 @@ public class RegistrationApplicationListenerTest { ...@@ -62,9 +60,8 @@ public class RegistrationApplicationListenerTest {
ScheduledFuture task = mock(ScheduledFuture.class); ScheduledFuture task = mock(ScheduledFuture.class);
when(scheduler.scheduleAtFixedRate(isA(Runnable.class), eq(10_000L))).thenReturn(task); when(scheduler.scheduleAtFixedRate(isA(Runnable.class), eq(10_000L))).thenReturn(task);
listener.onApplicationReady( listener.onApplicationReady(new ApplicationReadyEvent(mock(SpringApplication.class), null,
new ApplicationReadyEvent(mock(SpringApplication.class), null, mock(ConfigurableWebApplicationContext.class)));
mock(ConfigurableWebApplicationContext.class)));
verify(scheduler).scheduleAtFixedRate(isA(Runnable.class), eq(10_000L)); verify(scheduler).scheduleAtFixedRate(isA(Runnable.class), eq(10_000L));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment