@Test public void testGetImportedItemDefinitions() { final Map<Import, Definitions> importDefinitions = new HashMap<>(); final Import anImport = mock(Import.class); final Definitions definitions = mock(Definitions.class); final ItemDefinition itemDefinition1 = mock(ItemDefinition.class); final ItemDefinition itemDefinition2 = mock(ItemDefinition.class); final ItemDefinition itemDefinition3 = mock(ItemDefinition.class); final List<ItemDefinition> expectedItemDefinitions = asList(itemDefinition1, itemDefinition2, itemDefinition3); doReturn(expectedItemDefinitions).when(helper).getItemDefinitionsWithNamespace(definitions, anImport); importDefinitions.put(anImport, definitions); final List<ItemDefinition> actualItemDefinitions = helper.getImportedItemDefinitions(importDefinitions); assertEquals(expectedItemDefinitions, actualItemDefinitions); }
@Override public List<ItemDefinition> getImportedItemDefinitions(final Map<Import, Definitions> importDefinitions) { final List<ItemDefinition> itemDefinitions = new ArrayList<>(); importDefinitions.forEach((anImport, definitions) -> { itemDefinitions.addAll(getItemDefinitionsWithNamespace(definitions, anImport)); }); return itemDefinitions; }
DMNMarshallerImportsHelperStandaloneImpl implements DMNMarshallerImportsHelperStandalone { @Override public List<ItemDefinition> getImportedItemDefinitions(final Map<Import, Definitions> importDefinitions) { final List<ItemDefinition> itemDefinitions = new ArrayList<>(); importDefinitions.forEach((anImport, definitions) -> { itemDefinitions.addAll(getItemDefinitionsWithNamespace(definitions, anImport)); }); return itemDefinitions; } }
DMNMarshallerImportsHelperStandaloneImpl implements DMNMarshallerImportsHelperStandalone { @Override public List<ItemDefinition> getImportedItemDefinitions(final Map<Import, Definitions> importDefinitions) { final List<ItemDefinition> itemDefinitions = new ArrayList<>(); importDefinitions.forEach((anImport, definitions) -> { itemDefinitions.addAll(getItemDefinitionsWithNamespace(definitions, anImport)); }); return itemDefinitions; } DMNMarshallerImportsHelperStandaloneImpl(); @Inject  DMNMarshallerImportsHelperStandaloneImpl(final DMNPathsHelper pathsHelper,
                                                    final WorkspaceProjectService projectService,
                                                    final DMNMarshaller marshaller,
                                                    final DMNIOHelper dmnIOHelper,
                                                    final PMMLIncludedDocumentFactory pmmlDocumentFactory,
                                                    final @Named("ioStrategy") IOService ioService); }
DMNMarshallerImportsHelperStandaloneImpl implements DMNMarshallerImportsHelperStandalone { @Override public List<ItemDefinition> getImportedItemDefinitions(final Map<Import, Definitions> importDefinitions) { final List<ItemDefinition> itemDefinitions = new ArrayList<>(); importDefinitions.forEach((anImport, definitions) -> { itemDefinitions.addAll(getItemDefinitionsWithNamespace(definitions, anImport)); }); return itemDefinitions; } DMNMarshallerImportsHelperStandaloneImpl(); @Inject  DMNMarshallerImportsHelperStandaloneImpl(final DMNPathsHelper pathsHelper,
                                                    final WorkspaceProjectService projectService,
                                                    final DMNMarshaller marshaller,
                                                    final DMNIOHelper dmnIOHelper,
                                                    final PMMLIncludedDocumentFactory pmmlDocumentFactory,
                                                    final @Named("ioStrategy") IOService ioService); @Override Map<Import, Definitions> getImportDefinitions(final Metadata metadata,
                                                         final List<Import> imports); @Override Map<Import, PMMLDocumentMetadata> getPMMLDocuments(final Metadata metadata,
                                                              final List<Import> imports); @Override Map<Import, String> getImportXML(final Metadata metadata,
                                            final List<Import> imports); @Override Path getDMNModelPath(final Metadata metadata,
                                final String modelNamespace,
                                final String modelName); @Override List<DRGElement> getImportedDRGElements(final Map<Import, Definitions> importDefinitions); @Override List<ItemDefinition> getImportedItemDefinitions(final Map<Import, Definitions> importDefinitions); @Override List<ItemDefinition> getImportedItemDefinitionsByNamespace(final WorkspaceProject workspaceProject,
                                                                      final String modelName,
                                                                      final String namespace); @Override Optional<InputStream> loadPath(final Path path); }
DMNMarshallerImportsHelperStandaloneImpl implements DMNMarshallerImportsHelperStandalone { @Override public List<ItemDefinition> getImportedItemDefinitions(final Map<Import, Definitions> importDefinitions) { final List<ItemDefinition> itemDefinitions = new ArrayList<>(); importDefinitions.forEach((anImport, definitions) -> { itemDefinitions.addAll(getItemDefinitionsWithNamespace(definitions, anImport)); }); return itemDefinitions; } DMNMarshallerImportsHelperStandaloneImpl(); @Inject  DMNMarshallerImportsHelperStandaloneImpl(final DMNPathsHelper pathsHelper,
                                                    final WorkspaceProjectService projectService,
                                                    final DMNMarshaller marshaller,
                                                    final DMNIOHelper dmnIOHelper,
                                                    final PMMLIncludedDocumentFactory pmmlDocumentFactory,
                                                    final @Named("ioStrategy") IOService ioService); @Override Map<Import, Definitions> getImportDefinitions(final Metadata metadata,
                                                         final List<Import> imports); @Override Map<Import, PMMLDocumentMetadata> getPMMLDocuments(final Metadata metadata,
                                                              final List<Import> imports); @Override Map<Import, String> getImportXML(final Metadata metadata,
                                            final List<Import> imports); @Override Path getDMNModelPath(final Metadata metadata,
                                final String modelNamespace,
                                final String modelName); @Override List<DRGElement> getImportedDRGElements(final Map<Import, Definitions> importDefinitions); @Override List<ItemDefinition> getImportedItemDefinitions(final Map<Import, Definitions> importDefinitions); @Override List<ItemDefinition> getImportedItemDefinitionsByNamespace(final WorkspaceProject workspaceProject,
                                                                      final String modelName,
                                                                      final String namespace); @Override Optional<InputStream> loadPath(final Path path); static final QName NAMESPACE; }