org.jboss.arquillian.container.test.api.RunAsClient Java Examples
The following examples show how to use
org.jboss.arquillian.container.test.api.RunAsClient.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BasicAuthenticationTest.java From microprofile1.4-samples with MIT License | 6 votes |
@Test @RunAsClient public void testProtectedPageNotLoggedin() throws IOException { Response response = newClient() .target( URI.create(new URL(base, "servlet").toExternalForm())) .request(TEXT_PLAIN) .get(); // Not logged-in thus should not be accessible. assertFalse( "Not authenticated, so should not have been able to access protected resource", response.readEntity(String.class).contains("This is a protected servlet") ); }
Example #2
Source File: ServerInternalAsyncTest.java From microprofile1.4-samples with MIT License | 6 votes |
@Test @RunAsClient public void testServerInternalAsync() throws IOException { String response = newClient() .target( URI.create(new URL(base, "api/clientAsync").toExternalForm())) .request(TEXT_PLAIN) .get(String.class); System.out.println("-------------------------------------------------------------------------"); System.out.println("Response: " + response); System.out.println("-------------------------------------------------------------------------"); assertTrue( response.contains("HELLO WORLD (ASYNC)!") ); }
Example #3
Source File: WellnessSuccessfulTest.java From smallrye-health with Apache License 2.0 | 6 votes |
/** * Verifies the wellness integration with CDI at the scope of a server runtime */ @Test @RunAsClient public void testSuccessResponsePayload() { Response response = getUrlWellContents(); // status code Assert.assertEquals(response.getStatus(), 200); JsonObject json = readJson(response); // response size JsonArray checks = json.getJsonArray("checks"); Assert.assertEquals(checks.size(), 2, "Expected two check responses"); // single procedure response assertSuccessfulCheck(checks.getJsonObject(0), "successful-check"); assertSuccessfulCheck(checks.getJsonObject(1), "successful-check"); assertOverallSuccess(json); }
Example #4
Source File: WellnessFailedTest.java From smallrye-health with Apache License 2.0 | 6 votes |
/** * Verifies the wellness integration with CDI at the scope of a server runtime */ @Test @RunAsClient public void testFailedResponsePayload() { Response response = getUrlWellContents(); // status code Assert.assertEquals(response.getStatus(), 503); JsonObject json = readJson(response); // response size JsonArray checks = json.getJsonArray("checks"); Assert.assertEquals(checks.size(), 1, "Expected a single check response"); // single procedure response assertFailureCheck(checks.getJsonObject(0), "failed-check"); assertOverallFailure(json); }
Example #5
Source File: ClientServerTest.java From microprofile1.4-samples with MIT License | 6 votes |
@Test @RunAsClient public void testClientServer() throws IOException, IllegalStateException, RestClientDefinitionException, URISyntaxException { HelloService remoteApi = RestClientBuilder.newBuilder() .baseUrl(base) .build(HelloService.class); String response = remoteApi.hello("Programmer"); System.out.println("-------------------------------------------------------------------------"); System.out.println("Response: " + response); System.out.println("-------------------------------------------------------------------------"); assertTrue( response.contains("Hello Programmer!") ); }
Example #6
Source File: SingleCustomSuccessfulTest.java From smallrye-health with Apache License 2.0 | 6 votes |
/** * Verifies the custom health integration with CDI at the scope of a server runtime */ @Test @RunAsClient public void testSuccessResponsePayload() { Response response = getUrlCustomHealthContents("group1"); // status code Assert.assertEquals(response.getStatus(), 200); JsonObject json = readJson(response); // response size JsonArray checks = json.getJsonArray("checks"); Assert.assertEquals(checks.size(), 1, "Expected a single check response"); // single procedure response assertSuccessfulCheck(checks.getJsonObject(0), "successful-check"); assertOverallSuccess(json); }
Example #7
Source File: ClientServerAsyncTest.java From microprofile1.4-samples with MIT License | 6 votes |
@Test @RunAsClient public void testClientServerAsync() throws IOException, IllegalStateException, RestClientDefinitionException, URISyntaxException, InterruptedException, ExecutionException { HelloService remoteApi = RestClientBuilder.newBuilder() .baseUrl(base) .build(HelloService.class); String response = remoteApi.helloAsync("Programmer (Async)") .thenApply(String::toUpperCase) .toCompletableFuture() .get(); System.out.println("-------------------------------------------------------------------------"); System.out.println("Response: " + response); System.out.println("-------------------------------------------------------------------------"); assertTrue( response.contains("HELLO PROGRAMMER (ASYNC)!") ); }
Example #8
Source File: ServerInternalTest.java From microprofile1.4-samples with MIT License | 6 votes |
@Test @RunAsClient public void testServerInternal() throws IOException { String response = newClient() .target( URI.create(new URL(base, "api/client").toExternalForm())) .request(TEXT_PLAIN) .get(String.class); System.out.println("-------------------------------------------------------------------------"); System.out.println("Response: " + response); System.out.println("-------------------------------------------------------------------------"); assertTrue( response.contains("Hello World!") ); }
Example #9
Source File: BasicHelloTest.java From microprofile1.4-samples with MIT License | 6 votes |
@Test @RunAsClient public void testServerInternal() throws IOException { String response = newClient() .target( URI.create(new URL(base.getProtocol(), base.getHost(), base.getPort(), "/openapi").toExternalForm())) .request(TEXT_PLAIN) .get(String.class); System.out.println("-------------------------------------------------------------------------"); System.out.println("Response: " + response); System.out.println("-------------------------------------------------------------------------"); assertTrue( response.contains("hello-world") ); }
Example #10
Source File: JaxRsTest.java From microprofile1.4-samples with MIT License | 6 votes |
@Test @RunAsClient public void testProtectedResourceNotLoggedin() throws IOException { System.out.println("-------------------------------------------------------------------------"); System.out.println("Base URL: " + base); System.out.println("-------------------------------------------------------------------------"); Response response = newClient() .target( URI.create(new URL(base, "resource/protected").toExternalForm())) .request(TEXT_PLAIN) .get(); // Not logged-in thus should not be accessible. assertFalse( "Not authenticated, so should not have been able to access protected resource", response.readEntity(String.class).contains("This is a protected resource") ); }
Example #11
Source File: JaxRsTest.java From microprofile1.4-samples with MIT License | 6 votes |
@Test @RunAsClient public void testPublicResourceNotLoggedin() throws IOException { Response response = newClient() .target( URI.create(new URL(base, "resource/public").toExternalForm())) .request(TEXT_PLAIN) .get(); // Public resource, no log-in needed assertTrue( "Public resource is not constrained (protected) so should be accessible without sending the JWT token", response.readEntity(String.class).contains("This is a public resource") ); }
Example #12
Source File: BasicAuthenticationAltLocationTest.java From microprofile1.4-samples with MIT License | 6 votes |
@Test @RunAsClient public void testProtectedPageNotLoggedin() throws IOException { Response response = newClient() .target( URI.create(new URL(base, "servlet").toExternalForm())) .request(TEXT_PLAIN) .get(); // Not logged-in thus should not be accessible. assertFalse( "Not authenticated, so should not have been able to access protected resource", response.readEntity(String.class).contains("This is a protected servlet") ); }
Example #13
Source File: TestMatrixTest.java From microprofile-starter with Apache License 2.0 | 5 votes |
@Test @RunAsClient @InSequence(7) public void payaraAllButJWTRest() throws IOException, InterruptedException { testRuntime("PAYARA_MICRO", "payara", SpecSelection.ALL_BUT_JWT_REST, new int[]{6900}); }
Example #14
Source File: TestMatrixTest.java From microprofile-starter with Apache License 2.0 | 5 votes |
@Test @RunAsClient @InSequence(20) public void kumuluzeeJWTRest() throws IOException, InterruptedException { testRuntime("KUMULUZEE", "kumuluzee", SpecSelection.JWT_REST, new int[]{8180}); }
Example #15
Source File: TestMatrixTest.java From microprofile-starter with Apache License 2.0 | 5 votes |
@Test @RunAsClient @InSequence(14) public void helidonAll() throws IOException, InterruptedException { testRuntime("HELIDON", "helidon", SpecSelection.ALL, new int[]{8180}); }
Example #16
Source File: TestMatrixTest.java From microprofile-starter with Apache License 2.0 | 5 votes |
@Test @RunAsClient @InSequence(22) public void tomeeAll() throws IOException, InterruptedException { testRuntime("TOMEE", "tomee", SpecSelection.ALL, new int[]{8009, 8005, 8180, 8109, 8105}); }
Example #17
Source File: TestMatrixTest.java From microprofile-starter with Apache License 2.0 | 5 votes |
@Test @RunAsClient @InSequence(21) public void tomeeEmpty() throws IOException, InterruptedException { testRuntime("TOMEE", "tomee", SpecSelection.EMPTY, new int[]{8009, 8005}); }
Example #18
Source File: TestMatrixTest.java From microprofile-starter with Apache License 2.0 | 5 votes |
@Test @RunAsClient @InSequence(18) public void kumuluzeeAll() throws IOException, InterruptedException { testRuntime("KUMULUZEE", "kumuluzee", SpecSelection.ALL, new int[]{8180}); }
Example #19
Source File: TestMatrixTest.java From microprofile-starter with Apache License 2.0 | 5 votes |
@Test @RunAsClient @InSequence(36) public void wildflyJWTAuth() throws IOException, InterruptedException { testRuntime("WILDFLY", "wildfly", SpecSelection.JWT_AUTH, new int[]{9990, 8180, 10090}); }
Example #20
Source File: TestMatrixTest.java From microprofile-starter with Apache License 2.0 | 5 votes |
@Test @RunAsClient @InSequence(16) public void helidonJWTRest() throws IOException, InterruptedException { testRuntime("HELIDON", "helidon", SpecSelection.JWT_REST, new int[]{8180}); }
Example #21
Source File: TestMatrixTest.java From microprofile-starter with Apache License 2.0 | 5 votes |
@Test @RunAsClient @InSequence(15) public void helidonAllButJWTRest() throws IOException, InterruptedException { testRuntime("HELIDON", "helidon", SpecSelection.ALL_BUT_JWT_REST, new int[]{}); }
Example #22
Source File: TestMatrixTest.java From microprofile-starter with Apache License 2.0 | 5 votes |
@Test @RunAsClient @InSequence(19) public void kumuluzeeAllButJWTRest() throws IOException, InterruptedException { testRuntime("KUMULUZEE", "kumuluzee", SpecSelection.ALL_BUT_JWT_REST, new int[]{}); }
Example #23
Source File: TestMatrixTest.java From microprofile-starter with Apache License 2.0 | 5 votes |
@Test @RunAsClient @InSequence(5) public void payaraEmpty() throws IOException, InterruptedException { testRuntime("PAYARA_MICRO", "payara", SpecSelection.EMPTY, new int[]{6900}); }
Example #24
Source File: TestMatrixTest.java From microprofile-starter with Apache License 2.0 | 5 votes |
@Test @RunAsClient @InSequence(4) public void thorntailJWTRest() throws IOException, InterruptedException { testRuntime("THORNTAIL_V2", "thorntail", SpecSelection.JWT_REST, new int[]{9990, 8180, 10090}); }
Example #25
Source File: TestMatrixTest.java From microprofile-starter with Apache License 2.0 | 5 votes |
@Test @RunAsClient @InSequence(3) public void thorntailAllButJWTRest() throws IOException, InterruptedException { testRuntime("THORNTAIL_V2", "thorntail", SpecSelection.ALL_BUT_JWT_REST, new int[]{9990}); }
Example #26
Source File: TestMatrixTest.java From microprofile-starter with Apache License 2.0 | 5 votes |
@Test @RunAsClient @InSequence(2) public void thorntailAll() throws IOException, InterruptedException { testRuntime("THORNTAIL_V2", "thorntail", SpecSelection.ALL, new int[]{9990, 8180, 10090}); }
Example #27
Source File: TestMatrixTest.java From microprofile-starter with Apache License 2.0 | 5 votes |
@Test @RunAsClient @InSequence(1) public void thorntailEmpty() throws IOException, InterruptedException { testRuntime("THORNTAIL_V2", "thorntail", SpecSelection.EMPTY, new int[]{9990}); }
Example #28
Source File: TestMatrixTest.java From microprofile-starter with Apache License 2.0 | 5 votes |
@Test @RunAsClient @InSequence(0) public void apiAccessibleSanity() { Response response = target.request().get(); assertEquals("MicroProfile Starter REST API should be available", Response.Status.OK.getStatusCode(), response.getStatus()); }
Example #29
Source File: APITest.java From microprofile-starter with Apache License 2.0 | 5 votes |
@Test @RunAsClient public void supportMatrix() throws FileNotFoundException { test(v4Matrix, "/4/supportMatrix"); test(v4MatrixServers, "/4/supportMatrix/servers"); test(v3Matrix, "/3/supportMatrix"); test(v3MatrixServers, "/3/supportMatrix/servers"); }
Example #30
Source File: TestMatrixTest.java From microprofile-starter with Apache License 2.0 | 5 votes |
@Test @RunAsClient @InSequence(39) public void wildflyOpenTracing() throws IOException, InterruptedException { testRuntime("WILDFLY", "wildfly", SpecSelection.OPEN_TRACING, new int[]{9990}); }