GuidedDecisionTableEditorServiceImpl extends KieService<GuidedDecisionTableEditorContent> implements GuidedDecisionTableEditorService { @Override public Path create(final Path context, final String fileName, final GuidedDecisionTable52 content, final String comment) { try { final Package pkg = moduleService.resolvePackage(context); final String packageName = (pkg == null ? null : pkg.getPackageName()); content.setPackageName(packageName); final org.uberfire.java.nio.file.Path nioPath = Paths.convert(context).resolve(fileName); final Path newPath = Paths.convert(nioPath); if (ioService.exists(nioPath)) { throw new FileAlreadyExistsException(nioPath.toString()); } ioService.write(nioPath, GuidedDTXMLPersistence.getInstance().marshal(content), commentedOptionFactory.makeCommentedOption(comment)); return newPath; } catch (Exception e) { throw ExceptionUtilities.handleException(e); } } GuidedDecisionTableEditorServiceImpl(); @Inject  GuidedDecisionTableEditorServiceImpl(final @Named("ioStrategy") IOService ioService,
                                                final CopyService copyService,
                                                final DeleteService deleteService,
                                                final RenameService renameService,
                                                final DataModelService dataModelService,
                                                final WorkItemsEditorService workItemsService,
                                                final KieModuleService moduleService,
                                                final VersionRecordService versionRecordService,
                                                final GuidedDecisionTableGraphEditorService dtableGraphService,
                                                final DecisionTableGuidedToDecisionTableXLSConverter decisionTableGuidedToDecisionTableXLSConverter,
                                                final GuidedDTableGraphResourceTypeDefinition dtableGraphType,
                                                final Event<ResourceOpenedEvent> resourceOpenedEvent,
                                                final GenericValidator genericValidator,
                                                final CommentedOptionFactory commentedOptionFactory,
                                                final SaveAndRenameServiceImpl<GuidedDecisionTable52, Metadata> saveAndRenameService,
                                                final SessionInfo sessionInfo); @PostConstruct void init(); @Override Path create(final Path context,
                       final String fileName,
                       final GuidedDecisionTable52 content,
                       final String comment); @Override GuidedDecisionTable52 load(final Path path); @Override GuidedDecisionTableEditorContent loadContent(final Path path); @Override PackageDataModelOracleBaselinePayload loadDataModel(final Path path); @Override Path save(final Path resource,
                     final GuidedDecisionTable52 model,
                     final Metadata metadata,
                     final String comment); @Override Path saveAndUpdateGraphEntries(final Path resource,
                                          final GuidedDecisionTable52 model,
                                          final Metadata metadata,
                                          final String comment); @Override XLSConversionResult convert(final Path path); @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 @SuppressWarnings("unchecked") String toSource(final Path path,
                           final GuidedDecisionTable52 model); @Override List<ValidationMessage> validate(final Path path,
                                            final GuidedDecisionTable52 content); @Override Path saveAndRename(final Path path,
                              final String newFileName,
                              final Metadata metadata,
                              final GuidedDecisionTable52 content,
                              final String comment);  }
@Test public void checkCreate() { final Path context = mock(Path.class); final String fileName = "filename." + dtType.getSuffix(); final GuidedDecisionTable52 content = new GuidedDecisionTable52(); final String comment = "comment"; when(context.toURI()).thenReturn("file: final Path p = service.create(context, fileName, content, comment); verify(ioService, times(1)).write(any(org.uberfire.java.nio.file.Path.class), any(String.class), any(CommentedOption.class)); assertTrue(p.toURI().contains("src/main/resources/mypackage/filename." + dtType.getSuffix())); assertEquals("mypackage", content.getPackageName()); }