use of org.kie.workbench.common.dmn.api.editors.included.PMMLIncludedModel in project kie-wb-common by kiegroup.
the class DMNMarshallerImportsClientHelperTest method getPMMLDocumentsMetadataFromFiles.
@Test
public void getPMMLDocumentsMetadataFromFiles() {
final PMMLDocumentMetadata documentMetadata = new PMMLDocumentMetadata(PMML_FILE, PMML.getDefaultNamespace(), Collections.emptyList());
final List<PMMLIncludedModel> includedModels = Arrays.asList(new PMMLIncludedModel(PMML_MODEL_NAME, "", PMML_FILE, PMML.getDefaultNamespace(), 0));
when(dmnImportsContentService.getModelsPMMLFilesURIs()).thenReturn(promises.resolve(new String[] { PMML_PATH }));
when(dmnImportsContentService.loadFile(PMML_PATH)).thenReturn(promises.resolve(PMML_CONTENT));
doReturn(promises.resolve(documentMetadata)).when(dmnImportsContentService).getPMMLDocumentMetadata(PMML_PATH);
importsHelper.getPMMLDocumentsMetadataFromFiles(includedModels, pmmlMetadataServiceCallback);
verify(pmmlMetadataServiceCallback, times(1)).onSuccess(pmmlDocumentMetadataArgumentCaptor.capture());
assertEquals(1, pmmlDocumentMetadataArgumentCaptor.getValue().size());
assertEquals(PMML_FILE, pmmlDocumentMetadataArgumentCaptor.getValue().get(0).getPath());
assertEquals(PMML_MODEL_NAME, pmmlDocumentMetadataArgumentCaptor.getValue().get(0).getName());
assertEquals(PMML.getDefaultNamespace(), pmmlDocumentMetadataArgumentCaptor.getValue().get(0).getImportType());
assertTrue(pmmlDocumentMetadataArgumentCaptor.getValue().get(0).getModels().isEmpty());
}
use of org.kie.workbench.common.dmn.api.editors.included.PMMLIncludedModel in project kie-wb-common by kiegroup.
the class DMNAssetsDropdownItemsProviderTest method testAsKieAssetForPMMLIncludedModel.
@Test
public void testAsKieAssetForPMMLIncludedModel() {
final PMMLIncludedModel model = makePMMLIncludedModel(1, 2);
final KieAssetsDropdownItem dropdownItem = itemsProvider.asKieAsset(model);
assertEquals(model.getModelName(), dropdownItem.getText());
assertEquals(model.getModelPackage(), dropdownItem.getSubText());
assertEquals(model.getPath(), dropdownItem.getMetaData().get(PATH_METADATA));
assertEquals(model.getImportType(), dropdownItem.getMetaData().get(IMPORT_TYPE_METADATA));
assertEquals(model.getModelCount().toString(), dropdownItem.getMetaData().get(PMML_MODEL_COUNT_METADATA));
}
use of org.kie.workbench.common.dmn.api.editors.included.PMMLIncludedModel in project kie-wb-common by kiegroup.
the class DMNClientServicesProxyImplTest method testLoadPMMLDocumentsFromImports.
@Test
@SuppressWarnings("unchecked")
public void testLoadPMMLDocumentsFromImports() {
final Optional<WorkspaceProject> optionalWorkspaceProject = Optional.of(workspaceProject);
final PMMLIncludedModel includedModel1 = mock(PMMLIncludedModel.class);
final PMMLIncludedModel includedModel2 = mock(PMMLIncludedModel.class);
final List<PMMLIncludedModel> imports = asList(includedModel1, includedModel2);
when(projectContext.getActiveWorkspaceProject()).thenReturn(optionalWorkspaceProject);
clientServicesProxy.loadPMMLDocumentsFromImports(dmnModelPath, imports, serviceCallback);
verify(includedModelsService).loadPMMLDocumentsFromImports(dmnModelPath, workspaceProject, imports);
}
Aggregations