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): testng framwork changes #10734

Merged
merged 48 commits into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
b29ec63
feat(config-api): testng framework changes
pujavs Jan 6, 2025
6dc84ed
feat(config-api): testng framework
pujavs Jan 6, 2025
7b5a53a
feat(config-api): testng framework - wip
pujavs Jan 6, 2025
2c03fb9
feat(config-api): testng framework wip
pujavs Jan 7, 2025
fd0dae7
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Jan 7, 2025
a2d0509
feat(config-api): testng framework wip
pujavs Jan 7, 2025
df49df1
feat(config-api): testng framework wip
pujavs Jan 9, 2025
8baa79a
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Jan 9, 2025
512485f
feat(config-api): sync with main
pujavs Jan 9, 2025
fcd33b7
feat(config-api): testng framework
pujavs Jan 9, 2025
045ff0b
feat(config-api): testng framework
pujavs Jan 9, 2025
57680a4
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Jan 10, 2025
7fb6cac
feat(config-api) testng framework
pujavs Jan 10, 2025
74265ec
feat(config-api) testng framework
pujavs Jan 10, 2025
d26e5e6
feat(config-api) testng framework
pujavs Jan 10, 2025
1e10ba4
feat(config-api) testng framework
pujavs Jan 10, 2025
1c09b67
feat(config-api) testng framework
pujavs Jan 10, 2025
eb8dafb
feat(config-api) testng framework
pujavs Jan 10, 2025
5bbd426
feat(config-api) testng framework
pujavs Jan 10, 2025
91f42d2
feat(config-api) testng framework
pujavs Jan 10, 2025
8e474b7
feat(config-api) testng framework
pujavs Jan 10, 2025
d7aa2ce
feat(config-api) testng framework
pujavs Jan 10, 2025
b9e0b1c
feat(config-api) testng framework
pujavs Jan 10, 2025
ebd772f
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Jan 13, 2025
fc6482e
feat(config-api): testng framework
pujavs Jan 13, 2025
fcdfca1
feat(config-api): testng framework
pujavs Jan 13, 2025
06a39f1
feat(config-api): testng framwork
pujavs Jan 13, 2025
c59225d
feat(config-api): testng framwork
pujavs Jan 13, 2025
26b55b4
feat(config-api): testng framwork
pujavs Jan 13, 2025
bec2546
feat(config-api): testng framwork
pujavs Jan 13, 2025
cc49b48
feat(config-api): testng framwork
pujavs Jan 13, 2025
b22b581
feat(config-api): testng framwork
pujavs Jan 13, 2025
b89452c
feat(config-api): sync with main
pujavs Jan 15, 2025
0715d95
feat(config-api): testng framework
pujavs Jan 15, 2025
71fe795
feat(config-api): testng framework
pujavs Jan 15, 2025
0793a88
feat(config-api): testng framework
pujavs Jan 15, 2025
3589e8a
feat(config-api): testng framework
pujavs Jan 15, 2025
357b30b
feat(config-api): testng framework
pujavs Jan 15, 2025
6260d82
feat(config-api): testng framework
pujavs Jan 15, 2025
82e8aa3
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Jan 16, 2025
6d0e8e0
feat(config-api): testng framework
pujavs Jan 16, 2025
5bc07fb
feat(config-api): testng framework
pujavs Jan 16, 2025
d2da1c7
feat(config-api): testng framework
pujavs Jan 16, 2025
2bab8fe
feat(config-api): testng framework
pujavs Jan 16, 2025
ae0a071
feat(config-api): testng framework
pujavs Jan 24, 2025
0b051c8
feat(config-api): sync with main
pujavs Jan 24, 2025
61a3364
feat(config-api): testng framwork
pujavs Jan 24, 2025
1d11509
Merge branch 'main' into jans-config-api-9125-latest
yuriyz Jan 24, 2025
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
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
24 changes: 13 additions & 11 deletions jans-config-api/docs/jans-config-api-swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9335,22 +9335,22 @@ components:
$ref: '#/components/schemas/AttributeValidation'
tooltip:
type: string
selected:
whitePagesCanView:
type: boolean
userCanAccess:
type: boolean
adminCanAccess:
type: boolean
whitePagesCanView:
type: boolean
adminCanView:
type: boolean
userCanEdit:
type: boolean
adminCanEdit:
type: boolean
userCanEdit:
type: boolean
userCanView:
type: boolean
selected:
type: boolean
baseDn:
type: string
PatchRequest:
Expand Down Expand Up @@ -10351,8 +10351,10 @@ components:
type: string
finishedFlowPage:
type: string
bridgeScriptPage:
type: string
startEndUrlMapping:
type: object
additionalProperties:
type: string
serializeRules:
type: object
additionalProperties:
Expand Down Expand Up @@ -10988,10 +10990,10 @@ components:
type: array
items:
type: object
value:
type: object
displayValue:
type: string
value:
type: object
LocalizedString:
type: object
properties:
Expand Down Expand Up @@ -11331,14 +11333,14 @@ components:
type: boolean
internal:
type: boolean
locationPath:
type: string
locationType:
type: string
enum:
- ldap
- db
- file
locationPath:
type: string
baseDn:
type: string
ScriptError:
Expand Down
74 changes: 19 additions & 55 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 @@ -118,29 +98,13 @@
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
</systemPropertyVariables>
<excludedGroups>integration</excludedGroups>
<systemProperties>
<karate.options>--tags ~@ignore</karate.options>
</systemProperties>
</configuration>
<executions>
<execution>
<id>integration-tests</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<failIfNoTests>false</failIfNoTests>
<excludedGroups>!integration</excludedGroups>
<groups>integration</groups>
</configuration>
</execution>
</executions>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>target/test-classes/testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ public class AuditLoggerResource {

@Inject
Logger log;

@POST
@Path(AUDIT)
@ProtectedApi(scopes = {AUDIT_LOGGING_WRITE_SCOPE})
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/*
* 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.configapi.core.test.BaseTest;

import java.io.UnsupportedEncodingException;
import java.util.Map;
import java.util.HashMap;
import jakarta.ws.rs.core.Response;

import org.apache.http.entity.ContentType;
import org.testng.SkipException;
import org.testng.annotations.BeforeMethod;

public class AdminUIBaseTest extends BaseTest {

// Execute before each test is run
@BeforeMethod
protected void before() {
boolean isAvailable = isEndpointAvailable(propertiesMap.get("auditLoggingURL"), accessToken);
log.error("\n\n\n *********************** ADMIN-UI Plugin isAvailable:{} {}", isAvailable, "\n\n\n");
// check condition, note once you condition is met the rest of the tests will be

// skipped as well
if (!isAvailable) {
throw new SkipException("ADMIN-UI Plugin Not deployed");
} else {
log.info("\n\n\n *** ADMIN-UI Plugin is Deployed {}", "\n\n");
}
}

public void authorize() {
log.info("AdminUI - getAccessToken - propertiesMap:{}", propertiesMap);

String authzurl = 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");
String responseType = propertiesMap.get("test.response.type");
String redirectUri = propertiesMap.get("test.redirect.uri");
log.info(
"\n\n\n\n ************ AdminUI- authzurl:{}, strGrantType:{}, clientId:{}, clientSecret:{}, scopes:{}, responseType:{}, propertiesMap.get(auditLoggingURL)",
authzurl, strGrantType, clientId, clientSecret, scopes, responseType,
propertiesMap.get("auditLoggingURL"));
Map<String, String> params = new HashMap<>();
params.put("client_id", clientId);
params.put("scope", scopes);
params.put("grant_type", strGrantType);
params.put("response_type", responseType);
params.put("redirect_uri", redirectUri);
Response response = authorize(authzurl, clientId, clientSecret, null, getAuthCode(clientId, clientSecret),
params, null);
log.info("\n\n\n\n AdminUI- response:{} :{}", response, "**********");
}

private String getAuthCode(final String clientId, final String clientSecret) {
String code = null;
try {
code = getCredentials(clientId, clientSecret);
} catch (UnsupportedEncodingException ex) {
log.error("Error while encoding credentials is ", ex);
}
return code;
}

private Response authorize(final String authzurl, final Map<String, String> parameters,
ContentType contentType) {
return executePost(authzurl, clientId, clientSecret, authType, authCode, parameters, contentType);
}

}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* 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 static org.testng.Assert.assertTrue;

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("\n\n 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.getStatus():{}", response,
response.getStatus());

}

}
Loading
Loading