@Test public void testSave() { final Path path = mock(Path.class); final String content = "content"; final Metadata metadata = mock(Metadata.class); final String comment = "comment"; doReturn(path).when(service).save(path, content, metadata, comment, DeploymentMode.FORCED); service.save(path, content, metadata, comment); verify(service).save(path, content, metadata, comment, DeploymentMode.FORCED); }
@Override public Path save(final Path pomPath, final String pomXml, final Metadata metadata, final String comment, final DeploymentMode mode) { if (DeploymentMode.VALIDATED.equals(mode)) { checkRepositories(pomPath, pomXml); } try { final org.uberfire.java.nio.file.Path nioPomPath = Paths.convert(pomPath); ioService.startBatch(nioPomPath.getFileSystem()); ioService.write(nioPomPath, pomXml, metadataService.setUpAttributes(pomPath, metadata), commentedOptionFactory.makeCommentedOption(comment)); return pomPath; } catch (Exception e) { throw ExceptionUtilities.handleException(e); } finally { ioService.endBatch(); } }
PomEditorServiceImpl implements PomEditorService { @Override public Path save(final Path pomPath, final String pomXml, final Metadata metadata, final String comment, final DeploymentMode mode) { if (DeploymentMode.VALIDATED.equals(mode)) { checkRepositories(pomPath, pomXml); } try { final org.uberfire.java.nio.file.Path nioPomPath = Paths.convert(pomPath); ioService.startBatch(nioPomPath.getFileSystem()); ioService.write(nioPomPath, pomXml, metadataService.setUpAttributes(pomPath, metadata), commentedOptionFactory.makeCommentedOption(comment)); return pomPath; } catch (Exception e) { throw ExceptionUtilities.handleException(e); } finally { ioService.endBatch(); } } }
PomEditorServiceImpl implements PomEditorService { @Override public Path save(final Path pomPath, final String pomXml, final Metadata metadata, final String comment, final DeploymentMode mode) { if (DeploymentMode.VALIDATED.equals(mode)) { checkRepositories(pomPath, pomXml); } try { final org.uberfire.java.nio.file.Path nioPomPath = Paths.convert(pomPath); ioService.startBatch(nioPomPath.getFileSystem()); ioService.write(nioPomPath, pomXml, metadataService.setUpAttributes(pomPath, metadata), commentedOptionFactory.makeCommentedOption(comment)); return pomPath; } catch (Exception e) { throw ExceptionUtilities.handleException(e); } finally { ioService.endBatch(); } } PomEditorServiceImpl(); @Inject  PomEditorServiceImpl(final @Named("ioStrategy") IOService ioService,
                                final DefaultEditorService defaultEditorService,
                                final MetadataServerSideService metadataService,
                                final CommentedOptionFactory commentedOptionFactory,
                                final KieModuleService moduleService,
                                final POMContentHandler pomContentHandler,
                                final ModuleRepositoryResolver repositoryResolver,
                                final ModuleRepositoriesService moduleRepositoriesService,
                                final RenameService renameService,
                                final SaveAndRenameServiceImpl<String, Metadata> saveAndRenameService); }
PomEditorServiceImpl implements PomEditorService { @Override public Path save(final Path pomPath, final String pomXml, final Metadata metadata, final String comment, final DeploymentMode mode) { if (DeploymentMode.VALIDATED.equals(mode)) { checkRepositories(pomPath, pomXml); } try { final org.uberfire.java.nio.file.Path nioPomPath = Paths.convert(pomPath); ioService.startBatch(nioPomPath.getFileSystem()); ioService.write(nioPomPath, pomXml, metadataService.setUpAttributes(pomPath, metadata), commentedOptionFactory.makeCommentedOption(comment)); return pomPath; } catch (Exception e) { throw ExceptionUtilities.handleException(e); } finally { ioService.endBatch(); } } PomEditorServiceImpl(); @Inject  PomEditorServiceImpl(final @Named("ioStrategy") IOService ioService,
                                final DefaultEditorService defaultEditorService,
                                final MetadataServerSideService metadataService,
                                final CommentedOptionFactory commentedOptionFactory,
                                final KieModuleService moduleService,
                                final POMContentHandler pomContentHandler,
                                final ModuleRepositoryResolver repositoryResolver,
                                final ModuleRepositoriesService moduleRepositoriesService,
                                final RenameService renameService,
                                final SaveAndRenameServiceImpl<String, Metadata> saveAndRenameService); @PostConstruct void init(); @Override DefaultEditorContent loadContent(final Path path); @Override Path save(final Path pomPath,
                     final String pomXml,
                     final Metadata metadata,
                     final String comment,
                     final DeploymentMode mode); @Override Path saveAndRename(final Path path,
                              final String newFileName,
                              final Metadata metadata,
                              final String content,
                              final String comment); @Override Path rename(final Path path,
                       final String newName,
                       final String comment); @Override Path save(final Path path,
                     final String content,
                     final Metadata metadata,
                     final String comment); }
PomEditorServiceImpl implements PomEditorService { @Override public Path save(final Path pomPath, final String pomXml, final Metadata metadata, final String comment, final DeploymentMode mode) { if (DeploymentMode.VALIDATED.equals(mode)) { checkRepositories(pomPath, pomXml); } try { final org.uberfire.java.nio.file.Path nioPomPath = Paths.convert(pomPath); ioService.startBatch(nioPomPath.getFileSystem()); ioService.write(nioPomPath, pomXml, metadataService.setUpAttributes(pomPath, metadata), commentedOptionFactory.makeCommentedOption(comment)); return pomPath; } catch (Exception e) { throw ExceptionUtilities.handleException(e); } finally { ioService.endBatch(); } } PomEditorServiceImpl(); @Inject  PomEditorServiceImpl(final @Named("ioStrategy") IOService ioService,
                                final DefaultEditorService defaultEditorService,
                                final MetadataServerSideService metadataService,
                                final CommentedOptionFactory commentedOptionFactory,
                                final KieModuleService moduleService,
                                final POMContentHandler pomContentHandler,
                                final ModuleRepositoryResolver repositoryResolver,
                                final ModuleRepositoriesService moduleRepositoriesService,
                                final RenameService renameService,
                                final SaveAndRenameServiceImpl<String, Metadata> saveAndRenameService); @PostConstruct void init(); @Override DefaultEditorContent loadContent(final Path path); @Override Path save(final Path pomPath,
                     final String pomXml,
                     final Metadata metadata,
                     final String comment,
                     final DeploymentMode mode); @Override Path saveAndRename(final Path path,
                              final String newFileName,
                              final Metadata metadata,
                              final String content,
                              final String comment); @Override Path rename(final Path path,
                       final String newName,
                       final String comment); @Override Path save(final Path path,
                     final String content,
                     final Metadata metadata,
                     final String comment);  }