SimpleEmailComponent implements IAcceptsRuntimeInputs { public void setInputs( final Map<String, Object> inputs ) { this.inputs = inputs; if ( inputs.containsKey( INPUT_FROM ) ) { setFrom( (String) inputs.get( INPUT_FROM ) ); } if ( inputs.containsKey( INPUT_TO ) ) { setTo( (String) inputs.get( INPUT_TO ) ); } if ( inputs.containsKey( INPUT_CC ) ) { setCc( (String) inputs.get( INPUT_CC ) ); } if ( inputs.containsKey( INPUT_BCC ) ) { setBcc( (String) inputs.get( INPUT_BCC ) ); } if ( inputs.containsKey( INPUT_SUBJECT ) ) { setSubject( (String) inputs.get( INPUT_SUBJECT ) ); } if ( inputs.containsKey( INPUT_MESSAGEPLAIN ) ) { setMessagePlain( (String) inputs.get( INPUT_MESSAGEPLAIN ) ); } if ( inputs.containsKey( INPUT_MESSAGEHTML ) ) { setMessageHtml( (String) inputs.get( INPUT_MESSAGEHTML ) ); } if ( inputs.containsKey( INPUT_MIMEMESSAGE ) ) { setMimeMessage( (IContentItem) inputs.get( INPUT_MIMEMESSAGE ) ); } } 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 testSetInputs() throws Exception { final IContentItem contentItem = mock( IContentItem.class ); Map<String, Object> inputs = new HashMap<String, Object>() {{ put( "from", "fromValue" ); put( "to", "toValue" ); put( "cc", "ccValue" ); put( "bcc", "bccValue" ); put( "subject", "subjectValue" ); put( "message-plain", "message-plainValue" ); put( "message-html", "message-htmlValue" ); put( "mime-message", contentItem ); }}; sec.setInputs( inputs ); for ( int i = 0; i < inputs.size(); i++ ) { String key = inputs.keySet().toArray()[ i ].toString(); assertEquals( inputs.get( key ), sec.getInput( key, "" ) ); } }