use of org.folio.okapi.util.ModuleHandle in project okapi by folio-org.
the class ProcessModuleHandleTest method test2.
@Test
public void test2(TestContext context) {
final Async async = context.async();
LaunchDescriptor desc = new LaunchDescriptor();
desc.setExec("sleepxx 10 %p");
ModuleHandle mh = createModuleHandle(desc, 0);
mh.start(res -> {
context.assertFalse(res.succeeded());
async.complete();
});
}
use of org.folio.okapi.util.ModuleHandle in project okapi by folio-org.
the class ProcessModuleHandleTest method test6.
@Test
public void test6(TestContext context) {
final Async async = context.async();
LaunchDescriptor desc = new LaunchDescriptor();
desc.setExec("java " + invokeTest);
ModuleHandle mh = createModuleHandle(desc, 9231);
mh.start(res1 -> {
mh.stop(res2 -> {
context.assertTrue(res2.succeeded());
async.complete();
});
});
}
use of org.folio.okapi.util.ModuleHandle in project okapi by folio-org.
the class ProcessModuleHandleTest method test7.
@Test
public void test7(TestContext context) {
final Async async = context.async();
// Cannot rely on sh and kill on Windows
String os = System.getProperty("os.name").toLowerCase();
if (os.contains("win")) {
async.complete();
return;
}
LaunchDescriptor desc = new LaunchDescriptor();
desc.setCmdlineStart("java -DpidFile=test-module.pid " + invokeTest + " 2>&1 >/dev/null &");
desc.setCmdlineStop("kill `cat test-module.pid`; rm -f test-module.pid");
ModuleHandle mh = createModuleHandle(desc, 9231);
mh.start(res1 -> {
context.assertTrue(res1.succeeded());
mh.stop(res2 -> {
context.assertTrue(res2.succeeded());
async.complete();
});
});
}
use of org.folio.okapi.util.ModuleHandle in project okapi by folio-org.
the class ProcessModuleHandleTest method test1a.
@Test
public void test1a(TestContext context) {
final Async async = context.async();
LaunchDescriptor desc = new LaunchDescriptor();
desc.setExec("java -version %p");
ModuleHandle mh = createModuleHandle(desc, 9231);
mh.start(res -> {
if (res.succeeded()) {
// error did not expect to succeed!
mh.stop(res2 -> {
context.assertTrue(res2.succeeded());
context.assertFalse(res.failed());
async.complete();
});
}
context.assertFalse(res.succeeded());
String msg = res.cause().getMessage();
context.assertTrue(msg.startsWith("Deployment failed. Could not connect to port 9231"));
async.complete();
});
}
use of org.folio.okapi.util.ModuleHandle in project okapi by folio-org.
the class ProcessModuleHandleTest method test5.
@Test
public void test5(TestContext context) {
final Async async = context.async();
LaunchDescriptor desc = new LaunchDescriptor();
desc.setCmdlineStart("java -Dport=9000 -jar unknown.jar");
ModuleHandle mh = createModuleHandle(desc, 9231);
mh.start(res -> {
context.assertFalse(res.succeeded());
context.assertEquals("Can not deploy: No %p in the cmdlineStart", res.cause().getMessage());
async.complete();
});
}
Aggregations