WaitBindTask.java

1
package fr.sii.ogham.testing.sms.simulator.jsmpp;
2
3
import java.io.IOException;
4
import java.util.List;
5
import java.util.Objects;
6
import java.util.concurrent.TimeoutException;
7
8
import org.jsmpp.PDUStringException;
9
import org.jsmpp.SMPPConstant;
10
import org.jsmpp.bean.InterfaceVersion;
11
import org.jsmpp.session.BindRequest;
12
import org.jsmpp.session.SMPPServerSession;
13
import org.slf4j.Logger;
14
import org.slf4j.LoggerFactory;
15
16
import fr.sii.ogham.testing.sms.simulator.config.Credentials;
17
18
class WaitBindTask implements Runnable {
19
	private static final int WAIT_DURATION = 1000;
20
21
	private static final Logger LOG = LoggerFactory.getLogger(WaitBindTask.class);
22
23
	private final SMPPServerSession serverSession;
24
	private final List<Credentials> serverCredentials;
25
26
	public WaitBindTask(SMPPServerSession serverSession, List<Credentials> serverCredentials) {
27
		this.serverSession = serverSession;
28
		this.serverCredentials = serverCredentials;
29
	}
30
31
	public void run() {
32
		try {
33
			BindRequest bindRequest = serverSession.waitForBind(WAIT_DURATION);
34
			LOG.info("Accepting bind for session {}, interface version {}", serverSession.getSessionId(), InterfaceVersion.IF_34);
35 3 1. run : removed call to fr/sii/ogham/testing/sms/simulator/jsmpp/WaitBindTask::bind → NO_COVERAGE
2. run : removed call to fr/sii/ogham/testing/sms/simulator/jsmpp/WaitBindTask::bind → TIMED_OUT
3. run : removed call to fr/sii/ogham/testing/sms/simulator/jsmpp/WaitBindTask::bind → KILLED
			bind(bindRequest);
36
		} catch (IllegalStateException e) {
37
			LOG.error("System error", e);
38
		} catch (TimeoutException e) {
39
			LOG.warn("Wait for bind has reach timeout", e);
40
		} catch (IOException e) {
41
			LOG.error("Failed accepting bind request for session {}", serverSession.getSessionId(), e);
42
		}
43
	}
44
45
	private void bind(BindRequest bindRequest) throws IOException {
46
		try {
47 5 1. bind : negated conditional → NO_COVERAGE
2. bind : negated conditional → TIMED_OUT
3. bind : negated conditional → KILLED
4. bind : negated conditional → KILLED
5. bind : negated conditional → KILLED
			if (checkPassword(bindRequest)) {
48 2 1. bind : removed call to org/jsmpp/session/BindRequest::accept → NO_COVERAGE
2. bind : removed call to org/jsmpp/session/BindRequest::accept → TIMED_OUT
				bindRequest.accept(bindRequest.getSystemId(), InterfaceVersion.IF_34);
49
			} else {
50 2 1. bind : removed call to org/jsmpp/session/BindRequest::reject → NO_COVERAGE
2. bind : removed call to org/jsmpp/session/BindRequest::reject → TIMED_OUT
				bindRequest.reject(SMPPConstant.STAT_ESME_RINVPASWD);
51
			}
52
		} catch (PDUStringException e) {
53
			LOG.error("Invalid system id", e);
54 1 1. bind : removed call to org/jsmpp/session/BindRequest::reject → NO_COVERAGE
			bindRequest.reject(SMPPConstant.STAT_ESME_RSYSERR);
55
		}
56
	}
57
58
	private boolean checkPassword(BindRequest bindRequest) {
59
		// no credentials registered => allow requests
60 10 1. checkPassword : negated conditional → NO_COVERAGE
2. checkPassword : negated conditional → SURVIVED
3. checkPassword : negated conditional → NO_COVERAGE
4. checkPassword : negated conditional → TIMED_OUT
5. checkPassword : negated conditional → TIMED_OUT
6. checkPassword : negated conditional → KILLED
7. checkPassword : negated conditional → KILLED
8. checkPassword : negated conditional → KILLED
9. checkPassword : negated conditional → KILLED
10. checkPassword : negated conditional → KILLED
		if (serverCredentials == null || serverCredentials.isEmpty()) {
61 5 1. checkPassword : replaced boolean return with false for fr/sii/ogham/testing/sms/simulator/jsmpp/WaitBindTask::checkPassword → NO_COVERAGE
2. checkPassword : replaced boolean return with false for fr/sii/ogham/testing/sms/simulator/jsmpp/WaitBindTask::checkPassword → TIMED_OUT
3. checkPassword : replaced boolean return with false for fr/sii/ogham/testing/sms/simulator/jsmpp/WaitBindTask::checkPassword → KILLED
4. checkPassword : replaced boolean return with false for fr/sii/ogham/testing/sms/simulator/jsmpp/WaitBindTask::checkPassword → KILLED
5. checkPassword : replaced boolean return with false for fr/sii/ogham/testing/sms/simulator/jsmpp/WaitBindTask::checkPassword → KILLED
			return true;
62
		}
63
		for (Credentials creds : serverCredentials) {
64 6 1. checkPassword : negated conditional → NO_COVERAGE
2. checkPassword : negated conditional → NO_COVERAGE
3. checkPassword : negated conditional → KILLED
4. checkPassword : negated conditional → KILLED
5. checkPassword : negated conditional → KILLED
6. checkPassword : negated conditional → KILLED
			if (Objects.equals(creds.getSystemId(), bindRequest.getSystemId()) && Objects.equals(creds.getPassword(), bindRequest.getPassword())) {
65 2 1. checkPassword : replaced boolean return with false for fr/sii/ogham/testing/sms/simulator/jsmpp/WaitBindTask::checkPassword → NO_COVERAGE
2. checkPassword : replaced boolean return with false for fr/sii/ogham/testing/sms/simulator/jsmpp/WaitBindTask::checkPassword → KILLED
				return true;
66
			}
67
		}
68 3 1. checkPassword : replaced boolean return with true for fr/sii/ogham/testing/sms/simulator/jsmpp/WaitBindTask::checkPassword → NO_COVERAGE
2. checkPassword : replaced boolean return with true for fr/sii/ogham/testing/sms/simulator/jsmpp/WaitBindTask::checkPassword → KILLED
3. checkPassword : replaced boolean return with true for fr/sii/ogham/testing/sms/simulator/jsmpp/WaitBindTask::checkPassword → KILLED
		return false;
69
	}
70
}

