Skip to content

Commit

Permalink
Backing out previous change since it only works on JDK 19
Browse files Browse the repository at this point in the history
  • Loading branch information
gbevin committed Sep 30, 2023
1 parent 3eb5795 commit 0994f18
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 50 deletions.
72 changes: 33 additions & 39 deletions src/test/java/rife/bld/operations/TestCreateRife2Operation.java
Original file line number Diff line number Diff line change
Expand Up @@ -283,19 +283,17 @@ void testExecute()
/myapp/src/test/resources""").matcher(FileUtils.generateDirectoryListing(tmp)).matches());

var run_operation = new RunOperation().fromProject(create_operation.project());
StringBuilder check_result;
try (var executor = Executors.newSingleThreadScheduledExecutor()) {
var checked_url = new URL("http://localhost:8080");
check_result = new StringBuilder();
executor.schedule(() -> {
try {
check_result.append(FileUtils.readString(checked_url));
} catch (FileUtilsErrorException e) {
throw new RuntimeException(e);
}
}, 1, TimeUnit.SECONDS);
executor.schedule(() -> run_operation.process().destroy(), 2, TimeUnit.SECONDS);
}
var executor = Executors.newSingleThreadScheduledExecutor();
var checked_url = new URL("http://localhost:8080");
var check_result = new StringBuilder();
executor.schedule(() -> {
try {
check_result.append(FileUtils.readString(checked_url));
} catch (FileUtilsErrorException e) {
throw new RuntimeException(e);
}
}, 1, TimeUnit.SECONDS);
executor.schedule(() -> run_operation.process().destroy(), 2, TimeUnit.SECONDS);
assertThrows(ExitStatusException.class, run_operation::execute);

assertTrue(check_result.toString().contains("<p>Hello World Myapp</p>"));
Expand Down Expand Up @@ -535,19 +533,17 @@ void testExecuteLocalDependencies()
/myapp/src/test/resources""").matcher(FileUtils.generateDirectoryListing(tmp)).matches());

var run_operation = new RunOperation().fromProject(create_operation.project());
StringBuilder check_result;
try (var executor = Executors.newSingleThreadScheduledExecutor()) {
var checked_url = new URL("http://localhost:8080");
check_result = new StringBuilder();
executor.schedule(() -> {
try {
check_result.append(FileUtils.readString(checked_url));
} catch (FileUtilsErrorException e) {
throw new RuntimeException(e);
}
}, 1, TimeUnit.SECONDS);
executor.schedule(() -> run_operation.process().destroy(), 2, TimeUnit.SECONDS);
}
var executor = Executors.newSingleThreadScheduledExecutor();
var checked_url = new URL("http://localhost:8080");
var check_result = new StringBuilder();
executor.schedule(() -> {
try {
check_result.append(FileUtils.readString(checked_url));
} catch (FileUtilsErrorException e) {
throw new RuntimeException(e);
}
}, 1, TimeUnit.SECONDS);
executor.schedule(() -> run_operation.process().destroy(), 2, TimeUnit.SECONDS);
assertThrows(ExitStatusException.class, run_operation::execute);

assertTrue(check_result.toString().contains("<p>Hello World Myapp</p>"), check_result.toString());
Expand Down Expand Up @@ -703,19 +699,17 @@ void testExecuteLocalDependenciesFolders()
/myapp/src/test/resources""").matcher(FileUtils.generateDirectoryListing(tmp)).matches());

var run_operation = new RunOperation().fromProject(create_operation.project());
StringBuilder check_result;
try (var executor = Executors.newSingleThreadScheduledExecutor()) {
var checked_url = new URL("http://localhost:8080");
check_result = new StringBuilder();
executor.schedule(() -> {
try {
check_result.append(FileUtils.readString(checked_url));
} catch (FileUtilsErrorException e) {
throw new RuntimeException(e);
}
}, 1, TimeUnit.SECONDS);
executor.schedule(() -> run_operation.process().destroy(), 2, TimeUnit.SECONDS);
}
var executor = Executors.newSingleThreadScheduledExecutor();
var checked_url = new URL("http://localhost:8080");
var check_result = new StringBuilder();
executor.schedule(() -> {
try {
check_result.append(FileUtils.readString(checked_url));
} catch (FileUtilsErrorException e) {
throw new RuntimeException(e);
}
}, 1, TimeUnit.SECONDS);
executor.schedule(() -> run_operation.process().destroy(), 2, TimeUnit.SECONDS);
assertThrows(ExitStatusException.class, run_operation::execute);

assertTrue(check_result.toString().contains("<p>Hello World Myapp</p>"));
Expand Down
21 changes: 10 additions & 11 deletions src/test/java/rife/bld/operations/TestUberJarOperation.java
Original file line number Diff line number Diff line change
Expand Up @@ -162,17 +162,16 @@ void testFromProjectWeb()
var run_operation = new RunOperation()
.javaOptions(List.of("-jar"))
.mainClass(uberjar_file.getAbsolutePath());
try (var executor = Executors.newSingleThreadScheduledExecutor()) {
var checked_url = new URL("http://localhost:8080");
executor.schedule(() -> {
try {
check_result.append(FileUtils.readString(checked_url));
} catch (FileUtilsErrorException e) {
throw new RuntimeException(e);
}
}, 1, TimeUnit.SECONDS);
executor.schedule(() -> run_operation.process().destroy(), 2, TimeUnit.SECONDS);
}
var executor = Executors.newSingleThreadScheduledExecutor();
var checked_url = new URL("http://localhost:8080");
executor.schedule(() -> {
try {
check_result.append(FileUtils.readString(checked_url));
} catch (FileUtilsErrorException e) {
throw new RuntimeException(e);
}
}, 1, TimeUnit.SECONDS);
executor.schedule(() -> run_operation.process().destroy(), 2, TimeUnit.SECONDS);
assertThrows(ExitStatusException.class, run_operation::execute);

assertTrue(check_result.toString().contains("<p>Hello World App</p>"));
Expand Down

0 comments on commit 0994f18

Please sign in to comment.