]>
git.argeo.org Git - gpl/argeo-slc.git/blob - runtime/org.argeo.slc.support.aether/src/test/java/org/argeo/slc/aether/AetherUtilsTest.java
2 * Copyright (C) 2007-2012 Argeo GmbH
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org
.argeo
.slc
.aether
;
18 import org
.sonatype
.aether
.artifact
.Artifact
;
19 import org
.sonatype
.aether
.util
.artifact
.DefaultArtifact
;
21 import junit
.framework
.TestCase
;
23 public class AetherUtilsTest
extends TestCase
{
24 public void testConvertPathToArtifact() throws Exception
{
25 checkPathConversion("my.group.id:my-artifactId:pom:1.2.3",
26 "/my/group/id/my-artifactId/1.2.3/my-artifactId-1.2.3.pom");
27 checkPathConversion("my.group.id:my-artifactId:pom:1.2.3-SNAPSHOT",
28 "/my/group/id/my-artifactId/1.2.3-SNAPSHOT/my-artifactId-1.2.3-SNAPSHOT.pom");
29 checkPathConversion("my.group.id:my-artifactId:pom:myClassifier:1.2.3",
30 "/my/group/id/my-artifactId/1.2.3/my-artifactId-1.2.3-myClassifier.pom");
32 "my.group.id:my-artifactId:pom:myClassifier:1.2.3-SNAPSHOT",
33 "/my/group/id/my-artifactId/1.2.3-SNAPSHOT/my-artifactId-1.2.3-SNAPSHOT-myClassifier.pom");
35 "my.group.id:my-artifactId:pom:myClassifier:20110828.223836-2",
36 "/my/group/id/my-artifactId/1.2.3-SNAPSHOT/my-artifactId-20110828.223836-2-myClassifier.pom");
39 public void testConvertPathToArtifactRealLife() throws Exception
{
41 "org.apache.maven.plugins:maven-antrun-plugin:pom:1.1",
42 "org/apache/maven/plugins/maven-antrun-plugin/1.1/maven-antrun-plugin-1.1.pom");
44 "org.apache.maven.plugins:maven-plugin-parent:pom:2.0.1",
45 "org/apache/maven/plugins/maven-plugin-parent/2.0.1/maven-plugin-parent-2.0.1.pom");
47 "org.apache.avalon.framework:avalon-framework-impl:pom:4.3.1",
48 "org/apache/avalon/framework/avalon-framework-impl/4.3.1/avalon-framework-impl-4.3.1.pom");
50 "org.apache.maven.shared:maven-dependency-tree:pom:1.2",
51 "org/apache/maven/shared/maven-dependency-tree/1.2/maven-dependency-tree-1.2.pom");
53 "org.argeo.maven.plugins:maven-argeo-osgi-plugin:pom:1.0.33",
54 "org/argeo/maven/plugins/maven-argeo-osgi-plugin/1.0.33/maven-argeo-osgi-plugin-1.0.33.pom");
56 "org.apache.maven.plugins:maven-clean-plugin:pom:2.4.1",
57 "org/apache/maven/plugins/maven-clean-plugin/2.4.1/maven-clean-plugin-2.4.1.pom");
60 protected void checkPathConversion(String expectedArtifact
, String path
) {
61 Artifact artifact
= AetherUtils
.convertPathToArtifact(path
, null);
62 if (expectedArtifact
== null)
65 assertEquals(new DefaultArtifact(expectedArtifact
), artifact
);