use of org.guvnor.common.services.project.model.ModuleRepositories in project kie-wb-common by kiegroup.
the class ModuleRepositoriesSynchronizerTest method testRemoveModuleRepository.
@Test
public void testRemoveModuleRepository() {
final ResourceUpdatedEvent event = new ResourceUpdatedEvent(pomPath, "", sessionInfo);
final Set<ModuleRepositories.ModuleRepository> repositories = new HashSet<ModuleRepositories.ModuleRepository>() {
{
add(new ModuleRepositories.ModuleRepository(true, new MavenRepositoryMetadata("local-id", "local-url", MavenRepositorySource.LOCAL)));
}
};
final ModuleRepositories moduleRepositories = new ModuleRepositories(repositories);
when(moduleRepositoriesService.load(moduleRepositoriesPath)).thenReturn(moduleRepositories);
synchronizer.onResourceUpdated(event);
final ArgumentCaptor<ModuleRepositories> moduleRepositoriesArgumentCaptor = ArgumentCaptor.forClass(ModuleRepositories.class);
verify(moduleRepositoriesService, times(1)).save(eq(moduleRepositoriesPath), moduleRepositoriesArgumentCaptor.capture(), any(String.class));
final ModuleRepositories saved = moduleRepositoriesArgumentCaptor.getValue();
assertNotNull(saved);
assertEquals(0, saved.getRepositories().size());
}
Aggregations