/** * Verifies that the base service routes a request for retrieving * a tenant by its trusted certificate authority to the corresponding * <em>get</em> method. * * @param ctx The vert.x test context. */ @Test public void testGetByCaSucceeds(final TestContext ctx) { final EventBusMessage request = EventBusMessage.forOperation(TenantConstants.TenantAction.get.toString()) .setJsonPayload(new JsonObject().put(TenantConstants.FIELD_PAYLOAD_SUBJECT_DN, "CN=test")); tenantService.processRequest(request).setHandler(ctx.asyncAssertSuccess(response -> { ctx.assertEquals(HttpURLConnection.HTTP_OK, response.getStatus()); ctx.assertEquals("getByCa", response.getJsonPayload().getString("operation")); })); }
/** * Verifies that the base service routes a deprecated request for retrieving * a tenant by its identifier to the corresponding <em>get</em> method. * * @param ctx The vert.x test context. */ @Test public void testDeprecatedGetByIdSucceeds(final TestContext ctx) { final EventBusMessage request = EventBusMessage.forOperation(TenantConstants.TenantAction.get.toString()) .setJsonPayload(new JsonObject().put(TenantConstants.FIELD_PAYLOAD_TENANT_ID, "my-tenant")); tenantService.processRequest(request).setHandler(ctx.asyncAssertSuccess(response -> { ctx.assertEquals(HttpURLConnection.HTTP_OK, response.getStatus()); ctx.assertEquals("getById", response.getJsonPayload().getString("operation")); })); }
/** * Verifies that the base service routes a request for retrieving * a tenant by its identifier to the corresponding <em>get</em> method. * * @param ctx The vert.x test context. */ @Test public void testGetByIdSucceeds(final TestContext ctx) { final EventBusMessage request = createRequest(TenantConstants.TenantAction.get, null); tenantService.processRequest(request).setHandler(ctx.asyncAssertSuccess(response -> { ctx.assertEquals(HttpURLConnection.HTTP_OK, response.getStatus()); ctx.assertEquals(TEST_TENANT, response.getJsonPayload().getString(TenantConstants.FIELD_PAYLOAD_TENANT_ID)); })); }