Skip to content

Commit

Permalink
fix: make sure that app resources are properly deleted before we make…
Browse files Browse the repository at this point in the history
… the first request

fixes quarkusio#5163
  • Loading branch information
machi1990 committed Nov 4, 2019
1 parent 755662e commit f10318b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
1 change: 1 addition & 0 deletions core/devmode/src/main/java/io/quarkus/dev/DevModeMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ public void start() throws Exception {

runtimeUpdatesProcessor = setupRuntimeCompilation(context);
if (runtimeUpdatesProcessor != null) {
runtimeUpdatesProcessor.checkForFileChange();
runtimeUpdatesProcessor.checkForChangedClasses();
}
//TODO: we can't handle an exception on startup with hot replacement, as Undertow might not have started
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ private String getFileExtension(File file) {
return name.substring(lastIndexOf);
}

private Set<String> checkForFileChange() {
Set<String> checkForFileChange() {
Set<String> ret = new HashSet<>();
for (DevModeContext.ModuleInfo module : context.getModules()) {
final Set<Path> moduleResources = correspondingResources.computeIfAbsent(module.getName(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,25 @@ public void testThatApplicationRecoversStartupIssue() throws MavenInvocationExce
assertThat(last.get()).isEqualTo("hello");
}

@Test
public void testThatResourcesDeletionArePickedUpBeforeFirstRequest() throws MavenInvocationException, IOException {
testDir = initProject("projects/classic", "projects/project-classic-run-deletion-of-resources-before-first-request");

// Create the nresource
File source = new File(testDir, "src/main/resources/META-INF/resources/lorem.txt");
FileUtils.write(source,
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
"UTF-8");

// run the application
run();

// delete the resource before first request
source.delete();

assertThat(getHttpResponse("/lorem.txt", 404)).isEqualTo(true); // verify that index file has been deleted
}

@Test
public void testThatNewBeanAreDiscovered() throws IOException, MavenInvocationException {
testDir = initProject("projects/classic", "projects/project-classic-run-new-bean");
Expand Down

0 comments on commit f10318b

Please sign in to comment.