mirror of https://github.com/apache/archiva.git
PR: MRM-35
Submitted by: Maria Odea Ching Added more unit tests git-svn-id: https://svn.apache.org/repos/asf/maven/repository-manager/trunk@369655 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
12e8c4d60d
commit
05f70157b7
|
@ -114,7 +114,7 @@ public class MetadataRepositoryIndexingTest
|
||||||
*
|
*
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public void testSearchSingle()
|
public void testSearch()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
createTestIndex();
|
createTestIndex();
|
||||||
|
@ -181,6 +181,50 @@ public class MetadataRepositoryIndexingTest
|
||||||
indexer.close();
|
indexer.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testExceptions()
|
||||||
|
throws Exception
|
||||||
|
{
|
||||||
|
//test when the object passed in the index(..) method is not a RepositoryMetadat instance
|
||||||
|
RepositoryIndexingFactory factory = ( RepositoryIndexingFactory ) lookup( RepositoryIndexingFactory.ROLE );
|
||||||
|
indexer = factory.createMetadataRepositoryIndex( indexPath, repository );
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Artifact artifact = getArtifact("org.apache.maven", "maven-artifact", "2.0.1");
|
||||||
|
indexer.index( artifact );
|
||||||
|
fail( "Must throw exception when the passed object is not a RepositoryMetadata object." );
|
||||||
|
}
|
||||||
|
catch( Exception e )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
indexer.optimize();
|
||||||
|
indexer.close();
|
||||||
|
|
||||||
|
//test when the plugin prefix is blank
|
||||||
|
factory = ( RepositoryIndexingFactory ) lookup( RepositoryIndexingFactory.ROLE );
|
||||||
|
indexer = factory.createMetadataRepositoryIndex( indexPath, repository );
|
||||||
|
try
|
||||||
|
{
|
||||||
|
RepositoryMetadata repoMetadata = getMetadata( "test", null, null, "maven-metadata.xml", GROUP_TYPE );
|
||||||
|
indexer.index( repoMetadata );
|
||||||
|
}
|
||||||
|
catch( Exception e )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
indexer.optimize();
|
||||||
|
indexer.close();
|
||||||
|
|
||||||
|
//test when the index is closed
|
||||||
|
try
|
||||||
|
{
|
||||||
|
RepositoryMetadata repoMetadata = getMetadata( "org.apache.maven", null, null, "maven-metadata.xml", GROUP_TYPE );
|
||||||
|
indexer.index( repoMetadata );
|
||||||
|
fail( "Must throw exception when a metadata is added to the index while the indexer is still closed." );
|
||||||
|
}
|
||||||
|
catch( Exception e )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create RepositoryMetadata object.
|
* Create RepositoryMetadata object.
|
||||||
*
|
*
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
<metadata>
|
||||||
|
<groupId>test</groupId>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<prefix></prefix>
|
||||||
|
<artifactId>test-test-plugin</artifactId>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</metadata>
|
Loading…
Reference in New Issue