also add mail replication test that tests outside of SecurityService context

This commit is contained in:
Fredrik Teschke
2015-02-13 20:59:11 +01:00
parent 42e1411bb6
commit 1d99e6ba75
4 changed files with 52 additions and 18 deletions
@@ -6,6 +6,8 @@ Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: SAP
Fragment-Host: com.sap.sse.mail
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: org.junit4;bundle-version="4.8.2",
Require-Bundle: org.hamcrest;bundle-version="1.1.0",
org.junit4;bundle-version="4.8.2",
com.rabbitmq.client,
com.sap.sse.replication.testsupport
com.sap.sse.replication.testsupport,
com.sap.sse.mail.replication.testsupport
@@ -0,0 +1,28 @@
package com.sap.sse.mail.replication.test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import org.junit.Test;
import com.sap.sse.common.mail.MailException;
import com.sap.sse.mail.MailService;
import com.sap.sse.mail.replication.testsupport.AbstractMailServiceReplicationTest;
public class SimpleMailServiceReplicationTest extends AbstractMailServiceReplicationTest {
@Test
public void testReplicationOfSendMail() throws InterruptedException,
IllegalAccessException, MailException {
MailService master = testSetUp.getMaster();
MailService replica = testSetUp.getReplica();
master.sendMail("test@ing.me", "oh what a beatiful mail", "to be sent on this day");
testSetUp.getReplicaReplicator().waitUntilQueueIsEmpty();
Thread.sleep(3000);
assertThat("mail was not sent on replica",
AbstractMailServiceReplicationTest.numberOfMailsSent.get(replica), equalTo(null));
assertThat("mail was sent on master",
AbstractMailServiceReplicationTest.numberOfMailsSent.get(master), equalTo(1));
}
}