-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test InJarResolver with pom retrieved locally or from external maven …
…repository
- Loading branch information
Alberto Fanjul
committed
Jul 22, 2024
1 parent
ca55d00
commit 0b1dcb8
Showing
3 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
...maven-integration/src/test/java/org/appformer/maven/integration/ArtifactResolverTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package org.appformer.maven.integration; | ||
|
||
import junit.framework.TestCase; | ||
import org.appformer.maven.support.AFReleaseId; | ||
import org.appformer.maven.support.AFReleaseIdImpl; | ||
import org.junit.Assert; | ||
|
||
import java.net.URL; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.function.Predicate; | ||
|
||
public class ArtifactResolverTest extends TestCase { | ||
|
||
public void testInJarResolverSnapshotLocal() { | ||
|
||
ClassLoader classLoader = getClass().getClassLoader(); | ||
AFReleaseId releaseId = new AFReleaseIdImpl("org.jbpm", "kjar", "1.0.0-SNAPSHOT", "jar"); | ||
|
||
InJarArtifactResolver inJarArtifactResolver = new InJarArtifactResolver(classLoader, releaseId) { | ||
@Override | ||
protected List<URL> buildResources(Predicate<String> predicate) { | ||
ArrayList<URL> urlArrayList = new ArrayList<URL>(); | ||
|
||
if (predicate.test("BOOT-INF/classes/KIE-INF/lib/kjar.pom")) { | ||
urlArrayList.add(getClassLoader().getResource("BOOT-INF/classes/KIE-INF/lib/kjar-1.0.0-SNAPSHOT.pom")); | ||
return urlArrayList; | ||
} | ||
return super.buildResources(predicate); | ||
} | ||
}; | ||
|
||
Assert.assertTrue(inJarArtifactResolver.isLoaded()); | ||
} | ||
|
||
public void testInJarResolverSnapshotExternal() { | ||
|
||
ClassLoader classLoader = getClass().getClassLoader(); | ||
AFReleaseId releaseId = new AFReleaseIdImpl("org.jbpm", "kjar", "1.0.0-SNAPSHOT", "jar"); | ||
|
||
InJarArtifactResolver inJarArtifactResolver = new InJarArtifactResolver(classLoader, releaseId) { | ||
@Override | ||
protected List<URL> buildResources(Predicate<String> predicate) { | ||
ArrayList<URL> urlArrayList = new ArrayList<URL>(); | ||
|
||
if (predicate.test("BOOT-INF/classes/KIE-INF/lib/kjar.pom")) { | ||
urlArrayList.add(getClassLoader().getResource("BOOT-INF/classes/KIE-INF/lib/kjar-1.0.0-20240717-143315-1.pom")); | ||
return urlArrayList; | ||
} | ||
return super.buildResources(predicate); | ||
} | ||
}; | ||
Assert.assertTrue(inJarArtifactResolver.isLoaded()); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
...egration/src/test/resources/BOOT-INF/classes/KIE-INF/lib/kjar-1.0.0-20240717-143315-1.pom
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<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/maven-v4_0_0.xsd"> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>org.jbpm</groupId> | ||
<artifactId>kjar</artifactId> | ||
<version>1.0.0-SNAPSHOT</version> | ||
<packaging>jar</packaging> | ||
|
||
</project> | ||
|
11 changes: 11 additions & 0 deletions
11
...maven-integration/src/test/resources/BOOT-INF/classes/KIE-INF/lib/kjar-1.0.0-SNAPSHOT.pom
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<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/maven-v4_0_0.xsd"> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>org.jbpm</groupId> | ||
<artifactId>kjar</artifactId> | ||
<version>1.0.0-SNAPSHOT</version> | ||
<packaging>jar</packaging> | ||
|
||
</project> | ||
|