ReuseSessionOptions.java

1
package fr.sii.ogham.sms.sender.impl.cloudhopper;
2
3
import com.cloudhopper.smpp.pdu.EnquireLink;
4
5
public class ReuseSessionOptions {
6
	/**
7
	 * Enable or disable the reuse the same session (if possible) for sending
8
	 * messages.
9
	 */
10
	private Boolean enable;
11
	/**
12
	 * To check if the session is still alive, an {@link EnquireLink} request is
13
	 * sent. The request is sent just before sending the message.
14
	 * 
15
	 * This is the time (in milliseconds) to wait before considering last
16
	 * {@link EnquireLink} response as expired (need to send a new
17
	 * {@link EnquireLink} request to check if session is still alive).
18
	 * 
19
	 * <p>
20
	 * This is needed to prevent sending {@link EnquireLink} request every time
21
	 * a message has to be sent. Instead it considers that the time elapsed
22
	 * between now and the last {@link EnquireLink} response (or the last sent
23
	 * message) is not enough so a new {@link EnquireLink} is not necessary to
24
	 * check if session is still alive.
25
	 *
26
	 * <p>
27
	 * Set to 0 or null to always check session before sending message.
28
	 */
29
	private Long lastInteractionExpirationDelay;
30
	/**
31
	 * To check if the session is still alive, an {@link EnquireLink} request is
32
	 * sent. This request may fail since the session may be killed by the
33
	 * server. The timeout ensures that the client doesn't wait too long for a
34
	 * response that may never come.
35
	 * 
36
	 * The maximum amount of time (in milliseconds) to wait for receiving a
37
	 * response from the server to an {@link EnquireLink} request.
38
	 */
39
	private Long enquireLinkTimeout;
40
41
	public ReuseSessionOptions() {
42
		super();
43
	}
44
45
	public ReuseSessionOptions(boolean enable) {
46
		super();
47
		this.enable = enable;
48
	}
49
50
	public Boolean getEnable() {
51 2 1. getEnable : replaced Boolean return with False for fr/sii/ogham/sms/sender/impl/cloudhopper/ReuseSessionOptions::getEnable → NO_COVERAGE
2. getEnable : replaced Boolean return with True for fr/sii/ogham/sms/sender/impl/cloudhopper/ReuseSessionOptions::getEnable → NO_COVERAGE
		return enable;
52
	}
53
54
	public void setEnable(Boolean enable) {
55
		this.enable = enable;
56
	}
57
	
58
	public boolean isEnable(boolean defaultValue) {
59 7 1. isEnable : replaced boolean return with false for fr/sii/ogham/sms/sender/impl/cloudhopper/ReuseSessionOptions::isEnable → SURVIVED
2. isEnable : replaced boolean return with true for fr/sii/ogham/sms/sender/impl/cloudhopper/ReuseSessionOptions::isEnable → SURVIVED
3. isEnable : negated conditional → SURVIVED
4. isEnable : negated conditional → TIMED_OUT
5. isEnable : replaced boolean return with false for fr/sii/ogham/sms/sender/impl/cloudhopper/ReuseSessionOptions::isEnable → KILLED
6. isEnable : replaced boolean return with true for fr/sii/ogham/sms/sender/impl/cloudhopper/ReuseSessionOptions::isEnable → KILLED
7. isEnable : negated conditional → KILLED
		return enable == null ? defaultValue : enable;
60
	}
61
62
	public Long getLastInteractionExpirationDelay() {
63 2 1. getLastInteractionExpirationDelay : replaced Long return value with 0L for fr/sii/ogham/sms/sender/impl/cloudhopper/ReuseSessionOptions::getLastInteractionExpirationDelay → NO_COVERAGE
2. getLastInteractionExpirationDelay : replaced Long return value with 0L for fr/sii/ogham/sms/sender/impl/cloudhopper/ReuseSessionOptions::getLastInteractionExpirationDelay → KILLED
		return lastInteractionExpirationDelay;
64
	}
65
66
	public void setLastInteractionExpirationDelay(Long delay) {
67
		this.lastInteractionExpirationDelay = delay;
68
	}
69
70
	public Long getEnquireLinkTimeout() {
71 2 1. getEnquireLinkTimeout : replaced Long return value with 0L for fr/sii/ogham/sms/sender/impl/cloudhopper/ReuseSessionOptions::getEnquireLinkTimeout → NO_COVERAGE
2. getEnquireLinkTimeout : replaced Long return value with 0L for fr/sii/ogham/sms/sender/impl/cloudhopper/ReuseSessionOptions::getEnquireLinkTimeout → KILLED
		return enquireLinkTimeout;
72
	}
73
74
	public void setEnquireLinkTimeout(Long enquireLinkTimeout) {
75
		this.enquireLinkTimeout = enquireLinkTimeout;
76
	}
77
78
}

