Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(config-api): replacing testing framework to TestNG #10417

Open
wants to merge 66 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
f6ce24e
feat(config-api): testng framework
pujavs Nov 11, 2024
dead71c
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Nov 11, 2024
34307e6
feat(config-api): testng framework wip
pujavs Nov 11, 2024
7e30b03
feat(config-api): testng framework wip
pujavs Nov 11, 2024
ce816df
feat(config-api): testng framework wip
pujavs Nov 11, 2024
49e1911
feat(config-api): testng framework wip
pujavs Nov 11, 2024
14b5e55
feat(config-api): testng framework wip
pujavs Nov 11, 2024
8de4972
feat(config-api): testng framework wip
pujavs Nov 12, 2024
85fdb12
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Nov 12, 2024
86ffdee
feat(config-api): testng framework wip
pujavs Nov 12, 2024
d19b381
feat(config-api): testng framework wip
pujavs Nov 13, 2024
972d7c6
feat(config-api): testng framework
pujavs Nov 14, 2024
a52cb1d
feat(config-api): testng framework
pujavs Nov 14, 2024
1cdb436
feat(config-api): testng framework
pujavs Nov 14, 2024
789106c
feat(config-api): testng framework
pujavs Nov 14, 2024
ff9c60b
feat(config-api): testng framework
pujavs Nov 14, 2024
510937f
feat(config-api): testng framework - wip
pujavs Nov 15, 2024
c336ee9
feat(config-api): testng framework - wip
pujavs Nov 15, 2024
5caa2e9
feat(config-api): syn with main
pujavs Nov 19, 2024
7403d1c
feat(config-api): testing framework change wip
pujavs Nov 19, 2024
940b1f3
feat(config-api): testing framework change wip
pujavs Nov 19, 2024
4ced6c7
feat(config-api): testmg framework change wip
pujavs Nov 21, 2024
b47a52f
feat(config-api): testmg framework change wip
pujavs Nov 21, 2024
2609fbb
feat(config-api): testmg framework change wip
pujavs Nov 21, 2024
16a41ae
feat(config-api): sync with main
pujavs Nov 22, 2024
3fa56f2
t status
pujavs Nov 22, 2024
3fed3dc
feat(config-api): testng framework wip
pujavs Nov 25, 2024
ed3dc49
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Nov 25, 2024
9cf7758
feat(config-api): testng framework wip
pujavs Nov 25, 2024
d21c77b
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Nov 26, 2024
d6ffe74
feat(config-api): testng framework
pujavs Nov 27, 2024
c28a7b5
feat(config-api): testng framework wip
pujavs Nov 27, 2024
3f79627
feat(config-api): testng framework wip
pujavs Nov 27, 2024
e939dbf
feat(config-api): testng framework wip
pujavs Nov 28, 2024
9bf52f9
feat(config-api): testng framework wip
pujavs Nov 29, 2024
ba04601
feat(config-api): testng framework wip
pujavs Dec 4, 2024
f9ecb2c
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Dec 4, 2024
6173c04
feat(config-api): testng framework changes - wip
pujavs Dec 4, 2024
070ba78
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Dec 5, 2024
0986805
feat(config-api): testng framework chnages wip
pujavs Dec 5, 2024
7d26f5f
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Dec 9, 2024
fb01438
feat(config-api): testng framework wip
pujavs Dec 10, 2024
53c8f07
feat(config-api): testng framework wip
pujavs Dec 10, 2024
7e9b97f
feat(config-api): testng framework wip
pujavs Dec 10, 2024
51a27c8
feat(config-api): testng framework wip
pujavs Dec 10, 2024
ae9284f
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Dec 10, 2024
8a4de10
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Dec 11, 2024
21f7c32
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Dec 11, 2024
8e8a812
feat(config-api): sync with main
pujavs Dec 12, 2024
419757a
feat(config-api): testng framework
pujavs Dec 12, 2024
0e007c4
feat(config-api): testng framework
pujavs Dec 13, 2024
3e43e80
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Dec 13, 2024
0fd91f0
feat(config-api): testNG framework changes
pujavs Dec 13, 2024
71a628f
feat(config-api): testNG framework changes
pujavs Dec 13, 2024
9195125
feat(config-api): testNG framework changes
pujavs Dec 13, 2024
4a2913c
feat(jans-config-api): update surefire plugin
yurem Dec 13, 2024
39955b1
feat(jans-config-api): update surefire plugin
yurem Dec 13, 2024
e24e5bd
feat(jans-config-api): remote test data
yurem Dec 13, 2024
301c626
Merge branch 'jans-config-api-testng-9125_new' of https://github.com/…
yurem Dec 13, 2024
03209f5
feat(jans-config-api): udpate exclude
yurem Dec 13, 2024
14556f9
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Dec 16, 2024
9578236
Merge branch 'jans-config-api-testng-9125_new' of https://github.com/…
pujavs Dec 16, 2024
1371c3e
Merge branch 'main' into jans-config-api-testng-9125_new
yuriyz Dec 17, 2024
1c08165
feat(config-api): sync with main
pujavs Dec 17, 2024
7d95b3a
Merge branch 'jans-config-api-testng-9125_new' of https://github.com/…
pujavs Dec 17, 2024
fb44b2b
feat(config-api): testng framework wip
pujavs Dec 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions jans-config-api/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@ pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
release.properties
test-output/
6 changes: 0 additions & 6 deletions jans-config-api/common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,6 @@
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>true</skipTests>
<systemProperties>
<karate.options>--tags ~@ignore</karate.options>
</systemProperties>
</configuration>
</plugin>
</plugins>
</build>
Expand Down
59 changes: 18 additions & 41 deletions jans-config-api/plugins/admin-ui-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,42 +31,18 @@
<artifactId>commons-collections</artifactId>
<version>3.2.2</version>
</dependency>

