fieldErrors = this.getAction().getFieldErrors();
assertEquals(4, fieldErrors.size());
}
public void testSave() throws Throwable {
ConfigInterface configManager = (ConfigInterface) this.getService(SystemConstants.BASE_CONFIG_MANAGER);
String originaryConfig = configManager.getConfigItem(JpwebdynamicformSystemConstants.MESSAGE_NOTIFIER_CONFIG_ITEM);
MessageTypeNotifierConfig orginaryComConfig = this._messageManager.getNotifierConfig("COM");
try {
Map<String, Object> params = new HashMap<String, Object>();
params.put("typeCode", "PER");
params.put("store", "true");
params.put("mailAttrName", "eMail");
params.put("notifiable", "true");
params.put("senderCode", "CODE1");
params.put("bodyModel", "Mail Body");
params.put("subjectModel", "Mail Subject");
String[] recipientsTo = new String[] { "indirizzo1@inesistente.it" };
String[] recipientsCc = new String[] { "indirizzo2@inesistente.it", "indirizzo3@inesistente.it" };
String[] recipientsBcc = new String[] { "indirizzo1@inesistente.it", "indirizzo2@inesistente.it" };
String result = this.executeSave("admin", params, recipientsTo, recipientsCc, recipientsBcc);
assertEquals(Action.SUCCESS, result);
String newConfig = configManager.getConfigItem(JpwebdynamicformSystemConstants.MESSAGE_NOTIFIER_CONFIG_ITEM);
assertFalse(newConfig.equals(originaryConfig));
MessageTypeNotifierConfig newComConfig = this._messageManager.getNotifierConfig("COM");
this.checkConfigs(orginaryComConfig, newComConfig);
MessageTypeNotifierConfig newPerConfig = this._messageManager.getNotifierConfig("PER");
assertEquals("PER", newPerConfig.getTypeCode());
assertTrue(newPerConfig.isStore());
assertEquals("eMail", newPerConfig.getMailAttrName());
assertTrue(newPerConfig.isNotifiable());
assertEquals("CODE1", newPerConfig.getSenderCode());
MessageModel model = newPerConfig.getMessageModel();
assertEquals("Mail Body", model.getBodyModel());
assertEquals("Mail Subject", model.getSubjectModel());
this.checkStrings(recipientsTo, newPerConfig.getRecipientsTo());
this.checkStrings(recipientsCc, newPerConfig.getRecipientsCc());
this.checkStrings(recipientsBcc, newPerConfig.getRecipientsBcc());
} catch (Throwable t) {
throw t;
} finally {
configManager.updateConfigItem(JpwebdynamicformSystemConstants.MESSAGE_NOTIFIER_CONFIG_ITEM, originaryConfig);
}
}