@Test public void testAddAndRemoveModuleRepository() { 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); when(repositoryResolver.getRemoteRepositoriesMetaData(module)).thenReturn(new HashSet<MavenRepositoryMetadata>() {{ add(new MavenRepositoryMetadata("remote-id", "remote-url", MavenRepositorySource.PROJECT)); }}); 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(1, saved.getRepositories().size()); final ModuleRepositories.ModuleRepository repository = saved.getRepositories().iterator().next(); assertTrue(repository.isIncluded()); assertEquals("remote-id", repository.getMetadata().getId()); assertEquals("remote-url", repository.getMetadata().getUrl()); assertEquals(MavenRepositorySource.PROJECT, repository.getMetadata().getSource()); }
public void onResourceUpdated(@Observes final ResourceUpdatedEvent event) { if (observablePOMFile.accept(event.getPath())) { syncModuleRepositories(event.getPath()); } }
ModuleRepositoriesSynchronizer { public void onResourceUpdated(@Observes final ResourceUpdatedEvent event) { if (observablePOMFile.accept(event.getPath())) { syncModuleRepositories(event.getPath()); } } }
ModuleRepositoriesSynchronizer { public void onResourceUpdated(@Observes final ResourceUpdatedEvent event) { if (observablePOMFile.accept(event.getPath())) { syncModuleRepositories(event.getPath()); } } ModuleRepositoriesSynchronizer(); @Inject  ModuleRepositoriesSynchronizer(final @Named("ioStrategy") IOService ioService,
                                          final ModuleRepositoryResolver repositoryResolver,
                                          final ModuleRepositoriesService moduleRepositoriesService,
                                          final ObservablePOMFile observablePOMFile,
                                          final KieModuleFactory moduleFactory); }
ModuleRepositoriesSynchronizer { public void onResourceUpdated(@Observes final ResourceUpdatedEvent event) { if (observablePOMFile.accept(event.getPath())) { syncModuleRepositories(event.getPath()); } } ModuleRepositoriesSynchronizer(); @Inject  ModuleRepositoriesSynchronizer(final @Named("ioStrategy") IOService ioService,
                                          final ModuleRepositoryResolver repositoryResolver,
                                          final ModuleRepositoriesService moduleRepositoriesService,
                                          final ObservablePOMFile observablePOMFile,
                                          final KieModuleFactory moduleFactory); void onResourceUpdated(@Observes final ResourceUpdatedEvent event); void onBatchResourceChanges(@Observes final ResourceBatchChangesEvent resourceBatchChangesEvent); }
ModuleRepositoriesSynchronizer { public void onResourceUpdated(@Observes final ResourceUpdatedEvent event) { if (observablePOMFile.accept(event.getPath())) { syncModuleRepositories(event.getPath()); } } ModuleRepositoriesSynchronizer(); @Inject  ModuleRepositoriesSynchronizer(final @Named("ioStrategy") IOService ioService,
                                          final ModuleRepositoryResolver repositoryResolver,
                                          final ModuleRepositoriesService moduleRepositoriesService,
                                          final ObservablePOMFile observablePOMFile,
                                          final KieModuleFactory moduleFactory); void onResourceUpdated(@Observes final ResourceUpdatedEvent event); void onBatchResourceChanges(@Observes final ResourceBatchChangesEvent resourceBatchChangesEvent);  }