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 fa989e5 commit fb1f235
Show file tree
Hide file tree
Showing 12 changed files with 122 additions and 5 deletions.
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 fb1f235

Please sign in to comment.