use of org.springframework.boot.devtools.classpath.ClassPathChangedEvent in project spring-boot by spring-projects.
the class LocalDevToolsAutoConfigurationTests method restartTriggeredOnClassPathChangeWithRestart.
@Test
public void restartTriggeredOnClassPathChangeWithRestart() throws Exception {
this.context = initializeAndRun(Config.class);
ClassPathChangedEvent event = new ClassPathChangedEvent(this.context, Collections.<ChangedFiles>emptySet(), true);
this.context.publishEvent(event);
verify(this.mockRestarter.getMock()).restart(any(FailureHandler.class));
}
use of org.springframework.boot.devtools.classpath.ClassPathChangedEvent 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();
}
use of org.springframework.boot.devtools.classpath.ClassPathChangedEvent in project spring-boot by spring-projects.
the class LocalDevToolsAutoConfigurationTests method restartNotTriggeredOnClassPathChangeWithRestart.
@Test
public void restartNotTriggeredOnClassPathChangeWithRestart() throws Exception {
this.context = initializeAndRun(Config.class);
ClassPathChangedEvent event = new ClassPathChangedEvent(this.context, Collections.<ChangedFiles>emptySet(), false);
this.context.publishEvent(event);
verify(this.mockRestarter.getMock(), never()).restart();
}
use of org.springframework.boot.devtools.classpath.ClassPathChangedEvent in project spring-boot by spring-projects.
the class ClassPathChangeUploaderTests method createClassPathChangedEvent.
private ClassPathChangedEvent createClassPathChangedEvent(File sourceFolder) throws IOException {
Set<ChangedFile> files = new LinkedHashSet<>();
File file1 = createFile(sourceFolder, "File1");
File file2 = createFile(sourceFolder, "File2");
File file3 = createFile(sourceFolder, "File3");
files.add(new ChangedFile(sourceFolder, file1, Type.ADD));
files.add(new ChangedFile(sourceFolder, file2, Type.MODIFY));
files.add(new ChangedFile(sourceFolder, file3, Type.DELETE));
Set<ChangedFiles> changeSet = new LinkedHashSet<>();
changeSet.add(new ChangedFiles(sourceFolder, files));
ClassPathChangedEvent event = new ClassPathChangedEvent(this, changeSet, false);
return event;
}
use of org.springframework.boot.devtools.classpath.ClassPathChangedEvent in project spring-boot by spring-projects.
the class ClassPathChangeUploaderTests method sendsClassLoaderFiles.
@Test
public void sendsClassLoaderFiles() throws Exception {
File sourceFolder = this.temp.newFolder();
ClassPathChangedEvent event = createClassPathChangedEvent(sourceFolder);
this.requestFactory.willRespond(HttpStatus.OK);
this.uploader.onApplicationEvent(event);
assertThat(this.requestFactory.getExecutedRequests()).hasSize(1);
MockClientHttpRequest request = this.requestFactory.getExecutedRequests().get(0);
verifyUploadRequest(sourceFolder, request);
}
Aggregations