-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CLI: doc/help update; correct -P parsing
- Loading branch information
Showing
5 changed files
with
194 additions
and
16 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
90 changes: 90 additions & 0 deletions
90
devtools/cli/src/test/java/io/quarkus/cli/common/TargetQuarkusVersionGroupTest.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,90 @@ | ||
package io.quarkus.cli.common; | ||
|
||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import io.quarkus.cli.Version; | ||
import io.quarkus.maven.ArtifactCoords; | ||
import io.quarkus.maven.StreamCoords; | ||
import io.quarkus.platform.tools.ToolsConstants; | ||
|
||
public class TargetQuarkusVersionGroupTest { | ||
final static String clientVersion = Version.clientVersion(); | ||
|
||
TargetQuarkusVersionGroup qvg = new TargetQuarkusVersionGroup(); | ||
|
||
@Test | ||
void testPlatformFullyQualified() { | ||
qvg.setPlatformBom("io.something:custom-bom:1.3.0.Final"); | ||
|
||
ArtifactCoords coords = qvg.getPlatformBom(); | ||
Assertions.assertEquals("io.something", coords.getGroupId()); | ||
Assertions.assertEquals("custom-bom", coords.getArtifactId()); | ||
Assertions.assertEquals("1.3.0.Final", coords.getVersion()); | ||
Assertions.assertEquals("io.something:custom-bom:1.3.0.Final", qvg.validPlatformBom); | ||
} | ||
|
||
@Test | ||
void testPlatformUseDefaultArtifactVersion() { | ||
qvg.setPlatformBom("just.group::"); | ||
|
||
ArtifactCoords coords = qvg.getPlatformBom(); | ||
Assertions.assertEquals("just.group", coords.getGroupId()); | ||
Assertions.assertEquals(ToolsConstants.DEFAULT_PLATFORM_BOM_ARTIFACT_ID, coords.getArtifactId()); | ||
Assertions.assertEquals(clientVersion, coords.getVersion()); | ||
Assertions.assertEquals("just.group:" + ToolsConstants.DEFAULT_PLATFORM_BOM_ARTIFACT_ID + ":" + clientVersion, | ||
qvg.validPlatformBom); | ||
} | ||
|
||
@Test | ||
void testPlatformUseDefaultArtifact() { | ||
qvg.setPlatformBom("group::version"); | ||
|
||
ArtifactCoords coords = qvg.getPlatformBom(); | ||
Assertions.assertEquals("group", coords.getGroupId()); | ||
Assertions.assertEquals(ToolsConstants.DEFAULT_PLATFORM_BOM_ARTIFACT_ID, coords.getArtifactId()); | ||
Assertions.assertEquals("version", coords.getVersion()); | ||
Assertions.assertEquals("group:" + ToolsConstants.DEFAULT_PLATFORM_BOM_ARTIFACT_ID + ":version", | ||
qvg.validPlatformBom); | ||
} | ||
|
||
@Test | ||
void testPlatformUseDefaultGroupVersion() { | ||
qvg.setPlatformBom(":artifact:"); | ||
|
||
ArtifactCoords coords = qvg.getPlatformBom(); | ||
Assertions.assertEquals(ToolsConstants.DEFAULT_PLATFORM_BOM_GROUP_ID, coords.getGroupId()); | ||
Assertions.assertEquals("artifact", coords.getArtifactId()); | ||
Assertions.assertEquals(clientVersion, coords.getVersion()); | ||
Assertions.assertEquals(ToolsConstants.DEFAULT_PLATFORM_BOM_GROUP_ID + ":artifact:" + clientVersion, | ||
qvg.validPlatformBom); | ||
} | ||
|
||
@Test | ||
void testStreamUseDFullyQualified() { | ||
qvg.setStream("stream-platform:stream-version"); | ||
|
||
StreamCoords coords = qvg.getStream(); | ||
Assertions.assertEquals("stream-platform", coords.getPlatformKey()); | ||
Assertions.assertEquals("stream-version", coords.getStreamId()); | ||
} | ||
|
||
@Test | ||
void testStreamUseDefaultGroup() { | ||
qvg.setStream(":stream-version"); | ||
|
||
StreamCoords coords = qvg.getStream(); | ||
Assertions.assertNull(coords.getPlatformKey()); | ||
Assertions.assertEquals("stream-version", coords.getStreamId()); | ||
} | ||
|
||
@Test | ||
void testStreamUseDefaultVersion() { | ||
qvg.setStream("stream-platform:"); | ||
|
||
StreamCoords coords = qvg.getStream(); | ||
Assertions.assertEquals("stream-platform", coords.getPlatformKey()); | ||
Assertions.assertNull(coords.getStreamId()); | ||
} | ||
|
||
} |
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