1 | package fr.sii.ogham.sms.sender.impl.cloudhopper.session; | |
2 | ||
3 | import org.slf4j.Logger; | |
4 | import org.slf4j.LoggerFactory; | |
5 | ||
6 | import com.cloudhopper.smpp.SmppSession; | |
7 | ||
8 | import fr.sii.ogham.core.exception.MessageException; | |
9 | import fr.sii.ogham.core.exception.clean.CleanException; | |
10 | import fr.sii.ogham.core.retry.RetryExecutor; | |
11 | import fr.sii.ogham.sms.builder.cloudhopper.SmppClientSupplier; | |
12 | import fr.sii.ogham.sms.builder.cloudhopper.SmppSessionHandlerSupplier; | |
13 | import fr.sii.ogham.sms.message.Sms; | |
14 | import fr.sii.ogham.sms.sender.impl.cloudhopper.ExtendedSmppSessionConfiguration; | |
15 | import fr.sii.ogham.sms.sender.impl.cloudhopper.exception.SmppException; | |
16 | ||
17 | /** | |
18 | * Simple management of SMPP session. | |
19 | * | |
20 | * For each message: | |
21 | * <ol> | |
22 | * <li>Open a SMPP session</li> | |
23 | * <li>Send the message</li> | |
24 | * <li>Close the SMPP session</li> | |
25 | * </ol> | |
26 | * | |
27 | * <p> | |
28 | * Only one message can be sent in the same time. | |
29 | * | |
30 | * <p> | |
31 | * If an error is raised, the exception is thrown and the SMS is not sent. | |
32 | * | |
33 | * @author Aurélien Baudet | |
34 | * | |
35 | */ | |
36 | public class AlwaysNewSessionStrategy extends BaseSessionHandlingStrategy { | |
37 | private static final Logger LOG = LoggerFactory.getLogger(AlwaysNewSessionStrategy.class); | |
38 | ||
39 | public AlwaysNewSessionStrategy(ExtendedSmppSessionConfiguration configuration, SmppClientSupplier clientSupplier, SmppSessionHandlerSupplier smppSessionHandlerSupplier, RetryExecutor retry) { | |
40 | super(LOG, configuration, clientSupplier, smppSessionHandlerSupplier, retry); | |
41 | } | |
42 | ||
43 | @Override | |
44 | public SmppSession getSession() throws SmppException { | |
45 |
4
1. getSession : removed call to fr/sii/ogham/sms/sender/impl/cloudhopper/session/AlwaysNewSessionStrategy::destroySession → SURVIVED 2. getSession : removed call to fr/sii/ogham/sms/sender/impl/cloudhopper/session/AlwaysNewSessionStrategy::destroySession → NO_COVERAGE 3. getSession : removed call to fr/sii/ogham/sms/sender/impl/cloudhopper/session/AlwaysNewSessionStrategy::destroySession → SURVIVED 4. getSession : removed call to fr/sii/ogham/sms/sender/impl/cloudhopper/session/AlwaysNewSessionStrategy::destroySession → TIMED_OUT |
destroySession(); |
46 |
4
1. getSession : removed call to fr/sii/ogham/sms/sender/impl/cloudhopper/session/AlwaysNewSessionStrategy::destroyClient → SURVIVED 2. getSession : removed call to fr/sii/ogham/sms/sender/impl/cloudhopper/session/AlwaysNewSessionStrategy::destroyClient → NO_COVERAGE 3. getSession : removed call to fr/sii/ogham/sms/sender/impl/cloudhopper/session/AlwaysNewSessionStrategy::destroyClient → SURVIVED 4. getSession : removed call to fr/sii/ogham/sms/sender/impl/cloudhopper/session/AlwaysNewSessionStrategy::destroyClient → TIMED_OUT |
destroyClient(); |
47 |
3
1. getSession : removed call to fr/sii/ogham/sms/sender/impl/cloudhopper/session/AlwaysNewSessionStrategy::initClient → NO_COVERAGE 2. getSession : removed call to fr/sii/ogham/sms/sender/impl/cloudhopper/session/AlwaysNewSessionStrategy::initClient → TIMED_OUT 3. getSession : removed call to fr/sii/ogham/sms/sender/impl/cloudhopper/session/AlwaysNewSessionStrategy::initClient → KILLED |
initClient(); |
48 |
4
1. getSession : removed call to fr/sii/ogham/sms/sender/impl/cloudhopper/session/AlwaysNewSessionStrategy::initSession → NO_COVERAGE 2. getSession : removed call to fr/sii/ogham/sms/sender/impl/cloudhopper/session/AlwaysNewSessionStrategy::initSession → TIMED_OUT 3. getSession : removed call to fr/sii/ogham/sms/sender/impl/cloudhopper/session/AlwaysNewSessionStrategy::initSession → KILLED 4. getSession : removed call to fr/sii/ogham/sms/sender/impl/cloudhopper/session/AlwaysNewSessionStrategy::initSession → KILLED |
initSession(); |
49 |
4
1. getSession : replaced return value with null for fr/sii/ogham/sms/sender/impl/cloudhopper/session/AlwaysNewSessionStrategy::getSession → NO_COVERAGE 2. getSession : replaced return value with null for fr/sii/ogham/sms/sender/impl/cloudhopper/session/AlwaysNewSessionStrategy::getSession → TIMED_OUT 3. getSession : replaced return value with null for fr/sii/ogham/sms/sender/impl/cloudhopper/session/AlwaysNewSessionStrategy::getSession → KILLED 4. getSession : replaced return value with null for fr/sii/ogham/sms/sender/impl/cloudhopper/session/AlwaysNewSessionStrategy::getSession → KILLED |
return currentSession; |
50 | } | |
51 | ||
52 | @Override | |
53 | public void messageSent(Sms sms) throws MessageException { | |
54 | // nothing to do | |
55 | } | |
56 | ||
57 | @Override | |
58 | public void messageNotSent(Sms sms, SmppException e) throws MessageException { | |
59 | throw new MessageException("Failed to send SMS", sms, e); | |
60 | } | |
61 | ||
62 | @Override | |
63 | public void messageProcessed(Sms sms) { | |
64 |
4
1. messageProcessed : removed call to fr/sii/ogham/sms/sender/impl/cloudhopper/session/AlwaysNewSessionStrategy::destroySession → SURVIVED 2. messageProcessed : removed call to fr/sii/ogham/sms/sender/impl/cloudhopper/session/AlwaysNewSessionStrategy::destroySession → NO_COVERAGE 3. messageProcessed : removed call to fr/sii/ogham/sms/sender/impl/cloudhopper/session/AlwaysNewSessionStrategy::destroySession → TIMED_OUT 4. messageProcessed : removed call to fr/sii/ogham/sms/sender/impl/cloudhopper/session/AlwaysNewSessionStrategy::destroySession → KILLED |
destroySession(); |
65 |
4
1. messageProcessed : removed call to fr/sii/ogham/sms/sender/impl/cloudhopper/session/AlwaysNewSessionStrategy::destroyClient → SURVIVED 2. messageProcessed : removed call to fr/sii/ogham/sms/sender/impl/cloudhopper/session/AlwaysNewSessionStrategy::destroyClient → NO_COVERAGE 3. messageProcessed : removed call to fr/sii/ogham/sms/sender/impl/cloudhopper/session/AlwaysNewSessionStrategy::destroyClient → TIMED_OUT 4. messageProcessed : removed call to fr/sii/ogham/sms/sender/impl/cloudhopper/session/AlwaysNewSessionStrategy::destroyClient → KILLED |
destroyClient(); |
66 | } | |
67 | ||
68 | @Override | |
69 | public void clean() throws CleanException { | |
70 |
3
1. clean : removed call to fr/sii/ogham/sms/sender/impl/cloudhopper/session/AlwaysNewSessionStrategy::destroySession → SURVIVED 2. clean : removed call to fr/sii/ogham/sms/sender/impl/cloudhopper/session/AlwaysNewSessionStrategy::destroySession → SURVIVED 3. clean : removed call to fr/sii/ogham/sms/sender/impl/cloudhopper/session/AlwaysNewSessionStrategy::destroySession → TIMED_OUT |
destroySession(); |
71 |
3
1. clean : removed call to fr/sii/ogham/sms/sender/impl/cloudhopper/session/AlwaysNewSessionStrategy::destroyClient → SURVIVED 2. clean : removed call to fr/sii/ogham/sms/sender/impl/cloudhopper/session/AlwaysNewSessionStrategy::destroyClient → SURVIVED 3. clean : removed call to fr/sii/ogham/sms/sender/impl/cloudhopper/session/AlwaysNewSessionStrategy::destroyClient → TIMED_OUT |
destroyClient(); |
72 | } | |
73 | } | |
Mutations | ||
45 |
1.1 2.2 3.3 4.4 |
|
46 |
1.1 2.2 3.3 4.4 |
|
47 |
1.1 2.2 3.3 |
|
48 |
1.1 2.2 3.3 4.4 |
|
49 |
1.1 2.2 3.3 4.4 |
|
64 |
1.1 2.2 3.3 4.4 |
|
65 |
1.1 2.2 3.3 4.4 |
|
70 |
1.1 2.2 3.3 |
|
71 |
1.1 2.2 3.3 |