throws Exception
{
String groupId = "group-id";
Maven2GroupRepositoryTemplate template =
(Maven2GroupRepositoryTemplate) getRepositoryTemplates()
.getTemplates(Maven2GroupRepositoryTemplate.class).pick();
template.getConfigurableRepository().setId(groupId);
template.getConfigurableRepository().setName("group-name");
// Assert.assertEquals( "group-name", group.getName() );
template.getConfigurableRepository().setExposed(true);
template.getConfigurableRepository().setLocalStatus(LocalStatus.IN_SERVICE);
template.getExternalConfiguration(true).addMemberRepositoryId("central");
template.create();
boolean found = false;
// verify nexus config in memory
for (CRepository cRepo : this.nexusConfiguration.getConfigurationModel().getRepositories()) {
if (groupId.equals(cRepo.getId())) {
System.out.println("ummmm");
found = true;
// make sure something is there, there are already UT, to validate the rest
Assert.assertEquals("group-name", cRepo.getName());
// check the members (they are in the external config)
Xpp3Dom dom = (Xpp3Dom) cRepo.getExternalConfiguration();
Xpp3Dom memberDom = dom.getChild("memberRepositories");
Assert.assertEquals(1, memberDom.getChildCount());
Assert.assertEquals("central", memberDom.getChild(0).getValue());
}
}
Assert.assertTrue("Group Repo is not in memory.", found);
// reload the config and see if the repo is still there
this.nexusConfiguration.loadConfiguration(true);
found = false;
// verify nexus config in memory
for (CRepository cRepo : this.nexusConfiguration.getConfigurationModel().getRepositories()) {
if (groupId.equals(cRepo.getId())) {
found = true;
// make sure something is there, there are already UT, to validate the rest
Assert.assertEquals("group-name", template.getConfigurableRepository().getName());
}
}
Assert.assertTrue("Group Repo is not in file.", found);
}