Mutations

35

1.1
Location : run
Killed by : oghamall.it.sms.SmsSMPPGsm7bitTest.longMessage(oghamall.it.sms.SmsSMPPGsm7bitTest)
removed call to fr/sii/ogham/testing/sms/simulator/jsmpp/WaitBindTask::bind → KILLED

2.2
Location : run
Killed by : none
removed call to fr/sii/ogham/testing/sms/simulator/jsmpp/WaitBindTask::bind → NO_COVERAGE

3.3
Location : run
Killed by : none
removed call to fr/sii/ogham/testing/sms/simulator/jsmpp/WaitBindTask::bind → TIMED_OUT

47

1.1
Location : bind
Killed by : oghamall.it.sms.SmsSMPPGsm7bitTest.longMessage(oghamall.it.sms.SmsSMPPGsm7bitTest)
negated conditional → KILLED

2.2
Location : bind
Killed by : oghamtesting.it.sms.simulator.JsmppSimulatorSpec
negated conditional → KILLED

3.3
Location : bind
Killed by : none
negated conditional → NO_COVERAGE

4.4
Location : bind
Killed by : oghamcloudhopper.it.PartialConfigurationTest.splitterEnabledAndAutoGuessEnabledAndGsm7bitEncodingConfiguredAndLongMessageWithUnsupportedCharactersShouldFailIndicatingThatMessageCantBeSplit(oghamcloudhopper.it.PartialConfigurationTest)
negated conditional → KILLED

5.5
Location : bind
Killed by : none
negated conditional → TIMED_OUT

48

1.1
Location : bind
Killed by : none
removed call to org/jsmpp/session/BindRequest::accept → NO_COVERAGE

2.2
Location : bind
Killed by : none
removed call to org/jsmpp/session/BindRequest::accept → TIMED_OUT

50

1.1
Location : bind
Killed by : none
removed call to org/jsmpp/session/BindRequest::reject → TIMED_OUT

2.2
Location : bind
Killed by : none
removed call to org/jsmpp/session/BindRequest::reject → NO_COVERAGE

54

1.1
Location : bind
Killed by : none
removed call to org/jsmpp/session/BindRequest::reject → NO_COVERAGE

60

1.1
Location : checkPassword
Killed by : oghamtesting.it.sms.simulator.JsmppSimulatorSpec
negated conditional → KILLED

2.2
Location : checkPassword
Killed by : oghamcloudhopper.it.ConnectionFailureTest.invalidSystemId(oghamcloudhopper.it.ConnectionFailureTest)
negated conditional → KILLED

3.3
Location : checkPassword
Killed by : none
negated conditional → TIMED_OUT

4.4
Location : checkPassword
Killed by : none
negated conditional → NO_COVERAGE

5.5
Location : checkPassword
Killed by : none
negated conditional → SURVIVED

