Search in sources :

Example 1 with LiveReloadServer

use of org.springframework.boot.devtools.livereload.LiveReloadServer in project spring-boot by spring-projects.

the class LocalDevToolsAutoConfigurationTests method liveReloadNotTriggeredOnClassPathChangeWithRestart.

@Test
public void liveReloadNotTriggeredOnClassPathChangeWithRestart() throws Exception {
    this.context = initializeAndRun(ConfigWithMockLiveReload.class);
    LiveReloadServer server = this.context.getBean(LiveReloadServer.class);
    reset(server);
    ClassPathChangedEvent event = new ClassPathChangedEvent(this.context, Collections.<ChangedFiles>emptySet(), true);
    this.context.publishEvent(event);
    verify(server, never()).triggerReload();
}
Also used : LiveReloadServer(org.springframework.boot.devtools.livereload.LiveReloadServer) ClassPathChangedEvent(org.springframework.boot.devtools.classpath.ClassPathChangedEvent) Test(org.junit.Test)

Example 2 with LiveReloadServer

use of org.springframework.boot.devtools.livereload.LiveReloadServer in project spring-boot by spring-projects.

the class LocalDevToolsAutoConfigurationTests method liveReloadTriggeredOnContextRefresh.

@Test
public void liveReloadTriggeredOnContextRefresh() throws Exception {
    this.context = initializeAndRun(ConfigWithMockLiveReload.class);
    LiveReloadServer server = this.context.getBean(LiveReloadServer.class);
    reset(server);
    this.context.publishEvent(new ContextRefreshedEvent(this.context));
    verify(server).triggerReload();
}
Also used : LiveReloadServer(org.springframework.boot.devtools.livereload.LiveReloadServer) ContextRefreshedEvent(org.springframework.context.event.ContextRefreshedEvent) Test(org.junit.Test)

Example 3 with LiveReloadServer

use of org.springframework.boot.devtools.livereload.LiveReloadServer in project spring-boot by spring-projects.

the class RemoteClientConfigurationTests method liveReloadOnClassPathChanged.

@Test
public void liveReloadOnClassPathChanged() throws Exception {
    configure();
    Set<ChangedFiles> changeSet = new HashSet<>();
    ClassPathChangedEvent event = new ClassPathChangedEvent(this, changeSet, false);
    this.context.publishEvent(event);
    LiveReloadConfiguration configuration = this.context.getBean(LiveReloadConfiguration.class);
    configuration.getExecutor().shutdown();
    configuration.getExecutor().awaitTermination(2, TimeUnit.SECONDS);
    LiveReloadServer server = this.context.getBean(LiveReloadServer.class);
    verify(server).triggerReload();
}
Also used : LiveReloadConfiguration(org.springframework.boot.devtools.remote.client.RemoteClientConfiguration.LiveReloadConfiguration) ChangedFiles(org.springframework.boot.devtools.filewatch.ChangedFiles) OptionalLiveReloadServer(org.springframework.boot.devtools.autoconfigure.OptionalLiveReloadServer) LiveReloadServer(org.springframework.boot.devtools.livereload.LiveReloadServer) ClassPathChangedEvent(org.springframework.boot.devtools.classpath.ClassPathChangedEvent) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 4 with LiveReloadServer

use of org.springframework.boot.devtools.livereload.LiveReloadServer in project spring-boot by spring-projects.

the class LocalDevToolsAutoConfigurationTests method liveReloadServer.

@Test
public void liveReloadServer() throws Exception {
    this.context = initializeAndRun(Config.class);
    LiveReloadServer server = this.context.getBean(LiveReloadServer.class);
    assertThat(server.isStarted()).isTrue();
}
Also used : LiveReloadServer(org.springframework.boot.devtools.livereload.LiveReloadServer) Test(org.junit.Test)

Example 5 with LiveReloadServer

use of org.springframework.boot.devtools.livereload.LiveReloadServer in project spring-boot by spring-projects.

the class LocalDevToolsAutoConfigurationTests method liveReloadTriggeredOnClassPathChangeWithoutRestart.

@Test
public void liveReloadTriggeredOnClassPathChangeWithoutRestart() throws Exception {
    this.context = initializeAndRun(ConfigWithMockLiveReload.class);
    LiveReloadServer server = this.context.getBean(LiveReloadServer.class);
    reset(server);
    ClassPathChangedEvent event = new ClassPathChangedEvent(this.context, Collections.<ChangedFiles>emptySet(), false);
    this.context.publishEvent(event);
    verify(server).triggerReload();
}
Also used : LiveReloadServer(org.springframework.boot.devtools.livereload.LiveReloadServer) ClassPathChangedEvent(org.springframework.boot.devtools.classpath.ClassPathChangedEvent) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)6 LiveReloadServer (org.springframework.boot.devtools.livereload.LiveReloadServer)6 ClassPathChangedEvent (org.springframework.boot.devtools.classpath.ClassPathChangedEvent)3 HashSet (java.util.HashSet)1 OptionalLiveReloadServer (org.springframework.boot.devtools.autoconfigure.OptionalLiveReloadServer)1 ChangedFiles (org.springframework.boot.devtools.filewatch.ChangedFiles)1 LiveReloadConfiguration (org.springframework.boot.devtools.remote.client.RemoteClientConfiguration.LiveReloadConfiguration)1 ContextRefreshedEvent (org.springframework.context.event.ContextRefreshedEvent)1