use of org.kie.pmml.models.drools.tuples.KiePMMLOperatorValue in project drools by kiegroup.
the class KiePMMLDescrRulesFactoryTest method declareRule.
@Test
public void declareRule() {
String name = "NAME";
String statusToSet = "STATUS_TO_SET";
String patternType = "TEMPERATURE";
String agendaGroup = "agendaGroup";
String activationGroup = "activationGroup";
List<KiePMMLFieldOperatorValue> orConstraints = Arrays.asList(new KiePMMLFieldOperatorValue(patternType, BOOLEAN_OPERATOR.OR, Collections.singletonList(new KiePMMLOperatorValue(OPERATOR.LESS_THAN, 35)), null), new KiePMMLFieldOperatorValue(patternType, BOOLEAN_OPERATOR.AND, Collections.singletonList(new KiePMMLOperatorValue(OPERATOR.GREATER_THAN, 85)), null));
KiePMMLDroolsRule rule = KiePMMLDroolsRule.builder(name, statusToSet, Collections.emptyList()).withAgendaGroup(agendaGroup).withActivationGroup(activationGroup).withOrConstraints(orConstraints).build();
KiePMMLDescrRulesFactory.factory(builder).declareRule(rule);
assertNotNull(builder.getDescr().getRules());
assertEquals(1, builder.getDescr().getRules().size());
final RuleDescr retrieved = builder.getDescr().getRules().get(0);
assertEquals(name, retrieved.getName());
assertEquals(2, retrieved.getAttributes().size());
assertTrue(retrieved.getAttributes().containsKey("agenda-group"));
assertEquals(agendaGroup, retrieved.getAttributes().get("agenda-group").getValue());
assertTrue(retrieved.getAttributes().containsKey("activation-group"));
assertEquals(activationGroup, retrieved.getAttributes().get("activation-group").getValue());
}
Aggregations