GuidedRuleTemplateEditorServiceImpl extends KieService<GuidedTemplateEditorContent> implements GuidedRuleTemplateEditorService { @Override protected GuidedTemplateEditorContent constructContent(Path path, Overview overview) { final TemplateModel model = load(path); final PackageDataModelOracle oracle = dataModelService.getDataModel(path); final PackageDataModelOracleBaselinePayload dataModel = new PackageDataModelOracleBaselinePayload(); final GuidedRuleModelVisitor visitor = new GuidedRuleModelVisitor(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); resourceOpenedEvent.fire(new ResourceOpenedEvent(path, safeSessionInfo)); return new GuidedTemplateEditorContent(model, overview, dataModel); } GuidedRuleTemplateEditorServiceImpl(); @Inject  GuidedRuleTemplateEditorServiceImpl(final SessionInfo sessionInfo); @PostConstruct void init(); Path create(final Path context,
                       final String fileName,
                       final TemplateModel content,
                       final String comment); @Override TemplateModel load(final Path path); @Override GuidedTemplateEditorContent loadContent(final Path path); @Override Path save(final Path resource,
                     final TemplateModel model,
                     final Metadata metadata,
                     final String comment); @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 String toSource(final Path path,
                           final TemplateModel model); @Override boolean accepts(final Path path); @Override List<ValidationMessage> validate(final Path path); @Override List<ValidationMessage> validate(final Path path,
                                            final TemplateModel model); @Override Path saveAndRename(final Path path,
                              final String newFileName,
                              final Metadata metadata,
                              final TemplateModel content,
                              final String comment);  }
@Test public void checkConstructContentPopulateProjectCollectionTypes() { final Path path = mock(Path.class); final Overview overview = mock(Overview.class); final PackageDataModelOracle oracle = mock(PackageDataModelOracle.class); when(path.toURI()).thenReturn("file: when(dataModelService.getDataModel(any())).thenReturn(oracle); when(oracle.getPackageGlobals()).thenReturn(new HashMap<String, String>() {{ put("number", "java.lang.Number"); put("collection", "java.util.Collection"); }}); 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 GuidedTemplateEditorContent content = service.constructContent(path, overview); 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")); }