JBoss.orgCommunity Documentation
The MailDataInjector is used to manage data injection in the Mail application.
Because of the quite complicated architecture of the Mail application in eXo Collaboration, the injector uses a simple mail server (a mock server) to simulate the way a mail server works. This will create real mail data without mocking effort from the injector and create a reliable testing environment.
To use the injector, do as follows:
1. Add the Greenmail library to the classpath of the web server (in tomcat, copy it to the lib folder). The library is Greenmail 1.3.1b but including some bug fixes which are not updated in the counterpart version of Icegreen. (To have the library, contact eXo Support team).
2. Initialize this component as a service of GateIn, then it will be invoked by MailDataInjector.
<component>
<type>org.exoplatform.mail.service.bench.SimpleMailServerInitializer</type>
</component>
3. Register MailDataInjector to DataInjectorService by the following configuration:
<external-component-plugins>
<target-component>org.exoplatform.services.bench.DataInjectorService</target-component>
<component-plugin>
<name>MailDataInjector</name>
<set-method>addInjector</set-method>
<type>org.exoplatform.mail.service.bench.MailDataInjector</type>
<description>inject data for Contact</description>
</component-plugin>
</external-component-plugins>
In which:
Name: MailDataInjector
Set-method: addInjector
Type: org.exoplatform.mail.service.bench.MailDataInjector
To insert mail data into the Mail application, the request link is as follows:
http://{domain}/{rest}/bench/inject/MailDataInjector/?users=mary,root&accounts=2,account&inPro=IMAP&check=true&msgs=100&attSize=100
Params | Values | Description |
---|---|---|
users | String | The list of users separated by commas. |
accounts | String | The number of accounts injected by the data injector. This value consists of two parts separated by commas: the first is the number of accounts of an user, the second is the prefix of the account Id. |
inPro | String | The incoming protocol. The possible values are: POP3 and IMAP. |
check | Boolean | Specify if checking mails after the data are created on the mail server or not. If the value is true, the injector will execute checking new message tasks sequentially. This task can take some time if the data are large. |
msgs | Number | The number of messages will be available in each account. |
attSize | Number | The size of an attachment. If it does not exist or is equal to 0, no file is attached to the mail message. |
To reject mail data from the Mail application, the request link is as follows:
http://{domain}/{rest}/bench/reject/MailDataInjector/?users=root&accounts=2,account
This link will request for removing 2 accounts of "root" of which Id starts with "account".
By default, such settings have been declared in "csdemo.war/WEB-INF/conf/csdemo/cs/bench-configuration.xml". Therefore, to save time, you should import the bench-configuration.xml file to "csdemo.war/WEB-INF/conf/configuration.xml", and then modify it as your purpose rather than create a new one.