@Test public void testLoadPMMLDocumentsFromImports() { final WorkspaceProject workspaceProject = mock(WorkspaceProject.class); final PMMLIncludedModel includedModel1 = mock(PMMLIncludedModel.class); final PMMLIncludedModel includedModel2 = mock(PMMLIncludedModel.class); final PMMLIncludedModel includedModel3 = mock(PMMLIncludedModel.class); final Path path1 = mock(Path.class); final Path path2 = mock(Path.class); final Path path3 = mock(Path.class); final PMMLDocumentMetadata pmmlDocument1 = mock(PMMLDocumentMetadata.class); final PMMLDocumentMetadata pmmlDocument2 = mock(PMMLDocumentMetadata.class); final PMMLDocumentMetadata pmmlDocument3 = mock(PMMLDocumentMetadata.class); final List<PMMLIncludedModel> includedModels = asList(includedModel1, includedModel2, includedModel3); final List<Path> paths = asList(path1, path2, path3); when(pathsHelper.getPMMLModelsPaths(workspaceProject)).thenReturn(paths); when(includedDocumentsFilter.getDocumentFromImports(dmnModelPath, path1, includedModels)).thenReturn(pmmlDocument1); when(includedDocumentsFilter.getDocumentFromImports(dmnModelPath, path2, includedModels)).thenReturn(pmmlDocument2); when(includedDocumentsFilter.getDocumentFromImports(dmnModelPath, path3, includedModels)).thenReturn(pmmlDocument3); final List<PMMLDocumentMetadata> actualPMMLDocuments = service.loadPMMLDocumentsFromImports(dmnModelPath, workspaceProject, includedModels); final List<PMMLDocumentMetadata> expectedPMMLDocuments = asList(pmmlDocument1, pmmlDocument2, pmmlDocument3); assertEquals(expectedPMMLDocuments, actualPMMLDocuments); }
@Override public List<PMMLDocumentMetadata> loadPMMLDocumentsFromImports(final Path path, final WorkspaceProject workspaceProject, final List<PMMLIncludedModel> includedModels) { return getPMMLModelsPaths(workspaceProject) .stream() .map(includedModelPath -> includedDocumentsFilter.getDocumentFromImports(path, includedModelPath, includedModels)) .filter(Objects::nonNull) .collect(Collectors.toList()); }
DMNIncludedModelsServiceImpl implements DMNIncludedModelsService { @Override public List<PMMLDocumentMetadata> loadPMMLDocumentsFromImports(final Path path, final WorkspaceProject workspaceProject, final List<PMMLIncludedModel> includedModels) { return getPMMLModelsPaths(workspaceProject) .stream() .map(includedModelPath -> includedDocumentsFilter.getDocumentFromImports(path, includedModelPath, includedModels)) .filter(Objects::nonNull) .collect(Collectors.toList()); } }
DMNIncludedModelsServiceImpl implements DMNIncludedModelsService { @Override public List<PMMLDocumentMetadata> loadPMMLDocumentsFromImports(final Path path, final WorkspaceProject workspaceProject, final List<PMMLIncludedModel> includedModels) { return getPMMLModelsPaths(workspaceProject) .stream() .map(includedModelPath -> includedDocumentsFilter.getDocumentFromImports(path, includedModelPath, includedModels)) .filter(Objects::nonNull) .collect(Collectors.toList()); } @Inject  DMNIncludedModelsServiceImpl(final DMNPathsHelper pathsHelper,
                                        final IncludedModelFactory includedModelFactory,
                                        final DMNIncludedNodesFilter includedNodesFilter,
                                        final PMMLIncludedDocumentsFilter includedDocumentsFilter,
                                        final DMNMarshallerImportsHelperStandalone importsHelper); }
DMNIncludedModelsServiceImpl implements DMNIncludedModelsService { @Override public List<PMMLDocumentMetadata> loadPMMLDocumentsFromImports(final Path path, final WorkspaceProject workspaceProject, final List<PMMLIncludedModel> includedModels) { return getPMMLModelsPaths(workspaceProject) .stream() .map(includedModelPath -> includedDocumentsFilter.getDocumentFromImports(path, includedModelPath, includedModels)) .filter(Objects::nonNull) .collect(Collectors.toList()); } @Inject  DMNIncludedModelsServiceImpl(final DMNPathsHelper pathsHelper,
                                        final IncludedModelFactory includedModelFactory,
                                        final DMNIncludedNodesFilter includedNodesFilter,
                                        final PMMLIncludedDocumentsFilter includedDocumentsFilter,
                                        final DMNMarshallerImportsHelperStandalone importsHelper); @Override List<IncludedModel> loadModels(final Path path,
                                          final WorkspaceProject workspaceProject); @Override List<DMNIncludedNode> loadNodesFromImports(final WorkspaceProject workspaceProject,
                                                      final List<DMNIncludedModel> includedModels); @Override List<PMMLDocumentMetadata> loadPMMLDocumentsFromImports(final Path path,
                                                                   final WorkspaceProject workspaceProject,
                                                                   final List<PMMLIncludedModel> includedModels); @Override List<ItemDefinition> loadItemDefinitionsByNamespace(final WorkspaceProject workspaceProject,
                                                               final String modelName,
                                                               final String namespace); }
DMNIncludedModelsServiceImpl implements DMNIncludedModelsService { @Override public List<PMMLDocumentMetadata> loadPMMLDocumentsFromImports(final Path path, final WorkspaceProject workspaceProject, final List<PMMLIncludedModel> includedModels) { return getPMMLModelsPaths(workspaceProject) .stream() .map(includedModelPath -> includedDocumentsFilter.getDocumentFromImports(path, includedModelPath, includedModels)) .filter(Objects::nonNull) .collect(Collectors.toList()); } @Inject  DMNIncludedModelsServiceImpl(final DMNPathsHelper pathsHelper,
                                        final IncludedModelFactory includedModelFactory,
                                        final DMNIncludedNodesFilter includedNodesFilter,
                                        final PMMLIncludedDocumentsFilter includedDocumentsFilter,
                                        final DMNMarshallerImportsHelperStandalone importsHelper); @Override List<IncludedModel> loadModels(final Path path,
                                          final WorkspaceProject workspaceProject); @Override List<DMNIncludedNode> loadNodesFromImports(final WorkspaceProject workspaceProject,
                                                      final List<DMNIncludedModel> includedModels); @Override List<PMMLDocumentMetadata> loadPMMLDocumentsFromImports(final Path path,
                                                                   final WorkspaceProject workspaceProject,
                                                                   final List<PMMLIncludedModel> includedModels); @Override List<ItemDefinition> loadItemDefinitionsByNamespace(final WorkspaceProject workspaceProject,
                                                               final String modelName,
                                                               final String namespace);  }