org.testng.Reporter Java Examples
The following examples show how to use
org.testng.Reporter.
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: ExtentIReporterSuiteClassListenerAdapter.java From extentreports-testng-adapter with Apache License 2.0 | 7 votes |
@Override public void generateReport(List<XmlSuite> xmlSuites, List<ISuite> suites, String outputDirectory) { ExtentService.getInstance().setReportUsesManualConfiguration(true); ExtentService.getInstance().setAnalysisStrategy(AnalysisStrategy.SUITE); for (ISuite suite : suites) { Map<String, ISuiteResult> result = suite.getResults(); for (ISuiteResult r : result.values()) { ITestContext context = r.getTestContext(); ExtentTest suiteTest = ExtentService.getInstance().createTest(r.getTestContext().getSuite().getName()); buildTestNodes(suiteTest, context.getFailedTests(), Status.FAIL); buildTestNodes(suiteTest, context.getSkippedTests(), Status.SKIP); buildTestNodes(suiteTest, context.getPassedTests(), Status.PASS); } } for (String s : Reporter.getOutput()) { ExtentService.getInstance().setTestRunnerOutput(s); } ExtentService.getInstance().flush(); }
Example #2
Source File: PublicKeyAsPEMLocationURLTest.java From microprofile-jwt-auth with Apache License 2.0 | 6 votes |
@RunAsClient() @Test(groups = TEST_GROUP_CONFIG, description = "Validate the http://localhost:8080/pem/endp/publicKey4k PEM endpoint") public void validateLocationUrlContents() throws Exception { URL locationURL = new URL(baseURL, "pem/endp/publicKey4k"); Reporter.log("Begin validateLocationUrlContents"); StringWriter content = new StringWriter(); try(BufferedReader reader = new BufferedReader(new InputStreamReader(locationURL.openStream()))) { String line = reader.readLine(); while(line != null) { content.write(line); content.write('\n'); line = reader.readLine(); } } Reporter.log("Received: "+content); String expected = TokenUtils.readResource("/publicKey4k.pem"); Assert.assertEquals(content.toString(), expected); }
Example #3
Source File: ProviderInjectionTest.java From microprofile-jwt-auth with Apache License 2.0 | 6 votes |
@RunAsClient @Test(groups = TEST_GROUP_CDI_PROVIDER, description = "Verify that the injected raw token claim is as expected") public void verifyInjectedRawToken() throws Exception { Reporter.log("Begin verifyInjectedRawToken\n"); String uri = baseURL.toExternalForm() + "endp/verifyInjectedRawToken"; WebTarget echoEndpointTarget = ClientBuilder.newClient() .target(uri) .queryParam(Claims.raw_token.name(), token) .queryParam(Claims.auth_time.name(), authTimeClaim); Response response = echoEndpointTarget.request(MediaType.APPLICATION_JSON).header(HttpHeaders.AUTHORIZATION, "Bearer " + token).get(); Assert.assertEquals(response.getStatus(), HttpURLConnection.HTTP_OK); String replyString = response.readEntity(String.class); JsonReader jsonReader = Json.createReader(new StringReader(replyString)); JsonObject reply = jsonReader.readObject(); Reporter.log(reply.toString()); Assert.assertTrue(reply.getBoolean("pass"), reply.getString("msg")); }
Example #4
Source File: JsonValueInjectionTest.java From microprofile-jwt-auth with Apache License 2.0 | 6 votes |
@RunAsClient @Test(groups = TEST_GROUP_CDI_JSON, description = "Verify that the injected customDouble claim is as expected") public void verifyInjectedCustomDouble() throws Exception { Reporter.log("Begin verifyInjectedCustomDouble\n"); String uri = baseURL.toExternalForm() + "endp/verifyInjectedCustomDouble"; WebTarget echoEndpointTarget = ClientBuilder.newClient() .target(uri) .queryParam("value", 3.141592653589793) .queryParam(Claims.auth_time.name(), authTimeClaim); Response response = echoEndpointTarget.request(MediaType.APPLICATION_JSON).header(HttpHeaders.AUTHORIZATION, "Bearer " + token).get(); Assert.assertEquals(response.getStatus(), HttpURLConnection.HTTP_OK); String replyString = response.readEntity(String.class); JsonReader jsonReader = Json.createReader(new StringReader(replyString)); JsonObject reply = jsonReader.readObject(); Reporter.log(reply.toString()); Assert.assertTrue(reply.getBoolean("pass"), reply.getString("msg")); }
Example #5
Source File: ProviderInjectionTest.java From microprofile-jwt-auth with Apache License 2.0 | 6 votes |
@RunAsClient @Test(groups = TEST_GROUP_CDI_PROVIDER, description = "Verify that the injected raw token claim is as expected") public void verifyInjectedRawToken2() throws Exception { Reporter.log("Begin verifyInjectedRawToken\n"); String uri = baseURL.toExternalForm() + "endp/verifyInjectedRawToken"; WebTarget echoEndpointTarget = ClientBuilder.newClient() .target(uri) .queryParam(Claims.raw_token.name(), token) .queryParam(Claims.auth_time.name(), authTimeClaim); Response response = echoEndpointTarget.request(MediaType.APPLICATION_JSON).header(HttpHeaders.AUTHORIZATION, "Bearer " + token).get(); Assert.assertEquals(response.getStatus(), HttpURLConnection.HTTP_OK); String replyString = response.readEntity(String.class); JsonReader jsonReader = Json.createReader(new StringReader(replyString)); JsonObject reply = jsonReader.readObject(); Reporter.log(reply.toString()); Assert.assertTrue(reply.getBoolean("pass"), reply.getString("msg")); }
Example #6
Source File: DriverListener.java From carina with Apache License 2.0 | 6 votes |
private void onBeforeAction() { // 4a. if "tzid" not exist inside vncArtifact and exists in Reporter -> register new vncArtifact in Zafira. // 4b. if "tzid" already exists in current artifact but in Reporter there is another value. Then this is use case for class/suite mode when we share the same // driver across different tests ITestResult res = Reporter.getCurrentTestResult(); if (res != null && res.getAttribute("ztid") != null) { Long ztid = (Long) res.getAttribute("ztid"); if (ztid != vncArtifact.getTestId() && vncArtifact != null && ! StringUtils.isBlank(vncArtifact.getName())) { vncArtifact.setTestId(ztid); LOGGER.debug("Registered live video artifact " + vncArtifact.getName() + " into zafira"); ZafiraSingleton.INSTANCE.getClient().addTestArtifact(vncArtifact); } } }
Example #7
Source File: RequiredClaimsTest.java From microprofile-jwt-auth with Apache License 2.0 | 6 votes |
@RunAsClient @Test(groups = TEST_GROUP_JWT, description = "Verify that the uPN claim is as expected") public void verifyUPN() throws Exception { Reporter.log("Begin verifyUPN\n"); String uri = baseURL.toExternalForm() + "endp/verifyUPN"; WebTarget echoEndpointTarget = ClientBuilder.newClient() .target(uri) .queryParam(Claims.upn.name(), "[email protected]") .queryParam(Claims.auth_time.name(), authTimeClaim); Response response = echoEndpointTarget.request(MediaType.APPLICATION_JSON).header(HttpHeaders.AUTHORIZATION, "Bearer " + token).get(); Assert.assertEquals(response.getStatus(), HttpURLConnection.HTTP_OK); String replyString = response.readEntity(String.class); JsonReader jsonReader = Json.createReader(new StringReader(replyString)); JsonObject reply = jsonReader.readObject(); Reporter.log(reply.toString()); Assert.assertTrue(reply.getBoolean("pass"), reply.getString("msg")); }
Example #8
Source File: PrimitiveInjectionTest.java From microprofile-jwt-auth with Apache License 2.0 | 6 votes |
@RunAsClient @Test(groups = TEST_GROUP_CDI_PROVIDER, description = "Verify that the injected upn claim is as expected") public void verifyInjectedUPN() throws Exception { Reporter.log("Begin verifyInjectedUPN\n"); String uri = baseURL.toExternalForm() + "endp/verifyInjectedUPN"; WebTarget echoEndpointTarget = ClientBuilder.newClient() .target(uri) .queryParam(Claims.upn.name(), "[email protected]") .queryParam(Claims.auth_time.name(), authTimeClaim); Response response = echoEndpointTarget.request(MediaType.APPLICATION_JSON).header(HttpHeaders.AUTHORIZATION, "Bearer " + token).get(); Assert.assertEquals(response.getStatus(), HttpURLConnection.HTTP_OK); String replyString = response.readEntity(String.class); JsonReader jsonReader = Json.createReader(new StringReader(replyString)); JsonObject reply = jsonReader.readObject(); Reporter.log(reply.toString()); Assert.assertTrue(reply.getBoolean("pass"), reply.getString("msg")); }
Example #9
Source File: PublicKeyAsPEMTest.java From microprofile-jwt-auth with Apache License 2.0 | 6 votes |
@RunAsClient @Test(groups = TEST_GROUP_CONFIG, description = "Validate that the embedded PEM key is used to sign the JWT") public void testKeyAsPEM() throws Exception { Reporter.log("testKeyAsPEM, expect HTTP_OK"); PrivateKey privateKey = TokenUtils.readPrivateKey("/privateKey4k.pem"); String kid = "/privateKey4k.pem"; HashMap<String, Long> timeClaims = new HashMap<>(); String token = TokenUtils.generateTokenString(privateKey, kid, "/Token1.json", null, timeClaims); String uri = baseURL.toExternalForm() + "endp/verifyKeyAsPEM"; WebTarget echoEndpointTarget = ClientBuilder.newClient() .target(uri) ; Response response = echoEndpointTarget.request(APPLICATION_JSON).header(HttpHeaders.AUTHORIZATION, "Bearer "+token).get(); Assert.assertEquals(response.getStatus(), HttpURLConnection.HTTP_OK); String replyString = response.readEntity(String.class); JsonReader jsonReader = Json.createReader(new StringReader(replyString)); JsonObject reply = jsonReader.readObject(); Reporter.log(reply.toString()); Assert.assertTrue(reply.getBoolean("pass"), reply.getString("msg")); }
Example #10
Source File: ClaimValueInjectionTest.java From microprofile-jwt-auth with Apache License 2.0 | 6 votes |
@RunAsClient @Test(groups = TEST_GROUP_CDI, description = "Verify that the injected token issuer claim using @Claim(standard) is as expected") public void verifyIssuerStandardClaim() throws Exception { Reporter.log("Begin verifyIssuerClaim"); String uri = baseURL.toExternalForm() + "endp/verifyInjectedIssuerStandard"; WebTarget echoEndpointTarget = ClientBuilder.newClient() .target(uri) .queryParam(Claims.iss.name(), TCKConstants.TEST_ISSUER) .queryParam(Claims.auth_time.name(), authTimeClaim); Response response = echoEndpointTarget.request(MediaType.APPLICATION_JSON).header(HttpHeaders.AUTHORIZATION, "Bearer " + token).get(); Assert.assertEquals(response.getStatus(), HttpURLConnection.HTTP_OK); String replyString = response.readEntity(String.class); JsonReader jsonReader = Json.createReader(new StringReader(replyString)); JsonObject reply = jsonReader.readObject(); Reporter.log(reply.toString()); Assert.assertTrue(reply.getBoolean("pass"), reply.getString("msg")); }
Example #11
Source File: JsonValueInjectionTest.java From microprofile-jwt-auth with Apache License 2.0 | 6 votes |
@RunAsClient @Test(groups = TEST_GROUP_CDI_JSON, description = "Verify that the injected iat claim is as expected from Token2") public void verifyInjectedIssuedAt2() throws Exception { Reporter.log("Begin verifyInjectedIssuedAt2\n"); HashMap<String, Long> timeClaims = new HashMap<>(); String token2 = TokenUtils.generateTokenString("/Token2.json", null, timeClaims); Long iatClaim = timeClaims.get(Claims.auth_time.name()); Long authTimeClaim = timeClaims.get(Claims.auth_time.name()); String uri = baseURL.toExternalForm() + "endp/verifyInjectedIssuedAt"; WebTarget echoEndpointTarget = ClientBuilder.newClient() .target(uri) .queryParam(Claims.iat.name(), iatClaim) .queryParam(Claims.auth_time.name(), authTimeClaim); Response response = echoEndpointTarget.request(MediaType.APPLICATION_JSON).header(HttpHeaders.AUTHORIZATION, "Bearer " + token2).get(); Assert.assertEquals(response.getStatus(), HttpURLConnection.HTTP_OK); String replyString = response.readEntity(String.class); JsonReader jsonReader = Json.createReader(new StringReader(replyString)); JsonObject reply = jsonReader.readObject(); Reporter.log(reply.toString()); Assert.assertTrue(reply.getBoolean("pass"), reply.getString("msg")); }
Example #12
Source File: PublicKeyAsJWKTest.java From microprofile-jwt-auth with Apache License 2.0 | 6 votes |
@RunAsClient @Test(groups = TEST_GROUP_CONFIG, description = "Validate that the embedded JWKS key is used to verify the JWT signature") public void testKeyAsJWK() throws Exception { Reporter.log("testKeyAsJWK, expect HTTP_OK"); PrivateKey privateKey = TokenUtils.readPrivateKey("/privateKey4k.pem"); String kid = "publicKey4k"; HashMap<String, Long> timeClaims = new HashMap<>(); String token = TokenUtils.generateTokenString(privateKey, kid, "/Token1.json", null, timeClaims); String uri = baseURL.toExternalForm() + "jwks/endp/verifyKeyAsJWK"; WebTarget echoEndpointTarget = ClientBuilder.newClient() .target(uri) .queryParam("kid", kid) ; Response response = echoEndpointTarget.request(APPLICATION_JSON).header(HttpHeaders.AUTHORIZATION, "Bearer "+token).get(); Assert.assertEquals(response.getStatus(), HttpURLConnection.HTTP_OK); String replyString = response.readEntity(String.class); JsonReader jsonReader = Json.createReader(new StringReader(replyString)); JsonObject reply = jsonReader.readObject(); Reporter.log(reply.toString()); Assert.assertTrue(reply.getBoolean("pass"), reply.getString("msg")); }
Example #13
Source File: PrivateKeyAsJWKSClasspathTest.java From microprofile-jwt-auth with Apache License 2.0 | 6 votes |
@RunAsClient @Test(groups = TEST_GROUP_CONFIG, description = "Validate specifying the mp.jwt.decrypt.key.location as resource path to a JWKS key") public void testKeyAsLocation() throws Exception { Reporter.log("testKeyAsLocation, expect HTTP_OK"); PublicKey publicKey = TokenUtils.readJwkPublicKey("/encryptorPublicKey.jwk"); String kid = "mp-jwt-set"; String token = TokenUtils.encryptClaims(publicKey, kid, "/Token1.json"); String uri = baseURL.toExternalForm() + "jwks/endp/verifyKeyLocationAsJWKSResource"; WebTarget echoEndpointTarget = ClientBuilder.newClient() .target(uri) .queryParam("kid", kid); Response response = echoEndpointTarget.request(APPLICATION_JSON).header(HttpHeaders.AUTHORIZATION, "Bearer "+token).get(); Assert.assertEquals(response.getStatus(), HttpURLConnection.HTTP_OK); String replyString = response.readEntity(String.class); JsonReader jsonReader = Json.createReader(new StringReader(replyString)); JsonObject reply = jsonReader.readObject(); Reporter.log(reply.toString()); Assert.assertTrue(reply.getBoolean("pass"), reply.getString("msg")); }
Example #14
Source File: BenchmarkRequestAccessToken.java From oxAuth with MIT License | 6 votes |
@Parameters({"userId", "userSecret", "redirectUris", "sectorIdentifierUri"}) @BeforeClass public void registerClient(final String userId, final String userSecret, String redirectUris, String sectorIdentifierUri) throws Exception { Reporter.log("Register client", true); List<ResponseType> responseTypes = Arrays.asList(ResponseType.CODE, ResponseType.ID_TOKEN); List<String> scopes = Arrays.asList("openid", "profile", "address", "email", "user_name"); RegisterResponse registerResponse = registerClient(redirectUris, responseTypes, scopes, sectorIdentifierUri); assertEquals(registerResponse.getStatus(), 200, "Unexpected response code: " + registerResponse.getEntity()); assertNotNull(registerResponse.getClientId()); assertNotNull(registerResponse.getClientSecret()); assertNotNull(registerResponse.getRegistrationAccessToken()); assertNotNull(registerResponse.getClientIdIssuedAt()); assertNotNull(registerResponse.getClientSecretExpiresAt()); this.clientId = registerResponse.getClientId(); this.clientSecret = registerResponse.getClientSecret(); }
Example #15
Source File: ProviderInjectionTest.java From microprofile-jwt-auth with Apache License 2.0 | 6 votes |
@RunAsClient @Test(groups = TEST_GROUP_CDI_PROVIDER, description = "Verify that the injected sub claim is as expected") public void verifyInjectedOptionalSubject() throws Exception { Reporter.log("Begin verifyInjectedOptionalSubject\n"); String uri = baseURL.toExternalForm() + "endp/verifyInjectedOptionalSubject"; WebTarget echoEndpointTarget = ClientBuilder.newClient() .target(uri) .queryParam(Claims.sub.name(), "24400320") .queryParam(Claims.auth_time.name(), authTimeClaim); Response response = echoEndpointTarget.request(MediaType.APPLICATION_JSON).header(HttpHeaders.AUTHORIZATION, "Bearer " + token).get(); Assert.assertEquals(response.getStatus(), HttpURLConnection.HTTP_OK); String replyString = response.readEntity(String.class); JsonReader jsonReader = Json.createReader(new StringReader(replyString)); JsonObject reply = jsonReader.readObject(); Reporter.log(reply.toString()); Assert.assertTrue(reply.getBoolean("pass"), reply.getString("msg")); }
Example #16
Source File: PrimitiveInjectionTest.java From microprofile-jwt-auth with Apache License 2.0 | 6 votes |
@RunAsClient @Test(groups = TEST_GROUP_CDI_PROVIDER, description = "Verify that the injected customBoolean claim is as expected") public void verifyInjectedCustomBoolean() { String uri = baseURL.toExternalForm() + "endp/verifyInjectedCustomBoolean"; WebTarget echoEndpointTarget = ClientBuilder.newClient() .target(uri) .queryParam("value", "true"); Response response = echoEndpointTarget.request(MediaType.APPLICATION_JSON).header(HttpHeaders.AUTHORIZATION, "Bearer " + token).get(); Assert.assertEquals(response.getStatus(), HttpURLConnection.HTTP_OK); String replyString = response.readEntity(String.class); JsonReader jsonReader = Json.createReader(new StringReader(replyString)); JsonObject reply = jsonReader.readObject(); Reporter.log(reply.toString()); Assert.assertTrue(reply.getBoolean("pass"), reply.getString("msg")); }
Example #17
Source File: ClaimValueInjectionTest.java From microprofile-jwt-auth with Apache License 2.0 | 6 votes |
@RunAsClient @Test(groups = TEST_GROUP_CDI, description = "Verify that the injected sub claim is as expected") public void verifyInjectedOptionalSubject() throws Exception { Reporter.log("Begin verifyInjectedOptionalSubject\n"); String uri = baseURL.toExternalForm() + "endp/verifyInjectedOptionalSubject"; WebTarget echoEndpointTarget = ClientBuilder.newClient() .target(uri) .queryParam(Claims.sub.name(), "24400320") .queryParam(Claims.auth_time.name(), authTimeClaim); Response response = echoEndpointTarget.request(MediaType.APPLICATION_JSON).header(HttpHeaders.AUTHORIZATION, "Bearer " + token).get(); Assert.assertEquals(response.getStatus(), HttpURLConnection.HTTP_OK); String replyString = response.readEntity(String.class); JsonReader jsonReader = Json.createReader(new StringReader(replyString)); JsonObject reply = jsonReader.readObject(); Reporter.log(reply.toString()); Assert.assertTrue(reply.getBoolean("pass"), reply.getString("msg")); }
Example #18
Source File: ClaimValueInjectionTest.java From microprofile-jwt-auth with Apache License 2.0 | 6 votes |
@RunAsClient @Test(groups = TEST_GROUP_CDI, description = "Verify that the injected customString claim is as expected") public void verifyInjectedCustomString() throws Exception { Reporter.log("Begin verifyInjectedCustomString\n"); String uri = baseURL.toExternalForm() + "endp/verifyInjectedCustomString"; WebTarget echoEndpointTarget = ClientBuilder.newClient() .target(uri) .queryParam("value", "customStringValue") .queryParam(Claims.auth_time.name(), authTimeClaim); Response response = echoEndpointTarget.request(MediaType.APPLICATION_JSON).header(HttpHeaders.AUTHORIZATION, "Bearer " + token).get(); Assert.assertEquals(response.getStatus(), HttpURLConnection.HTTP_OK); String replyString = response.readEntity(String.class); JsonReader jsonReader = Json.createReader(new StringReader(replyString)); JsonObject reply = jsonReader.readObject(); Reporter.log(reply.toString()); Assert.assertTrue(reply.getBoolean("pass"), reply.getString("msg")); }
Example #19
Source File: PublicKeyAsJWKLocationTest.java From microprofile-jwt-auth with Apache License 2.0 | 6 votes |
@RunAsClient @Test(groups = TEST_GROUP_CONFIG, description = "Validate specifying the mp.jwt.verify.publickey.location as resource path to a JWK key") public void testKeyAsLocation() throws Exception { Reporter.log("testKeyAsLocation, expect HTTP_OK"); PrivateKey privateKey = TokenUtils.readPrivateKey("/privateKey4k.pem"); String kid = "publicKey4k"; HashMap<String, Long> timeClaims = new HashMap<>(); String token = TokenUtils.generateTokenString(privateKey, kid, "/Token1.json", null, timeClaims); String uri = baseURL.toExternalForm() + "jwks/endp/verifyKeyLocationAsJWKResource"; WebTarget echoEndpointTarget = ClientBuilder.newClient() .target(uri) .queryParam("kid", kid) ; Response response = echoEndpointTarget.request(APPLICATION_JSON).header(HttpHeaders.AUTHORIZATION, "Bearer "+token).get(); Assert.assertEquals(response.getStatus(), HttpURLConnection.HTTP_OK); String replyString = response.readEntity(String.class); JsonReader jsonReader = Json.createReader(new StringReader(replyString)); JsonObject reply = jsonReader.readObject(); Reporter.log(reply.toString()); Assert.assertTrue(reply.getBoolean("pass"), reply.getString("msg")); }
Example #20
Source File: PrimitiveInjectionTest.java From microprofile-jwt-auth with Apache License 2.0 | 6 votes |
@RunAsClient @Test(groups = TEST_GROUP_CDI_PROVIDER, description = "Verify that the injected sub claim is as expected") public void verifyInjectedSUB() throws Exception { Reporter.log("Begin verifyInjectedSUB\n"); String uri = baseURL.toExternalForm() + "endp/verifyInjectedSUB"; WebTarget echoEndpointTarget = ClientBuilder.newClient() .target(uri) .queryParam(Claims.sub.name(), "24400320") .queryParam(Claims.auth_time.name(), authTimeClaim); Response response = echoEndpointTarget.request(MediaType.APPLICATION_JSON).header(HttpHeaders.AUTHORIZATION, "Bearer " + token).get(); Assert.assertEquals(response.getStatus(), HttpURLConnection.HTTP_OK); String replyString = response.readEntity(String.class); JsonReader jsonReader = Json.createReader(new StringReader(replyString)); JsonObject reply = jsonReader.readObject(); Reporter.log(reply.toString()); Assert.assertTrue(reply.getBoolean("pass"), reply.getString("msg")); }
Example #21
Source File: ClaimValueInjectionTest.java From microprofile-jwt-auth with Apache License 2.0 | 6 votes |
@RunAsClient @Test(groups = TEST_GROUP_CDI, description = "Verify that the injected jti claim using @Claim(standard) is as expected") public void verifyInjectedJTIStandard() throws Exception { Reporter.log("Begin verifyInjectedJTIStandard\n"); String uri = baseURL.toExternalForm() + "endp/verifyInjectedJTIStandard"; WebTarget echoEndpointTarget = ClientBuilder.newClient() .target(uri) .queryParam(Claims.jti.name(), "a-123") .queryParam(Claims.auth_time.name(), authTimeClaim); Response response = echoEndpointTarget.request(MediaType.APPLICATION_JSON).header(HttpHeaders.AUTHORIZATION, "Bearer " + token).get(); Assert.assertEquals(response.getStatus(), HttpURLConnection.HTTP_OK); String replyString = response.readEntity(String.class); JsonReader jsonReader = Json.createReader(new StringReader(replyString)); JsonObject reply = jsonReader.readObject(); Reporter.log(reply.toString()); Assert.assertTrue(reply.getBoolean("pass"), reply.getString("msg")); }
Example #22
Source File: JsonValueInjectionTest.java From microprofile-jwt-auth with Apache License 2.0 | 6 votes |
@RunAsClient @Test(groups = TEST_GROUP_CDI_JSON, description = "Verify that the injected customDouble claim is as expected") public void verifyInjectedCustomDouble2() throws Exception { Reporter.log("Begin verifyInjectedCustomDouble2\n"); String token2 = TokenUtils.generateTokenString("/Token2.json"); String uri = baseURL.toExternalForm() + "endp/verifyInjectedCustomDouble"; WebTarget echoEndpointTarget = ClientBuilder.newClient() .target(uri) .queryParam("value", 3.241592653589793) .queryParam(Claims.auth_time.name(), authTimeClaim); Response response = echoEndpointTarget.request(MediaType.APPLICATION_JSON).header(HttpHeaders.AUTHORIZATION, "Bearer " + token2).get(); Assert.assertEquals(response.getStatus(), HttpURLConnection.HTTP_OK); String replyString = response.readEntity(String.class); JsonReader jsonReader = Json.createReader(new StringReader(replyString)); JsonObject reply = jsonReader.readObject(); Reporter.log(reply.toString()); Assert.assertTrue(reply.getBoolean("pass"), reply.getString("msg")); }
Example #23
Source File: PrimitiveInjectionTest.java From microprofile-jwt-auth with Apache License 2.0 | 6 votes |
@RunAsClient @Test(groups = TEST_GROUP_CDI_PROVIDER, description = "Verify that the injected jti claim is as expected") public void verifyInjectedJTI() throws Exception { Reporter.log("Begin verifyInjectedJTI\n"); String uri = baseURL.toExternalForm() + "endp/verifyInjectedJTI"; WebTarget echoEndpointTarget = ClientBuilder.newClient() .target(uri) .queryParam(Claims.jti.name(), "a-123") .queryParam(Claims.auth_time.name(), authTimeClaim); Response response = echoEndpointTarget.request(MediaType.APPLICATION_JSON).header(HttpHeaders.AUTHORIZATION, "Bearer " + token).get(); Assert.assertEquals(response.getStatus(), HttpURLConnection.HTTP_OK); String replyString = response.readEntity(String.class); JsonReader jsonReader = Json.createReader(new StringReader(replyString)); JsonObject reply = jsonReader.readObject(); Reporter.log(reply.toString()); Assert.assertTrue(reply.getBoolean("pass"), reply.getString("msg")); }
Example #24
Source File: QTestTest.java From carina with Apache License 2.0 | 6 votes |
@Test @QTestCases(id = FIRST_TEST_ID, locale = "en") @QTestCases(id = SECOND_TEST_ID, locale = "fr") public void testTestRailByLocale() { ITestResult result = Reporter.getCurrentTestResult(); Set<String> testRailUdids = getQTestCasesUuid(result); Assert.assertTrue(testRailUdids.contains(FIRST_TEST_ID), "TestRail should contain id=" + FIRST_TEST_ID); Assert.assertEquals(testRailUdids.size(), 1); R.CONFIG.put(Parameter.LOCALE.getKey(), "fr"); testRailUdids = getQTestCasesUuid(result); Assert.assertTrue(testRailUdids.contains(SECOND_TEST_ID), "TestRail should contain id=" + SECOND_TEST_ID); Assert.assertEquals(testRailUdids.size(), 1); R.CONFIG.put(Parameter.LOCALE.getKey(), "en"); }
Example #25
Source File: ProviderInjectionTest.java From microprofile-jwt-auth with Apache License 2.0 | 6 votes |
@RunAsClient @Test(groups = TEST_GROUP_CDI_PROVIDER, description = "Verify that the injected customDouble claim is as expected") public void verifyInjectedCustomDouble() throws Exception { Reporter.log("Begin verifyInjectedCustomDouble\n"); String uri = baseURL.toExternalForm() + "endp/verifyInjectedCustomDouble"; WebTarget echoEndpointTarget = ClientBuilder.newClient() .target(uri) .queryParam("value", 3.141592653589793) .queryParam(Claims.auth_time.name(), authTimeClaim); Response response = echoEndpointTarget.request(MediaType.APPLICATION_JSON).header(HttpHeaders.AUTHORIZATION, "Bearer " + token).get(); Assert.assertEquals(response.getStatus(), HttpURLConnection.HTTP_OK); String replyString = response.readEntity(String.class); JsonReader jsonReader = Json.createReader(new StringReader(replyString)); JsonObject reply = jsonReader.readObject(); Reporter.log(reply.toString()); Assert.assertTrue(reply.getBoolean("pass"), reply.getString("msg")); }
Example #26
Source File: ProviderInjectionTest.java From microprofile-jwt-auth with Apache License 2.0 | 6 votes |
@RunAsClient @Test(groups = TEST_GROUP_CDI_PROVIDER, description = "Verify that the injected customInteger claim is as expected") public void verifyInjectedCustomInteger2() throws Exception { Reporter.log("Begin verifyInjectedCustomInteger\n"); String uri = baseURL.toExternalForm() + "endp/verifyInjectedCustomInteger"; WebTarget echoEndpointTarget = ClientBuilder.newClient() .target(uri) .queryParam("value", 123456789) .queryParam(Claims.auth_time.name(), authTimeClaim); Response response = echoEndpointTarget.request(MediaType.APPLICATION_JSON).header(HttpHeaders.AUTHORIZATION, "Bearer " + token).get(); Assert.assertEquals(response.getStatus(), HttpURLConnection.HTTP_OK); String replyString = response.readEntity(String.class); JsonReader jsonReader = Json.createReader(new StringReader(replyString)); JsonObject reply = jsonReader.readObject(); Reporter.log(reply.toString()); Assert.assertTrue(reply.getBoolean("pass"), reply.getString("msg")); }
Example #27
Source File: ClaimValueInjectionTest.java From microprofile-jwt-auth with Apache License 2.0 | 6 votes |
@RunAsClient @Test(groups = TEST_GROUP_CDI, description = "Verify that the injected aud claim using @Claim(standard) is as expected") public void verifyInjectedAudienceStandard() throws Exception { Reporter.log("Begin verifyInjectedAudienceStandard\n"); String uri = baseURL.toExternalForm() + "endp/verifyInjectedAudienceStandard"; WebTarget echoEndpointTarget = ClientBuilder.newClient() .target(uri) .queryParam(Claims.aud.name(), "s6BhdRkqt3") .queryParam(Claims.auth_time.name(), authTimeClaim); Response response = echoEndpointTarget.request(MediaType.APPLICATION_JSON).header(HttpHeaders.AUTHORIZATION, "Bearer " + token).get(); Assert.assertEquals(response.getStatus(), HttpURLConnection.HTTP_OK); String replyString = response.readEntity(String.class); JsonReader jsonReader = Json.createReader(new StringReader(replyString)); JsonObject reply = jsonReader.readObject(); System.out.println(reply); Reporter.log(reply.toString()); Assert.assertTrue(reply.getBoolean("pass"), reply.getString("msg")); }
Example #28
Source File: JsonValueInjectionTest.java From microprofile-jwt-auth with Apache License 2.0 | 6 votes |
@RunAsClient @Test(groups = TEST_GROUP_CDI_JSON, description = "Verify that the injected jti claim is as expected from Token2") public void verifyInjectedJTI2() throws Exception { Reporter.log("Begin verifyInjectedJTI2\n"); String token2 = TokenUtils.generateTokenString("/Token2.json"); String uri = baseURL.toExternalForm() + "endp/verifyInjectedJTI"; WebTarget echoEndpointTarget = ClientBuilder.newClient() .target(uri) .queryParam(Claims.jti.name(), "a-123.2") .queryParam(Claims.auth_time.name(), authTimeClaim); Response response = echoEndpointTarget.request(MediaType.APPLICATION_JSON).header(HttpHeaders.AUTHORIZATION, "Bearer " + token2).get(); Assert.assertEquals(response.getStatus(), HttpURLConnection.HTTP_OK); String replyString = response.readEntity(String.class); JsonReader jsonReader = Json.createReader(new StringReader(replyString)); JsonObject reply = jsonReader.readObject(); Reporter.log(reply.toString()); Assert.assertTrue(reply.getBoolean("pass"), reply.getString("msg")); }
Example #29
Source File: JsonValueInjectionTest.java From microprofile-jwt-auth with Apache License 2.0 | 6 votes |
@RunAsClient @Test(groups = TEST_GROUP_CDI_JSON, description = "Verify that the injected raw token claim is as expected") public void verifyInjectedRawToken() throws Exception { Reporter.log("Begin verifyInjectedRawToken\n"); String uri = baseURL.toExternalForm() + "endp/verifyInjectedRawToken"; WebTarget echoEndpointTarget = ClientBuilder.newClient() .target(uri) .queryParam(Claims.raw_token.name(), token) .queryParam(Claims.auth_time.name(), authTimeClaim); Response response = echoEndpointTarget.request(MediaType.APPLICATION_JSON).header(HttpHeaders.AUTHORIZATION, "Bearer " + token).get(); Assert.assertEquals(response.getStatus(), HttpURLConnection.HTTP_OK); String replyString = response.readEntity(String.class); JsonReader jsonReader = Json.createReader(new StringReader(replyString)); JsonObject reply = jsonReader.readObject(); Reporter.log(reply.toString()); Assert.assertTrue(reply.getBoolean("pass"), reply.getString("msg")); }
Example #30
Source File: ClaimValueInjectionTest.java From microprofile-jwt-auth with Apache License 2.0 | 6 votes |
@RunAsClient @Test(groups = TEST_GROUP_CDI, description = "Verify that the injected raw token claim is as expected") public void verifyInjectedRawToken() throws Exception { Reporter.log("Begin verifyInjectedRawToken\n"); String uri = baseURL.toExternalForm() + "endp/verifyInjectedRawToken"; WebTarget echoEndpointTarget = ClientBuilder.newClient() .target(uri) .queryParam(Claims.raw_token.name(), token) .queryParam(Claims.auth_time.name(), authTimeClaim); Response response = echoEndpointTarget.request(MediaType.APPLICATION_JSON).header(HttpHeaders.AUTHORIZATION, "Bearer " + token).get(); Assert.assertEquals(response.getStatus(), HttpURLConnection.HTTP_OK); String replyString = response.readEntity(String.class); JsonReader jsonReader = Json.createReader(new StringReader(replyString)); JsonObject reply = jsonReader.readObject(); Reporter.log(reply.toString()); Assert.assertTrue(reply.getBoolean("pass"), reply.getString("msg")); }