[MRM-127] cull POMs that belong to other artifacts from the list

git-svn-id: https://svn.apache.org/repos/asf/maven/repository-manager/trunk@425947 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Porter 2006-07-27 03:59:01 +00:00
parent 60eaf42859
commit 1c20fd9fd8
3 changed files with 57 additions and 1 deletions

View File

@ -125,7 +125,17 @@ public class StandardArtifactIndexRecordFactory
} }
else else
{ {
populatePomEntries( readPom( file ), record ); Model model = readPom( file );
if ( !"pom".equals( model.getPackaging() ) )
{
// Don't return a record for a POM that is does not belong on its own
record = null;
}
else
{
populatePomEntries( model, record );
}
} }
} }
} }

View File

@ -107,6 +107,29 @@ public class MinimalArtifactIndexRecordFactoryTest
assertNull( "Check no record", record ); assertNull( "Check no record", record );
} }
public void testNonIndexedPom()
throws RepositoryIndexException
{
// If we pass in only the POM that belongs to a JAR, then expect null not the POM
Artifact artifact = createArtifact( "test-jar-and-pom", "1.0", "pom" );
RepositoryIndexRecord record = factory.createRecord( artifact );
assertNull( "Check no record", record );
artifact = createArtifact( "test-plugin", "1.0", "pom" );
record = factory.createRecord( artifact );
assertNull( "Check no record", record );
artifact = createArtifact( "test-archetype", "1.0", "pom" );
record = factory.createRecord( artifact );
assertNull( "Check no record", record );
}
public void testIndexedPlugin() public void testIndexedPlugin()
throws RepositoryIndexException, IOException, XmlPullParserException throws RepositoryIndexException, IOException, XmlPullParserException
{ {

View File

@ -139,6 +139,29 @@ public class StandardArtifactIndexRecordFactoryTest
assertEquals( "check record", expectedRecord, record ); assertEquals( "check record", expectedRecord, record );
} }
public void testNonIndexedPom()
throws RepositoryIndexException
{
// If we pass in only the POM that belongs to a JAR, then expect null not the POM
Artifact artifact = createArtifact( "test-jar-and-pom", "1.0", "pom" );
RepositoryIndexRecord record = factory.createRecord( artifact );
assertNull( "Check no record", record );
artifact = createArtifact( "test-plugin", "1.0", "pom" );
record = factory.createRecord( artifact );
assertNull( "Check no record", record );
artifact = createArtifact( "test-archetype", "1.0", "pom" );
record = factory.createRecord( artifact );
assertNull( "Check no record", record );
}
public void testIndexedPlugin() public void testIndexedPlugin()
throws RepositoryIndexException, IOException, XmlPullParserException throws RepositoryIndexException, IOException, XmlPullParserException
{ {