aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-modules
diff options
context:
space:
mode:
authorOlivier Lamy <olamy@apache.org>2011-06-14 21:46:04 +0000
committerOlivier Lamy <olamy@apache.org>2011-06-14 21:46:04 +0000
commite75bb63a99d6adb3464f9f84439ed996d7ad94e0 (patch)
treee38e6ddcf11a83774b048d99ac2992f9bcf8b774 /archiva-modules
parent0ddd97bda1329db8ce6ef36b916791693732f24d (diff)
downloadarchiva-e75bb63a99d6adb3464f9f84439ed996d7ad94e0.tar.gz
archiva-e75bb63a99d6adb3464f9f84439ed996d7ad94e0.zip
fix junit BrowseActionTest and RepositoriesActionTest
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1135814 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules')
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/AbstractActionTestCase.java3
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/BrowseActionTest.java9
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoriesActionTest.java18
3 files changed, 19 insertions, 11 deletions
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/AbstractActionTestCase.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/AbstractActionTestCase.java
index c5c2da070..9a95ce546 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/AbstractActionTestCase.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/AbstractActionTestCase.java
@@ -107,8 +107,7 @@ public abstract class AbstractActionTestCase
protected void setObservableRepos( List<String> repoIds )
{
- //(UserRepositoriesStub) lookup( UserRepositories.class );
- UserRepositoriesStub repos = applicationContext.getBean( "userRepositories#test", UserRepositoriesStub.class );
+ UserRepositoriesStub repos = applicationContext.getBean( "userRepositories", UserRepositoriesStub.class );
repos.setObservableRepositoryIds( repoIds );
}
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/BrowseActionTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/BrowseActionTest.java
index 394d04e77..2b5c6c025 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/BrowseActionTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/BrowseActionTest.java
@@ -19,6 +19,7 @@ package org.apache.maven.archiva.web.action;
* under the License.
*/
+import com.google.common.collect.Lists;
import com.opensymphony.xwork2.Action;
import org.apache.archiva.metadata.model.ProjectVersionMetadata;
import org.apache.archiva.metadata.repository.RepositorySession;
@@ -390,6 +391,7 @@ public class BrowseActionTest
throws Exception
{
super.setUp();
+ setObservableRepos( Lists.<String>newArrayList( "test-repo" ) );
//action = (BrowseAction) lookup( Action.class, ACTION_HINT );
action = (BrowseAction) getActionProxy( "/browse.action" ).getAction();
metadataResolver = new TestMetadataResolver();
@@ -399,4 +401,11 @@ public class BrowseActionTest
applicationContext.getBean( "repositorySessionFactory#test", TestRepositorySessionFactory.class );
factory.setRepositorySession( repositorySession );
}
+
+ protected void tearDown()
+ throws Exception
+ {
+ super.tearDown();
+ setObservableRepos( Lists.<String>newArrayList( "test-repo" ) );
+ }
} \ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoriesActionTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoriesActionTest.java
index 2a489e6e6..b21e0e5d1 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoriesActionTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoriesActionTest.java
@@ -50,7 +50,7 @@ public class RepositoriesActionTest
super.setUp();
//action = (RepositoriesAction) lookup( Action.class.getName(), "repositoriesAction" );
- action = (RepositoriesAction) getActionProxy( "/admin/index.action" ).getAction();
+ action = (RepositoriesAction) getActionProxy( "/admin/index.action" ).getAction();
}
@@ -67,20 +67,20 @@ public class RepositoriesActionTest
MetadataRepository metadataRepository = (MetadataRepository) control.getMock();
control.expectAndReturn( metadataRepository.getMetadataFacets( "internal", RepositoryStatistics.FACET_ID ),
Arrays.asList( "20091125.123456.678" ) );
- control.expectAndReturn( metadataRepository.getMetadataFacet( "internal", RepositoryStatistics.FACET_ID,
- "20091125.123456.678" ),
- new RepositoryStatistics() );
+ control.expectAndReturn(
+ metadataRepository.getMetadataFacet( "internal", RepositoryStatistics.FACET_ID, "20091125.123456.678" ),
+ new RepositoryStatistics() );
control.expectAndReturn( metadataRepository.getMetadataFacets( "snapshots", RepositoryStatistics.FACET_ID ),
Arrays.asList( "20091112.012345.012" ) );
- control.expectAndReturn( metadataRepository.getMetadataFacet( "snapshots", RepositoryStatistics.FACET_ID,
- "20091112.012345.012" ),
- new RepositoryStatistics() );
+ control.expectAndReturn(
+ metadataRepository.getMetadataFacet( "snapshots", RepositoryStatistics.FACET_ID, "20091112.012345.012" ),
+ new RepositoryStatistics() );
control.replay();
RepositorySession session = mock( RepositorySession.class );
when( session.getRepository() ).thenReturn( metadataRepository );
- //TestRepositorySessionFactory factory = (TestRepositorySessionFactory) lookup( RepositorySessionFactory.class );
- TestRepositorySessionFactory factory = new TestRepositorySessionFactory();
+ TestRepositorySessionFactory factory =
+ applicationContext.getBean( "repositorySessionFactory#test", TestRepositorySessionFactory.class );
factory.setRepositorySession( session );
ServletRunner sr = new ServletRunner();