use of com.salaboy.model.KeyS in project jBPM5-Developer-Guide by Salaboy.
the class EventsTesterJFrame method onKeySjButtonKeyPressed.
private void onKeySjButtonKeyPressed(java.awt.event.KeyEvent evt) {
if (evt.getKeyCode() == KeyEvent.VK_S) {
ksession.insert(new KeyS());
ksession.fireAllRules();
outjTextPane.setText(outjTextPane.getText() + " >>> Key S Pressed!\n");
keySjButton.setBackground(new java.awt.Color(51, 255, 0));
keySjButton.setForeground(new java.awt.Color(51, 204, 0));
keySjButton.setText("[ Key S ]");
keySjButton.setOpaque(true);
}
}
use of com.salaboy.model.KeyS in project jBPM5-Developer-Guide by Salaboy.
the class MyFirstDrools5FusionRulesTest method testPatternDetectionEvents.
@Test
public void testPatternDetectionEvents() {
StatefulKnowledgeSession ksession = createKnowledgeSession();
SessionPseudoClock clock = ksession.getSessionClock();
int fired = 0;
// Initial time 0s -> t0
ksession.insert(new KeyA());
fired = ksession.fireAllRules();
clock.advanceTime(15, TimeUnit.MILLISECONDS);
assertEquals(0, fired);
ksession.insert(new KeyS());
fired = ksession.fireAllRules();
clock.advanceTime(15, TimeUnit.MILLISECONDS);
assertEquals(0, fired);
ksession.insert(new KeyD());
fired = ksession.fireAllRules();
clock.advanceTime(15, TimeUnit.MILLISECONDS);
assertEquals(1, fired);
ksession.dispose();
}
Aggregations