JSMPPServer.java

1
package fr.sii.ogham.testing.sms.simulator.jsmpp;
2
3
import java.util.List;
4
5
import org.jsmpp.bean.SubmitSm;
6
import org.slf4j.Logger;
7
import org.slf4j.LoggerFactory;
8
9
import fr.sii.ogham.testing.sms.simulator.SmppServerException;
10
import fr.sii.ogham.testing.sms.simulator.SmppServerSimulator;
11
import fr.sii.ogham.testing.sms.simulator.config.SimulatorConfiguration;
12
13
/**
14
 * The server simulator based on <a href="http://jsmpp.org/">jsmpp</a> samples.
15
 */
16
public class JSMPPServer implements SmppServerSimulator<SubmitSm> {
17
	private static final Logger LOG = LoggerFactory.getLogger(JSMPPServer.class);
18
19
	private Thread thread;
20
	private final JSMPPServerSimulator simulator;
21
22
	/**
23
	 * Initializes with provided configuration.
24
	 * 
25
	 * @param config
26
	 *            the server configuration
27
	 */
28
	public JSMPPServer(SimulatorConfiguration config) {
29
		super();
30 6 1. <init> : negated conditional → NO_COVERAGE
2. <init> : negated conditional → TIMED_OUT
3. <init> : negated conditional → KILLED
4. <init> : negated conditional → KILLED
5. <init> : negated conditional → KILLED
6. <init> : negated conditional → KILLED
		if (config.getPortProvider() == null) {
31
			throw new IllegalArgumentException("Port configuration is mandatory");
32
		}
33
		simulator = new JSMPPServerSimulator(config.getPortProvider().getPort(), config);
34
	}
35
36
	@Override
37
	public synchronized void start() throws SmppServerException {
38
		try {
39
			LOG.debug("starting simulator thread...");
40 3 1. start : removed call to fr/sii/ogham/testing/sms/simulator/jsmpp/JSMPPServerSimulator::reset → SURVIVED
2. start : removed call to fr/sii/ogham/testing/sms/simulator/jsmpp/JSMPPServerSimulator::reset → NO_COVERAGE
3. start : removed call to fr/sii/ogham/testing/sms/simulator/jsmpp/JSMPPServerSimulator::reset → TIMED_OUT
			simulator.reset();
41
			thread = new Thread(simulator);
42 2 1. start : removed call to java/lang/Thread::start → NO_COVERAGE
2. start : removed call to java/lang/Thread::start → TIMED_OUT
			thread.start();
43 5 1. start : removed call to fr/sii/ogham/testing/sms/simulator/jsmpp/JSMPPServerSimulator::waitTillRunning → NO_COVERAGE
2. start : removed call to fr/sii/ogham/testing/sms/simulator/jsmpp/JSMPPServerSimulator::waitTillRunning → SURVIVED
3. start : removed call to fr/sii/ogham/testing/sms/simulator/jsmpp/JSMPPServerSimulator::waitTillRunning → TIMED_OUT
4. start : removed call to fr/sii/ogham/testing/sms/simulator/jsmpp/JSMPPServerSimulator::waitTillRunning → KILLED
5. start : removed call to fr/sii/ogham/testing/sms/simulator/jsmpp/JSMPPServerSimulator::waitTillRunning → KILLED
			simulator.waitTillRunning(5000L);
44
			LOG.debug("simulator started");
45
		} catch (ServerStartupException e) {
46
			throw new SmppServerException("Failed to start JSMPP server", e);
47
		}
48
	}
49
50
	@Override
51
	public synchronized void stop() throws SmppServerException {
52
		try {
53
			LOG.debug("stopping simulator thread...");
54 2 1. stop : removed call to fr/sii/ogham/testing/sms/simulator/jsmpp/JSMPPServerSimulator::stop → NO_COVERAGE
2. stop : removed call to fr/sii/ogham/testing/sms/simulator/jsmpp/JSMPPServerSimulator::stop → TIMED_OUT
			simulator.stop();
55 3 1. stop : removed call to java/lang/Thread::interrupt → NO_COVERAGE
2. stop : removed call to java/lang/Thread::interrupt → SURVIVED
3. stop : removed call to java/lang/Thread::interrupt → TIMED_OUT
			thread.interrupt();
56 4 1. stop : removed call to java/lang/Thread::join → NO_COVERAGE
2. stop : removed call to java/lang/Thread::join → SURVIVED
3. stop : removed call to java/lang/Thread::join → TIMED_OUT
4. stop : removed call to java/lang/Thread::join → KILLED
			thread.join();
57
			LOG.debug("simulator stopped");
58
		} catch (InterruptedException e) {
59 1 1. stop : removed call to java/lang/Thread::interrupt → NO_COVERAGE
			Thread.currentThread().interrupt();
60
			throw new SmppServerException("Failed to stop JSMPP server", e);
61
		}
62
	}
63
64
	@Override
65
	public int getPort() {
66 6 1. getPort : replaced int return with 0 for fr/sii/ogham/testing/sms/simulator/jsmpp/JSMPPServer::getPort → SURVIVED
2. getPort : replaced int return with 0 for fr/sii/ogham/testing/sms/simulator/jsmpp/JSMPPServer::getPort → NO_COVERAGE
3. getPort : replaced int return with 0 for fr/sii/ogham/testing/sms/simulator/jsmpp/JSMPPServer::getPort → TIMED_OUT
4. getPort : replaced int return with 0 for fr/sii/ogham/testing/sms/simulator/jsmpp/JSMPPServer::getPort → KILLED
5. getPort : replaced int return with 0 for fr/sii/ogham/testing/sms/simulator/jsmpp/JSMPPServer::getPort → KILLED
6. getPort : replaced int return with 0 for fr/sii/ogham/testing/sms/simulator/jsmpp/JSMPPServer::getPort → KILLED
		return simulator.getPort();
67
	}
68
69
	@Override
70
	public List<SubmitSm> getReceivedMessages() {
71 5 1. getReceivedMessages : replaced return value with Collections.emptyList for fr/sii/ogham/testing/sms/simulator/jsmpp/JSMPPServer::getReceivedMessages → NO_COVERAGE
2. getReceivedMessages : replaced return value with Collections.emptyList for fr/sii/ogham/testing/sms/simulator/jsmpp/JSMPPServer::getReceivedMessages → TIMED_OUT
3. getReceivedMessages : replaced return value with Collections.emptyList for fr/sii/ogham/testing/sms/simulator/jsmpp/JSMPPServer::getReceivedMessages → KILLED
4. getReceivedMessages : replaced return value with Collections.emptyList for fr/sii/ogham/testing/sms/simulator/jsmpp/JSMPPServer::getReceivedMessages → KILLED
5. getReceivedMessages : replaced return value with Collections.emptyList for fr/sii/ogham/testing/sms/simulator/jsmpp/JSMPPServer::getReceivedMessages → KILLED
		return simulator.getReceivedMessages();
72
	}
73
74
}

