@Test public void testGetProjectContent() { final String defSetId = "defSetId"; final String expectedContent = "<xml/>"; final String moduleName = "moduleName"; final Package aPackage = mock(Package.class); final KieModule kieModule = mock(KieModule.class); final Overview overview = mock(Overview.class); doReturn(expectedContent).when(service).getSource(path); when(moduleService.resolvePackage(path)).thenReturn(aPackage); when(moduleService.resolveModule(path)).thenReturn(kieModule); when(overviewLoader.loadOverview(path)).thenReturn(overview); when(kieModule.getModuleName()).thenReturn(moduleName); final DMNContentResource contentResource = service.getProjectContent(path, defSetId); final String actualContent = contentResource.getContent(); final ProjectMetadataImpl metadata = (ProjectMetadataImpl) contentResource.getMetadata(); assertEquals(expectedContent, actualContent); assertEquals(defSetId, metadata.getDefinitionSetId()); assertEquals(moduleName, metadata.getModuleName()); assertEquals(aPackage, metadata.getProjectPackage()); assertEquals(overview, metadata.getOverview()); assertEquals(fileName, metadata.getTitle()); assertEquals(path, metadata.getPath()); }
@Override public DMNContentResource getProjectContent(final Path path, final String defSetId) { final String content = getSource(path); final String title = path.getFileName(); final ProjectMetadata metadata = buildMetadataInstance(path, defSetId, title); return new DMNContentResource(content, metadata); }
DMNContentServiceImpl extends KieService<String> implements DMNContentService { @Override public DMNContentResource getProjectContent(final Path path, final String defSetId) { final String content = getSource(path); final String title = path.getFileName(); final ProjectMetadata metadata = buildMetadataInstance(path, defSetId, title); return new DMNContentResource(content, metadata); } }
DMNContentServiceImpl extends KieService<String> implements DMNContentService { @Override public DMNContentResource getProjectContent(final Path path, final String defSetId) { final String content = getSource(path); final String title = path.getFileName(); final ProjectMetadata metadata = buildMetadataInstance(path, defSetId, title); return new DMNContentResource(content, metadata); } @Inject  DMNContentServiceImpl(final CommentedOptionFactory commentedOptionFactory,
                                 final DMNIOHelper dmnIOHelper,
                                 final DMNPathsHelper pathsHelper,
                                 final PMMLIncludedDocumentFactory pmmlIncludedDocumentFactory); }
DMNContentServiceImpl extends KieService<String> implements DMNContentService { @Override public DMNContentResource getProjectContent(final Path path, final String defSetId) { final String content = getSource(path); final String title = path.getFileName(); final ProjectMetadata metadata = buildMetadataInstance(path, defSetId, title); return new DMNContentResource(content, metadata); } @Inject  DMNContentServiceImpl(final CommentedOptionFactory commentedOptionFactory,
                                 final DMNIOHelper dmnIOHelper,
                                 final DMNPathsHelper pathsHelper,
                                 final PMMLIncludedDocumentFactory pmmlIncludedDocumentFactory); @Override String getContent(final Path path); @Override DMNContentResource getProjectContent(final Path path,
                                                final String defSetId); @Override void saveContent(final Path path,
                            final String content,
                            final Metadata metadata,
                            final String comment); @Override List<Path> getModelsPaths(final WorkspaceProject workspaceProject); @Override List<Path> getDMNModelsPaths(final WorkspaceProject workspaceProject); @Override List<Path> getPMMLModelsPaths(final WorkspaceProject workspaceProject); @Override PMMLDocumentMetadata loadPMMLDocumentMetadata(final Path path); @Override String getSource(final Path path); }
DMNContentServiceImpl extends KieService<String> implements DMNContentService { @Override public DMNContentResource getProjectContent(final Path path, final String defSetId) { final String content = getSource(path); final String title = path.getFileName(); final ProjectMetadata metadata = buildMetadataInstance(path, defSetId, title); return new DMNContentResource(content, metadata); } @Inject  DMNContentServiceImpl(final CommentedOptionFactory commentedOptionFactory,
                                 final DMNIOHelper dmnIOHelper,
                                 final DMNPathsHelper pathsHelper,
                                 final PMMLIncludedDocumentFactory pmmlIncludedDocumentFactory); @Override String getContent(final Path path); @Override DMNContentResource getProjectContent(final Path path,
                                                final String defSetId); @Override void saveContent(final Path path,
                            final String content,
                            final Metadata metadata,
                            final String comment); @Override List<Path> getModelsPaths(final WorkspaceProject workspaceProject); @Override List<Path> getDMNModelsPaths(final WorkspaceProject workspaceProject); @Override List<Path> getPMMLModelsPaths(final WorkspaceProject workspaceProject); @Override PMMLDocumentMetadata loadPMMLDocumentMetadata(final Path path); @Override String getSource(final Path path);  }