Mutations

51

1.1
Location : getEnable
Killed by : none
replaced Boolean return with False for fr/sii/ogham/sms/sender/impl/cloudhopper/ReuseSessionOptions::getEnable → NO_COVERAGE

2.2
Location : getEnable
Killed by : none
replaced Boolean return with True for fr/sii/ogham/sms/sender/impl/cloudhopper/ReuseSessionOptions::getEnable → NO_COVERAGE

59

1.1
Location : isEnable
Killed by : none
replaced boolean return with false for fr/sii/ogham/sms/sender/impl/cloudhopper/ReuseSessionOptions::isEnable → SURVIVED

2.2
Location : isEnable
Killed by : oghamcloudhopper.it.ReuseSessionStrategyTest.reuseSessionButEnquireLinkTimeout(oghamcloudhopper.it.ReuseSessionStrategyTest)
replaced boolean return with false for fr/sii/ogham/sms/sender/impl/cloudhopper/ReuseSessionOptions::isEnable → KILLED

3.3
Location : isEnable
Killed by : oghamcloudhopper.it.SpecialCharactersTest.gsm8bit(oghamcloudhopper.it.SpecialCharactersTest)
replaced boolean return with true for fr/sii/ogham/sms/sender/impl/cloudhopper/ReuseSessionOptions::isEnable → KILLED

4.4
Location : isEnable
Killed by : none
replaced boolean return with true for fr/sii/ogham/sms/sender/impl/cloudhopper/ReuseSessionOptions::isEnable → SURVIVED

5.5
Location : isEnable
Killed by : oghamcloudhopper.it.ReuseSessionStrategyTest.reuseSessionButEnquireLinkTimeout(oghamcloudhopper.it.ReuseSessionStrategyTest)
negated conditional → KILLED

6.6
Location : isEnable
Killed by : none
negated conditional → TIMED_OUT

7.7
Location : isEnable
Killed by : none
negated conditional → SURVIVED

63

1.1
Location : getLastInteractionExpirationDelay
Killed by : oghamcloudhopper.it.ReuseSessionStrategyTest.reuseSessionButEnquireLinkTimeout(oghamcloudhopper.it.ReuseSessionStrategyTest)
replaced Long return value with 0L for fr/sii/ogham/sms/sender/impl/cloudhopper/ReuseSessionOptions::getLastInteractionExpirationDelay → KILLED

2.2
Location : getLastInteractionExpirationDelay
Killed by : none
replaced Long return value with 0L for fr/sii/ogham/sms/sender/impl/cloudhopper/ReuseSessionOptions::getLastInteractionExpirationDelay → NO_COVERAGE

71

1.1
Location : getEnquireLinkTimeout
Killed by : none
replaced Long return value with 0L for fr/sii/ogham/sms/sender/impl/cloudhopper/ReuseSessionOptions::getEnquireLinkTimeout → NO_COVERAGE

2.2
Location : getEnquireLinkTimeout
Killed by : oghamcloudhopper.it.ReuseSessionStrategyTest.reuseSessionButSendFailsDueToSessionClosedByServer(oghamcloudhopper.it.ReuseSessionStrategyTest)
replaced Long return value with 0L for fr/sii/ogham/sms/sender/impl/cloudhopper/ReuseSessionOptions::getEnquireLinkTimeout → KILLED

Active mutators

Tests examined


Report generated by PIT OGHAM