@Test public void testEnsurePackageStructureWhenNoValuesProvided() { prepareEnsurePackageTest(); assertNull(serviceHelper.ensurePackageStructure(module, null)); assertNull(serviceHelper.ensurePackageStructure(module, "")); }
public Package ensurePackageStructure(final Module module, final String packageName) { if (packageName == null || "".equals(packageName) || module == null) { return null; } final Package defaultPackage = moduleService.resolveDefaultPackage(module); final Path defaultPackagePath = Paths.convert(defaultPackage.getPackageMainSrcPath()); final String newPackageName = packageName.replace(".", "/"); final Path newPackagePath = defaultPackagePath.resolve(newPackageName); if (!ioService.exists(newPackagePath)) { return moduleService.newPackage(defaultPackage, packageName); } else { return moduleService.resolvePackage(Paths.convert(newPackagePath)); } }
DataModelerServiceHelper { public Package ensurePackageStructure(final Module module, final String packageName) { if (packageName == null || "".equals(packageName) || module == null) { return null; } final Package defaultPackage = moduleService.resolveDefaultPackage(module); final Path defaultPackagePath = Paths.convert(defaultPackage.getPackageMainSrcPath()); final String newPackageName = packageName.replace(".", "/"); final Path newPackagePath = defaultPackagePath.resolve(newPackageName); if (!ioService.exists(newPackagePath)) { return moduleService.newPackage(defaultPackage, packageName); } else { return moduleService.resolvePackage(Paths.convert(newPackagePath)); } } }
DataModelerServiceHelper { public Package ensurePackageStructure(final Module module, final String packageName) { if (packageName == null || "".equals(packageName) || module == null) { return null; } final Package defaultPackage = moduleService.resolveDefaultPackage(module); final Path defaultPackagePath = Paths.convert(defaultPackage.getPackageMainSrcPath()); final String newPackageName = packageName.replace(".", "/"); final Path newPackagePath = defaultPackagePath.resolve(newPackageName); if (!ioService.exists(newPackagePath)) { return moduleService.newPackage(defaultPackage, packageName); } else { return moduleService.resolvePackage(Paths.convert(newPackagePath)); } } DataModelerServiceHelper(); @Inject  DataModelerServiceHelper(final KieModuleService moduleService,
                                    final @Named("ioStrategy") IOService ioService,
                                    final CommentedOptionFactory commentedOptionFactory); }
DataModelerServiceHelper { public Package ensurePackageStructure(final Module module, final String packageName) { if (packageName == null || "".equals(packageName) || module == null) { return null; } final Package defaultPackage = moduleService.resolveDefaultPackage(module); final Path defaultPackagePath = Paths.convert(defaultPackage.getPackageMainSrcPath()); final String newPackageName = packageName.replace(".", "/"); final Path newPackagePath = defaultPackagePath.resolve(newPackageName); if (!ioService.exists(newPackagePath)) { return moduleService.newPackage(defaultPackage, packageName); } else { return moduleService.resolvePackage(Paths.convert(newPackagePath)); } } DataModelerServiceHelper(); @Inject  DataModelerServiceHelper(final KieModuleService moduleService,
                                    final @Named("ioStrategy") IOService ioService,
                                    final CommentedOptionFactory commentedOptionFactory); List<DataModelerError> toDataModelerError(List<DriverError> errors); List<DataModelerError> toDataModelerError(final List<SyntaxError> syntaxErrors,
                                                     final Path file); List<ValidationMessage> toValidationMessage(final List<DataModelerError> errors); CommentedOption makeCommentedOption(final String commitMessage); Package ensurePackageStructure(final Module module,
                                          final String packageName); Set<String> resolvePackages(final Module project); String calculateClassName(final Module module,
                                     final org.uberfire.backend.vfs.Path path); Path calculateFilePath(final String className,
                                  final Path javaPath); }
DataModelerServiceHelper { public Package ensurePackageStructure(final Module module, final String packageName) { if (packageName == null || "".equals(packageName) || module == null) { return null; } final Package defaultPackage = moduleService.resolveDefaultPackage(module); final Path defaultPackagePath = Paths.convert(defaultPackage.getPackageMainSrcPath()); final String newPackageName = packageName.replace(".", "/"); final Path newPackagePath = defaultPackagePath.resolve(newPackageName); if (!ioService.exists(newPackagePath)) { return moduleService.newPackage(defaultPackage, packageName); } else { return moduleService.resolvePackage(Paths.convert(newPackagePath)); } } DataModelerServiceHelper(); @Inject  DataModelerServiceHelper(final KieModuleService moduleService,
                                    final @Named("ioStrategy") IOService ioService,
                                    final CommentedOptionFactory commentedOptionFactory); List<DataModelerError> toDataModelerError(List<DriverError> errors); List<DataModelerError> toDataModelerError(final List<SyntaxError> syntaxErrors,
                                                     final Path file); List<ValidationMessage> toValidationMessage(final List<DataModelerError> errors); CommentedOption makeCommentedOption(final String commitMessage); Package ensurePackageStructure(final Module module,
                                          final String packageName); Set<String> resolvePackages(final Module project); String calculateClassName(final Module module,
                                     final org.uberfire.backend.vfs.Path path); Path calculateFilePath(final String className,
                                  final Path javaPath);  }