forked from quarkusio/quarkus
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: deployer detection in mvn plugin
- Loading branch information
Showing
2 changed files
with
78 additions
and
2 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
60 changes: 60 additions & 0 deletions
60
devtools/maven/src/test/java/io/quarkus/maven/DeployerTest.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,60 @@ | ||
package io.quarkus.maven; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
import java.util.List; | ||
import java.util.Set; | ||
|
||
import org.apache.maven.model.Dependency; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import io.quarkus.builder.Version; | ||
|
||
public class DeployerTest { | ||
|
||
@Test | ||
void shouldNotFindDeployer() { | ||
Set<String> deployers = Deployer.getProjecDeployers(List.of()); | ||
assertTrue(deployers.isEmpty()); | ||
|
||
deployers = Deployer.getProjecDeployers(List.of(newDependency("quarkus-arc"), newDependency("quarkus-resteasy"))); | ||
assertTrue(deployers.isEmpty()); | ||
} | ||
|
||
@Test | ||
void shouldFindDeployer() { | ||
Set<String> deployers = Deployer.getProjecDeployers( | ||
List.of(newDependency("quarkus-arc"), newDependency("quarkus-resteasy"), newDependency("quarkus-kubernetes"))); | ||
assertEquals(Set.of("kubernetes"), deployers); | ||
|
||
deployers = Deployer.getProjecDeployers( | ||
List.of(newDependency("quarkus-arc"), newDependency("quarkus-resteasy"), newDependency("quarkus-openshift"))); | ||
assertEquals(Set.of("openshift"), deployers); | ||
|
||
deployers = Deployer.getProjecDeployers( | ||
List.of(newDependency("quarkus-arc"), newDependency("quarkus-resteasy"), newDependency("quarkus-kind"))); | ||
assertEquals(Set.of("kind"), deployers); | ||
|
||
deployers = Deployer.getProjecDeployers( | ||
List.of(newDependency("quarkus-arc"), newDependency("quarkus-resteasy"), newDependency("quarkus-minikube"))); | ||
assertEquals(Set.of("minikube"), deployers); | ||
} | ||
|
||
@Test | ||
void shouldFindMultipleDeployer() { | ||
Set<String> deployers = Deployer.getProjecDeployers( | ||
List.of(newDependency("quarkus-arc"), newDependency("quarkus-resteasy"), newDependency("quarkus-kubernetes"), | ||
newDependency("quarkus-openshift"))); | ||
assertEquals(Set.of("kubernetes", "openshift"), deployers); | ||
} | ||
|
||
private static Dependency newDependency(String artifactId) { | ||
Dependency dependency = new Dependency(); | ||
dependency.setGroupId("io.quarkus"); | ||
dependency.setArtifactId(artifactId); | ||
dependency.setVersion(Version.getVersion()); | ||
dependency.setType("jar"); | ||
return dependency; | ||
} | ||
} |