From b65800bd866a0acd11172e0c494b88d300610c95 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Tue, 14 Jun 2011 19:32:27 +0000 Subject: [PATCH] fix junit DeleteArtifactActionTest git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1135761 13f79535-47bb-0310-9956-ffa450edef68 --- .../web/action/DeleteArtifactActionTest.java | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/DeleteArtifactActionTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/DeleteArtifactActionTest.java index 7627b2aed..49635f30e 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/DeleteArtifactActionTest.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/DeleteArtifactActionTest.java @@ -19,11 +19,9 @@ package org.apache.maven.archiva.web.action; * 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 @@ public class DeleteArtifactActionTest 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 class DeleteArtifactActionTest 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() ); + metadataRepositoryControl.expectAndReturn( + metadataRepository.getArtifacts( REPOSITORY_ID, GROUP_ID, ARTIFACT_ID, VERSION ), + new ArrayList() ); configurationControl.replay(); repositoryFactoryControl.replay(); @@ -150,8 +146,8 @@ public class DeleteArtifactActionTest 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() ); -- 2.39.5