mirror of
https://github.com/apache/archiva.git
synced 2025-02-24 11:35:02 +00:00
fix junit BrowseActionTest and RepositoriesActionTest
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1135814 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0ddd97bda1
commit
e75bb63a99
@ -107,8 +107,7 @@ protected String[] getContextLocations()
|
||||
|
||||
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 );
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
* 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 @@ protected void setUp()
|
||||
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 @@ protected void setUp()
|
||||
applicationContext.getBean( "repositorySessionFactory#test", TestRepositorySessionFactory.class );
|
||||
factory.setRepositorySession( repositorySession );
|
||||
}
|
||||
|
||||
protected void tearDown()
|
||||
throws Exception
|
||||
{
|
||||
super.tearDown();
|
||||
setObservableRepos( Lists.<String>newArrayList( "test-repo" ) );
|
||||
}
|
||||
}
|
@ -50,7 +50,7 @@ protected void setUp()
|
||||
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 void testGetRepositories()
|
||||
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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user