@Test @SuppressWarnings("unchecked") public void testLoadPMMLIncludedDocumentsPMMLIncludedModels() { final Import dmn = new ImportDMN("dmn", new LocationURI("dmn-location"), DMNImportTypes.DMN.getDefaultNamespace()); final Import pmml = new ImportPMML("pmml", new LocationURI("pmml-location"), DMNImportTypes.PMML.getDefaultNamespace()); dmn.getName().setValue("dmn"); pmml.getName().setValue("pmml"); definitions.getImport().add(dmn); definitions.getImport().add(pmml); provider.loadPMMLIncludedDocuments(); verify(clientServicesProxy).loadPMMLDocumentsFromImports(any(Path.class), pmmlIncludedModelsArgumentCaptor.capture(), any(ServiceCallback.class)); final List<PMMLIncludedModel> actualIncludedModels = pmmlIncludedModelsArgumentCaptor.getValue(); assertThat(actualIncludedModels).hasSize(1); final PMMLIncludedModel pmmlIncludedModel = actualIncludedModels.get(0); assertThat(pmmlIncludedModel.getModelName()).isEqualTo("pmml"); assertThat(pmmlIncludedModel.getPath()).isEqualTo("pmml-location"); assertThat(pmmlIncludedModel.getImportType()).isEqualTo(DMNImportTypes.PMML.getDefaultNamespace()); }
@PostConstruct public void loadPMMLIncludedDocuments() { final Optional<Diagram> diagram = stateProvider.getDiagram(); if (!diagram.isPresent()) { return; } pmmlDocuments.clear(); clientServicesProxy.loadPMMLDocumentsFromImports(getDMNModelPath(diagram.get()), getPMMLIncludedModels(diagram.get()), new ServiceCallback<List<PMMLDocumentMetadata>>() { @Override public void onSuccess(final List<PMMLDocumentMetadata> documents) { documents.forEach(document -> pmmlDocuments.put(document.getName(), document)); } @Override public void onError(final ClientRuntimeError error) { clientServicesProxy.logWarning(error); } }); }
PMMLDocumentMetadataProvider { @PostConstruct public void loadPMMLIncludedDocuments() { final Optional<Diagram> diagram = stateProvider.getDiagram(); if (!diagram.isPresent()) { return; } pmmlDocuments.clear(); clientServicesProxy.loadPMMLDocumentsFromImports(getDMNModelPath(diagram.get()), getPMMLIncludedModels(diagram.get()), new ServiceCallback<List<PMMLDocumentMetadata>>() { @Override public void onSuccess(final List<PMMLDocumentMetadata> documents) { documents.forEach(document -> pmmlDocuments.put(document.getName(), document)); } @Override public void onError(final ClientRuntimeError error) { clientServicesProxy.logWarning(error); } }); } }
PMMLDocumentMetadataProvider { @PostConstruct public void loadPMMLIncludedDocuments() { final Optional<Diagram> diagram = stateProvider.getDiagram(); if (!diagram.isPresent()) { return; } pmmlDocuments.clear(); clientServicesProxy.loadPMMLDocumentsFromImports(getDMNModelPath(diagram.get()), getPMMLIncludedModels(diagram.get()), new ServiceCallback<List<PMMLDocumentMetadata>>() { @Override public void onSuccess(final List<PMMLDocumentMetadata> documents) { documents.forEach(document -> pmmlDocuments.put(document.getName(), document)); } @Override public void onError(final ClientRuntimeError error) { clientServicesProxy.logWarning(error); } }); } PMMLDocumentMetadataProvider(); @Inject  PMMLDocumentMetadataProvider(final DMNGraphUtils graphUtils,
                                        final DMNClientServicesProxy clientServicesProxy,
                                        final IncludedModelsPageStateProviderImpl stateProvider); }
PMMLDocumentMetadataProvider { @PostConstruct public void loadPMMLIncludedDocuments() { final Optional<Diagram> diagram = stateProvider.getDiagram(); if (!diagram.isPresent()) { return; } pmmlDocuments.clear(); clientServicesProxy.loadPMMLDocumentsFromImports(getDMNModelPath(diagram.get()), getPMMLIncludedModels(diagram.get()), new ServiceCallback<List<PMMLDocumentMetadata>>() { @Override public void onSuccess(final List<PMMLDocumentMetadata> documents) { documents.forEach(document -> pmmlDocuments.put(document.getName(), document)); } @Override public void onError(final ClientRuntimeError error) { clientServicesProxy.logWarning(error); } }); } PMMLDocumentMetadataProvider(); @Inject  PMMLDocumentMetadataProvider(final DMNGraphUtils graphUtils,
                                        final DMNClientServicesProxy clientServicesProxy,
                                        final IncludedModelsPageStateProviderImpl stateProvider); @PostConstruct void loadPMMLIncludedDocuments(); @SuppressWarnings("unused") void onRefreshDecisionComponents(final @Observes RefreshDecisionComponents events); List<String> getPMMLDocumentNames(); List<String> getPMMLDocumentModels(final String pmmlDocumentName); List<String> getPMMLDocumentModelParameterNames(final String pmmlDocumentName,
                                                           final String pmmlDocumentModelName); }
PMMLDocumentMetadataProvider { @PostConstruct public void loadPMMLIncludedDocuments() { final Optional<Diagram> diagram = stateProvider.getDiagram(); if (!diagram.isPresent()) { return; } pmmlDocuments.clear(); clientServicesProxy.loadPMMLDocumentsFromImports(getDMNModelPath(diagram.get()), getPMMLIncludedModels(diagram.get()), new ServiceCallback<List<PMMLDocumentMetadata>>() { @Override public void onSuccess(final List<PMMLDocumentMetadata> documents) { documents.forEach(document -> pmmlDocuments.put(document.getName(), document)); } @Override public void onError(final ClientRuntimeError error) { clientServicesProxy.logWarning(error); } }); } PMMLDocumentMetadataProvider(); @Inject  PMMLDocumentMetadataProvider(final DMNGraphUtils graphUtils,
                                        final DMNClientServicesProxy clientServicesProxy,
                                        final IncludedModelsPageStateProviderImpl stateProvider); @PostConstruct void loadPMMLIncludedDocuments(); @SuppressWarnings("unused") void onRefreshDecisionComponents(final @Observes RefreshDecisionComponents events); List<String> getPMMLDocumentNames(); List<String> getPMMLDocumentModels(final String pmmlDocumentName); List<String> getPMMLDocumentModelParameterNames(final String pmmlDocumentName,
                                                           final String pmmlDocumentModelName);  }