@Test public void testSetUpProjectStructure() throws Exception { Path pathToProjectRoot = mock(Path.class); org.uberfire.java.nio.file.Path directory = setUpPathToProjectRoot(pathToProjectRoot); org.uberfire.java.nio.file.Path mainJava = mock(org.uberfire.java.nio.file.Path.class); setUpDirectory(directory, "src/main/java", mainJava); org.uberfire.java.nio.file.Path mainResources = mock(org.uberfire.java.nio.file.Path.class); setUpDirectory(directory, "src/main/resources", mainResources); org.uberfire.java.nio.file.Path testJava = mock(org.uberfire.java.nio.file.Path.class); setUpDirectory(directory, "src/test/java", testJava); org.uberfire.java.nio.file.Path testResources = mock(org.uberfire.java.nio.file.Path.class); setUpDirectory(directory, "src/test/resources", testResources); org.uberfire.java.nio.file.Path kmodule = mock(org.uberfire.java.nio.file.Path.class); setUpDirectory(directory, "src/main/resources/META-INF/kmodule.xml", kmodule); serviceImpl.setUpKModule(pathToProjectRoot); verify(ioService).write(eq(kmodule), anyString()); }
@Override public Path setUpKModule(final Path path) { try { final org.uberfire.java.nio.file.Path pathToKModuleXML = Paths.convert(path); if (ioService.exists(pathToKModuleXML)) { throw new FileAlreadyExistsException(pathToKModuleXML.toString()); } else { ioService.write(pathToKModuleXML, moduleContentHandler.toString(new KModuleModel())); return Paths.convert(pathToKModuleXML); } } catch (Exception e) { throw ExceptionUtilities.handleException(e); } }
KModuleServiceImpl implements KModuleService { @Override public Path setUpKModule(final Path path) { try { final org.uberfire.java.nio.file.Path pathToKModuleXML = Paths.convert(path); if (ioService.exists(pathToKModuleXML)) { throw new FileAlreadyExistsException(pathToKModuleXML.toString()); } else { ioService.write(pathToKModuleXML, moduleContentHandler.toString(new KModuleModel())); return Paths.convert(pathToKModuleXML); } } catch (Exception e) { throw ExceptionUtilities.handleException(e); } } }
KModuleServiceImpl implements KModuleService { @Override public Path setUpKModule(final Path path) { try { final org.uberfire.java.nio.file.Path pathToKModuleXML = Paths.convert(path); if (ioService.exists(pathToKModuleXML)) { throw new FileAlreadyExistsException(pathToKModuleXML.toString()); } else { ioService.write(pathToKModuleXML, moduleContentHandler.toString(new KModuleModel())); return Paths.convert(pathToKModuleXML); } } catch (Exception e) { throw ExceptionUtilities.handleException(e); } } KModuleServiceImpl(); @Inject  KModuleServiceImpl(final @Named("ioStrategy") IOService ioService,
                              final KieModuleService moduleService,
                              final MetadataService metadataService,
                              final KModuleContentHandler moduleContentHandler); }
KModuleServiceImpl implements KModuleService { @Override public Path setUpKModule(final Path path) { try { final org.uberfire.java.nio.file.Path pathToKModuleXML = Paths.convert(path); if (ioService.exists(pathToKModuleXML)) { throw new FileAlreadyExistsException(pathToKModuleXML.toString()); } else { ioService.write(pathToKModuleXML, moduleContentHandler.toString(new KModuleModel())); return Paths.convert(pathToKModuleXML); } } catch (Exception e) { throw ExceptionUtilities.handleException(e); } } KModuleServiceImpl(); @Inject  KModuleServiceImpl(final @Named("ioStrategy") IOService ioService,
                              final KieModuleService moduleService,
                              final MetadataService metadataService,
                              final KModuleContentHandler moduleContentHandler); @Override boolean isKModule(final Path resource); @Override Path setUpKModule(final Path path); @Override KModuleModel load(final Path path); @Override Path save(final Path path,
                     final KModuleModel content,
                     final Metadata metadata,
                     final String comment); }
KModuleServiceImpl implements KModuleService { @Override public Path setUpKModule(final Path path) { try { final org.uberfire.java.nio.file.Path pathToKModuleXML = Paths.convert(path); if (ioService.exists(pathToKModuleXML)) { throw new FileAlreadyExistsException(pathToKModuleXML.toString()); } else { ioService.write(pathToKModuleXML, moduleContentHandler.toString(new KModuleModel())); return Paths.convert(pathToKModuleXML); } } catch (Exception e) { throw ExceptionUtilities.handleException(e); } } KModuleServiceImpl(); @Inject  KModuleServiceImpl(final @Named("ioStrategy") IOService ioService,
                              final KieModuleService moduleService,
                              final MetadataService metadataService,
                              final KModuleContentHandler moduleContentHandler); @Override boolean isKModule(final Path resource); @Override Path setUpKModule(final Path path); @Override KModuleModel load(final Path path); @Override Path save(final Path path,
                     final KModuleModel content,
                     final Metadata metadata,
                     final String comment);  }