Mutations

30

1.1
Location : <init>
Killed by : oghamcore.ut.sms.sender.impl.PhoneNumberTranslatorSenderTest.simple(oghamcore.ut.sms.sender.impl.PhoneNumberTranslatorSenderTest)
negated conditional → KILLED

2.2
Location : <init>
Killed by : none
negated conditional → TIMED_OUT

3.3
Location : <init>
Killed by : oghamcloudhopper.it.PartialConfigurationTest.splitterEnabledButAutoGuessNotEnabledAndNoEncodingConfiguredAndLongMessageShouldFailIndicatingThatNoSplitterIsConfigured(oghamcloudhopper.it.PartialConfigurationTest)
negated conditional → KILLED

4.4
Location : <init>
Killed by : none
negated conditional → NO_COVERAGE

5.5
Location : <init>
Killed by : oghamtesting.it.sms.simulator.JsmppSimulatorFailureSpec
negated conditional → KILLED

6.6
Location : <init>
Killed by : oghamall.it.configuration.EmptyBuilderTest.noMimetypeConfigurationCantSendEmail(oghamall.it.configuration.EmptyBuilderTest)
negated conditional → KILLED

40

1.1
Location : start
Killed by : none
removed call to fr/sii/ogham/testing/sms/simulator/jsmpp/JSMPPServerSimulator::reset → SURVIVED

2.2
Location : start
Killed by : none
removed call to fr/sii/ogham/testing/sms/simulator/jsmpp/JSMPPServerSimulator::reset → NO_COVERAGE

3.3
Location : start
Killed by : none
removed call to fr/sii/ogham/testing/sms/simulator/jsmpp/JSMPPServerSimulator::reset → TIMED_OUT

42

1.1
Location : start
Killed by : none
removed call to java/lang/Thread::start → NO_COVERAGE

2.2
Location : start
Killed by : none
removed call to java/lang/Thread::start → TIMED_OUT

43

1.1
Location : start
Killed by : oghamtesting.it.sms.simulator.JsmppSimulatorFailureSpec
removed call to fr/sii/ogham/testing/sms/simulator/jsmpp/JSMPPServerSimulator::waitTillRunning → KILLED

2.2
Location : start
Killed by : none
removed call to fr/sii/ogham/testing/sms/simulator/jsmpp/JSMPPServerSimulator::waitTillRunning → TIMED_OUT

3.3
Location : start
Killed by : oghamcloudhopper.it.PartialConfigurationTest.splitterEnabledAndAutoGuessEnabledAndGsm7bitEncodingConfiguredAndLongMessageShouldSendTwoMessages(oghamcloudhopper.it.PartialConfigurationTest)
removed call to fr/sii/ogham/testing/sms/simulator/jsmpp/JSMPPServerSimulator::waitTillRunning → KILLED

4.4
Location : start
Killed by : none
removed call to fr/sii/ogham/testing/sms/simulator/jsmpp/JSMPPServerSimulator::waitTillRunning → NO_COVERAGE

