2
0
Fork 0
mirror of https://github.com/ethauvin/bld.git synced 2025-04-25 08:17:11 -07:00

Backing out previous change since it only works on JDK 19

This commit is contained in:
Geert Bevin 2023-09-30 19:17:11 -04:00
parent 3eb5795cf2
commit 0994f184f2
2 changed files with 43 additions and 50 deletions

View file

@ -283,19 +283,17 @@ public class TestCreateRife2Operation {
/myapp/src/test/resources""").matcher(FileUtils.generateDirectoryListing(tmp)).matches()); /myapp/src/test/resources""").matcher(FileUtils.generateDirectoryListing(tmp)).matches());
var run_operation = new RunOperation().fromProject(create_operation.project()); var run_operation = new RunOperation().fromProject(create_operation.project());
StringBuilder check_result; var executor = Executors.newSingleThreadScheduledExecutor();
try (var executor = Executors.newSingleThreadScheduledExecutor()) { var checked_url = new URL("http://localhost:8080");
var checked_url = new URL("http://localhost:8080"); var check_result = new StringBuilder();
check_result = new StringBuilder(); executor.schedule(() -> {
executor.schedule(() -> { try {
try { check_result.append(FileUtils.readString(checked_url));
check_result.append(FileUtils.readString(checked_url)); } catch (FileUtilsErrorException e) {
} catch (FileUtilsErrorException e) { throw new RuntimeException(e);
throw new RuntimeException(e); }
} }, 1, TimeUnit.SECONDS);
}, 1, TimeUnit.SECONDS); executor.schedule(() -> run_operation.process().destroy(), 2, TimeUnit.SECONDS);
executor.schedule(() -> run_operation.process().destroy(), 2, TimeUnit.SECONDS);
}
assertThrows(ExitStatusException.class, run_operation::execute); assertThrows(ExitStatusException.class, run_operation::execute);
assertTrue(check_result.toString().contains("<p>Hello World Myapp</p>")); assertTrue(check_result.toString().contains("<p>Hello World Myapp</p>"));
@ -535,19 +533,17 @@ public class TestCreateRife2Operation {
/myapp/src/test/resources""").matcher(FileUtils.generateDirectoryListing(tmp)).matches()); /myapp/src/test/resources""").matcher(FileUtils.generateDirectoryListing(tmp)).matches());
var run_operation = new RunOperation().fromProject(create_operation.project()); var run_operation = new RunOperation().fromProject(create_operation.project());
StringBuilder check_result; var executor = Executors.newSingleThreadScheduledExecutor();
try (var executor = Executors.newSingleThreadScheduledExecutor()) { var checked_url = new URL("http://localhost:8080");
var checked_url = new URL("http://localhost:8080"); var check_result = new StringBuilder();
check_result = new StringBuilder(); executor.schedule(() -> {
executor.schedule(() -> { try {
try { check_result.append(FileUtils.readString(checked_url));
check_result.append(FileUtils.readString(checked_url)); } catch (FileUtilsErrorException e) {
} catch (FileUtilsErrorException e) { throw new RuntimeException(e);
throw new RuntimeException(e); }
} }, 1, TimeUnit.SECONDS);
}, 1, TimeUnit.SECONDS); executor.schedule(() -> run_operation.process().destroy(), 2, TimeUnit.SECONDS);
executor.schedule(() -> run_operation.process().destroy(), 2, TimeUnit.SECONDS);
}
assertThrows(ExitStatusException.class, run_operation::execute); assertThrows(ExitStatusException.class, run_operation::execute);
assertTrue(check_result.toString().contains("<p>Hello World Myapp</p>"), check_result.toString()); assertTrue(check_result.toString().contains("<p>Hello World Myapp</p>"), check_result.toString());
@ -703,19 +699,17 @@ public class TestCreateRife2Operation {
/myapp/src/test/resources""").matcher(FileUtils.generateDirectoryListing(tmp)).matches()); /myapp/src/test/resources""").matcher(FileUtils.generateDirectoryListing(tmp)).matches());
var run_operation = new RunOperation().fromProject(create_operation.project()); var run_operation = new RunOperation().fromProject(create_operation.project());
StringBuilder check_result; var executor = Executors.newSingleThreadScheduledExecutor();
try (var executor = Executors.newSingleThreadScheduledExecutor()) { var checked_url = new URL("http://localhost:8080");
var checked_url = new URL("http://localhost:8080"); var check_result = new StringBuilder();
check_result = new StringBuilder(); executor.schedule(() -> {
executor.schedule(() -> { try {
try { check_result.append(FileUtils.readString(checked_url));
check_result.append(FileUtils.readString(checked_url)); } catch (FileUtilsErrorException e) {
} catch (FileUtilsErrorException e) { throw new RuntimeException(e);
throw new RuntimeException(e); }
} }, 1, TimeUnit.SECONDS);
}, 1, TimeUnit.SECONDS); executor.schedule(() -> run_operation.process().destroy(), 2, TimeUnit.SECONDS);
executor.schedule(() -> run_operation.process().destroy(), 2, TimeUnit.SECONDS);
}
assertThrows(ExitStatusException.class, run_operation::execute); assertThrows(ExitStatusException.class, run_operation::execute);
assertTrue(check_result.toString().contains("<p>Hello World Myapp</p>")); assertTrue(check_result.toString().contains("<p>Hello World Myapp</p>"));

View file

@ -162,17 +162,16 @@ public class TestUberJarOperation {
var run_operation = new RunOperation() var run_operation = new RunOperation()
.javaOptions(List.of("-jar")) .javaOptions(List.of("-jar"))
.mainClass(uberjar_file.getAbsolutePath()); .mainClass(uberjar_file.getAbsolutePath());
try (var executor = Executors.newSingleThreadScheduledExecutor()) { var executor = Executors.newSingleThreadScheduledExecutor();
var checked_url = new URL("http://localhost:8080"); var checked_url = new URL("http://localhost:8080");
executor.schedule(() -> { executor.schedule(() -> {
try { try {
check_result.append(FileUtils.readString(checked_url)); check_result.append(FileUtils.readString(checked_url));
} catch (FileUtilsErrorException e) { } catch (FileUtilsErrorException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
}, 1, TimeUnit.SECONDS); }, 1, TimeUnit.SECONDS);
executor.schedule(() -> run_operation.process().destroy(), 2, TimeUnit.SECONDS); executor.schedule(() -> run_operation.process().destroy(), 2, TimeUnit.SECONDS);
}
assertThrows(ExitStatusException.class, run_operation::execute); assertThrows(ExitStatusException.class, run_operation::execute);
assertTrue(check_result.toString().contains("<p>Hello World App</p>")); assertTrue(check_result.toString().contains("<p>Hello World App</p>"));