Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
target
31 changes: 31 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# The following images also work but produce images twice as big:
#
# - FROM maven:3-jdk-11-slim AS builder
# - FROM openjdk:11
#
# The following can be used on MacOS:
#
# FROM --platform=linux/amd64 ibmjava:8-sdk


FROM maven:3.6-jdk-8-alpine AS builder

COPY . /app/src

RUN mvn -f /app/src/pom.xml clean package

FROM adoptopenjdk/openjdk8

COPY --from=builder /app/src/charset/target/opensmpp-charset-3.0.3-SNAPSHOT.jar /app/charset.jar
COPY --from=builder /app/src/client/target/opensmpp-client-3.0.3-SNAPSHOT.jar /app/client.jar
COPY --from=builder /app/src/core/target/opensmpp-core-3.0.3-SNAPSHOT.jar /app/core.jar
COPY --from=builder /app/src/sim/target/opensmpp-sim-3.0.3-SNAPSHOT.jar /app/sim.jar
COPY sim/users.txt /app/etc/users.txt

WORKDIR /app

EXPOSE 2775

ENV CLASSPATH=".:charset.jar:client.jar:core.jar:sim.jar"

ENTRYPOINT ["java", "org.smpp.smscsim.Simulator"]
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ bug fixes, and has been generally refactored.
* client - a simple SMPP client
* sim - a simple SMSC simulator

How to build and run Simulator with Docker:

$ ./scripts/docker-build
$ ./scripts/docker-run

# Versions

Versions of this project are managed according to the
Expand Down
6 changes: 6 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: '3'
services:
simulator:
build: .
ports:
- 2775:2775
10 changes: 5 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
<url>http://opensmpp.org/</url>

<properties>
<maven.compiler.source>1.5</maven.compiler.source>
<maven.compiler.target>1.5</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>

<modules>
Expand Down Expand Up @@ -200,10 +200,10 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<version>3.8.0</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
<source>1.8</source>
<target>1.8</target>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a library for an old technology (SMS), and some of its users might be using old JVMs. You can still get commercially supported Java 1.6 and 1.7 JVMs. So we would rather keep support for at least Java 1.6.

<encoding>UTF-8</encoding>
</configuration>
</plugin>
Expand Down
3 changes: 3 additions & 0 deletions scripts/docker-build
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

docker build -t opensmpp-sim:3.0.3 .
22 changes: 22 additions & 0 deletions scripts/docker-remove-dangling
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash

# remove all: stopped containers, unused networks, dangling images, build cache
# docker system prune

# remove dangling images

dangling_images='docker images -f dangling=true -q'

if [ $( $dangling_images |wc -l ) -gt 0 ]; then
docker rmi $( $dangling_images )
printf "* Dangling images have been removed\n"
fi

# remove exited containers

exited_containers='docker ps -a -f status=exited -f status=created -q'

if [ $( $exited_containers |wc -l ) -gt 0 ]; then
docker rm $( $exited_containers )
printf "* Exited containers have been removed\n"
fi
3 changes: 3 additions & 0 deletions scripts/docker-run
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

docker run -p 2775:2775 -it opensmpp-sim:3.0.3
16 changes: 9 additions & 7 deletions sim/src/main/java/org/smpp/smscsim/Simulator.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
* <p>
* User file can be specified using <code>usersFileName</code> property, e.g.: <code>-DusersFileName=/my/path/to/users.txt</code>
* </p>
*
*
* @author Logica Mobile Networks SMPP Open Source Team
* @version $Id: Simulator.java 72 2008-07-15 19:43:00Z sverkera $
* @see SimulatorPDUProcessor
Expand Down Expand Up @@ -197,15 +197,17 @@ protected void menu() throws IOException {
/**
* Permits a user to choose the port where to listen on and then creates and
* starts new instance of <code>SMSCListener</code>.
* An instance of the <code>SimulatorPDUProcessor</code> is created
* An instance of the <code>SimulatorPDUProcessor</code> is created
* and this instance is passed to the <code>SMSCListener</code> which is started
* just after.
*/
protected void start() throws IOException {
if (smscListener == null) {
System.out.print("Enter port number> ");
int port = Integer.parseInt(keyboard.readLine());
System.out.print("Starting listener... ");
// System.out.print("Enter port number> ");
// int port = Integer.parseInt(keyboard.readLine());
// System.out.print("Starting listener... ");
System.out.print("Listening on port 2775 ");
int port = 2775;
smscListener = new SMSCListenerImpl(port, true);
processors = new PDUProcessorGroup();
messageStore = new ShortMessageStore();
Expand Down Expand Up @@ -343,7 +345,7 @@ protected void listClients() {

/**
* Permits data to be sent to a specific client.
* With the id of the client set by the user, the method <code>sendMessage</code>
* With the id of the client set by the user, the method <code>sendMessage</code>
* gets back the specific reference to the client's <code>PDUProcessor</code>.
* With this reference you are able to send data to the client.
*/
Expand Down Expand Up @@ -399,7 +401,7 @@ protected void sendMessage() throws IOException {
* Revision 1.1 2003/07/23 00:28:39 sverkera
* Imported
*
*
*
* Old changelog:
* 20-09-01 ticp@logica.com added support for sending of delivery info
* 26-09-01 ticp@logica.com debug now in a group
Expand Down
13 changes: 10 additions & 3 deletions sim/users.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,16 @@
# "peter" and " peter".


# Pavel can bound for unlimited time as any type
name=pavel
password=dfsew
name=smppclient1
password=password
timeout=unlimited

name=smppclient2
password=password
timeout=unlimited

name=smppclient3
password=password
timeout=unlimited


Expand Down