6.6
Location : checkPassword
Killed by : none
negated conditional → NO_COVERAGE

7.7
Location : checkPassword
Killed by : none
negated conditional → TIMED_OUT

8.8
Location : checkPassword
Killed by : oghamcloudhopper.it.PartialConfigurationTest.splitterEnabledAndAutoGuessEnabledAndGsm7bitEncodingConfiguredAndLongMessageWithUnsupportedCharactersShouldFailIndicatingThatMessageCantBeSplit(oghamcloudhopper.it.PartialConfigurationTest)
negated conditional → KILLED

9.9
Location : checkPassword
Killed by : oghamall.it.sms.SmsSMPPGsm7bitTest.longMessage(oghamall.it.sms.SmsSMPPGsm7bitTest)
negated conditional → KILLED

10.10
Location : checkPassword
Killed by : oghamtesting.it.sms.simulator.JsmppSimulatorSpec
negated conditional → KILLED

61

1.1
Location : checkPassword
Killed by : oghamtesting.it.sms.simulator.JsmppSimulatorSpec
replaced boolean return with false for fr/sii/ogham/testing/sms/simulator/jsmpp/WaitBindTask::checkPassword → KILLED

2.2
Location : checkPassword
Killed by : none
replaced boolean return with false for fr/sii/ogham/testing/sms/simulator/jsmpp/WaitBindTask::checkPassword → NO_COVERAGE

3.3
Location : checkPassword
Killed by : oghamall.it.sms.SmsSMPPGsm7bitTest.longMessage(oghamall.it.sms.SmsSMPPGsm7bitTest)
replaced boolean return with false for fr/sii/ogham/testing/sms/simulator/jsmpp/WaitBindTask::checkPassword → KILLED

4.4
Location : checkPassword
Killed by : none
replaced boolean return with false for fr/sii/ogham/testing/sms/simulator/jsmpp/WaitBindTask::checkPassword → TIMED_OUT

5.5
Location : checkPassword
Killed by : oghamcloudhopper.it.PartialConfigurationTest.splitterEnabledAndAutoGuessEnabledAndGsm7bitEncodingConfiguredAndLongMessageWithUnsupportedCharactersShouldFailIndicatingThatMessageCantBeSplit(oghamcloudhopper.it.PartialConfigurationTest)
replaced boolean return with false for fr/sii/ogham/testing/sms/simulator/jsmpp/WaitBindTask::checkPassword → KILLED

64

1.1
Location : checkPassword
Killed by : oghamtesting.it.sms.simulator.JsmppSimulatorSpec
negated conditional → KILLED

2.2
Location : checkPassword
Killed by : oghamcloudhopper.it.ConnectionFailureTest.invalidSystemId(oghamcloudhopper.it.ConnectionFailureTest)
negated conditional → KILLED

3.3
Location : checkPassword
Killed by : none
negated conditional → NO_COVERAGE

4.4
Location : checkPassword
Killed by : oghamcloudhopper.it.ConnectionFailureTest.invalidPassword(oghamcloudhopper.it.ConnectionFailureTest)
negated conditional → KILLED

5.5
Location : checkPassword
Killed by : none
negated conditional → NO_COVERAGE

6.6
Location : checkPassword
Killed by : oghamtesting.it.sms.simulator.JsmppSimulatorSpec
negated conditional → KILLED

65

1.1
Location : checkPassword
Killed by : oghamtesting.it.sms.simulator.JsmppSimulatorSpec
replaced boolean return with false for fr/sii/ogham/testing/sms/simulator/jsmpp/WaitBindTask::checkPassword → KILLED

2.2
Location : checkPassword
Killed by : none
replaced boolean return with false for fr/sii/ogham/testing/sms/simulator/jsmpp/WaitBindTask::checkPassword → NO_COVERAGE

68

1.1
Location : checkPassword
Killed by : none
replaced boolean return with true for fr/sii/ogham/testing/sms/simulator/jsmpp/WaitBindTask::checkPassword → NO_COVERAGE

2.2
Location : checkPassword
Killed by : oghamcloudhopper.it.ConnectionFailureTest.invalidSystemId(oghamcloudhopper.it.ConnectionFailureTest)
replaced boolean return with true for fr/sii/ogham/testing/sms/simulator/jsmpp/WaitBindTask::checkPassword → KILLED

3.3
Location : checkPassword
Killed by : oghamtesting.it.sms.simulator.JsmppSimulatorSpec
replaced boolean return with true for fr/sii/ogham/testing/sms/simulator/jsmpp/WaitBindTask::checkPassword → KILLED

Active mutators

Tests examined


Report generated by PIT OGHAM