@Test public void testLoadNodesFromImports() { final WorkspaceProject workspaceProject = mock(WorkspaceProject.class); final DMNIncludedModel includedModel1 = mock(DMNIncludedModel.class); final DMNIncludedModel includedModel2 = mock(DMNIncludedModel.class); final DMNIncludedModel includedModel3 = mock(DMNIncludedModel.class); final Path path1 = mock(Path.class); final Path path2 = mock(Path.class); final Path path3 = mock(Path.class); final DMNIncludedNode node1 = mock(DMNIncludedNode.class); final DMNIncludedNode node2 = mock(DMNIncludedNode.class); final DMNIncludedNode node3 = mock(DMNIncludedNode.class); final DMNIncludedNode node4 = mock(DMNIncludedNode.class); final DMNIncludedNode node5 = mock(DMNIncludedNode.class); final DMNIncludedNode node6 = mock(DMNIncludedNode.class); final DMNIncludedNode node7 = mock(DMNIncludedNode.class); final List<DMNIncludedNode> path1Nodes = asList(node1, node2, node3, node4); final List<DMNIncludedNode> path2Nodes = singletonList(node5); final List<DMNIncludedNode> path3Nodes = asList(node6, node7); final List<DMNIncludedModel> includedModels = asList(includedModel1, includedModel2, includedModel3); final List<Path> paths = asList(path1, path2, path3); when(pathsHelper.getDMNModelsPaths(workspaceProject)).thenReturn(paths); when(includedNodesFilter.getNodesFromImports(path1, includedModels)).thenReturn(path1Nodes); when(includedNodesFilter.getNodesFromImports(path2, includedModels)).thenReturn(path2Nodes); when(includedNodesFilter.getNodesFromImports(path3, includedModels)).thenReturn(path3Nodes); final List<DMNIncludedNode> actualNodes = service.loadNodesFromImports(workspaceProject, includedModels); final List<DMNIncludedNode> expectedNodes = asList(node1, node2, node3, node4, node5, node6, node7); assertEquals(expectedNodes, actualNodes); }
@Override public List<DMNIncludedNode> loadNodesFromImports(final WorkspaceProject workspaceProject, final List<DMNIncludedModel> includedModels) { return getDMNModelsPaths(workspaceProject) .stream() .map(path -> includedNodesFilter.getNodesFromImports(path, includedModels)) .flatMap(Collection::stream) .collect(Collectors.toList()); }
DMNIncludedModelsServiceImpl implements DMNIncludedModelsService { @Override public List<DMNIncludedNode> loadNodesFromImports(final WorkspaceProject workspaceProject, final List<DMNIncludedModel> includedModels) { return getDMNModelsPaths(workspaceProject) .stream() .map(path -> includedNodesFilter.getNodesFromImports(path, includedModels)) .flatMap(Collection::stream) .collect(Collectors.toList()); } }
DMNIncludedModelsServiceImpl implements DMNIncludedModelsService { @Override public List<DMNIncludedNode> loadNodesFromImports(final WorkspaceProject workspaceProject, final List<DMNIncludedModel> includedModels) { return getDMNModelsPaths(workspaceProject) .stream() .map(path -> includedNodesFilter.getNodesFromImports(path, includedModels)) .flatMap(Collection::stream) .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<DMNIncludedNode> loadNodesFromImports(final WorkspaceProject workspaceProject, final List<DMNIncludedModel> includedModels) { return getDMNModelsPaths(workspaceProject) .stream() .map(path -> includedNodesFilter.getNodesFromImports(path, includedModels)) .flatMap(Collection::stream) .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<DMNIncludedNode> loadNodesFromImports(final WorkspaceProject workspaceProject, final List<DMNIncludedModel> includedModels) { return getDMNModelsPaths(workspaceProject) .stream() .map(path -> includedNodesFilter.getNodesFromImports(path, includedModels)) .flatMap(Collection::stream) .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);  }