-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #396 from TomasHofman/wildfly-channels-property-9.x
JBEAP-27022 Allow setting manifest coordinates via system property
- Loading branch information
Showing
3 changed files
with
136 additions
and
3 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
75 changes: 75 additions & 0 deletions
75
...c/test/java/org/wildfly/plugins/bootablejar/maven/goals/ChannelConfigurationTestCase.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,75 @@ | ||
package org.wildfly.plugins.bootablejar.maven.goals; | ||
|
||
import org.junit.Assert; | ||
import org.junit.Test; | ||
import org.wildfly.channel.Channel; | ||
|
||
import java.util.Collections; | ||
|
||
public class ChannelConfigurationTestCase { | ||
|
||
@Test | ||
public void testFileUrlFromString() throws Exception { | ||
{ | ||
// Make sure that the notation "file:relative/path" is handled like a file URL, rather than a Maven G:A. | ||
|
||
String url = "file:path/to/manifest.yaml"; | ||
ChannelConfiguration configuration = new ChannelConfiguration(); | ||
configuration.set(url); | ||
Channel channel = configuration.toChannel(Collections.emptyList()); | ||
|
||
Assert.assertNotNull(channel.getManifestCoordinate().getUrl()); | ||
Assert.assertEquals(url, channel.getManifestCoordinate().getUrl().toExternalForm()); | ||
} | ||
|
||
{ | ||
// The notation "file://relative/path" should still be handled like a file URL too. | ||
|
||
String url = "file://path/to/manifest.yaml"; | ||
ChannelConfiguration configuration = new ChannelConfiguration(); | ||
configuration.set(url); | ||
Channel channel = configuration.toChannel(Collections.emptyList()); | ||
|
||
Assert.assertNotNull(channel.getManifestCoordinate().getUrl()); | ||
Assert.assertEquals(url, channel.getManifestCoordinate().getUrl().toExternalForm()); | ||
} | ||
} | ||
|
||
@Test | ||
public void testHttpUrlFromString() throws Exception { | ||
String url = "http://wildfly.org/path/to/manifest"; | ||
ChannelConfiguration configuration = new ChannelConfiguration(); | ||
configuration.set(url); | ||
Channel channel = configuration.toChannel(Collections.emptyList()); | ||
|
||
Assert.assertNotNull(channel.getManifestCoordinate().getUrl()); | ||
Assert.assertEquals(url, channel.getManifestCoordinate().getUrl().toExternalForm()); | ||
} | ||
|
||
@Test | ||
public void testMavenGavFromString() throws Exception { | ||
{ | ||
String gav = "g:a:v"; | ||
ChannelConfiguration configuration = new ChannelConfiguration(); | ||
configuration.set(gav); | ||
Channel channel = configuration.toChannel(Collections.emptyList()); | ||
|
||
Assert.assertNotNull(channel.getManifestCoordinate().getMaven()); | ||
Assert.assertEquals("g", channel.getManifestCoordinate().getMaven().getGroupId()); | ||
Assert.assertEquals("a", channel.getManifestCoordinate().getMaven().getArtifactId()); | ||
Assert.assertEquals("v", channel.getManifestCoordinate().getMaven().getVersion()); | ||
} | ||
|
||
{ | ||
String gav = "g:a"; | ||
ChannelConfiguration configuration = new ChannelConfiguration(); | ||
configuration.set(gav); | ||
Channel channel = configuration.toChannel(Collections.emptyList()); | ||
|
||
Assert.assertNotNull(channel.getManifestCoordinate().getMaven()); | ||
Assert.assertEquals("g", channel.getManifestCoordinate().getMaven().getGroupId()); | ||
Assert.assertEquals("a", channel.getManifestCoordinate().getMaven().getArtifactId()); | ||
Assert.assertNull(channel.getManifestCoordinate().getMaven().getVersion()); | ||
} | ||
} | ||
} |