@Test public void testInstall() { KieModule module = mock(KieModule.class); Path pomXMLPath = mock(Path.class); POM pom = mock(POM.class); when(moduleService.resolveModule(eq(root))).thenReturn(module); when(module.getPomXMLPath()).thenReturn(pomXMLPath); when(pomService.load(eq(pomXMLPath))).thenReturn(pom); Dependencies dependencies = new Dependencies(Collections.emptyList()); when(pom.getDependencies()).thenReturn(dependencies); org.guvnor.common.services.shared.metadata.model.Metadata projMetadata = mock(org.guvnor.common.services.shared.metadata.model.Metadata.class); when(metadataService.getMetadata(pomXMLPath)).thenReturn(projMetadata); tested.install(Collections.singleton(WID), this.metadata); verify(pomService, times(1)) .save(eq(pomXMLPath), eq(pom), eq(projMetadata), anyString(), eq(false)); }
@SuppressWarnings("all") public void install(final Collection<WorkItemDefinition> items, final Metadata metadata) { final Module module = moduleService.resolveModule(metadata.getRoot()); final Path pomXMLPath = module.getPomXMLPath(); final POM projectPOM = pomService.load(pomXMLPath); if (projectPOM != null) { final Dependencies projectDependencies = projectPOM.getDependencies(); final Set<Dependency> widDependencies = items.stream() .flatMap(wid -> wid.getDependencies().stream()) .filter(d -> !projectDependencies.contains(d)) .collect(Collectors.toSet()); projectDependencies.addAll(widDependencies); pomService.save(pomXMLPath, projectPOM, metadataService.getMetadata(pomXMLPath), INSALL_MESSAGE, false); } }
WorkItemDefinitionProjectInstaller { @SuppressWarnings("all") public void install(final Collection<WorkItemDefinition> items, final Metadata metadata) { final Module module = moduleService.resolveModule(metadata.getRoot()); final Path pomXMLPath = module.getPomXMLPath(); final POM projectPOM = pomService.load(pomXMLPath); if (projectPOM != null) { final Dependencies projectDependencies = projectPOM.getDependencies(); final Set<Dependency> widDependencies = items.stream() .flatMap(wid -> wid.getDependencies().stream()) .filter(d -> !projectDependencies.contains(d)) .collect(Collectors.toSet()); projectDependencies.addAll(widDependencies); pomService.save(pomXMLPath, projectPOM, metadataService.getMetadata(pomXMLPath), INSALL_MESSAGE, false); } } }
WorkItemDefinitionProjectInstaller { @SuppressWarnings("all") public void install(final Collection<WorkItemDefinition> items, final Metadata metadata) { final Module module = moduleService.resolveModule(metadata.getRoot()); final Path pomXMLPath = module.getPomXMLPath(); final POM projectPOM = pomService.load(pomXMLPath); if (projectPOM != null) { final Dependencies projectDependencies = projectPOM.getDependencies(); final Set<Dependency> widDependencies = items.stream() .flatMap(wid -> wid.getDependencies().stream()) .filter(d -> !projectDependencies.contains(d)) .collect(Collectors.toSet()); projectDependencies.addAll(widDependencies); pomService.save(pomXMLPath, projectPOM, metadataService.getMetadata(pomXMLPath), INSALL_MESSAGE, false); } } protected  WorkItemDefinitionProjectInstaller(); @Inject  WorkItemDefinitionProjectInstaller(final POMService pomService,
                                              final MetadataService metadataService,
                                              final KieModuleService moduleService); }
WorkItemDefinitionProjectInstaller { @SuppressWarnings("all") public void install(final Collection<WorkItemDefinition> items, final Metadata metadata) { final Module module = moduleService.resolveModule(metadata.getRoot()); final Path pomXMLPath = module.getPomXMLPath(); final POM projectPOM = pomService.load(pomXMLPath); if (projectPOM != null) { final Dependencies projectDependencies = projectPOM.getDependencies(); final Set<Dependency> widDependencies = items.stream() .flatMap(wid -> wid.getDependencies().stream()) .filter(d -> !projectDependencies.contains(d)) .collect(Collectors.toSet()); projectDependencies.addAll(widDependencies); pomService.save(pomXMLPath, projectPOM, metadataService.getMetadata(pomXMLPath), INSALL_MESSAGE, false); } } protected  WorkItemDefinitionProjectInstaller(); @Inject  WorkItemDefinitionProjectInstaller(final POMService pomService,
                                              final MetadataService metadataService,
                                              final KieModuleService moduleService); @SuppressWarnings("all") void install(final Collection<WorkItemDefinition> items,
                        final Metadata metadata); }
WorkItemDefinitionProjectInstaller { @SuppressWarnings("all") public void install(final Collection<WorkItemDefinition> items, final Metadata metadata) { final Module module = moduleService.resolveModule(metadata.getRoot()); final Path pomXMLPath = module.getPomXMLPath(); final POM projectPOM = pomService.load(pomXMLPath); if (projectPOM != null) { final Dependencies projectDependencies = projectPOM.getDependencies(); final Set<Dependency> widDependencies = items.stream() .flatMap(wid -> wid.getDependencies().stream()) .filter(d -> !projectDependencies.contains(d)) .collect(Collectors.toSet()); projectDependencies.addAll(widDependencies); pomService.save(pomXMLPath, projectPOM, metadataService.getMetadata(pomXMLPath), INSALL_MESSAGE, false); } } protected  WorkItemDefinitionProjectInstaller(); @Inject  WorkItemDefinitionProjectInstaller(final POMService pomService,
                                              final MetadataService metadataService,
                                              final KieModuleService moduleService); @SuppressWarnings("all") void install(final Collection<WorkItemDefinition> items,
                        final Metadata metadata);  }