| 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 2.2 3.3 4.4 5.5 6.6 |
|
| 40 |
1.1 2.2 3.3 |
|
| 42 |
1.1 2.2 |
|
| 43 |
1.1 2.2 3.3 4.4 5.5 |
|
| 54 |
1.1 2.2 |
|
| 55 |
1.1 2.2 3.3 |
|
| 56 |
1.1 2.2 3.3 4.4 |
|
| 59 |
1.1 |
|
| 66 |
1.1 2.2 3.3 4.4 5.5 6.6 |
|
| 71 |
1.1 2.2 3.3 4.4 5.5 |