{
RepositoryServlet servlet = (RepositoryServlet) getServletUnitClient().newInvocation( REQUEST_PATH ).getServlet();
assertNotNull( servlet );
ArchivaConfiguration archivaConfiguration = servlet.getConfiguration();
Configuration c = archivaConfiguration.getConfiguration();
ManagedRepositoryConfiguration repo = new ManagedRepositoryConfiguration();
repo.setId( NEW_REPOSITORY_ID );
repo.setName( NEW_REPOSITORY_NAME );
File repoRoot = new File( "target/test-repository-root" );
if ( !repoRoot.exists() )
{
repoRoot.mkdirs();
}
repo.setLocation( repoRoot.getAbsolutePath() );
c.addManagedRepository( repo );
saveConfiguration( archivaConfiguration );
ManagedRepository repository = servlet.getRepository( NEW_REPOSITORY_ID );
assertNotNull( repository );
assertEquals( NEW_REPOSITORY_NAME, repository.getName() );