@Test public void artifact() throws Exception { MavenPath mavenPath; mavenPath = pathParser.parsePath("/org/jruby/jruby/1.0RC1-SNAPSHOT/jruby-1.0RC1-20070504.160758-25-javadoc.jar"); assertThat(mavenPath, notNullValue()); assertThat(mavenPath.getPath(), equalTo( "org/jruby/jruby/1.0RC1-SNAPSHOT/jruby-1.0RC1-20070504.160758-25-javadoc.jar")); assertThat(mavenPath.getFileName(), equalTo("jruby-1.0RC1-20070504.160758-25-javadoc.jar")); assertThat(mavenPath.getHashType(), nullValue()); assertThat(mavenPath.getCoordinates(), notNullValue()); assertThat(mavenPath.getCoordinates().getGroupId(), equalTo("org.jruby")); assertThat(mavenPath.getCoordinates().getArtifactId(), equalTo("jruby")); assertThat(mavenPath.getCoordinates().getVersion(), equalTo("1.0RC1-20070504.160758-25")); assertThat(mavenPath.getCoordinates().getTimestamp(), equalTo(parseTimestamp("20070504.160758"))); assertThat(mavenPath.getCoordinates().getBuildNumber(), equalTo(25)); assertThat(mavenPath.getCoordinates().getBaseVersion(), equalTo("1.0RC1-SNAPSHOT")); assertThat(mavenPath.getCoordinates().getClassifier(), equalTo("javadoc")); assertThat(mavenPath.getCoordinates().getExtension(), equalTo("jar")); assertThat(mavenPath.getCoordinates().getSignatureType(), nullValue()); mavenPath = pathParser.parsePath("/com/sun/xml/ws/jaxws-local-transport/2.1.3/jaxws-local-transport-2.1.3.pom.md5"); assertThat(mavenPath, notNullValue()); assertThat(mavenPath.getPath(), equalTo( "com/sun/xml/ws/jaxws-local-transport/2.1.3/jaxws-local-transport-2.1.3.pom.md5")); assertThat(mavenPath.getFileName(), equalTo("jaxws-local-transport-2.1.3.pom.md5")); assertThat(mavenPath.getHashType(), equalTo(HashType.MD5)); assertThat(mavenPath.getCoordinates(), notNullValue()); assertThat(mavenPath.getCoordinates().getGroupId(), equalTo("com.sun.xml.ws")); assertThat(mavenPath.getCoordinates().getArtifactId(), equalTo("jaxws-local-transport")); assertThat(mavenPath.getCoordinates().getVersion(), equalTo("2.1.3")); assertThat(mavenPath.getCoordinates().getTimestamp(), nullValue()); assertThat(mavenPath.getCoordinates().getBuildNumber(), nullValue()); assertThat(mavenPath.getCoordinates().getBaseVersion(), equalTo("2.1.3")); assertThat(mavenPath.getCoordinates().getClassifier(), nullValue()); assertThat(mavenPath.getCoordinates().getExtension(), equalTo("pom.md5")); assertThat(mavenPath.getCoordinates().getSignatureType(), nullValue()); mavenPath = pathParser.parsePath("/org/jruby/jruby/1.0RC1-SNAPSHOT/jruby-1.0RC1-20070504.160758-2.jar"); assertThat(mavenPath, notNullValue()); assertThat(mavenPath.getPath(), equalTo( "org/jruby/jruby/1.0RC1-SNAPSHOT/jruby-1.0RC1-20070504.160758-2.jar")); assertThat(mavenPath.getFileName(), equalTo("jruby-1.0RC1-20070504.160758-2.jar")); assertThat(mavenPath.getHashType(), nullValue()); assertThat(mavenPath.getCoordinates(), notNullValue()); assertThat(mavenPath.getCoordinates().getGroupId(), equalTo("org.jruby")); assertThat(mavenPath.getCoordinates().getArtifactId(), equalTo("jruby")); assertThat(mavenPath.getCoordinates().getVersion(), equalTo("1.0RC1-20070504.160758-2")); assertThat(mavenPath.getCoordinates().getBaseVersion(), equalTo("1.0RC1-SNAPSHOT")); assertThat(mavenPath.getCoordinates().getClassifier(), nullValue()); assertThat(mavenPath.getCoordinates().getExtension(), equalTo("jar")); assertThat(mavenPath.getCoordinates().getSignatureType(), nullValue()); mavenPath = pathParser.parsePath("/org/jruby/jruby/1.0RC1-SNAPSHOT/jruby-1.0RC1-20070504.160758-2.jar.md5"); assertThat(mavenPath, notNullValue()); assertThat(mavenPath.getPath(), equalTo( "org/jruby/jruby/1.0RC1-SNAPSHOT/jruby-1.0RC1-20070504.160758-2.jar.md5")); assertThat(mavenPath.getFileName(), equalTo("jruby-1.0RC1-20070504.160758-2.jar.md5")); assertThat(mavenPath.getHashType(), equalTo(HashType.MD5)); assertThat(mavenPath.getCoordinates(), notNullValue()); assertThat(mavenPath.getCoordinates().getGroupId(), equalTo("org.jruby")); assertThat(mavenPath.getCoordinates().getArtifactId(), equalTo("jruby")); assertThat(mavenPath.getCoordinates().getVersion(), equalTo("1.0RC1-20070504.160758-2")); assertThat(mavenPath.getCoordinates().getBaseVersion(), equalTo("1.0RC1-SNAPSHOT")); assertThat(mavenPath.getCoordinates().getClassifier(), nullValue()); assertThat(mavenPath.getCoordinates().getExtension(), equalTo("jar.md5")); assertThat(mavenPath.getCoordinates().getSignatureType(), nullValue()); mavenPath = pathParser.parsePath( "/com/stchome/products/dsms/services/dsms-intervention-service/2.4.2-64-SNAPSHOT/dsms-intervention-service-2.4.2-64-SNAPSHOT.jar.sha1"); assertThat(mavenPath, notNullValue()); assertThat(mavenPath.getPath(), equalTo( "com/stchome/products/dsms/services/dsms-intervention-service/2.4.2-64-SNAPSHOT/dsms-intervention-service-2.4.2-64-SNAPSHOT.jar.sha1")); assertThat(mavenPath.getFileName(), equalTo("dsms-intervention-service-2.4.2-64-SNAPSHOT.jar.sha1")); assertThat(mavenPath.getHashType(), equalTo(HashType.SHA1)); assertThat(mavenPath.getCoordinates(), notNullValue()); assertThat(mavenPath.getCoordinates().getGroupId(), equalTo("com.stchome.products.dsms.services")); assertThat(mavenPath.getCoordinates().getArtifactId(), equalTo("dsms-intervention-service")); assertThat(mavenPath.getCoordinates().getVersion(), equalTo("2.4.2-64-SNAPSHOT")); assertThat(mavenPath.getCoordinates().getBaseVersion(), equalTo("2.4.2-64-SNAPSHOT")); assertThat(mavenPath.getCoordinates().getClassifier(), nullValue()); assertThat(mavenPath.getCoordinates().getExtension(), equalTo("jar.sha1")); assertThat(mavenPath.getCoordinates().getSignatureType(), nullValue()); mavenPath = pathParser.parsePath( "/com/stchome/products/dsms/services/dsms-intervention-service/2.4.2-64-SNAPSHOT/dsms-intervention-service-2.4.2-64-SNAPSHOT-javadoc.jar.sha1"); assertThat(mavenPath, notNullValue()); assertThat(mavenPath.getPath(), equalTo( "com/stchome/products/dsms/services/dsms-intervention-service/2.4.2-64-SNAPSHOT/dsms-intervention-service-2.4.2-64-SNAPSHOT-javadoc.jar.sha1")); assertThat(mavenPath.getFileName(), equalTo("dsms-intervention-service-2.4.2-64-SNAPSHOT-javadoc.jar.sha1")); assertThat(mavenPath.getHashType(), equalTo(HashType.SHA1)); assertThat(mavenPath.getCoordinates(), notNullValue()); assertThat(mavenPath.getCoordinates().getGroupId(), equalTo("com.stchome.products.dsms.services")); assertThat(mavenPath.getCoordinates().getArtifactId(), equalTo("dsms-intervention-service")); assertThat(mavenPath.getCoordinates().getVersion(), equalTo("2.4.2-64-SNAPSHOT")); assertThat(mavenPath.getCoordinates().getBaseVersion(), equalTo("2.4.2-64-SNAPSHOT")); assertThat(mavenPath.getCoordinates().getClassifier(), equalTo("javadoc")); assertThat(mavenPath.getCoordinates().getExtension(), equalTo("jar.sha1")); assertThat(mavenPath.getCoordinates().getSignatureType(), nullValue()); mavenPath = pathParser.parsePath("/org/jruby/jruby/1.0/jruby-1.0-javadoc.jar"); assertThat(mavenPath, notNullValue()); assertThat(mavenPath.getPath(), equalTo( "org/jruby/jruby/1.0/jruby-1.0-javadoc.jar")); assertThat(mavenPath.getFileName(), equalTo("jruby-1.0-javadoc.jar")); assertThat(mavenPath.getHashType(), nullValue()); assertThat(mavenPath.getCoordinates(), notNullValue()); assertThat(mavenPath.getCoordinates().getGroupId(), equalTo("org.jruby")); assertThat(mavenPath.getCoordinates().getArtifactId(), equalTo("jruby")); assertThat(mavenPath.getCoordinates().getVersion(), equalTo("1.0")); assertThat(mavenPath.getCoordinates().getBaseVersion(), equalTo("1.0")); assertThat(mavenPath.getCoordinates().getClassifier(), equalTo("javadoc")); assertThat(mavenPath.getCoordinates().getExtension(), equalTo("jar")); assertThat(mavenPath.getCoordinates().getSignatureType(), nullValue()); mavenPath = pathParser.parsePath("/org/jruby/jruby/1.0/jruby-1.0-javadoc.jar.sha1"); assertThat(mavenPath, notNullValue()); assertThat(mavenPath.getPath(), equalTo( "org/jruby/jruby/1.0/jruby-1.0-javadoc.jar.sha1")); assertThat(mavenPath.getFileName(), equalTo("jruby-1.0-javadoc.jar.sha1")); assertThat(mavenPath.getHashType(), equalTo(HashType.SHA1)); assertThat(mavenPath.getCoordinates(), notNullValue()); assertThat(mavenPath.getCoordinates().getGroupId(), equalTo("org.jruby")); assertThat(mavenPath.getCoordinates().getArtifactId(), equalTo("jruby")); assertThat(mavenPath.getCoordinates().getVersion(), equalTo("1.0")); assertThat(mavenPath.getCoordinates().getBaseVersion(), equalTo("1.0")); assertThat(mavenPath.getCoordinates().getClassifier(), equalTo("javadoc")); assertThat(mavenPath.getCoordinates().getExtension(), equalTo("jar.sha1")); assertThat(mavenPath.getCoordinates().getSignatureType(), nullValue()); mavenPath = pathParser.parsePath("/activemq/activemq-core/1.2/activemq-core-1.2.pom"); assertThat(mavenPath, notNullValue()); assertThat(mavenPath.getPath(), equalTo( "activemq/activemq-core/1.2/activemq-core-1.2.pom")); assertThat(mavenPath.getFileName(), equalTo("activemq-core-1.2.pom")); assertThat(mavenPath.getHashType(), nullValue()); assertThat(mavenPath.getCoordinates(), notNullValue()); assertThat(mavenPath.getCoordinates().getGroupId(), equalTo("activemq")); assertThat(mavenPath.getCoordinates().getArtifactId(), equalTo("activemq-core")); assertThat(mavenPath.getCoordinates().getVersion(), equalTo("1.2")); assertThat(mavenPath.getCoordinates().getBaseVersion(), equalTo("1.2")); assertThat(mavenPath.getCoordinates().getClassifier(), nullValue()); assertThat(mavenPath.getCoordinates().getExtension(), equalTo("pom")); assertThat(mavenPath.getCoordinates().getSignatureType(), nullValue()); mavenPath = pathParser.parsePath("/junit/junit/3.8/junit-3.8.jar"); assertThat(mavenPath, notNullValue()); assertThat(mavenPath.getPath(), equalTo( "junit/junit/3.8/junit-3.8.jar")); assertThat(mavenPath.getFileName(), equalTo("junit-3.8.jar")); assertThat(mavenPath.getHashType(), nullValue()); assertThat(mavenPath.getCoordinates(), notNullValue()); assertThat(mavenPath.getCoordinates().getGroupId(), equalTo("junit")); assertThat(mavenPath.getCoordinates().getArtifactId(), equalTo("junit")); assertThat(mavenPath.getCoordinates().getVersion(), equalTo("3.8")); assertThat(mavenPath.getCoordinates().getBaseVersion(), equalTo("3.8")); assertThat(mavenPath.getCoordinates().getClassifier(), nullValue()); assertThat(mavenPath.getCoordinates().getExtension(), equalTo("jar")); assertThat(mavenPath.getCoordinates().getSignatureType(), nullValue()); mavenPath = pathParser.parsePath("/foo1/foo1/0.0.1SNAPSHOT/foo1-0.0.1SNAPSHOT.pom"); assertThat(mavenPath, notNullValue()); assertThat(mavenPath.getPath(), equalTo( "foo1/foo1/0.0.1SNAPSHOT/foo1-0.0.1SNAPSHOT.pom")); assertThat(mavenPath.getFileName(), equalTo("foo1-0.0.1SNAPSHOT.pom")); assertThat(mavenPath.getHashType(), nullValue()); assertThat(mavenPath.getCoordinates(), notNullValue()); assertThat(mavenPath.getCoordinates().getGroupId(), equalTo("foo1")); assertThat(mavenPath.getCoordinates().getArtifactId(), equalTo("foo1")); assertThat(mavenPath.getCoordinates().getVersion(), equalTo("0.0.1SNAPSHOT")); assertThat(mavenPath.getCoordinates().getBaseVersion(), equalTo("0.0.1SNAPSHOT")); assertThat(mavenPath.getCoordinates().getClassifier(), nullValue()); assertThat(mavenPath.getCoordinates().getExtension(), equalTo("pom")); assertThat(mavenPath.getCoordinates().getSignatureType(), nullValue()); mavenPath = pathParser.parsePath("/foo1/foo1/0.0.1.SNAPSHOT/foo1-0.0.1.SNAPSHOT.pom"); assertThat(mavenPath, notNullValue()); assertThat(mavenPath.getPath(), equalTo( "foo1/foo1/0.0.1.SNAPSHOT/foo1-0.0.1.SNAPSHOT.pom")); assertThat(mavenPath.getFileName(), equalTo("foo1-0.0.1.SNAPSHOT.pom")); assertThat(mavenPath.getHashType(), nullValue()); assertThat(mavenPath.getCoordinates(), notNullValue()); assertThat(mavenPath.getCoordinates().getGroupId(), equalTo("foo1")); assertThat(mavenPath.getCoordinates().getArtifactId(), equalTo("foo1")); assertThat(mavenPath.getCoordinates().getVersion(), equalTo("0.0.1.SNAPSHOT")); assertThat(mavenPath.getCoordinates().getBaseVersion(), equalTo("0.0.1.SNAPSHOT")); assertThat(mavenPath.getCoordinates().getClassifier(), nullValue()); assertThat(mavenPath.getCoordinates().getExtension(), equalTo("pom")); assertThat(mavenPath.getCoordinates().getSignatureType(), nullValue()); mavenPath = pathParser.parsePath("/foo1/foo1/0.0.1-SNAPSHOT/foo1-0.0.1-SNAPSHOT-jdk14.jar"); assertThat(mavenPath, notNullValue()); assertThat(mavenPath.getPath(), equalTo( "foo1/foo1/0.0.1-SNAPSHOT/foo1-0.0.1-SNAPSHOT-jdk14.jar")); assertThat(mavenPath.getFileName(), equalTo("foo1-0.0.1-SNAPSHOT-jdk14.jar")); assertThat(mavenPath.getHashType(), nullValue()); assertThat(mavenPath.getCoordinates(), notNullValue()); assertThat(mavenPath.getCoordinates().getGroupId(), equalTo("foo1")); assertThat(mavenPath.getCoordinates().getArtifactId(), equalTo("foo1")); assertThat(mavenPath.getCoordinates().getVersion(), equalTo("0.0.1-SNAPSHOT")); assertThat(mavenPath.getCoordinates().getBaseVersion(), equalTo("0.0.1-SNAPSHOT")); assertThat(mavenPath.getCoordinates().getClassifier(), equalTo("jdk14")); assertThat(mavenPath.getCoordinates().getExtension(), equalTo("jar")); assertThat(mavenPath.getCoordinates().getSignatureType(), nullValue()); mavenPath = pathParser.parsePath("/foo1/foo1/1.0.0-beta-4-SNAPSHOT/foo1-1.0.0-beta-4-20080623.175436-1.jar"); assertThat(mavenPath, notNullValue()); assertThat(mavenPath.getPath(), equalTo( "foo1/foo1/1.0.0-beta-4-SNAPSHOT/foo1-1.0.0-beta-4-20080623.175436-1.jar")); assertThat(mavenPath.getFileName(), equalTo("foo1-1.0.0-beta-4-20080623.175436-1.jar")); assertThat(mavenPath.getHashType(), nullValue()); assertThat(mavenPath.getCoordinates(), notNullValue()); assertThat(mavenPath.getCoordinates().getGroupId(), equalTo("foo1")); assertThat(mavenPath.getCoordinates().getArtifactId(), equalTo("foo1")); assertThat(mavenPath.getCoordinates().getVersion(), equalTo("1.0.0-beta-4-20080623.175436-1")); assertThat(mavenPath.getCoordinates().getBaseVersion(), equalTo("1.0.0-beta-4-SNAPSHOT")); assertThat(mavenPath.getCoordinates().getClassifier(), nullValue()); assertThat(mavenPath.getCoordinates().getExtension(), equalTo("jar")); assertThat(mavenPath.getCoordinates().getSignatureType(), nullValue()); mavenPath = pathParser.parsePath( "/org/apache/maven/artifact/maven-artifact/3.0-SNAPSHOT/maven-artifact-3.0-20080411.005221-75.pom.asc"); assertThat(mavenPath, notNullValue()); assertThat(mavenPath.getPath(), equalTo( "org/apache/maven/artifact/maven-artifact/3.0-SNAPSHOT/maven-artifact-3.0-20080411.005221-75.pom.asc")); assertThat(mavenPath.getFileName(), equalTo("maven-artifact-3.0-20080411.005221-75.pom.asc")); assertThat(mavenPath.getHashType(), nullValue()); assertThat(mavenPath.getCoordinates(), notNullValue()); assertThat(mavenPath.getCoordinates().getGroupId(), equalTo("org.apache.maven.artifact")); assertThat(mavenPath.getCoordinates().getArtifactId(), equalTo("maven-artifact")); assertThat(mavenPath.getCoordinates().getVersion(), equalTo("3.0-20080411.005221-75")); assertThat(mavenPath.getCoordinates().getBaseVersion(), equalTo("3.0-SNAPSHOT")); assertThat(mavenPath.getCoordinates().getClassifier(), nullValue()); assertThat(mavenPath.getCoordinates().getExtension(), equalTo("pom.asc")); assertThat(mavenPath.getCoordinates().getSignatureType(), equalTo(SignatureType.GPG)); mavenPath = pathParser.parsePath( "/org/apache/maven/artifact/maven-artifact/3.0-SNAPSHOT/maven-artifact-3.0-20080411.005221-75.pom.asc.sha1"); assertThat(mavenPath, notNullValue()); assertThat(mavenPath.getPath(), equalTo( "org/apache/maven/artifact/maven-artifact/3.0-SNAPSHOT/maven-artifact-3.0-20080411.005221-75.pom.asc.sha1")); assertThat(mavenPath.getFileName(), equalTo("maven-artifact-3.0-20080411.005221-75.pom.asc.sha1")); assertThat(mavenPath.getHashType(), equalTo(HashType.SHA1)); assertThat(mavenPath.getCoordinates(), notNullValue()); assertThat(mavenPath.getCoordinates().getGroupId(), equalTo("org.apache.maven.artifact")); assertThat(mavenPath.getCoordinates().getArtifactId(), equalTo("maven-artifact")); assertThat(mavenPath.getCoordinates().getVersion(), equalTo("3.0-20080411.005221-75")); assertThat(mavenPath.getCoordinates().getBaseVersion(), equalTo("3.0-SNAPSHOT")); assertThat(mavenPath.getCoordinates().getClassifier(), nullValue()); assertThat(mavenPath.getCoordinates().getExtension(), equalTo("pom.asc.sha1")); assertThat(mavenPath.getCoordinates().getSignatureType(), equalTo(SignatureType.GPG)); mavenPath = pathParser.parsePath( "/org/apache/maven/artifact/maven-artifact/3.0-SNAPSHOT/maven-artifact-3.0-20080411.005221-75-some.strange.classifier.pom.asc.sha1"); assertThat(mavenPath, notNullValue()); assertThat(mavenPath.getPath(), equalTo( "org/apache/maven/artifact/maven-artifact/3.0-SNAPSHOT/maven-artifact-3.0-20080411.005221-75-some.strange.classifier.pom.asc.sha1")); assertThat(mavenPath.getFileName(), equalTo("maven-artifact-3.0-20080411.005221-75-some.strange.classifier.pom.asc.sha1")); assertThat(mavenPath.getHashType(), equalTo(HashType.SHA1)); assertThat(mavenPath.getCoordinates(), notNullValue()); assertThat(mavenPath.getCoordinates().getGroupId(), equalTo("org.apache.maven.artifact")); assertThat(mavenPath.getCoordinates().getArtifactId(), equalTo("maven-artifact")); assertThat(mavenPath.getCoordinates().getVersion(), equalTo("3.0-20080411.005221-75")); assertThat(mavenPath.getCoordinates().getBaseVersion(), equalTo("3.0-SNAPSHOT")); assertThat(mavenPath.getCoordinates().getClassifier(), equalTo("some.strange.classifier")); assertThat(mavenPath.getCoordinates().getExtension(), equalTo("pom.asc.sha1")); assertThat(mavenPath.getCoordinates().getSignatureType(), equalTo(SignatureType.GPG)); }
@Nonnull @Override public MavenPath parsePath(final String path) { return parsePath(path, true); }
Maven2MavenPathParser extends ComponentSupport implements MavenPathParser { @Nonnull @Override public MavenPath parsePath(final String path) { return parsePath(path, true); } }
Maven2MavenPathParser extends ComponentSupport implements MavenPathParser { @Nonnull @Override public MavenPath parsePath(final String path) { return parsePath(path, true); }  }
Maven2MavenPathParser extends ComponentSupport implements MavenPathParser { @Nonnull @Override public MavenPath parsePath(final String path) { return parsePath(path, true); }  @Nonnull @Override MavenPath parsePath(final String path); @Nonnull @Override MavenPath parsePath(final String path, final boolean caseSensitive); @Override boolean isRepositoryMetadata(final MavenPath path); @Override boolean isRepositoryIndex(final MavenPath path); }
Maven2MavenPathParser extends ComponentSupport implements MavenPathParser { @Nonnull @Override public MavenPath parsePath(final String path) { return parsePath(path, true); }  @Nonnull @Override MavenPath parsePath(final String path); @Nonnull @Override MavenPath parsePath(final String path, final boolean caseSensitive); @Override boolean isRepositoryMetadata(final MavenPath path); @Override boolean isRepositoryIndex(final MavenPath path);  }