use of org.folio.okapi.bean.DeploymentDescriptor in project okapi by folio-org.
the class BeanTest method testDeploymentDescriptor3.
@Test
public void testDeploymentDescriptor3() {
int fail = 0;
final String docSampleDeployment = "{" + LS + " \"srvcId\" : \"sample-module-1\"," + LS + " \"descriptor\" : {" + LS + " \"exec\" : " + "\"java -Dport=%p -jar ../okapi-test-module/target/okapi-test-module-fat.jar\"" + LS + " }" + LS + "}";
try {
final DeploymentDescriptor md = Json.decodeValue(docSampleDeployment, DeploymentDescriptor.class);
String pretty = Json.encodePrettily(md);
assertEquals(docSampleDeployment, pretty);
} catch (DecodeException ex) {
ex.printStackTrace();
fail = 400;
}
assertEquals(0, fail);
}
use of org.folio.okapi.bean.DeploymentDescriptor in project okapi by folio-org.
the class InternalModule method discoveryDeploy.
private void discoveryDeploy(ProxyContext pc, String body, Handler<ExtendedAsyncResult<String>> fut) {
try {
final DeploymentDescriptor pmd = Json.decodeValue(body, DeploymentDescriptor.class);
discoveryManager.addAndDeploy(pmd, pc, res -> {
if (res.failed()) {
fut.handle(new Failure<>(res.getType(), res.cause()));
return;
}
DeploymentDescriptor md = res.result();
final String s = Json.encodePrettily(md);
final String baseuri = pc.getCtx().request().uri() + "/" + md.getSrvcId();
location(pc, md.getInstId(), baseuri, s, fut);
});
} catch (DecodeException ex) {
fut.handle(new Failure<>(USER, ex));
}
}
use of org.folio.okapi.bean.DeploymentDescriptor 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();
});
});
}
use of org.folio.okapi.bean.DeploymentDescriptor in project okapi by folio-org.
the class BeanTest method testDeploymentDescriptor4.
@Test
public void testDeploymentDescriptor4() {
int fail = 0;
final String docSampleDeployment = "{" + LS + " \"srvcId\" : \"sample-module-1\"," + LS + " \"descriptor\" : {" + LS + " \"dockerImage\" : \"my-image\"," + LS + " \"dockerArgs\" : {" + LS + " \"Hostname\" : \"localhost\"," + LS + " \"User\" : \"nobody\"" + LS + " }" + LS + " }" + LS + "}";
try {
final DeploymentDescriptor md = Json.decodeValue(docSampleDeployment, DeploymentDescriptor.class);
String pretty = Json.encodePrettily(md);
assertEquals(docSampleDeployment, pretty);
} catch (DecodeException ex) {
ex.printStackTrace();
fail = 400;
}
assertEquals(0, fail);
}
use of org.folio.okapi.bean.DeploymentDescriptor in project okapi by folio-org.
the class BeanTest method testDeploymentDescriptor1.
@Test
public void testDeploymentDescriptor1() {
int fail = 0;
final String docSampleDeployment = "{" + LS + " \"srvcId\" : \"sample-module-1\"," + LS + " \"descriptor\" : {" + LS + " \"exec\" : " + "\"java -Dport=%p -jar ../okapi-test-module/target/okapi-test-module-fat.jar\"," + LS + " \"env\" : [ {" + LS + " \"name\" : \"helloGreeting\"," + LS + " \"value\" : \"hej\"" + LS + " } ]" + LS + " }" + LS + "}";
try {
final DeploymentDescriptor md = Json.decodeValue(docSampleDeployment, DeploymentDescriptor.class);
String pretty = Json.encodePrettily(md);
assertEquals(docSampleDeployment, pretty);
} catch (DecodeException ex) {
ex.printStackTrace();
fail = 400;
}
assertEquals(0, fail);
}
Aggregations