@Test public void ensureDependenciesTest() { service.ensureDependencies(kieModuleMock); verify(pomServiceMock, times(1)).save(any(Path.class), any(POM.class), any(Metadata.class), anyString()); reset(pomServiceMock); when(dependenciesMock.containsDependency(any())).thenReturn(true); service.ensureDependencies(kieModuleMock); verify(pomServiceMock, never()).save(any(Path.class), any(POM.class), any(Metadata.class), anyString()); }
protected boolean ensureDependencies(KieModule module) { POM projectPom = module.getPom(); Dependencies dependencies = projectPom.getDependencies(); String kieVersion = props.getProperty(KIE_VERSION); boolean toSave = false; Path modulePomXMLPath = module.getPomXMLPath(); for (GAV oldDependency : getOldDependencies()) { toSave |= removeFromPomIfNecessary(dependencies, oldDependency); } boolean oldDependenciesExist = toSave; for (GAV gav : getDependencies(kieVersion)) { toSave |= editPomIfNecessary(dependencies, gav); } if (toSave) { pomService.save(modulePomXMLPath, projectPom, null, ""); } return oldDependenciesExist; }
ScenarioSimulationServiceImpl extends KieService<ScenarioSimulationModelContent> implements ScenarioSimulationService { protected boolean ensureDependencies(KieModule module) { POM projectPom = module.getPom(); Dependencies dependencies = projectPom.getDependencies(); String kieVersion = props.getProperty(KIE_VERSION); boolean toSave = false; Path modulePomXMLPath = module.getPomXMLPath(); for (GAV oldDependency : getOldDependencies()) { toSave |= removeFromPomIfNecessary(dependencies, oldDependency); } boolean oldDependenciesExist = toSave; for (GAV gav : getDependencies(kieVersion)) { toSave |= editPomIfNecessary(dependencies, gav); } if (toSave) { pomService.save(modulePomXMLPath, projectPom, null, ""); } return oldDependenciesExist; } }
ScenarioSimulationServiceImpl extends KieService<ScenarioSimulationModelContent> implements ScenarioSimulationService { protected boolean ensureDependencies(KieModule module) { POM projectPom = module.getPom(); Dependencies dependencies = projectPom.getDependencies(); String kieVersion = props.getProperty(KIE_VERSION); boolean toSave = false; Path modulePomXMLPath = module.getPomXMLPath(); for (GAV oldDependency : getOldDependencies()) { toSave |= removeFromPomIfNecessary(dependencies, oldDependency); } boolean oldDependenciesExist = toSave; for (GAV gav : getDependencies(kieVersion)) { toSave |= editPomIfNecessary(dependencies, gav); } if (toSave) { pomService.save(modulePomXMLPath, projectPom, null, ""); } return oldDependenciesExist; } ScenarioSimulationServiceImpl(); @Inject  ScenarioSimulationServiceImpl(final SessionInfo sessionInfo); }
ScenarioSimulationServiceImpl extends KieService<ScenarioSimulationModelContent> implements ScenarioSimulationService { protected boolean ensureDependencies(KieModule module) { POM projectPom = module.getPom(); Dependencies dependencies = projectPom.getDependencies(); String kieVersion = props.getProperty(KIE_VERSION); boolean toSave = false; Path modulePomXMLPath = module.getPomXMLPath(); for (GAV oldDependency : getOldDependencies()) { toSave |= removeFromPomIfNecessary(dependencies, oldDependency); } boolean oldDependenciesExist = toSave; for (GAV gav : getDependencies(kieVersion)) { toSave |= editPomIfNecessary(dependencies, gav); } if (toSave) { pomService.save(modulePomXMLPath, projectPom, null, ""); } return oldDependenciesExist; } ScenarioSimulationServiceImpl(); @Inject  ScenarioSimulationServiceImpl(final SessionInfo sessionInfo); @PostConstruct void init(); @Override SimulationRunResult runScenario(final Path path,
                                           final ScesimModelDescriptor simulationDescriptor,
                                           final List<ScenarioWithIndex> scenarios,
                                           final Settings settings,
                                           final Background background); @Override Path create(final Path context,
                       final String fileName,
                       final ScenarioSimulationModel content,
                       final String comment); @Override Path create(Path context, String fileName, ScenarioSimulationModel content, String comment, Type type, String value); @Override ScenarioSimulationModel load(final Path path); @Override Path save(final Path resource,
                     final ScenarioSimulationModel content,
                     final Metadata metadata,
                     final String comment); @Override void delete(final Path path,
                       final String comment); @Override Path rename(final Path path,
                       final String newName,
                       final String comment); @Override Path copy(final Path path,
                     final String newName,
                     final String comment); @Override Path copy(final Path path,
                     final String newName,
                     final Path targetDirectory,
                     final String comment); @Override Path saveAndRename(final Path path,
                              final String newFileName,
                              final Metadata metadata,
                              final ScenarioSimulationModel content,
                              final String comment); @Override List<FactMappingValidationError> validate(Simulation simulation, Settings settings, Path path); }
ScenarioSimulationServiceImpl extends KieService<ScenarioSimulationModelContent> implements ScenarioSimulationService { protected boolean ensureDependencies(KieModule module) { POM projectPom = module.getPom(); Dependencies dependencies = projectPom.getDependencies(); String kieVersion = props.getProperty(KIE_VERSION); boolean toSave = false; Path modulePomXMLPath = module.getPomXMLPath(); for (GAV oldDependency : getOldDependencies()) { toSave |= removeFromPomIfNecessary(dependencies, oldDependency); } boolean oldDependenciesExist = toSave; for (GAV gav : getDependencies(kieVersion)) { toSave |= editPomIfNecessary(dependencies, gav); } if (toSave) { pomService.save(modulePomXMLPath, projectPom, null, ""); } return oldDependenciesExist; } ScenarioSimulationServiceImpl(); @Inject  ScenarioSimulationServiceImpl(final SessionInfo sessionInfo); @PostConstruct void init(); @Override SimulationRunResult runScenario(final Path path,
                                           final ScesimModelDescriptor simulationDescriptor,
                                           final List<ScenarioWithIndex> scenarios,
                                           final Settings settings,
                                           final Background background); @Override Path create(final Path context,
                       final String fileName,
                       final ScenarioSimulationModel content,
                       final String comment); @Override Path create(Path context, String fileName, ScenarioSimulationModel content, String comment, Type type, String value); @Override ScenarioSimulationModel load(final Path path); @Override Path save(final Path resource,
                     final ScenarioSimulationModel content,
                     final Metadata metadata,
                     final String comment); @Override void delete(final Path path,
                       final String comment); @Override Path rename(final Path path,
                       final String newName,
                       final String comment); @Override Path copy(final Path path,
                     final String newName,
                     final String comment); @Override Path copy(final Path path,
                     final String newName,
                     final Path targetDirectory,
                     final String comment); @Override Path saveAndRename(final Path path,
                              final String newFileName,
                              final Metadata metadata,
                              final ScenarioSimulationModel content,
                              final String comment); @Override List<FactMappingValidationError> validate(Simulation simulation, Settings settings, Path path);  }