<!-- Testing -->
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.intuit.karate</groupId>
<artifactId>karate-junit5</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.intuit.karate</groupId>
<artifactId>karate-apache</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.masterthought</groupId>
<artifactId>cucumber-reporting</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
<!-- API, java.xml.bind module -->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
Expand All @@ -90,15 +66,19 @@

<build>
<finalName>admin-ui-plugin</finalName>

<filters>
<filter>../../profiles/${cfg}/config-build.properties</filter>
<filter>../../profiles/${cfg}/config-api-test.properties</filter>
</filters>

<testResources>
<testResource>
<directory>src/test/resources</directory>
<filtering>true</filtering>
<includes>
<include>*.*</include>
</includes>
</testResource>
</testResources>

<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand All @@ -119,14 +99,11 @@
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
</systemPropertyVariables>
<excludedGroups>integration</excludedGroups>
<systemProperties>
<karate.options>--tags ~@ignore</karate.options>
</systemProperties>
</configuration>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>target/test-classes/testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
<executions>
<execution>
<id>integration-tests</id>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text.
*
* Copyright (c) 2020, Janssen Project
*/

package io.jans.ca.plugin.adminui;

import io.jans.as.model.common.GrantType;
import io.jans.configapi.core.test.BaseTest;

import org.testng.annotations.BeforeMethod;

public class AdminUIBaseTest extends BaseTest{

//AdminUI specific code

@BeforeMethod
@Override
public void getAccessToken() throws Exception {
log.info("AdminUI - getAccessToken - propertiesMap:{}", propertiesMap);

String tokenUrl = propertiesMap.get("test.authzurl");
String strGrantType = propertiesMap.get("test.grant.type");
String clientId = propertiesMap.get("test.client.id");
String clientSecret = propertiesMap.get("test.client.secret");
String scopes = propertiesMap.get("test.scopes");

GrantType grantType = GrantType.fromString(strGrantType);
this.accessToken = getToken(tokenUrl, clientId, clientSecret, grantType, scopes);
log.info("\n\n\n\n AdminUI- accessToken:{}", accessToken);
}


}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text.
*
* Copyright (c) 2020, Janssen Project
*/

package io.jans.ca.plugin.adminui.test;


import io.jans.ca.plugin.adminui.AdminUIBaseTest;

import jakarta.ws.rs.client.Entity;
import jakarta.ws.rs.client.Invocation.Builder;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;

import jakarta.ws.rs.core.Response.Status;

import static org.testng.Assert.assertEquals;
import org.testng.annotations.Parameters;
import org.testng.annotations.Test;

public class AuditLoggingResourceTest extends AdminUIBaseTest{


/**
* Testing Audit Logging endpoint
*/
@Parameters({"test.issuer", "auditLoggingURL", "audit_post_1"})
@Test
public void postAuditLoggingData(final String issuer, final String auditLoggingURL, final String json) {
log.info("postAuditLoggingData() - accessToken:{}, issuer:{}, auditLoggingURL:{}, json:{}", accessToken, issuer, auditLoggingURL, json);
Builder request = getResteasyService().getClientBuilder(issuer+auditLoggingURL);
request.header(AUTHORIZATION, AUTHORIZATION_TYPE + " " + accessToken);
request.header(CONTENT_TYPE, MediaType.APPLICATION_JSON);

Response response = request.post(Entity.entity(json, MediaType.APPLICATION_JSON));
assertEquals(response.getStatus(), Status.OK.getStatusCode());
log.info("\n\n Response for postAuditLoggingData - response:{}", response);
}



}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text.
*
* Copyright (c) 2020, Janssen Project
*/

