fix unit tests

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1401291 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-10-23 13:29:56 +00:00
parent 0835fd6be4
commit 01b9012562
2 changed files with 41 additions and 39 deletions

View File

@ -288,8 +288,8 @@ public class Maven2RepositoryMetadataResolverMRM1411RepoGroupTest
"target/test-repositorys/com/example/test/test-snapshot-artifact-root" );
ReadMetadataRequest readMetadataRequest =
new ReadMetadataRequest().namespace( TEST_SNAP_REPO_ID ).namespace( "com.example.test" ).projectId(
"test-snapshot-artifact-module-a" ).projectVersion( "1.1-SNAPSHOT" );
new ReadMetadataRequest( TEST_SNAP_REPO_ID, "com.example.test", "test-snapshot-artifact-module-a",
"1.1-SNAPSHOT" );
ProjectVersionMetadata metadata = storage.readProjectVersionMetadata( readMetadataRequest );

View File

@ -19,13 +19,6 @@ package org.apache.archiva.metadata.repository.storage.maven2;
* under the License.
*/
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.inject.Inject;
import javax.inject.Named;
import junit.framework.TestCase;
import org.apache.archiva.common.utils.FileUtil;
import org.apache.archiva.configuration.ArchivaConfiguration;
@ -40,6 +33,7 @@ import org.apache.archiva.metadata.model.MailingList;
import org.apache.archiva.metadata.model.ProjectVersionMetadata;
import org.apache.archiva.metadata.repository.filter.AllFilter;
import org.apache.archiva.metadata.repository.filter.Filter;
import org.apache.archiva.metadata.repository.storage.ReadMetadataRequest;
import org.apache.archiva.metadata.repository.storage.RepositoryStorageRuntimeException;
import org.apache.archiva.proxy.common.WagonFactory;
import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
@ -48,9 +42,18 @@ import org.apache.maven.wagon.Wagon;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import javax.inject.Inject;
import javax.inject.Named;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import org.springframework.test.context.ContextConfiguration;
@RunWith ( ArchivaSpringJUnit4ClassRunner.class )
@ContextConfiguration ( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
@ -107,7 +110,6 @@ public class Maven2RepositoryMetadataResolverMRM1411Test
testRepo.setSnapshots( true );
c.addManagedRepository( testRepo );
RemoteRepositoryConfiguration testRemoteRepo = new RemoteRepositoryConfiguration();
testRemoteRepo.setId( TEST_REMOTE_REPO_ID );
testRemoteRepo.setLayout( "default" );
@ -143,8 +145,8 @@ public class Maven2RepositoryMetadataResolverMRM1411Test
copyTestArtifactWithParent( "target/test-classes/com/example/test/test-artifact-module-a",
"target/test-repository/com/example/test/test-artifact-module-a" );
ProjectVersionMetadata metadata =
storage.readProjectVersionMetadata( TEST_REPO_ID, "com.example.test", "test-artifact-module-a", "1.0" );
ProjectVersionMetadata metadata = storage.readProjectVersionMetadata(
new ReadMetadataRequest( TEST_REPO_ID, "com.example.test", "test-artifact-module-a", "1.0" ) );
MavenProjectFacet facet = (MavenProjectFacet) metadata.getFacet( MavenProjectFacet.FACET_ID );
assertEquals( "jar", facet.getPackaging() );
@ -193,8 +195,8 @@ public class Maven2RepositoryMetadataResolverMRM1411Test
copyTestArtifactWithParent( "target/test-classes/com/example/test/test-artifact-module-a",
"target/test-repository/com/example/test/test-artifact-module-a" );
ProjectVersionMetadata metadata =
storage.readProjectVersionMetadata( TEST_REPO_ID, "com.example.test", "test-artifact-module-a", "1.0" );
ProjectVersionMetadata metadata = storage.readProjectVersionMetadata(
new ReadMetadataRequest( TEST_REPO_ID, "com.example.test", "test-artifact-module-a", "1.0" ) );
assertEquals( "1.0", metadata.getId() );
MavenProjectFacet facet = (MavenProjectFacet) metadata.getFacet( MavenProjectFacet.FACET_ID );
@ -218,8 +220,8 @@ public class Maven2RepositoryMetadataResolverMRM1411Test
copyTestArtifactWithParent( "target/test-classes/com/example/test/test-artifact-module-a",
"target/test-repository/com/example/test/test-artifact-module-a" );
ProjectVersionMetadata metadata =
storage.readProjectVersionMetadata( TEST_REPO_ID, "com.example.test", "missing-parent", "1.1" );
ProjectVersionMetadata metadata = storage.readProjectVersionMetadata(
new ReadMetadataRequest( TEST_REPO_ID, "com.example.test", "missing-parent", "1.1" ) );
assertEquals( "1.1", metadata.getId() );
@ -244,9 +246,9 @@ public class Maven2RepositoryMetadataResolverMRM1411Test
copyTestArtifactWithParent( "target/test-classes/com/example/test/test-snapshot-artifact-module-a",
"target/test-repository/com/example/test/test-snapshot-artifact-module-a" );
ProjectVersionMetadata metadata =
storage.readProjectVersionMetadata( TEST_REPO_ID, "com.example.test", "test-snapshot-artifact-module-a",
"1.1-SNAPSHOT" );
ProjectVersionMetadata metadata = storage.readProjectVersionMetadata(
new ReadMetadataRequest( TEST_REPO_ID, "com.example.test", "test-snapshot-artifact-module-a",
"1.1-SNAPSHOT" ) );
MavenProjectFacet facet = (MavenProjectFacet) metadata.getFacet( MavenProjectFacet.FACET_ID );
assertEquals( "jar", facet.getPackaging() );
@ -291,9 +293,9 @@ public class Maven2RepositoryMetadataResolverMRM1411Test
try
{
ProjectVersionMetadata metadata =
storage.readProjectVersionMetadata( TEST_REPO_ID, "com.example.test", "test-snapshot-artifact-module-a",
"1.1-SNAPSHOT" );
ProjectVersionMetadata metadata = storage.readProjectVersionMetadata(
new ReadMetadataRequest( TEST_REPO_ID, "com.example.test", "test-snapshot-artifact-module-a",
"1.1-SNAPSHOT" ) );
fail( "Should not be found" );
}
catch ( RepositoryStorageRuntimeException e )