Search in sources :

Example 11 with ImportPMML

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());
}
Also used : ImportDMN(org.kie.workbench.common.dmn.api.definition.model.ImportDMN) ImportPMML(org.kie.workbench.common.dmn.api.definition.model.ImportPMML) DMNIncludedModel(org.kie.workbench.common.dmn.api.editors.included.DMNIncludedModel) Test(org.junit.Test)

Example 12 with ImportPMML

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());
}
Also used : Import(org.kie.workbench.common.dmn.api.definition.model.Import) JSITImport(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITImport) PMMLModelMetadata(org.kie.workbench.common.dmn.api.editors.included.PMMLModelMetadata) ImportPMML(org.kie.workbench.common.dmn.api.definition.model.ImportPMML) Test(org.junit.Test)

Example 13 with ImportPMML

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());
}
Also used : Import(org.kie.workbench.common.dmn.api.definition.model.Import) JSITImport(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITImport) PMMLModelMetadata(org.kie.workbench.common.dmn.api.editors.included.PMMLModelMetadata) ImportPMML(org.kie.workbench.common.dmn.api.definition.model.ImportPMML) Test(org.junit.Test)

Aggregations

ImportPMML (org.kie.workbench.common.dmn.api.definition.model.ImportPMML)13 Import (org.kie.workbench.common.dmn.api.definition.model.Import)9 Test (org.junit.Test)8 ImportDMN (org.kie.workbench.common.dmn.api.definition.model.ImportDMN)7 LocationURI (org.kie.workbench.common.dmn.api.property.dmn.LocationURI)5 Name (org.kie.workbench.common.dmn.api.property.dmn.Name)4 PMMLIncludedModelActiveRecord (org.kie.workbench.common.dmn.client.editors.included.PMMLIncludedModelActiveRecord)4 JSITImport (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITImport)4 PMMLDocumentMetadata (org.kie.workbench.common.dmn.api.editors.included.PMMLDocumentMetadata)3 HashMap (java.util.HashMap)2 Map (java.util.Map)2 Objects (java.util.Objects)2 Optional (java.util.Optional)2 Function (java.util.function.Function)2 Definitions (org.kie.dmn.model.api.Definitions)2 DMNImportTypes (org.kie.workbench.common.dmn.api.editors.included.DMNImportTypes)2 DMNImportTypes.determineImportType (org.kie.workbench.common.dmn.api.editors.included.DMNImportTypes.determineImportType)2 PMMLModelMetadata (org.kie.workbench.common.dmn.api.editors.included.PMMLModelMetadata)2 QName (org.kie.workbench.common.dmn.api.property.dmn.QName)2 BaseIncludedModelActiveRecord (org.kie.workbench.common.dmn.client.editors.included.BaseIncludedModelActiveRecord)2