-
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.
RHPAM-4970 locate pom with snapshot versioning on Springboot (#277)
* prepare classes for testing * locate pom with snapshot --------- Co-authored-by: Alberto Fanjul <[email protected]>
- Loading branch information
Showing
6 changed files
with
102 additions
and
7 deletions.
There are no files selected for viewing
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
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
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
64 changes: 64 additions & 0 deletions
64
...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,64 @@ | ||
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 org.mockito.Mockito; | ||
|
||
import java.net.URL; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.Optional; | ||
import java.util.function.Predicate; | ||
|
||
import static org.mockito.ArgumentMatchers.any; | ||
import static org.mockito.Mockito.*; | ||
|
||
public class ArtifactResolverTest extends TestCase { | ||
|
||
class MyInJarArtifactResolver extends InJarArtifactResolver { | ||
|
||
MyInJarArtifactResolver(ClassLoader classLoader, AFReleaseId releaseId) { | ||
super(classLoader, releaseId); | ||
} | ||
|
||
@Override | ||
protected Optional<URL> tryInStructuredJar(AFReleaseId releaseId) { | ||
return super.tryInStructuredJar(releaseId); | ||
} | ||
} | ||
|
||
public void testInJarResolverSnapshotLocal() { | ||
ClassLoader classLoader = getClass().getClassLoader(); | ||
AFReleaseId releaseId = new AFReleaseIdImpl("org.jbpm", "kjar", "1.0.0-SNAPSHOT", "jar"); | ||
|
||
|
||
ArrayList<URL> urlArrayList = new ArrayList<URL>(); | ||
urlArrayList.add(classLoader.getResource("BOOT-INF/classes/KIE-INF/lib/kjar-1.0.0-SNAPSHOT.pom")); | ||
|
||
InJarArtifactResolver inJarArtifactResolver = new InJarArtifactResolver(classLoader, releaseId); | ||
InJarArtifactResolver spy = Mockito.spy(inJarArtifactResolver); | ||
doReturn(urlArrayList).when(spy).buildResources(any()); | ||
|
||
spy.init(); | ||
|
||
verify(spy).getURL(endsWith("BOOT-INF/classes/KIE-INF/lib/kjar-1.0.0-SNAPSHOT.pom")); | ||
} | ||
|
||
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 ); | ||
InJarArtifactResolver spy = Mockito.spy(inJarArtifactResolver); | ||
|
||
ArrayList<URL> urlArrayList = new ArrayList<URL>(); | ||
urlArrayList.add(classLoader.getResource("BOOT-INF/classes/KIE-INF/lib/kjar-1.0.0-20240717-143315-1.pom")); | ||
doReturn(urlArrayList).when(spy).buildResources(any()); | ||
|
||
spy.init(); | ||
|
||
verify(spy).getURL(endsWith("BOOT-INF/classes/KIE-INF/lib/kjar-1.0.0-20240717-143315-1.pom")); | ||
} | ||
} |
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> | ||
|