*/
import org.apache.archiva.repository.LayoutException;
+import org.apache.archiva.repository.content.ItemSelector;
+import org.apache.archiva.repository.content.base.ArchivaItemSelector;
+import org.junit.Test;
import static org.junit.Assert.fail;
/**
+ * Specific tests for ManagedRepositoryContent
+ *
* @author Martin Stockhammer <martin_s@apache.org>
*/
public abstract class AbstractManagedRepositoryContentTest extends AbstractRepositoryContentTest
{
getManaged().toItem( path );
fail(
- "Should have thrown a LayoutException on the invalid path [" + path + "] because of [" + reason + "]" );
+ "toItem(path) should have thrown a LayoutException on the invalid path [" + path + "] because of [" + reason + "]" );
}
catch ( LayoutException e )
{
/* expected path */
}
}
+
+ @Test
+ public void testGetArtifactOnEmptyPath() {
+ ItemSelector selector = ArchivaItemSelector.builder( ).build( );
+ try {
+ getManaged( ).getArtifact( selector );
+ fail( "getArtifact(ItemSelector) with empty selector should throw IllegalArgumentException" );
+ } catch (IllegalArgumentException e) {
+ // Good
+ }
+ }
}
*/
import org.apache.archiva.model.ArtifactReference;
+import org.apache.archiva.repository.RepositoryContent;
import org.apache.archiva.repository.maven.AbstractRepositoryLayerTestCase;
import org.apache.archiva.repository.LayoutException;
import org.apache.archiva.repository.ManagedRepositoryContent;
public void testBadPathTooShort()
{
assertBadPath( "invalid/invalid-1.0.jar", "path is too short" );
+ assertBadPathCi( "invalid/invalid-1.0.jar", "path is too short" );
}
@Test
public void testBadPathVersionMismatchA()
{
assertBadPath( "invalid/invalid/1.0/invalid-2.0.jar", "version mismatch between path and artifact" );
+ assertBadPathCi( "invalid/invalid/1.0/invalid-2.0.jar", "version mismatch between path and artifact" );
}
@Test
public void testBadPathVersionMismatchB()
{
assertBadPath( "invalid/invalid/1.0/invalid-1.0b.jar", "version mismatch between path and artifact" );
+ assertBadPathCi( "invalid/invalid/1.0/invalid-1.0b.jar", "version mismatch between path and artifact" );
}
@Test
{
assertBadPath( "org/apache/maven/test/1.0-SNAPSHOT/wrong-artifactId-1.0-20050611.112233-1.jar",
"wrong artifact id" );
+ assertBadPathCi( "org/apache/maven/test/1.0-SNAPSHOT/wrong-artifactId-1.0-20050611.112233-1.jar",
+ "wrong artifact id" );
}
/**
assertLayoutCi( path, groupId, artifactId, version, classifier, type );
}
+
@Test
- public void testToArtifactOnEmptyPath()
+ public void testToItemSelectorOnEmptyPath()
{
try
{
- toArtifactReference( "" );
- fail( "Should have failed due to empty path." );
+ getContent( ).toItemSelector( "" );
+ fail( "toItemSelector() should have failed due to empty path." );
}
catch ( LayoutException e )
{
}
@Test
- public void testToArtifactOnNullPath()
+ public void testToArtifactOnEmptyPath()
{
try
{
- toArtifactReference( null );
- fail( "Should have failed due to null path." );
+ toArtifactReference( "" );
+ fail( "Should have failed due to empty path." );
}
catch ( LayoutException e )
{
}
@Test
- public void testToArtifactReferenceOnEmptyPath()
+ public void testToArtifactOnNullPath()
{
try
{
- toArtifactReference( "" );
- fail( "Should have failed due to empty path." );
+ toArtifactReference( null );
+ fail( "Should have failed due to null path." );
}
catch ( LayoutException e )
{
}
@Test
- public void testToArtifactReferenceOnNullPath()
+ public void testToItemSelectorOnNullPath()
{
try
{
- toArtifactReference( null );
- fail( "Should have failed due to null path." );
+ getContent().toItemSelector( null );
+ fail( "toItemSelector() should have failed due to null path." );
}
catch ( LayoutException e )
{
protected abstract ItemSelector toItemSelector(String path) throws LayoutException;
protected abstract ManagedRepositoryContent getManaged();
+
+ protected abstract RepositoryContent getContent( );
}