use of org.olat.modules.reminder.ReminderRule in project OpenOLAT by OpenOLAT.
the class ReminderRuleEngineTest method getRepositoryEntryLifecycleRuleValidFromRule.
private List<ReminderRule> getRepositoryEntryLifecycleRuleValidFromRule(int amount, LaunchUnit unit) {
ReminderRuleImpl rule = new ReminderRuleImpl();
rule.setType(RepositoryEntryLifecycleAfterValidFromRuleSPI.class.getSimpleName());
rule.setOperator(">");
rule.setRightOperand(Integer.toString(amount));
rule.setRightUnit(unit.name());
List<ReminderRule> rules = new ArrayList<>(1);
rules.add(rule);
return rules;
}
use of org.olat.modules.reminder.ReminderRule in project OpenOLAT by OpenOLAT.
the class ReminderRuleEngineTest method dateRule.
@Test
public void dateRule() {
Calendar cal = Calendar.getInstance();
// check rule with date in the past
List<ReminderRule> rulePastList = new ArrayList<>();
ReminderRuleImpl pastRule = new ReminderRuleImpl();
pastRule.setType(DateRuleSPI.class.getSimpleName());
pastRule.setOperator(DateRuleSPI.AFTER);
cal.add(Calendar.HOUR_OF_DAY, -4);
pastRule.setRightOperand(Formatter.formatDatetime(cal.getTime()));
rulePastList.add(pastRule);
boolean pastEval = ruleEngine.evaluateDateRule(rulePastList);
Assert.assertTrue(pastEval);
// check rule with date in the future
List<ReminderRule> ruleFutureList = new ArrayList<>();
ReminderRuleImpl futureRule = new ReminderRuleImpl();
futureRule.setType(DateRuleSPI.class.getSimpleName());
futureRule.setOperator(DateRuleSPI.AFTER);
cal.add(Calendar.DATE, 4);
futureRule.setRightOperand(Formatter.formatDatetime(cal.getTime()));
ruleFutureList.add(futureRule);
boolean futureEval = ruleEngine.evaluateDateRule(ruleFutureList);
Assert.assertFalse(futureEval);
}
use of org.olat.modules.reminder.ReminderRule in project OpenOLAT by OpenOLAT.
the class ReminderRuleEngineTest method getRecentLaunchRules.
private List<ReminderRule> getRecentLaunchRules(int amount, LaunchUnit unit) {
ReminderRuleImpl rule = new ReminderRuleImpl();
rule.setType(RecentCourseLaunchRuleSPI.class.getSimpleName());
rule.setOperator(">");
rule.setRightOperand(Integer.toString(amount));
rule.setRightUnit(unit.name());
List<ReminderRule> rules = new ArrayList<>(1);
rules.add(rule);
return rules;
}
use of org.olat.modules.reminder.ReminderRule in project OpenOLAT by OpenOLAT.
the class ReminderRuleEngineTest method getInitialAttemptsRules.
private List<ReminderRule> getInitialAttemptsRules(int value, String unit, String nodeIdent) {
ReminderRuleImpl rule = new ReminderRuleImpl();
rule.setType(InitialAttemptsRuleSPI.class.getSimpleName());
rule.setLeftOperand(nodeIdent);
rule.setOperator(">");
rule.setRightOperand(Integer.toString(value));
rule.setRightUnit(unit);
List<ReminderRule> rules = new ArrayList<>(1);
rules.add(rule);
return rules;
}
use of org.olat.modules.reminder.ReminderRule in project OpenOLAT by OpenOLAT.
the class ReminderRuleEngineTest method getRepositoryEntryLifecycleRuleValidToRule.
private List<ReminderRule> getRepositoryEntryLifecycleRuleValidToRule(int amount, LaunchUnit unit) {
ReminderRuleImpl rule = new ReminderRuleImpl();
rule.setType(RepositoryEntryLifecycleAfterValidToRuleSPI.class.getSimpleName());
rule.setOperator(">");
rule.setRightOperand(Integer.toString(amount));
rule.setRightUnit(unit.name());
List<ReminderRule> rules = new ArrayList<>(1);
rules.add(rule);
return rules;
}
Aggregations