return def;
}
private AlertNotification createAlertNotificationForTest(AlertDefinition alertDefinition, boolean precanned) {
AlertNotification notif = new AlertNotification(TestAlertSender.NAME);
Configuration alertConfig = new Configuration();
//generate random property so that the notifications are distinguishable from each other
//and are saved separately
Random randomGenerator = new Random();
String randomValue = randomGenerator.nextInt(100) + " - " + randomGenerator.nextInt(200);
alertConfig.put(new PropertySimple(randomValue, randomValue));
if (precanned) {
alertConfig.put(new PropertySimple(TestAlertSender.PERSISTENT_PROPERTY_NAME,
TestAlertSender.PERSISTEN_PROPERTY_EXPECTED_VALUE));
} else {
alertConfig.put(new PropertySimple(TestAlertSender.PERSISTENT_PROPERTY_NAME, "persistent"));
alertConfig.put(new PropertySimple(TestAlertSender.EPHEMERAL_PROPERTY_NAME, "ephemeral"));
}
Configuration extraConfig = new Configuration();
if (precanned) {
extraConfig.put(new PropertySimple(TestAlertSender.PERSISTENT_PROPERTY_NAME,
TestAlertSender.PERSISTEN_PROPERTY_EXPECTED_VALUE));
} else {
extraConfig.put(new PropertySimple(TestAlertSender.PERSISTENT_PROPERTY_NAME, "persistent"));
extraConfig.put(new PropertySimple(TestAlertSender.EPHEMERAL_PROPERTY_NAME, "ephemeral"));
}
notif.setConfiguration(alertConfig);
notif.setExtraConfiguration(extraConfig);
alertDefinition.addAlertNotification(notif);
notif.setAlertDefinition(alertDefinition);
return notif;
}