Search in sources :

Example 1 with MainDeploy

use of org.folio.okapi.MainDeploy in project okapi by folio-org.

the class MainDeployTest method testClusterModeFail2.

@Test
public void testClusterModeFail2(TestContext context) {
    async = context.async();
    String[] args = { "cluster", "-hazelcast-config-file", "foobar" };
    MainDeploy d = new MainDeploy();
    d.init(args, res -> {
        vertx = res.succeeded() ? res.result() : null;
        Assert.assertTrue("main1 " + res.cause(), res.failed());
        async.complete();
    });
}
Also used : MainDeploy(org.folio.okapi.MainDeploy) Test(org.junit.Test)

Example 2 with MainDeploy

use of org.folio.okapi.MainDeploy in project okapi by folio-org.

the class MainDeployTest method testClusterMode.

@Test
public void testClusterMode(TestContext context) {
    async = context.async();
    String[] args = { "cluster" };
    MainDeploy d = new MainDeploy();
    d.init(args, res -> {
        vertx = res.succeeded() ? res.result() : null;
        Assert.assertTrue("main1 " + res.cause(), res.succeeded());
        RestAssuredClient c;
        Response r;
        c = api.createRestAssured3();
        r = c.given().get("/_/proxy/modules").then().statusCode(200).log().ifValidationFails().extract().response();
        Assert.assertTrue("raml: " + c.getLastReport().toString(), c.getLastReport().isEmpty());
        async.complete();
    });
}
Also used : Response(io.restassured.response.Response) MainDeploy(org.folio.okapi.MainDeploy) RestAssuredClient(guru.nidi.ramltester.restassured3.RestAssuredClient) Test(org.junit.Test)

Example 3 with MainDeploy

use of org.folio.okapi.MainDeploy in project okapi by folio-org.

the class MainDeployTest method testBadMode.

@Test
public void testBadMode(TestContext context) {
    async = context.async();
    String[] args = { "bad" };
    MainDeploy d = new MainDeploy();
    d.init(args, res -> {
        vertx = res.succeeded() ? res.result() : null;
        Assert.assertFalse(res.succeeded());
        async.complete();
    });
}
Also used : MainDeploy(org.folio.okapi.MainDeploy) Test(org.junit.Test)

Example 4 with MainDeploy

use of org.folio.okapi.MainDeploy in project okapi by folio-org.

the class MainDeployTest method testBadOption.

@Test
public void testBadOption(TestContext context) {
    async = context.async();
    String[] args = { "-bad-option" };
    MainDeploy d = new MainDeploy();
    d.init(args, res -> {
        vertx = res.succeeded() ? res.result() : null;
        Assert.assertFalse(res.succeeded());
        async.complete();
    });
}
Also used : MainDeploy(org.folio.okapi.MainDeploy) Test(org.junit.Test)

Example 5 with MainDeploy

use of org.folio.okapi.MainDeploy in project okapi by folio-org.

the class MainDeployTest method testDevMode.

@Test
public void testDevMode(TestContext context) {
    async = context.async();
    String[] args = { "dev" };
    MainDeploy d = new MainDeploy();
    d.init(args, res -> {
        vertx = res.succeeded() ? res.result() : null;
        Assert.assertTrue("main1 " + res.cause(), res.succeeded());
        RestAssuredClient c;
        Response r;
        c = api.createRestAssured3();
        r = c.given().get("/_/version").then().statusCode(200).log().ifValidationFails().extract().response();
        Assert.assertTrue("raml: " + c.getLastReport().toString(), c.getLastReport().isEmpty());
        async.complete();
    });
}
Also used : Response(io.restassured.response.Response) MainDeploy(org.folio.okapi.MainDeploy) RestAssuredClient(guru.nidi.ramltester.restassured3.RestAssuredClient) Test(org.junit.Test)

Aggregations

MainDeploy (org.folio.okapi.MainDeploy)13 Test (org.junit.Test)12 RestAssuredClient (guru.nidi.ramltester.restassured3.RestAssuredClient)4 Response (io.restassured.response.Response)4 JsonObject (io.vertx.core.json.JsonObject)1 Async (io.vertx.ext.unit.Async)1 Matchers.containsString (org.hamcrest.Matchers.containsString)1 Before (org.junit.Before)1