package io.jans.ca.plugin.adminui.test;


import io.jans.ca.plugin.adminui.AdminUIBaseTest;

import jakarta.ws.rs.client.Invocation.Builder;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;

import jakarta.ws.rs.core.Response.Status;

import static org.testng.Assert.assertEquals;
import org.testng.annotations.Parameters;
import org.testng.annotations.Test;

public class LicenseResourceTest extends AdminUIBaseTest {

/**
* Test License Details
*/
@Parameters({ "test.issuer", "checkActiveLicenseURL" })
@Test
public void getLicenseDetails(final String issuer, final String checkActiveLicenseURL) {
log.info("getLicenseDetails() - accessToken:{}, issuer:{}, checkActiveLicenseURL:{}", accessToken, issuer,
checkActiveLicenseURL);
Builder request = getResteasyService().getClientBuilder(issuer + checkActiveLicenseURL);
request.header(AUTHORIZATION, AUTHORIZATION_TYPE + " " + accessToken);
request.header(CONTENT_TYPE, MediaType.APPLICATION_JSON);

Response response = request.get();
assertEquals(response.getStatus(), Status.OK.getStatusCode());
log.info("\n\n Response for getLicenseDetails - response:{}", response);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text.
*
* Copyright (c) 2020, Janssen Project
*/

package io.jans.ca.plugin.adminui.test;



import io.jans.ca.plugin.adminui.AdminUIBaseTest;

import jakarta.ws.rs.client.Invocation.Builder;
import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.core.MediaType;

import org.testng.annotations.Parameters;
import org.testng.annotations.Test;

public class OAuth2ResourceTest extends AdminUIBaseTest{


/**
* Testing oauth2 GET configuration endpoint
*/
@Parameters({"test.issuer", "adminUIConfigURL"})
@Test
public void getOAuth2Data(final String issuer, final String adminUIConfigURL) {
log.info("getOAuth2Data() - accessToken:{}, issuer:{}, adminUIConfigURL:{}", accessToken, issuer, adminUIConfigURL);
Builder request = getResteasyService().getClientBuilder(issuer+adminUIConfigURL);
request.header(AUTHORIZATION, AUTHORIZATION_TYPE + " " + accessToken);
request.header(CONTENT_TYPE, MediaType.APPLICATION_JSON);

Response response = request.get();
log.info("Response for getOAuth2Data() - response:{}", response);
}


/**
* Testing api-protection-token GET endpoint
*/
@Parameters({"test.issuer", "apiProtectionTokenURL", "ujwt"})
@Test
public void getApiProtectionTokenData(final String issuer, final String apiProtectionTokenURL, final String ujwt) {
log.info("\n\n getApiProtectionTokenData() - accessToken:{}, issuer:{}, apiProtectionTokenURL:{}, ujwt:{}", accessToken, issuer, apiProtectionTokenURL, ujwt);
Builder request = getResteasyService().getClientBuilder(issuer+apiProtectionTokenURL);
request.header(AUTHORIZATION, AUTHORIZATION_TYPE + " " + accessToken);
request.header(CONTENT_TYPE, MediaType.APPLICATION_FORM_URLENCODED);
request.property("ujwt", ujwt);
Response response = request.get();
log.info("\n\n Response for getApiProtectionTokenData() - response:{}", response);
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# new feature
# Tags: optional

Feature: Test License endpoints of admin-ui

Scenario Outline: Testing 'auditLogging' POST endpoint
Given url <expression>
And header <name> = <values>
And request <body>
When method <method>
Then status <status>
And print <exps>
Examples:
| expression | name | values | body | method | status | exps |
| getAuditLoggingURL | Accept | 'application/json' | {\"message\": {\"childMsg\": \"Testing audit logging.\"}} | POST | 200 | response |
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# new feature
# Tags: optional

Feature: Test Audit logging endpoints of admin-ui

Scenario: Testing 'checkLicense' GET endpoint
Given url checkLicenseURL
When method GET
Then status 200
And print response
Loading