]>
git.argeo.org Git - gpl/argeo-slc.git/blob - cms/org.argeo.slc.repo/ext/test/org/argeo/slc/repo/internal/AetherUtilsTest.java
1 package org
.argeo
.slc
.repo
.internal
;
4 import junit
.framework
.TestCase
;
6 import org
.argeo
.slc
.repo
.maven
.AetherUtils
;
7 import org
.eclipse
.aether
.artifact
.Artifact
;
8 import org
.eclipse
.aether
.artifact
.DefaultArtifact
;
10 public class AetherUtilsTest
extends TestCase
{
11 public void testConvertPathToArtifact() throws Exception
{
12 checkPathConversion("my.group.id:my-artifactId:pom:1.2.3",
13 "/my/group/id/my-artifactId/1.2.3/my-artifactId-1.2.3.pom");
14 checkPathConversion("my.group.id:my-artifactId:pom:1.2.3-SNAPSHOT",
15 "/my/group/id/my-artifactId/1.2.3-SNAPSHOT/my-artifactId-1.2.3-SNAPSHOT.pom");
16 checkPathConversion("my.group.id:my-artifactId:pom:myClassifier:1.2.3",
17 "/my/group/id/my-artifactId/1.2.3/my-artifactId-1.2.3-myClassifier.pom");
19 "my.group.id:my-artifactId:pom:myClassifier:1.2.3-SNAPSHOT",
20 "/my/group/id/my-artifactId/1.2.3-SNAPSHOT/my-artifactId-1.2.3-SNAPSHOT-myClassifier.pom");
22 "my.group.id:my-artifactId:pom:myClassifier:20110828.223836-2",
23 "/my/group/id/my-artifactId/1.2.3-SNAPSHOT/my-artifactId-20110828.223836-2-myClassifier.pom");
26 public void testConvertPathToArtifactRealLife() throws Exception
{
28 "org.apache.maven.plugins:maven-antrun-plugin:pom:1.1",
29 "org/apache/maven/plugins/maven-antrun-plugin/1.1/maven-antrun-plugin-1.1.pom");
31 "org.apache.maven.plugins:maven-plugin-parent:pom:2.0.1",
32 "org/apache/maven/plugins/maven-plugin-parent/2.0.1/maven-plugin-parent-2.0.1.pom");
34 "org.apache.avalon.framework:avalon-framework-impl:pom:4.3.1",
35 "org/apache/avalon/framework/avalon-framework-impl/4.3.1/avalon-framework-impl-4.3.1.pom");
37 "org.apache.maven.shared:maven-dependency-tree:pom:1.2",
38 "org/apache/maven/shared/maven-dependency-tree/1.2/maven-dependency-tree-1.2.pom");
40 "org.argeo.maven.plugins:maven-argeo-osgi-plugin:pom:1.0.33",
41 "org/argeo/maven/plugins/maven-argeo-osgi-plugin/1.0.33/maven-argeo-osgi-plugin-1.0.33.pom");
43 "org.apache.maven.plugins:maven-clean-plugin:pom:2.4.1",
44 "org/apache/maven/plugins/maven-clean-plugin/2.4.1/maven-clean-plugin-2.4.1.pom");
47 protected void checkPathConversion(String expectedArtifact
, String path
) {
48 Artifact artifact
= AetherUtils
.convertPathToArtifact(path
, null);
49 if (expectedArtifact
== null)
52 assertEquals(new DefaultArtifact(expectedArtifact
), artifact
);