mirror of
https://github.com/apache/archiva.git
synced 2025-02-24 19:44:45 +00:00
fix junit DeleteArtifactActionTest
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1135761 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6080960325
commit
b65800bd86
@ -19,11 +19,9 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import com.opensymphony.xwork2.Action;
|
||||
import org.apache.archiva.metadata.model.ArtifactMetadata;
|
||||
import org.apache.archiva.metadata.repository.MetadataRepository;
|
||||
import org.apache.archiva.metadata.repository.RepositorySession;
|
||||
import org.apache.archiva.metadata.repository.RepositorySessionFactory;
|
||||
import org.apache.archiva.metadata.repository.memory.TestRepositorySessionFactory;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
|
||||
@ -97,10 +95,8 @@ protected void setUp()
|
||||
RepositorySession repositorySession = mock( RepositorySession.class );
|
||||
when( repositorySession.getRepository() ).thenReturn( metadataRepository );
|
||||
|
||||
//TestRepositorySessionFactory repositorySessionFactory = (TestRepositorySessionFactory) lookup(
|
||||
// RepositorySessionFactory.class );
|
||||
|
||||
TestRepositorySessionFactory repositorySessionFactory = new TestRepositorySessionFactory();
|
||||
TestRepositorySessionFactory repositorySessionFactory =
|
||||
applicationContext.getBean( "repositorySessionFactory#test", TestRepositorySessionFactory.class );
|
||||
|
||||
repositorySessionFactory.setRepositorySession( repositorySession );
|
||||
|
||||
@ -140,9 +136,9 @@ public void testNPEInDeleteArtifact()
|
||||
configurationControl.expectAndReturn( configuration.getConfiguration(), config );
|
||||
repositoryFactoryControl.expectAndReturn( repositoryFactory.getManagedRepositoryContent( REPOSITORY_ID ),
|
||||
repoContent );
|
||||
metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( REPOSITORY_ID, GROUP_ID,
|
||||
ARTIFACT_ID, VERSION ),
|
||||
new ArrayList<ArtifactMetadata>() );
|
||||
metadataRepositoryControl.expectAndReturn(
|
||||
metadataRepository.getArtifacts( REPOSITORY_ID, GROUP_ID, ARTIFACT_ID, VERSION ),
|
||||
new ArrayList<ArtifactMetadata>() );
|
||||
|
||||
configurationControl.replay();
|
||||
repositoryFactoryControl.replay();
|
||||
@ -150,8 +146,8 @@ public void testNPEInDeleteArtifact()
|
||||
|
||||
action.doDelete();
|
||||
|
||||
String artifactPath = REPO_LOCATION + "/" + StringUtils.replace( GROUP_ID, ".", "/" ) + "/" +
|
||||
StringUtils.replace( ARTIFACT_ID, ".", "/" ) + "/" + VERSION + "/" + ARTIFACT_ID + "-" + VERSION;
|
||||
String artifactPath = REPO_LOCATION + "/" + StringUtils.replace( GROUP_ID, ".", "/" ) + "/"
|
||||
+ StringUtils.replace( ARTIFACT_ID, ".", "/" ) + "/" + VERSION + "/" + ARTIFACT_ID + "-" + VERSION;
|
||||
|
||||
assertFalse( new File( artifactPath + ".jar" ).exists() );
|
||||
assertFalse( new File( artifactPath + ".jar.sha1" ).exists() );
|
||||
|
Loading…
x
Reference in New Issue
Block a user