Search in sources :

Example 6 with LaunchDescriptor

use of org.folio.okapi.bean.LaunchDescriptor in project okapi by folio-org.

the class ProcessModuleHandleTest method test3.

@Test
public void test3(TestContext context) {
    final Async async = context.async();
    LaunchDescriptor desc = new LaunchDescriptor();
    desc.setExec("java -Dport=%p -jar unknown.jar");
    ModuleHandle mh = createModuleHandle(desc, 9231);
    mh.start(res -> {
        context.assertFalse(res.succeeded());
        async.complete();
    });
}
Also used : Async(io.vertx.ext.unit.Async) ProcessModuleHandle(org.folio.okapi.util.ProcessModuleHandle) ModuleHandle(org.folio.okapi.util.ModuleHandle) LaunchDescriptor(org.folio.okapi.bean.LaunchDescriptor) Test(org.junit.Test)

Example 7 with LaunchDescriptor

use of org.folio.okapi.bean.LaunchDescriptor in project okapi by folio-org.

the class ProcessModuleHandleTest method test4.

@Test
public void test4(TestContext context) {
    final Async async = context.async();
    LaunchDescriptor desc = new LaunchDescriptor();
    desc.setExec("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 exec line", res.cause().getMessage());
        async.complete();
    });
}
Also used : Async(io.vertx.ext.unit.Async) ProcessModuleHandle(org.folio.okapi.util.ProcessModuleHandle) ModuleHandle(org.folio.okapi.util.ModuleHandle) LaunchDescriptor(org.folio.okapi.bean.LaunchDescriptor) Test(org.junit.Test)

Example 8 with LaunchDescriptor

use of org.folio.okapi.bean.LaunchDescriptor 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();
    });
}
Also used : Async(io.vertx.ext.unit.Async) ProcessModuleHandle(org.folio.okapi.util.ProcessModuleHandle) ModuleHandle(org.folio.okapi.util.ModuleHandle) LaunchDescriptor(org.folio.okapi.bean.LaunchDescriptor) Test(org.junit.Test)

Example 9 with LaunchDescriptor

use of org.folio.okapi.bean.LaunchDescriptor 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();
        });
    });
}
Also used : Async(io.vertx.ext.unit.Async) ProcessModuleHandle(org.folio.okapi.util.ProcessModuleHandle) ModuleHandle(org.folio.okapi.util.ModuleHandle) LaunchDescriptor(org.folio.okapi.bean.LaunchDescriptor) Test(org.junit.Test)

Example 10 with LaunchDescriptor

use of org.folio.okapi.bean.LaunchDescriptor in project okapi by folio-org.

the class DeploymentManagerTest method test1.

@Test
public void test1(TestContext context) {
    async = context.async();
    LaunchDescriptor descriptor = new LaunchDescriptor();
    descriptor.setExec("java -Dport=%p -jar " + "../okapi-test-module/target/okapi-test-module-fat.jar");
    DeploymentDescriptor dd = new DeploymentDescriptor("1", "sid", descriptor);
    dm.deploy(dd, res1 -> {
        context.assertTrue(res1.succeeded());
        dm.undeploy(res1.result().getInstId(), res2 -> {
            // after undeploy so we have no stale process
            context.assertEquals("http://myhost.index:9231", res1.result().getUrl());
            context.assertTrue(res2.succeeded());
            async.complete();
        });
    });
}
Also used : DeploymentDescriptor(org.folio.okapi.bean.DeploymentDescriptor) LaunchDescriptor(org.folio.okapi.bean.LaunchDescriptor) Test(org.junit.Test)

Aggregations

LaunchDescriptor (org.folio.okapi.bean.LaunchDescriptor)14 Test (org.junit.Test)10 ModuleHandle (org.folio.okapi.util.ModuleHandle)9 Async (io.vertx.ext.unit.Async)8 ProcessModuleHandle (org.folio.okapi.util.ProcessModuleHandle)8 DeploymentDescriptor (org.folio.okapi.bean.DeploymentDescriptor)4 HashMap (java.util.HashMap)1 LinkedHashMap (java.util.LinkedHashMap)1 LinkedList (java.util.LinkedList)1 List (java.util.List)1 EnvEntry (org.folio.okapi.bean.EnvEntry)1 ModuleDescriptor (org.folio.okapi.bean.ModuleDescriptor)1 Success (org.folio.okapi.common.Success)1 CompList (org.folio.okapi.util.CompList)1