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 68 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
01ca3b5
feat(config-api): testng framework
pujavs Nov 11, 2024
cbe5696
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Nov 11, 2024
7b9d278
feat(config-api): testng framework wip
pujavs Nov 11, 2024
e9f7938
feat(config-api): testng framework wip
pujavs Nov 11, 2024
27b14f6
feat(config-api): testng framework wip
pujavs Nov 11, 2024
e5f65eb
feat(config-api): testng framework wip
pujavs Nov 11, 2024
dc815fe
feat(config-api): testng framework wip
pujavs Nov 11, 2024
9c9ec70
feat(config-api): testng framework wip
pujavs Nov 12, 2024
872ab37
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Nov 12, 2024
f7ac91b
feat(config-api): testng framework wip
pujavs Nov 12, 2024
6902936
feat(config-api): testng framework wip
pujavs Nov 13, 2024
c05d323
feat(config-api): testng framework
pujavs Nov 14, 2024
de95b62
feat(config-api): testng framework
pujavs Nov 14, 2024
db7d4eb
feat(config-api): testng framework
pujavs Nov 14, 2024
e73b5a0
feat(config-api): testng framework
pujavs Nov 14, 2024
3a75cd1
feat(config-api): testng framework
pujavs Nov 14, 2024
71826b6
feat(config-api): testng framework - wip
pujavs Nov 15, 2024
8321a24
feat(config-api): testng framework - wip
pujavs Nov 15, 2024
c9c5e8c
feat(config-api): syn with main
pujavs Nov 19, 2024
e643f0f
feat(config-api): testing framework change wip
pujavs Nov 19, 2024
9fe748f
feat(config-api): testing framework change wip
pujavs Nov 19, 2024
7d84126
feat(config-api): testmg framework change wip
pujavs Nov 21, 2024
74b78d6
feat(config-api): testmg framework change wip
pujavs Nov 21, 2024
27ea40f
feat(config-api): testmg framework change wip
pujavs Nov 21, 2024
0159fc0
feat(config-api): sync with main
pujavs Nov 22, 2024
860167d
t status
pujavs Nov 22, 2024
c328435
feat(config-api): testng framework wip
pujavs Nov 25, 2024
dc85deb
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Nov 25, 2024
804ee59
feat(config-api): testng framework wip
pujavs Nov 25, 2024
4f842a2
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Nov 26, 2024
1477ea6
feat(config-api): testng framework
pujavs Nov 27, 2024
c89fc37
feat(config-api): testng framework wip
pujavs Nov 27, 2024
006ce4c
feat(config-api): testng framework wip
pujavs Nov 27, 2024
26b7eee
feat(config-api): testng framework wip
pujavs Nov 28, 2024
e9b6466
feat(config-api): testng framework wip
pujavs Nov 29, 2024
f6029f4
feat(config-api): testng framework wip
pujavs Dec 4, 2024
8f6c5af
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Dec 4, 2024
55c3706
feat(config-api): testng framework changes - wip
pujavs Dec 4, 2024
06396ef
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Dec 5, 2024
f35d31b
feat(config-api): testng framework chnages wip
pujavs Dec 5, 2024
e395464
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Dec 9, 2024
dc1c099
feat(config-api): testng framework wip
pujavs Dec 10, 2024
7ba1124
feat(config-api): testng framework wip
pujavs Dec 10, 2024
66715cc
feat(config-api): testng framework wip
pujavs Dec 10, 2024
8449ff1
feat(config-api): testng framework wip
pujavs Dec 10, 2024
2dd847b
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Dec 10, 2024
96d93a4
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Dec 11, 2024
ad897e6
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Dec 11, 2024
f6140e2
feat(config-api): sync with main
pujavs Dec 12, 2024
7cb59c5
feat(config-api): testng framework
pujavs Dec 12, 2024
ec4e590
feat(config-api): testng framework
pujavs Dec 13, 2024
d6fb6ec
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Dec 13, 2024
8b0e947
feat(config-api): testNG framework changes
pujavs Dec 13, 2024
56641cc
feat(config-api): testNG framework changes
pujavs Dec 13, 2024
b6bf0d6
feat(config-api): testNG framework changes
pujavs Dec 13, 2024
5ee080f
feat(jans-config-api): update surefire plugin
yurem Dec 13, 2024
55a7896
feat(jans-config-api): update surefire plugin
yurem Dec 13, 2024
68cf3fc
feat(jans-config-api): remote test data
yurem Dec 13, 2024
fb751e9
Merge branch 'jans-config-api-testng-9125_new' of https://github.com/…
yurem Dec 13, 2024
da53b9c
feat(jans-config-api): udpate exclude
yurem Dec 13, 2024
9f44060
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Dec 16, 2024
dabd4f1
Merge branch 'jans-config-api-testng-9125_new' of https://github.com/…
pujavs Dec 16, 2024
d19739a
Merge branch 'main' into jans-config-api-testng-9125_new
yuriyz Dec 17, 2024
71436b4
feat(config-api): sync with main
pujavs Dec 17, 2024
b063d39
Merge branch 'jans-config-api-testng-9125_new' of https://github.com/…
pujavs Dec 17, 2024
2b4a01d
feat(config-api): testng framework wip
pujavs Dec 18, 2024
ac7b940
Merge branch 'main' into jans-config-api-testng-9125_new
moabu Dec 31, 2024
14c4678
Merge branch 'main' into jans-config-api-testng-9125_new
yuriyz Dec 31, 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