5.5
Location : start
Killed by : none
removed call to fr/sii/ogham/testing/sms/simulator/jsmpp/JSMPPServerSimulator::waitTillRunning → SURVIVED

54

1.1
Location : stop
Killed by : none
removed call to fr/sii/ogham/testing/sms/simulator/jsmpp/JSMPPServerSimulator::stop → TIMED_OUT

2.2
Location : stop
Killed by : none
removed call to fr/sii/ogham/testing/sms/simulator/jsmpp/JSMPPServerSimulator::stop → NO_COVERAGE

55

1.1
Location : stop
Killed by : none
removed call to java/lang/Thread::interrupt → TIMED_OUT

2.2
Location : stop
Killed by : none
removed call to java/lang/Thread::interrupt → NO_COVERAGE

3.3
Location : stop
Killed by : none
removed call to java/lang/Thread::interrupt → SURVIVED

56

1.1
Location : stop
Killed by : none
removed call to java/lang/Thread::join → NO_COVERAGE

2.2
Location : stop
Killed by : none
removed call to java/lang/Thread::join → TIMED_OUT

3.3
Location : stop
Killed by : oghamcloudhopper.it.KeepAliveSessionStrategyTest.keepAliveButSessionClosedByServer(oghamcloudhopper.it.KeepAliveSessionStrategyTest)
removed call to java/lang/Thread::join → KILLED

4.4
Location : stop
Killed by : none
removed call to java/lang/Thread::join → SURVIVED

59

1.1
Location : stop
Killed by : none
removed call to java/lang/Thread::interrupt → NO_COVERAGE

66

1.1
Location : getPort
Killed by : none
replaced int return with 0 for fr/sii/ogham/testing/sms/simulator/jsmpp/JSMPPServer::getPort → SURVIVED

2.2
Location : getPort
Killed by : oghamcloudhopper.it.PartialConfigurationTest.splitterEnabledButAutoGuessNotEnabledAndNoEncodingConfiguredAndLongMessageShouldFailIndicatingThatNoSplitterIsConfigured(oghamcloudhopper.it.PartialConfigurationTest)
replaced int return with 0 for fr/sii/ogham/testing/sms/simulator/jsmpp/JSMPPServer::getPort → KILLED

3.3
Location : getPort
Killed by : oghamall.it.freemarker.StaticMethodAccessDisabledTest.smsUsingFreemarkerTemplateAndStaticMethodAccessDisabledShouldFail(oghamall.it.freemarker.StaticMethodAccessDisabledTest)
replaced int return with 0 for fr/sii/ogham/testing/sms/simulator/jsmpp/JSMPPServer::getPort → KILLED

4.4
Location : getPort
Killed by : none
replaced int return with 0 for fr/sii/ogham/testing/sms/simulator/jsmpp/JSMPPServer::getPort → NO_COVERAGE

5.5
Location : getPort
Killed by : none
replaced int return with 0 for fr/sii/ogham/testing/sms/simulator/jsmpp/JSMPPServer::getPort → TIMED_OUT

6.6
Location : getPort
Killed by : oghamtesting.it.sms.simulator.JsmppSimulatorSpec
replaced int return with 0 for fr/sii/ogham/testing/sms/simulator/jsmpp/JSMPPServer::getPort → KILLED

71

1.1
Location : getReceivedMessages
Killed by : none
replaced return value with Collections.emptyList for fr/sii/ogham/testing/sms/simulator/jsmpp/JSMPPServer::getReceivedMessages → NO_COVERAGE

2.2
Location : getReceivedMessages
Killed by : oghamcloudhopper.it.PartialConfigurationTest.nothingConfiguredAndLongMessageShouldSendOneLongMessageUsingDefaultEncoding(oghamcloudhopper.it.PartialConfigurationTest)
replaced return value with Collections.emptyList for fr/sii/ogham/testing/sms/simulator/jsmpp/JSMPPServer::getReceivedMessages → KILLED

3.3
Location : getReceivedMessages
Killed by : none
replaced return value with Collections.emptyList for fr/sii/ogham/testing/sms/simulator/jsmpp/JSMPPServer::getReceivedMessages → TIMED_OUT

4.4
Location : getReceivedMessages
Killed by : oghamall.it.sms.SmsSMPPGsm7bitTest.longMessage(oghamall.it.sms.SmsSMPPGsm7bitTest)
replaced return value with Collections.emptyList for fr/sii/ogham/testing/sms/simulator/jsmpp/JSMPPServer::getReceivedMessages → KILLED

5.5
Location : getReceivedMessages
Killed by : oghamtesting.it.sms.simulator.JsmppSimulatorSpec
replaced return value with Collections.emptyList for fr/sii/ogham/testing/sms/simulator/jsmpp/JSMPPServer::getReceivedMessages → KILLED

Active mutators

Tests examined


Report generated by PIT OGHAM