use of org.kie.workbench.common.dmn.api.definition.model.ImportPMML in project kie-wb-common by kiegroup.
the class DecisionComponentsTest method testGetDMNIncludedModelsOnlyIncludesDMN.
@Test
public void testGetDMNIncludedModelsOnlyIncludesDMN() {
final ImportDMN dmnImport = new ImportDMN();
final ImportPMML pmmlImport = new ImportPMML();
dmnImport.getName().setValue("dmn");
dmnImport.setImportType(DMNImportTypes.DMN.getDefaultNamespace());
pmmlImport.setImportType(DMNImportTypes.PMML.getDefaultNamespace());
when(dmnDiagramsSession.getModelImports()).thenReturn(asList(dmnImport, pmmlImport));
final List<DMNIncludedModel> includedModels = decisionComponents.getDMNIncludedModels();
assertThat(includedModels).hasSize(1);
assertThat(includedModels.get(0).getModelName()).isEqualTo("dmn");
assertThat(includedModels.get(0).getImportType()).isEqualTo(DMNImportTypes.DMN.getDefaultNamespace());
}
use of org.kie.workbench.common.dmn.api.definition.model.ImportPMML in project kie-wb-common by kiegroup.
the class ImportConverterTest method wbFromDMN_PMMLImportWithModels.
@Test
public void wbFromDMN_PMMLImportWithModels() {
when(jsitImportMock.getImportType()).thenReturn(PMML_IMPORT_TYPE);
pmmlDocumentMetadata.getModels().add(new PMMLModelMetadata("modelName", null));
Import resultImport = ImportConverter.wbFromDMN(jsitImportMock, null, pmmlDocumentMetadata);
assertTrue(resultImport instanceof ImportPMML);
assertEquals(LOCATION_URI, resultImport.getLocationURI().getValue());
assertEquals(NAME, resultImport.getNamespace());
assertEquals(DESCRIPTION, resultImport.getDescription().getValue());
assertEquals(NAME, resultImport.getName().getValue());
assertEquals(PMML_IMPORT_TYPE, resultImport.getImportType());
assertNotNull(resultImport.getId().getValue());
assertEquals(1, ((ImportPMML) resultImport).getModelCount());
}
use of org.kie.workbench.common.dmn.api.definition.model.ImportPMML in project kie-wb-common by kiegroup.
the class ImportConverterTest method wbFromDMN_PMMLImportNoPmmlModelMetadata.
@Test
public void wbFromDMN_PMMLImportNoPmmlModelMetadata() {
when(jsitImportMock.getImportType()).thenReturn(PMML_IMPORT_TYPE);
pmmlDocumentMetadata.getModels().add(new PMMLModelMetadata("modelName", null));
Import resultImport = ImportConverter.wbFromDMN(jsitImportMock, null, null);
assertTrue(resultImport instanceof ImportPMML);
assertEquals(LOCATION_URI, resultImport.getLocationURI().getValue());
assertEquals(NAME, resultImport.getNamespace());
assertEquals(DESCRIPTION, resultImport.getDescription().getValue());
assertEquals(NAME, resultImport.getName().getValue());
assertEquals(PMML_IMPORT_TYPE, resultImport.getImportType());
assertNotNull(resultImport.getId().getValue());
assertEquals(0, ((ImportPMML) resultImport).getModelCount());
}
Aggregations