mirror of https://github.com/apache/archiva.git
[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:
parent
60eaf42859
commit
1c20fd9fd8
|
@ -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 );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
||||||
{
|
{
|
||||||
|
|
|
@ -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
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue