throws Exception
{
final RepositoryTypeRegistry repositoryTypeRegistry = lookup(RepositoryTypeRegistry.class);
final RepositoryRegistry repositoryRegistry = lookup(RepositoryRegistry.class);
final NexusConfiguration nexusConfiguration = lookup(NexusConfiguration.class);
final TemplateManager templateManager = lookup(TemplateManager.class);
// register this
repositoryTypeRegistry.registerRepositoryTypeDescriptors(new RepositoryTypeDescriptor(Repository.class,
Nexus4807RepositoryImpl.ID, "foo"));
// load config
nexusConfiguration.loadConfiguration();
// assert we have peter not present
try {
repositoryRegistry.getRepository("peter");
Assert.fail("Peter should not be present!");
}
catch (NoSuchRepositoryException e) {
// good, it should be not present
}
// create this new repo type
final RepositoryTemplate template =
(RepositoryTemplate) templateManager.getTemplates().getTemplateById("nexus4807");
template.getConfigurableRepository().setId("peter");
template.getConfigurableRepository().setName("We all love Peter!");
final Repository repository = template.create();
// do some simple assertion