Skip to content

Commit

Permalink
Merge pull request #33 from brettchaldecott/fix/code-coverage-2
Browse files Browse the repository at this point in the history
fix: Added aggregation project and fixed pom files
  • Loading branch information
DanielRivers authored Nov 18, 2024
2 parents 0fa14ae + 36ec2c8 commit e1e5032
Show file tree
Hide file tree
Showing 7 changed files with 177 additions and 61 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ jobs:
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
files: '**/target/site/jacoco/jacoco.xml'
files: 'kinde-report-aggregate/target/site/jacoco-aggregate/jacoco.xml'
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
59 changes: 6 additions & 53 deletions kinde-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -98,60 +98,13 @@
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.2.5</version>
<configuration>
<parallel>none</parallel>
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.12</version> <!-- Replace with the latest version -->
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
<execution>
<id>post-unit-test</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/jacoco</outputDirectory>
<dataFile>${project.build.directory}/jacoco/jacoco.exec</dataFile>
<reportFormats>
<format>HTML</format>
<format>XML</format>
</reportFormats>
<append>true</append>
<skip>false</skip>
<includes>
<include>com/kinde/**</include>
</includes>
<excludes>
<exclude>com/google/inject/**/*.class</exclude>
<exclude>javax/inject/**/*.class</exclude>
<exclude>org/springframework/**/*.class</exclude>
<exclude>**/generated/**</exclude>
<exclude>**/thirdparty/**</exclude>
<!-- Add more excludes if necessary -->
</excludes>
</configuration>
</execution>
</executions>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.2.5</version>
<configuration>
<parallel>none</parallel>
</configuration>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
Expand Down
24 changes: 23 additions & 1 deletion kinde-management/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,31 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<phase>generate-sources</phase>
<configuration>
<target>
<echo>Fixing syntax error in generated OpenAPI code</echo>
<replace file="target/generated-sources/openapi/src/gen/java/main/org/openapitools/client/model/UpdateApplicationsPropertyRequestValue.java"
token="(token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE));"
value="(token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE);"/>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.10</version> <!-- Replace with the latest version -->
<version>0.8.12</version> <!-- Replace with the latest version -->
<executions>
<execution>
<goals>
Expand Down Expand Up @@ -203,6 +224,7 @@
<exclude>org/springframework/**/*.class</exclude>
<exclude>**/generated/**</exclude>
<exclude>**/thirdparty/**</exclude>
<exclude>**/openapitools/**</exclude>
<!-- Add more excludes if necessary -->
</excludes>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,12 @@
import com.kinde.KindeAdminSession;
import com.kinde.KindeClient;
import com.kinde.token.AccessToken;
import com.kinde.token.KindeToken;
import com.kinde.token.KindeTokens;
import org.openapitools.client.ApiClient;
import org.openapitools.client.auth.Authentication;
import org.openapitools.client.auth.HttpBearerAuth;
import org.openapitools.client.auth.OAuth;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class KindeAdminSessionImpl implements KindeAdminSession {
Expand All @@ -35,11 +32,8 @@ public ApiClient initClient() {
HttpBearerAuth httpBearerAuth = new HttpBearerAuth("bearer");
httpBearerAuth.setBearerToken(accessToken.token());
Map<String, Authentication> authMap = new HashMap<>();
authMap.put("ManagementAPI",new OAuth(
kindeClient.kindeConfig().domain(),kindeClient.oidcMetaData().getOpMetadata().getTokenEndpointURI().toString()));
ApiClient apiClient = new ApiClient(authMap);
apiClient.setBasePath(kindeClient.kindeConfig().domain());
apiClient.setAccessToken(accessToken.token());
return apiClient;
}
}
83 changes: 83 additions & 0 deletions kinde-report-aggregate/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2009, 2024 Mountainminds GmbH & Co. KG and Contributors
This program and the accompanying materials are made available under
the terms of the Eclipse Public License 2.0 which is available at
http://www.eclipse.org/legal/epl-2.0
SPDX-License-Identifier: EPL-2.0
Contributors:
Marc R. Hoffmann, Jan Wloka - initial API and implementation
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>com.kinde</groupId>
<artifactId>kinde-parent-pom</artifactId>
<version>2.0.0</version>
</parent>

<properties>
<kinde-version>2.0.0</kinde-version>
</properties>

<artifactId>report</artifactId>
<name>Aggregate Report</name>
<version>2.0.0</version>

<dependencies>
<dependency>
<groupId>com.kinde</groupId>
<artifactId>kinde-core</artifactId>
</dependency>
<dependency>
<groupId>com.kinde</groupId>
<artifactId>kinde-j2ee</artifactId>
</dependency>
<dependency>
<groupId>com.kinde</groupId>
<artifactId>kinde-management</artifactId>
</dependency>
<dependency>
<groupId>com.kinde.spring</groupId>
<artifactId>kinde-springboot-core</artifactId>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.11.0</version>
</dependency>

</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.12</version>
<executions>
<execution>
<id>report-aggregate</id>
<phase>verify</phase>
<goals>
<goal>report-aggregate</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
11 changes: 11 additions & 0 deletions kinde-report-aggregate/src/test/java/com/kinde/ReportTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.kinde;

import org.junit.Test;

public class ReportTest {

@Test
public void test() {
}

}
53 changes: 53 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,21 @@
<artifactId>kinde-core</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>com.kinde</groupId>
<artifactId>kinde-management</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>com.kinde</groupId>
<artifactId>kinde-j2ee</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>com.kinde.spring</groupId>
<artifactId>kinde-springboot-core</artifactId>
<version>2.0.0</version>
</dependency>
</dependencies>
</dependencyManagement>

Expand All @@ -168,6 +183,7 @@
<module>playground/kinde-springboot-starter-example</module>
<module>playground/springboot-pkce-client-example</module>
<module>playground/springboot-thymeleaf-full-example</module>
<module>kinde-report-aggregate</module>
</modules>

<distributionManagement>
Expand Down Expand Up @@ -207,6 +223,13 @@
<configuration>
<source>17</source>
<target>17</target>
<annotationProcessorPaths>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.34</version> <!-- Use the version you need -->
</path>
</annotationProcessorPaths>
</configuration>
</plugin>

Expand Down Expand Up @@ -267,7 +290,37 @@
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.12</version>
<executions>
<execution>
<id>prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
</executions>
<configuration>
<includes>
<include>com/kinde/**</include>
</includes>
<excludes>
<exclude>com/google/inject/**/*.class</exclude>
<exclude>javax/inject/**/*.class</exclude>
<exclude>org/springframework/**/*.class</exclude>
<exclude>**/generated/**</exclude>
<exclude>**/thirdparty/**</exclude>
<exclude>**/openapitools/**</exclude>
<!-- Add more excludes if necessary -->
</excludes>
</configuration>
</plugin>
</plugins>


</build>

</project>

0 comments on commit e1e5032

Please sign in to comment.