use of org.folio.rest.client.TenantClient in project raml-module-builder by folio-org.
the class DemoRamlRestTest method setUp.
/**
* @param context the test context.
*/
@BeforeClass
public static void setUp(TestContext context) {
PostgresClient.setPostgresTester(new PostgresTesterContainer());
vertx = VertxUtils.getVertxWithExceptionHandler();
port = NetworkUtils.nextFreePort();
RestAssured.port = port;
RestAssured.enableLoggingOfRequestAndResponseIfValidationFails();
tenant = new RequestSpecBuilder().addHeader("x-okapi-tenant", TENANT).build();
try {
deployRestVerticle(context);
client = new TenantClient("http://localhost:" + port, TENANT, null);
TenantAttributes ta = new TenantAttributes().withModuleTo("raml-module-builder-1.0.0");
TenantInit.exec(client, ta, 60000).onComplete(context.asyncAssertSuccess());
} catch (Exception e) {
context.fail(e);
}
}
use of org.folio.rest.client.TenantClient in project raml-module-builder by folio-org.
the class TenantInitTest method testBadPortGet.
@Test
public void testBadPortGet(TestContext context) {
TenantClient client2 = new TenantClient("http://localhost:" + NetworkUtils.nextFreePort(), "library", null);
Future.<Void>future(promise -> TenantInit.execGet(client2, "1", 1, promise)).onComplete(context.asyncAssertFailure(cause -> {
assertThat(cause, isA(ConnectException.class));
}));
}
use of org.folio.rest.client.TenantClient in project raml-module-builder by folio-org.
the class Test method main.
/**
* @param args
*/
public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
MimeMultipart mmp = new MimeMultipart();
BodyPart bp = new MimeBodyPart(new FileInputStream("C:\\Git\\mod-files\\ramls\\mod-files\\files.raml"));
bp.setDisposition("form-data");
bp.setFileName("abc.raml");
BodyPart bp2 = new MimeBodyPart(new FileInputStream("C:\\Git\\mod-files\\ramls\\mod-files\\files.raml"));
bp2.setDisposition("form-data");
bp2.setFileName("abcd.raml");
mmp.addBodyPart(bp);
mmp.addBodyPart(bp2);
AdminClient aClient = new AdminClient("localhost", 8888, null, null, false);
aClient.postUploadmultipart(PersistMethod.SAVE, null, "abc", mmp, reply -> {
reply.statusCode();
});
/* aClient.postImportSQL(
Test.class.getClassLoader().getResourceAsStream("create_config.sql"), reply -> {
reply.statusCode();
});*/
aClient.getJstack(trace -> {
trace.bodyHandler(content -> {
System.out.println(content);
});
});
TenantClient tc = new TenantClient("localhost", 8888, "harvard", "harvard");
tc.post(null, response -> {
response.bodyHandler(body -> {
System.out.println(body.toString());
tc.delete(reply -> {
reply.bodyHandler(body2 -> {
System.out.println(body2.toString());
});
});
});
});
aClient.getPostgresActiveSessions("postgres", reply -> {
reply.bodyHandler(body -> {
System.out.println(body.toString("UTF8"));
});
});
aClient.getPostgresLoad("postgres", reply -> {
reply.bodyHandler(body -> {
System.out.println(body.toString("UTF8"));
});
});
aClient.getPostgresTableAccessStats(reply -> {
reply.bodyHandler(body -> {
System.out.println(body.toString("UTF8"));
});
});
aClient.getPostgresTableSize("postgres", reply -> {
reply.bodyHandler(body -> {
System.out.println(body.toString("UTF8"));
});
});
}
use of org.folio.rest.client.TenantClient in project raml-module-builder by folio-org.
the class TenantInitTest method testBadPortPost.
@Test
public void testBadPortPost(TestContext context) {
TenantClient client2 = new TenantClient("http://localhost:" + NetworkUtils.nextFreePort(), "library", null);
TenantAttributes ta = new TenantAttributes().withModuleTo("module-1.0.0");
TenantInit.exec(client2, ta, 1).onComplete(context.asyncAssertFailure(cause -> assertThat(cause, isA(ConnectException.class))));
}
use of org.folio.rest.client.TenantClient in project raml-module-builder by folio-org.
the class TenantInitTest method beforeClass.
@BeforeClass
public static void beforeClass(TestContext context) {
vertx = Vertx.vertx();
port = NetworkUtils.nextFreePort();
Router router = Router.router(vertx);
router.post("/_/tenant").handler(BodyHandler.create());
router.post("/_/tenant").handler(TenantInitTest::postHandler);
router.getWithRegex("/_/tenant/.*").handler(TenantInitTest::getHandler);
router.deleteWithRegex("/_/tenant/.*").handler(TenantInitTest::deleteHandler);
client = new TenantClient("http://localhost:" + port, "testlib", null);
HttpServerOptions so = new HttpServerOptions().setHandle100ContinueAutomatically(true);
vertx.createHttpServer(so).requestHandler(router).listen(port).onComplete(context.asyncAssertSuccess());
}
Aggregations