@Test public void testLoadItemDefinitionsByNamespace() { final WorkspaceProject workspaceProject = mock(WorkspaceProject.class); final String modelName = "model1"; final String namespace = ": final org.kie.dmn.model.api.ItemDefinition itemDefinition1 = mock(org.kie.dmn.model.api.ItemDefinition.class); final org.kie.dmn.model.api.ItemDefinition itemDefinition2 = mock(org.kie.dmn.model.api.ItemDefinition.class); final org.kie.dmn.model.api.ItemDefinition itemDefinition3 = mock(org.kie.dmn.model.api.ItemDefinition.class); final ItemDefinition wbItemDefinition1 = mock(ItemDefinition.class); final ItemDefinition wbItemDefinition2 = mock(ItemDefinition.class); final ItemDefinition wbItemDefinition3 = mock(ItemDefinition.class); final List<org.kie.dmn.model.api.ItemDefinition> itemDefinitions = asList(itemDefinition1, itemDefinition2, itemDefinition3); doReturn(wbItemDefinition1).when(service).wbFromDMN(itemDefinition1, modelName); doReturn(wbItemDefinition2).when(service).wbFromDMN(itemDefinition2, modelName); doReturn(wbItemDefinition3).when(service).wbFromDMN(itemDefinition3, modelName); when(importsHelper.getImportedItemDefinitionsByNamespace(workspaceProject, modelName, namespace)).thenReturn(itemDefinitions); final List<ItemDefinition> actualItemDefinitions = service.loadItemDefinitionsByNamespace(workspaceProject, modelName, namespace); final List<ItemDefinition> expectedItemDefinitions = asList(wbItemDefinition1, wbItemDefinition2, wbItemDefinition3); assertEquals(expectedItemDefinitions, actualItemDefinitions); }
@Override public List<ItemDefinition> loadItemDefinitionsByNamespace(final WorkspaceProject workspaceProject, final String modelName, final String namespace) { return importsHelper .getImportedItemDefinitionsByNamespace(workspaceProject, modelName, namespace) .stream() .map(itemDefinition -> wbFromDMN(itemDefinition, modelName)) .collect(Collectors.toList()); }
DMNIncludedModelsServiceImpl implements DMNIncludedModelsService { @Override public List<ItemDefinition> loadItemDefinitionsByNamespace(final WorkspaceProject workspaceProject, final String modelName, final String namespace) { return importsHelper .getImportedItemDefinitionsByNamespace(workspaceProject, modelName, namespace) .stream() .map(itemDefinition -> wbFromDMN(itemDefinition, modelName)) .collect(Collectors.toList()); } }
DMNIncludedModelsServiceImpl implements DMNIncludedModelsService { @Override public List<ItemDefinition> loadItemDefinitionsByNamespace(final WorkspaceProject workspaceProject, final String modelName, final String namespace) { return importsHelper .getImportedItemDefinitionsByNamespace(workspaceProject, modelName, namespace) .stream() .map(itemDefinition -> wbFromDMN(itemDefinition, modelName)) .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<ItemDefinition> loadItemDefinitionsByNamespace(final WorkspaceProject workspaceProject, final String modelName, final String namespace) { return importsHelper .getImportedItemDefinitionsByNamespace(workspaceProject, modelName, namespace) .stream() .map(itemDefinition -> wbFromDMN(itemDefinition, modelName)) .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<ItemDefinition> loadItemDefinitionsByNamespace(final WorkspaceProject workspaceProject, final String modelName, final String namespace) { return importsHelper .getImportedItemDefinitionsByNamespace(workspaceProject, modelName, namespace) .stream() .map(itemDefinition -> wbFromDMN(itemDefinition, modelName)) .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);  }