use of org.springframework.boot.devtools.restart.classloader.ClassLoaderFile in project spring-boot by spring-projects.
the class HttpRestartServerTests method sendClassLoaderFiles.
@Test
public void sendClassLoaderFiles() throws Exception {
MockHttpServletRequest request = new MockHttpServletRequest();
MockHttpServletResponse response = new MockHttpServletResponse();
ClassLoaderFiles files = new ClassLoaderFiles();
files.addFile("name", new ClassLoaderFile(Kind.ADDED, new byte[0]));
byte[] bytes = serialize(files);
request.setContent(bytes);
this.server.handle(new ServletServerHttpRequest(request), new ServletServerHttpResponse(response));
verify(this.delegate).updateAndRestart(this.filesCaptor.capture());
assertThat(this.filesCaptor.getValue().getFile("name")).isNotNull();
assertThat(response.getStatus()).isEqualTo(200);
}
use of org.springframework.boot.devtools.restart.classloader.ClassLoaderFile in project spring-boot by spring-projects.
the class ClassLoaderFilesResourcePatternResolverTests method getResourceWhenDeletedShouldReturnDeletedResource.
@Test
public void getResourceWhenDeletedShouldReturnDeletedResource() throws Exception {
File folder = this.temp.newFolder();
File file = createFile(folder, "name.class");
this.files.addFile(folder.getName(), "name.class", new ClassLoaderFile(Kind.DELETED, null));
Resource resource = this.resolver.getResource("file:" + file.getAbsolutePath());
assertThat(resource).isNotNull().isInstanceOf(DeletedClassLoaderFileResource.class);
}
use of org.springframework.boot.devtools.restart.classloader.ClassLoaderFile in project spring-boot by spring-projects.
the class ClassLoaderFilesResourcePatternResolverTests method getResourcesWhenDeletedShouldFilterDeleted.
@Test
public void getResourcesWhenDeletedShouldFilterDeleted() throws Exception {
File folder = this.temp.newFolder();
createFile(folder, "name.class");
this.files.addFile(folder.getName(), "name.class", new ClassLoaderFile(Kind.DELETED, null));
Resource[] resources = this.resolver.getResources("file:" + folder.getAbsolutePath() + "/**");
assertThat(resources).isEmpty();
}
Aggregations