Skip to content

Commit

Permalink
[incubator-kie-drools-6158] Remove remaining binaries from test resou…
Browse files Browse the repository at this point in the history
…rces on main

- Create TestJar.jar on the fly
  • Loading branch information
tkobayas committed Nov 25, 2024
1 parent f990ec1 commit eec4be7
Show file tree
Hide file tree
Showing 13 changed files with 128 additions and 5 deletions.
6 changes: 6 additions & 0 deletions .rat-excludes
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,22 @@ CompositeKnowledgeBuilderImpl_build.sdt
PMMLAssemblerService_addResourceAfterRules_withoutConfigurations.sdt
# efesto/documentation/sdt/PMMLAssemblerService_addResourcesAfterRules_withConfigurations.sdt
PMMLAssemblerService_addResourcesAfterRules_withConfigurations.sdt
# efesto/efesto-core/efesto-common-api/src/test/custom-resources/IndexFile.testb_json
IndexFile.testb_json
# efesto/efesto-core/efesto-common-api/src/test/resources/IndexFile.test_json
IndexFile.test_json
# efesto/efesto-core/efesto-common-api/src/test/resources/TestingEmptyFile.txt
TestingEmptyFile.txt
# efesto/efesto-core/efesto-common-core/src/test/custom-resources/IndexFile.testb_json
IndexFile.testb_json
# efesto/efesto-core/efesto-common-core/src/test/resources/IndexFile.test_json
IndexFile.test_json
# efesto/efesto-core/efesto-common-core/src/test/resources/TestingEmptyFile.txt
TestingEmptyFile.txt
# efesto/efesto-core/efesto-compilation-manager/efesto-compilation-manager-core/src/test/resources/IndexFile.test_json
IndexFile.test_json
# efesto/efesto-core/efesto-runtime-manager/efesto-runtime-manager-core/src/test/custom-resources/IndexFile.testb_json
IndexFile.testb_json
# efesto/efesto-core/efesto-runtime-manager/efesto-runtime-manager-core/src/test/resources/IndexFile.test_json
IndexFile.test_json
# kie-archetypes/kie-drools-dmn-archetype/src/test/resources/projects/integrationtestDefaults/goal.txt
Expand Down
23 changes: 23 additions & 0 deletions efesto/efesto-core/efesto-common-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,28 @@
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>process-test-resources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<jar destfile="${project.build.testOutputDirectory}/TestJar.jar">
<fileset dir="${project.basedir}/src/test/custom-resources"/>
</jar>
</target>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[
{
"step-type": "executable",
"modelLocalUriId": {
"model": "foo",
"basePath": "/this/is/fri",
"fullPath": "/foo/this/is/fri"
},
"fullClassNames": ["full.class.Name"]
},
{
"step-type": "class",
"fullClassName": "full.class.Name"
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ private static URL getResourceUrl() {

private static URL getJarUrl() throws MalformedURLException {
URL retrieved = Thread.currentThread().getContextClassLoader().getResource("TestJar.jar");
assertThat(retrieved).isNotNull();
assertThat(retrieved).as("Run `mvn test` to build TestJar.jar").isNotNull();
String newString = "jar:" + retrieved + "!/IndexFile.testb_json";
return new URL(newString);
}
Expand Down
Binary file not shown.
24 changes: 23 additions & 1 deletion efesto/efesto-core/efesto-common-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,27 @@
</dependency>
</dependencies>


<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>process-test-resources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<jar destfile="${project.build.testOutputDirectory}/TestJar.jar">
<fileset dir="${project.basedir}/src/test/custom-resources"/>
</jar>
</target>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[
{
"step-type": "executable",
"modelLocalUriId": {
"model": "foo",
"basePath": "/this/is/fri",
"fullPath": "/foo/this/is/fri"
},
"fullClassNames": ["full.class.Name"]
},
{
"step-type": "class",
"fullClassName": "full.class.Name"
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ void getModelLocalUriIdObject() throws JsonProcessingException {
private ClassLoader addJarToClassLoader() {
ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
URL jarUrl = Thread.currentThread().getContextClassLoader().getResource("TestJar.jar");
assertThat(jarUrl).isNotNull();
assertThat(jarUrl).as("Run `mvn test` to build TestJar.jar").isNotNull();
URL fileUrl = Thread.currentThread().getContextClassLoader().getResource("IndexFile.testb_json");
assertThat(fileUrl).isNull();
URL[] urls = {jarUrl};
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,27 @@
</dependency>
</dependencies>


<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>process-test-resources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<jar destfile="${project.build.testOutputDirectory}/TestJar.jar">
<fileset dir="${project.basedir}/src/test/custom-resources"/>
</jar>
</target>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[
{
"step-type": "executable",
"modelLocalUriId": {
"model": "testb",
"basePath": "/testmod",
"fullPath": "/testb/testmod"
},
"fullClassNames": [""]
},
{
"step-type": "redirect",
"modelLocalUriId": {
"model": "testb",
"basePath": "/redirecttestmod",
"fullPath": "/testb/redirecttestmod"
},
"target": "other"
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ void getGeneratedRedirectResourceFromJar() {
private ClassLoader addJarToClassLoader() {
ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
URL jarUrl = Thread.currentThread().getContextClassLoader().getResource("TestJar.jar");
assertThat(jarUrl).isNotNull();
assertThat(jarUrl).as("Run `mvn test` to build TestJar.jar").isNotNull();
URL fileUrl = Thread.currentThread().getContextClassLoader().getResource("IndexFile.testb_json");
assertThat(fileUrl).isNull();
URL[] urls = {jarUrl};
Expand Down
Binary file not shown.

0 comments on commit eec4be7

Please sign in to comment.