AlwaysNewSessionStrategy.java

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 1 1. getSession : removed call to fr/sii/ogham/sms/sender/impl/cloudhopper/session/AlwaysNewSessionStrategy::destroySession → RUN_ERROR
		destroySession();
46 1 1. getSession : removed call to fr/sii/ogham/sms/sender/impl/cloudhopper/session/AlwaysNewSessionStrategy::destroyClient → RUN_ERROR
		destroyClient();
47 1 1. getSession : removed call to fr/sii/ogham/sms/sender/impl/cloudhopper/session/AlwaysNewSessionStrategy::initClient → RUN_ERROR
		initClient();
48 1 1. getSession : removed call to fr/sii/ogham/sms/sender/impl/cloudhopper/session/AlwaysNewSessionStrategy::initSession → RUN_ERROR
		initSession();
49 1 1. getSession : replaced return value with null for fr/sii/ogham/sms/sender/impl/cloudhopper/session/AlwaysNewSessionStrategy::getSession → RUN_ERROR
		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 1 1. messageProcessed : removed call to fr/sii/ogham/sms/sender/impl/cloudhopper/session/AlwaysNewSessionStrategy::destroySession → RUN_ERROR
		destroySession();
65 1 1. messageProcessed : removed call to fr/sii/ogham/sms/sender/impl/cloudhopper/session/AlwaysNewSessionStrategy::destroyClient → RUN_ERROR
		destroyClient();
66
	}
67
68
	@Override
69
	public void clean() throws CleanException {
70 1 1. clean : removed call to fr/sii/ogham/sms/sender/impl/cloudhopper/session/AlwaysNewSessionStrategy::destroySession → RUN_ERROR
		destroySession();
71 1 1. clean : removed call to fr/sii/ogham/sms/sender/impl/cloudhopper/session/AlwaysNewSessionStrategy::destroyClient → RUN_ERROR
		destroyClient();
72
	}
73
}

Mutations

45

1.1
Location : getSession
Killed by :
removed call to fr/sii/ogham/sms/sender/impl/cloudhopper/session/AlwaysNewSessionStrategy::destroySession → RUN_ERROR

46

1.1
Location : getSession
Killed by :
removed call to fr/sii/ogham/sms/sender/impl/cloudhopper/session/AlwaysNewSessionStrategy::destroyClient → RUN_ERROR

47

1.1
Location : getSession
Killed by :
removed call to fr/sii/ogham/sms/sender/impl/cloudhopper/session/AlwaysNewSessionStrategy::initClient → RUN_ERROR

48

1.1
Location : getSession
Killed by :
removed call to fr/sii/ogham/sms/sender/impl/cloudhopper/session/AlwaysNewSessionStrategy::initSession → RUN_ERROR

49

1.1
Location : getSession
Killed by :
replaced return value with null for fr/sii/ogham/sms/sender/impl/cloudhopper/session/AlwaysNewSessionStrategy::getSession → RUN_ERROR

64

1.1
Location : messageProcessed
Killed by :
removed call to fr/sii/ogham/sms/sender/impl/cloudhopper/session/AlwaysNewSessionStrategy::destroySession → RUN_ERROR

65

1.1
Location : messageProcessed
Killed by :
removed call to fr/sii/ogham/sms/sender/impl/cloudhopper/session/AlwaysNewSessionStrategy::destroyClient → RUN_ERROR

70

1.1
Location : clean
Killed by :
removed call to fr/sii/ogham/sms/sender/impl/cloudhopper/session/AlwaysNewSessionStrategy::destroySession → RUN_ERROR

71

1.1
Location : clean
Killed by :
removed call to fr/sii/ogham/sms/sender/impl/cloudhopper/session/AlwaysNewSessionStrategy::destroyClient → RUN_ERROR

Active mutators

Tests examined


Report generated by PIT 1.13.1