Search in sources :

Example 1 with NormDiscrete

use of org.dmg.pmml.NormDiscrete in project drools by kiegroup.

the class PMMLModelTestUtils method getRandomNormDiscrete.

public static NormDiscrete getRandomNormDiscrete() {
    NormDiscrete toReturn = new NormDiscrete();
    toReturn.setField(FieldName.create(RandomStringUtils.random(6, true, false)));
    toReturn.setValue(getRandomObject(DataType.INTEGER));
    toReturn.setMapMissingTo((Number) getRandomObject(DataType.INTEGER));
    toReturn.setMethod(getRandomMethod());
    return toReturn;
}
Also used : NormDiscrete(org.dmg.pmml.NormDiscrete)

Example 2 with NormDiscrete

use of org.dmg.pmml.NormDiscrete in project drools by kiegroup.

the class KiePMMLNormDiscreteFactoryTest method getNormDiscreteVariableDeclaration.

@Test
public void getNormDiscreteVariableDeclaration() throws IOException {
    String variableName = "variableName";
    String fieldName = "fieldName";
    String fieldValue = "fieldValue";
    double mapMissingTo = 45.32;
    NormDiscrete normDiscrete = new NormDiscrete();
    normDiscrete.setField(FieldName.create(fieldName));
    normDiscrete.setValue(fieldValue);
    normDiscrete.setMapMissingTo(mapMissingTo);
    BlockStmt retrieved = KiePMMLNormDiscreteFactory.getNormDiscreteVariableDeclaration(variableName, normDiscrete);
    String text = getFileContent(TEST_01_SOURCE);
    Statement expected = JavaParserUtils.parseBlock(String.format(text, variableName, fieldName, fieldValue, mapMissingTo));
    assertTrue(JavaParserUtils.equalsNode(expected, retrieved));
    List<Class<?>> imports = Arrays.asList(Collections.class, KiePMMLNormDiscrete.class);
    commonValidateCompilationWithImports(retrieved, imports);
}
Also used : NormDiscrete(org.dmg.pmml.NormDiscrete) KiePMMLNormDiscrete(org.kie.pmml.commons.model.expressions.KiePMMLNormDiscrete) Statement(com.github.javaparser.ast.stmt.Statement) BlockStmt(com.github.javaparser.ast.stmt.BlockStmt) Test(org.junit.Test)

Example 3 with NormDiscrete

use of org.dmg.pmml.NormDiscrete in project drools by kiegroup.

the class KiePMMLNormDiscreteInstanceFactoryTest method getKiePMMLNormDiscrete.

@Test
public void getKiePMMLNormDiscrete() {
    NormDiscrete toConvert = getRandomNormDiscrete();
    KiePMMLNormDiscrete retrieved = KiePMMLNormDiscreteInstanceFactory.getKiePMMLNormDiscrete(toConvert);
    commonVerifyKiePMMLNormDiscrete(retrieved, toConvert);
}
Also used : InstanceFactoriesTestCommon.commonVerifyKiePMMLNormDiscrete(org.kie.pmml.compiler.commons.factories.InstanceFactoriesTestCommon.commonVerifyKiePMMLNormDiscrete) NormDiscrete(org.dmg.pmml.NormDiscrete) PMMLModelTestUtils.getRandomNormDiscrete(org.kie.pmml.compiler.api.testutils.PMMLModelTestUtils.getRandomNormDiscrete) KiePMMLNormDiscrete(org.kie.pmml.commons.model.expressions.KiePMMLNormDiscrete) InstanceFactoriesTestCommon.commonVerifyKiePMMLNormDiscrete(org.kie.pmml.compiler.commons.factories.InstanceFactoriesTestCommon.commonVerifyKiePMMLNormDiscrete) KiePMMLNormDiscrete(org.kie.pmml.commons.model.expressions.KiePMMLNormDiscrete) Test(org.junit.Test)

Aggregations

NormDiscrete (org.dmg.pmml.NormDiscrete)3 Test (org.junit.Test)2 KiePMMLNormDiscrete (org.kie.pmml.commons.model.expressions.KiePMMLNormDiscrete)2 BlockStmt (com.github.javaparser.ast.stmt.BlockStmt)1 Statement (com.github.javaparser.ast.stmt.Statement)1 PMMLModelTestUtils.getRandomNormDiscrete (org.kie.pmml.compiler.api.testutils.PMMLModelTestUtils.getRandomNormDiscrete)1 InstanceFactoriesTestCommon.commonVerifyKiePMMLNormDiscrete (org.kie.pmml.compiler.commons.factories.InstanceFactoriesTestCommon.commonVerifyKiePMMLNormDiscrete)1