use of com.salaboy.model.KeyD in project jBPM5-Developer-Guide by Salaboy.
the class EventsTesterJFrame method onKeyDjButtonKeyPressed.
private void onKeyDjButtonKeyPressed(java.awt.event.KeyEvent evt) {
if (evt.getKeyCode() == KeyEvent.VK_D) {
ksession.insert(new KeyD());
ksession.fireAllRules();
outjTextPane.setText(outjTextPane.getText() + " >>> Key D Pressed!\n");
keyDjButton.setBackground(new java.awt.Color(51, 255, 0));
keyDjButton.setForeground(new java.awt.Color(51, 204, 0));
keyDjButton.setText("[ Key D ]");
keyDjButton.setOpaque(true);
}
}
use of com.salaboy.model.KeyD 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