@Test void initShouldThrowOnEmptyDestinationAttribute() { assertThatThrownBy(() -> testee.init(FakeMailetConfig.builder() .setProperty(ICALToJsonAttribute.DESTINATION_ATTRIBUTE_NAME, "") .build())) .isInstanceOf(MessagingException.class); }
@Override public void init() throws MessagingException { String sourceAttributeNameRaw = getInitParameter(SOURCE_ATTRIBUTE_NAME, DEFAULT_SOURCE_ATTRIBUTE_NAME); String rawSourceAttributeNameRaw = getInitParameter(RAW_SOURCE_ATTRIBUTE_NAME, DEFAULT_RAW_SOURCE_ATTRIBUTE_NAME); String destinationAttributeNameRaw = getInitParameter(DESTINATION_ATTRIBUTE_NAME, DEFAULT_DESTINATION_ATTRIBUTE_NAME); if (Strings.isNullOrEmpty(sourceAttributeNameRaw)) { throw new MessagingException(SOURCE_ATTRIBUTE_NAME + " configuration parameter can not be null or empty"); } sourceAttributeName = AttributeName.of(sourceAttributeNameRaw); if (Strings.isNullOrEmpty(rawSourceAttributeNameRaw)) { throw new MessagingException(RAW_SOURCE_ATTRIBUTE_NAME + " configuration parameter can not be null or empty"); } rawSourceAttributeName = AttributeName.of(rawSourceAttributeNameRaw); if (Strings.isNullOrEmpty(destinationAttributeNameRaw)) { throw new MessagingException(DESTINATION_ATTRIBUTE_NAME + " configuration parameter can not be null or empty"); } destinationAttributeName = AttributeName.of(destinationAttributeNameRaw); }
ICALToJsonAttribute extends GenericMailet { @Override public void init() throws MessagingException { String sourceAttributeNameRaw = getInitParameter(SOURCE_ATTRIBUTE_NAME, DEFAULT_SOURCE_ATTRIBUTE_NAME); String rawSourceAttributeNameRaw = getInitParameter(RAW_SOURCE_ATTRIBUTE_NAME, DEFAULT_RAW_SOURCE_ATTRIBUTE_NAME); String destinationAttributeNameRaw = getInitParameter(DESTINATION_ATTRIBUTE_NAME, DEFAULT_DESTINATION_ATTRIBUTE_NAME); if (Strings.isNullOrEmpty(sourceAttributeNameRaw)) { throw new MessagingException(SOURCE_ATTRIBUTE_NAME + " configuration parameter can not be null or empty"); } sourceAttributeName = AttributeName.of(sourceAttributeNameRaw); if (Strings.isNullOrEmpty(rawSourceAttributeNameRaw)) { throw new MessagingException(RAW_SOURCE_ATTRIBUTE_NAME + " configuration parameter can not be null or empty"); } rawSourceAttributeName = AttributeName.of(rawSourceAttributeNameRaw); if (Strings.isNullOrEmpty(destinationAttributeNameRaw)) { throw new MessagingException(DESTINATION_ATTRIBUTE_NAME + " configuration parameter can not be null or empty"); } destinationAttributeName = AttributeName.of(destinationAttributeNameRaw); } }
ICALToJsonAttribute extends GenericMailet { @Override public void init() throws MessagingException { String sourceAttributeNameRaw = getInitParameter(SOURCE_ATTRIBUTE_NAME, DEFAULT_SOURCE_ATTRIBUTE_NAME); String rawSourceAttributeNameRaw = getInitParameter(RAW_SOURCE_ATTRIBUTE_NAME, DEFAULT_RAW_SOURCE_ATTRIBUTE_NAME); String destinationAttributeNameRaw = getInitParameter(DESTINATION_ATTRIBUTE_NAME, DEFAULT_DESTINATION_ATTRIBUTE_NAME); if (Strings.isNullOrEmpty(sourceAttributeNameRaw)) { throw new MessagingException(SOURCE_ATTRIBUTE_NAME + " configuration parameter can not be null or empty"); } sourceAttributeName = AttributeName.of(sourceAttributeNameRaw); if (Strings.isNullOrEmpty(rawSourceAttributeNameRaw)) { throw new MessagingException(RAW_SOURCE_ATTRIBUTE_NAME + " configuration parameter can not be null or empty"); } rawSourceAttributeName = AttributeName.of(rawSourceAttributeNameRaw); if (Strings.isNullOrEmpty(destinationAttributeNameRaw)) { throw new MessagingException(DESTINATION_ATTRIBUTE_NAME + " configuration parameter can not be null or empty"); } destinationAttributeName = AttributeName.of(destinationAttributeNameRaw); } ICALToJsonAttribute(); }
ICALToJsonAttribute extends GenericMailet { @Override public void init() throws MessagingException { String sourceAttributeNameRaw = getInitParameter(SOURCE_ATTRIBUTE_NAME, DEFAULT_SOURCE_ATTRIBUTE_NAME); String rawSourceAttributeNameRaw = getInitParameter(RAW_SOURCE_ATTRIBUTE_NAME, DEFAULT_RAW_SOURCE_ATTRIBUTE_NAME); String destinationAttributeNameRaw = getInitParameter(DESTINATION_ATTRIBUTE_NAME, DEFAULT_DESTINATION_ATTRIBUTE_NAME); if (Strings.isNullOrEmpty(sourceAttributeNameRaw)) { throw new MessagingException(SOURCE_ATTRIBUTE_NAME + " configuration parameter can not be null or empty"); } sourceAttributeName = AttributeName.of(sourceAttributeNameRaw); if (Strings.isNullOrEmpty(rawSourceAttributeNameRaw)) { throw new MessagingException(RAW_SOURCE_ATTRIBUTE_NAME + " configuration parameter can not be null or empty"); } rawSourceAttributeName = AttributeName.of(rawSourceAttributeNameRaw); if (Strings.isNullOrEmpty(destinationAttributeNameRaw)) { throw new MessagingException(DESTINATION_ATTRIBUTE_NAME + " configuration parameter can not be null or empty"); } destinationAttributeName = AttributeName.of(destinationAttributeNameRaw); } ICALToJsonAttribute(); @Override String getMailetInfo(); @Override void init(); @Override void service(Mail mail); }
ICALToJsonAttribute extends GenericMailet { @Override public void init() throws MessagingException { String sourceAttributeNameRaw = getInitParameter(SOURCE_ATTRIBUTE_NAME, DEFAULT_SOURCE_ATTRIBUTE_NAME); String rawSourceAttributeNameRaw = getInitParameter(RAW_SOURCE_ATTRIBUTE_NAME, DEFAULT_RAW_SOURCE_ATTRIBUTE_NAME); String destinationAttributeNameRaw = getInitParameter(DESTINATION_ATTRIBUTE_NAME, DEFAULT_DESTINATION_ATTRIBUTE_NAME); if (Strings.isNullOrEmpty(sourceAttributeNameRaw)) { throw new MessagingException(SOURCE_ATTRIBUTE_NAME + " configuration parameter can not be null or empty"); } sourceAttributeName = AttributeName.of(sourceAttributeNameRaw); if (Strings.isNullOrEmpty(rawSourceAttributeNameRaw)) { throw new MessagingException(RAW_SOURCE_ATTRIBUTE_NAME + " configuration parameter can not be null or empty"); } rawSourceAttributeName = AttributeName.of(rawSourceAttributeNameRaw); if (Strings.isNullOrEmpty(destinationAttributeNameRaw)) { throw new MessagingException(DESTINATION_ATTRIBUTE_NAME + " configuration parameter can not be null or empty"); } destinationAttributeName = AttributeName.of(destinationAttributeNameRaw); } ICALToJsonAttribute(); @Override String getMailetInfo(); @Override void init(); @Override void service(Mail mail); static final String SOURCE_ATTRIBUTE_NAME; static final String RAW_SOURCE_ATTRIBUTE_NAME; static final String DESTINATION_ATTRIBUTE_NAME; static final String DEFAULT_SOURCE_ATTRIBUTE_NAME; static final String DEFAULT_RAW_SOURCE_ATTRIBUTE_NAME; static final String DEFAULT_DESTINATION_ATTRIBUTE_NAME; static final AttributeName DEFAULT_SOURCE; static final AttributeName DEFAULT_RAW_SOURCE; static final AttributeName DEFAULT_DESTINATION; static final String REPLY_TO_HEADER_NAME; }