SimpleEmailComponent implements IAcceptsRuntimeInputs { public boolean validate() throws Exception { boolean result = true; if ( getTo() == null ) { log.error( Messages.getInstance().getString( "ReportPlugin.emailToNotProvided" ) ); return false; } else if ( getFrom() == null ) { log.error( Messages.getInstance().getString( "ReportPlugin.emailFromNotProvided" ) ); return false; } else if ( ( getMessagePlain() == null ) && ( getMessageHtml() == null ) && ( getMimeMessage() == null ) ) { log.error( Messages.getInstance().getString( "ReportPlugin.emailContentNotProvided" ) ); result = false; } return result; } SimpleEmailComponent(); String getBcc(); void setBcc( final String bcc ); String getCc(); void setCc( final String cc ); String getFrom(); void setFrom( final String from ); String getSubject(); void setSubject( final String subject ); String getTo(); void setTo( final String to ); Object getMessageHtml(); void setMessageHtml( final Object messageHtml ); Object getMessagePlain(); void setMessagePlain( final Object messagePlain ); IContentItem getMimeMessage(); void setMimeMessage( final IContentItem mimeMessage ); IContentItem getAttachmentContent(); void setAttachmentContent( final IContentItem attachmentContent ); String getAttachmentName(); void setAttachmentName( final String attachmentName ); IContentItem getAttachmentContent2(); void setAttachmentContent2( final IContentItem attachmentContent2 ); IContentItem getAttachmentContent3(); void setAttachmentContent3( final IContentItem attachmentContent3 ); String getAttachmentName2(); void setAttachmentName2( final String attachmentName2 ); String getAttachmentName3(); void setAttachmentName3( final String attachmentName3 ); void setOutputType( final String outputType ); String getOutputType(); void setInputs( final Map<String, Object> inputs ); boolean validate(); boolean execute(); String getMimeType(); static final String INPUT_TO; static final String INPUT_FROM; static final String INPUT_CC; static final String INPUT_BCC; static final String INPUT_SUBJECT; static final String INPUT_MESSAGEPLAIN; static final String INPUT_MESSAGEHTML; static final String INPUT_MIMEMESSAGE; }
@Test public void testValidate() throws Exception { assertFalse( sec.validate() ); sec.setTo( "to" ); assertFalse( sec.validate() ); sec.setFrom( "from" ); assertFalse( sec.validate() ); sec.setMessagePlain( "messagePlain" ); sec.setMessageHtml( "messageHtml" ); sec.setMimeMessage( mock( IContentItem.class ) ); assertTrue( sec.validate() ); }