{
RepositoryServlet servlet = (RepositoryServlet) sc.newInvocation( REQUEST_PATH ).getServlet();
assertNotNull( servlet );
Configuration c = archivaConfiguration.getConfiguration();
ManagedRepositoryConfiguration repo = new ManagedRepositoryConfiguration();
repo.setId( NEW_REPOSITORY_ID );
repo.setName( NEW_REPOSITORY_NAME );
File repoRoot = new File( getBasedir(), "target/test-repository-root" );
if ( !repoRoot.exists() )
{
repoRoot.mkdirs();
}
repo.setLocation( repoRoot.getAbsolutePath() );
c.addManagedRepository( repo );
saveConfiguration();
ManagedRepositoryConfiguration repository = servlet.getRepository( NEW_REPOSITORY_ID );
assertNotNull( repository );
assertEquals( NEW_REPOSITORY_NAME, repository.getName() );
// check other is still intact
assertRepositoryValid( servlet, REPOID_INTERNAL );
}