GuidedDecisionTableEditorServiceImpl extends KieService<GuidedDecisionTableEditorContent> implements GuidedDecisionTableEditorService { @Override protected GuidedDecisionTableEditorContent constructContent(Path path, Overview overview) { final GuidedDecisionTable52 model = load(path); final PackageDataModelOracle oracle = dataModelService.getDataModel(path); final PackageDataModelOracleBaselinePayload dataModel = new PackageDataModelOracleBaselinePayload(); final GuidedDecisionTableModelVisitor visitor = new GuidedDecisionTableModelVisitor(model); final Set<String> consumedFQCNs = visitor.getConsumedModelClasses(); consumedFQCNs.addAll(oracle.getPackageGlobals().values()); consumedFQCNs.addAll(oracle.getModuleCollectionTypes() .entrySet() .stream() .filter(entry -> entry.getValue()) .map(entry -> entry.getKey()) .collect(Collectors.toSet())); DataModelOracleUtilities.populateDataModel(oracle, dataModel, consumedFQCNs); final Set<PortableWorkDefinition> workItemDefinitions = workItemsService.loadWorkItemDefinitions(path); resourceOpenedEvent.fire(new ResourceOpenedEvent(path, safeSessionInfo)); return new GuidedDecisionTableEditorContent(model, workItemDefinitions, overview, dataModel); } 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 checkConstructContent() { final Path path = mock(Path.class); final Overview overview = mock(Overview.class); final PackageDataModelOracle oracle = mock(PackageDataModelOracle.class); when(oracle.getModuleCollectionTypes()).thenReturn(new HashMap<String, Boolean>() {{ put("java.util.List", true); put("java.util.Set", true); put("java.util.Collection", true); put("java.util.UnknownCollection", false); }}); final Set<PortableWorkDefinition> workItemDefinitions = new HashSet<>(); when(path.toURI()).thenReturn("file: when(dataModelService.getDataModel(eq(path))).thenReturn(oracle); when(workItemsService.loadWorkItemDefinitions(eq(path))).thenReturn(workItemDefinitions); final GuidedDecisionTableEditorContent content = service.constructContent(path, overview); verify(resourceOpenedEvent, times(1)).fire(any(ResourceOpenedEvent.class)); assertNotNull(content.getModel()); assertNotNull(content.getDataModel()); assertNotNull(content.getWorkItemDefinitions()); assertEquals(overview, content.getOverview()); assertEquals(3, content.getDataModel().getCollectionTypes().size()); assertTrue(content.getDataModel().getCollectionTypes().containsKey("java.util.Collection")); assertTrue(content.getDataModel().getCollectionTypes().containsKey("java.util.List")); assertTrue(content.getDataModel().getCollectionTypes().containsKey("java.util.Set")); }