use of org.drools.core.command.runtime.rule.FireAllRulesCommand in project drools by kiegroup.
the class XStreamXMLTest method testFireAllRulesCommand.
@Test
public void testFireAllRulesCommand() {
RuleNameEndsWithAgendaFilter filter = new RuleNameEndsWithAgendaFilter("mySuffix", true);
FireAllRulesCommand cmd = new FireAllRulesCommand("ABC", 100, filter);
String xmlString = xstream.toXML(cmd);
String expected = "<fire-all-rules max=\"100\" out-identifier=\"ABC\">\n" + " <agendaFilter class=\"org.drools.core.base.RuleNameEndsWithAgendaFilter\">\n" + " <suffix>mySuffix</suffix>\n" + " <accept>true</accept>\n" + " </agendaFilter>\n" + "</fire-all-rules>";
Assertions.assertThat(expected).isEqualToIgnoringWhitespace(xmlString);
FireAllRulesCommand cmd2 = (FireAllRulesCommand) xstream.fromXML(xmlString);
Assert.assertEquals(100, cmd2.getMax());
Assert.assertEquals(RuleNameEndsWithAgendaFilter.class, cmd2.getAgendaFilter().getClass());
Assert.assertEquals("mySuffix", ((RuleNameEndsWithAgendaFilter) cmd2.getAgendaFilter()).getSuffix());
Assert.assertTrue(((RuleNameEndsWithAgendaFilter) cmd2.getAgendaFilter()).isAccept());
}
Aggregations