Skip to content

Commit

Permalink
update latest codec version (#14)
Browse files Browse the repository at this point in the history
Signed-off-by: ZhangJian He <shoothzj@gmail.com>
  • Loading branch information
shoothzj authored Mar 10, 2024
1 parent 3970f19 commit 327791f
Show file tree
Hide file tree
Showing 16 changed files with 190 additions and 121 deletions.
25 changes: 10 additions & 15 deletions .github/workflows/checkstyle.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
# Copyright 2024 shoothzj <shoothzj@gmail.com>
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: checkstyle
on:
Expand Down
25 changes: 10 additions & 15 deletions .github/workflows/line_lint.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
# Copyright 2024 shoothzj <shoothzj@gmail.com>
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: line lint
on:
Expand Down
25 changes: 10 additions & 15 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
# Copyright 2024 shoothzj <shoothzj@gmail.com>
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: Release

Expand Down
25 changes: 10 additions & 15 deletions .github/workflows/spotbugs.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
# Copyright 2024 shoothzj <shoothzj@gmail.com>
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: spot bugs
on:
Expand Down
44 changes: 0 additions & 44 deletions .github/workflows/unit-tests.yml

This file was deleted.

39 changes: 39 additions & 0 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Copyright 2024 shoothzj <shoothzj@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: unit tests
on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
unit-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Maven Central Repository
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'temurin'
- name: unit tests
run: mvn -B clean test
- uses: codecov/codecov-action@v2
with:
files: ./java-tool/target/site/jacoco/jacoco.xml,./sdk-codec-bk/target/site/jacoco/jacoco.xml
flags: unittests
4 changes: 4 additions & 0 deletions ci/spotbugs/exclude.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,8 @@
<Bug pattern="EI_EXPOSE_REP2"/>
</Match>

<Match>
<Bug pattern="PA_PUBLIC_PRIMITIVE_ATTRIBUTE"/>
</Match>

</FindBugsFilter>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package io.github.protocol.sms.server.example;

import io.github.protocol.sms.cmpp.server.CmppConfig;
import io.github.protocol.sms.cmpp.server.CmppServer;

public class CmppServerExample {
public static void main(String[] args) throws Exception {
CmppConfig config = new CmppConfig();
config = config.port(PortConst.CMPP_DEFAULT_PORT);
CmppServer cmppServer = new CmppServer(config);
cmppServer.start();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package io.github.protocol.sms.server.example;

import io.github.protocol.sms.cngp.server.CngpConfig;
import io.github.protocol.sms.cngp.server.CngpServer;

public class CngpServerExample {
public static void main(String[] args) throws Exception {
CngpConfig config = new CngpConfig();
config = config.port(PortConst.CNGP_DEFAULT_PORT);
CngpServer cngpServer = new CngpServer(config);
cngpServer.start();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package io.github.protocol.sms.server.example;

import io.github.protocol.sms.sgip.server.SgipConfig;
import io.github.protocol.sms.sgip.server.SgipServer;

public class SgipServerExample {
public static void main(String[] args) throws Exception {
SgipConfig config = new SgipConfig();
config = config.port(PortConst.SGIP_DEFAULT_PORT);
SgipServer sgipServer = new SgipServer(config);
sgipServer.start();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package io.github.protocol.sms.server.example;

import io.github.protocol.sms.smgp.server.SmgpConfig;
import io.github.protocol.sms.smgp.server.SmgpServer;

public class SmgpServerExample {
public static void main(String[] args) throws Exception {
SmgpConfig config = new SmgpConfig();
config = config.port(PortConst.SMGP_DEFAULT_PORT);
SmgpServer smgpServer = new SmgpServer(config);
smgpServer.start();
}
}
34 changes: 18 additions & 16 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,21 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<src.dir>src/main/java</src.dir>
<!-- dependency -->
<junit-jupiter-engine.version>5.9.2</junit-jupiter-engine.version>
<junit-jupiter-engine.version>5.10.2</junit-jupiter-engine.version>
<log4j.version>2.20.0</log4j.version>
<mockito.version>5.2.0</mockito.version>
<netty.version>4.1.90.Final</netty.version>
<lombok.version>1.18.30</lombok.version>
<mockito.version>5.11.0</mockito.version>
<netty.version>4.1.107.Final</netty.version>
<puppycrawl.version>10.14.0</puppycrawl.version>
<slf4j.version>2.0.7</slf4j.version>
<sms-codec.version>0.0.11</sms-codec.version>
<sms-codec.version>0.0.12</sms-codec.version>
<!-- plugin -->
<compiler-plugin.version>3.10.1</compiler-plugin.version>
<checkstyle-plugin.version>3.2.1</checkstyle-plugin.version>
<lombok.version>1.18.26</lombok.version>
<puppycrawl.version>10.11.0</puppycrawl.version>
<spotbugs-maven-plugin.version>4.7.3.0</spotbugs-maven-plugin.version>
<surefire-plugin.version>3.1.0</surefire-plugin.version>
<lombok-maven-plugin.version>1.18.20.0</lombok-maven-plugin.version>
<maven-compiler-plugin.version>3.11.0</maven-compiler-plugin.version>
<maven-checkstyle-plugin.version>3.3.1</maven-checkstyle-plugin.version>
<maven-javadoc-plugin.version>3.6.0</maven-javadoc-plugin.version>
<maven-surefire-plugin.version>3.2.1</maven-surefire-plugin.version>
<spotbugs-maven-plugin.version>4.8.3.1</spotbugs-maven-plugin.version>
</properties>

<dependencyManagement>
Expand Down Expand Up @@ -99,7 +101,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${compiler-plugin.version}</version>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
Expand All @@ -108,12 +110,12 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire-plugin.version}</version>
<version>${maven-surefire-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>${checkstyle-plugin.version}</version>
<version>${maven-checkstyle-plugin.version}</version>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
Expand Down Expand Up @@ -167,7 +169,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.4.1</version>
<version>${maven-javadoc-plugin.version}</version>
<configuration>
<sourcepath>${src.dir}</sourcepath>
<doclint>all,-missing</doclint>
Expand Down Expand Up @@ -293,12 +295,12 @@
<plugin>
<groupId>org.projectlombok</groupId>
<artifactId>lombok-maven-plugin</artifactId>
<version>1.18.20.0</version>
<version>${lombok-maven-plugin.version}</version>
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.24</version>
<version>${lombok.version}</version>
</dependency>
</dependencies>
<executions>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
package io.github.protocol.sms.cmpp.server;

import io.github.protocol.codec.cmpp.CmppConnect;
import io.github.protocol.codec.cmpp.CmppConnectBody;
import io.github.protocol.codec.cmpp.CmppConnectResp;
import io.github.protocol.codec.cmpp.CmppConnectRespBody;
import io.github.protocol.codec.cmpp.CmppConst;
import io.github.protocol.codec.cmpp.CmppDecoder;
import io.github.protocol.codec.cmpp.CmppEncoder;
import io.github.protocol.codec.cmpp.CmppHeader;
import io.github.protocol.codec.cmpp.CmppMessage;
import io.github.protocol.codec.cmpp.CmppSubmit;
import io.github.protocol.sms.server.util.BoundAtomicInt;
Expand All @@ -22,6 +27,7 @@
import lombok.extern.slf4j.Slf4j;

import java.net.InetSocketAddress;
import java.nio.charset.StandardCharsets;
import java.util.Optional;

@ChannelHandler.Sharable
Expand Down Expand Up @@ -105,7 +111,12 @@ public void channelRead(ChannelHandlerContext ctx, Object message) {
}
}

private void processConnect(ChannelHandlerContext ctx, CmppConnect message) {
private void processConnect(ChannelHandlerContext ctx, CmppConnect msg) {
CmppHeader header = new CmppHeader(CmppConst.CONNECT_RESP_ID, msg.header().sequenceId());
CmppConnectBody body = msg.body();
String authenticator = new String(body.authenticatorSource(), StandardCharsets.UTF_8);
CmppConnectRespBody respBody = new CmppConnectRespBody(0, authenticator, (byte) 0);
ctx.writeAndFlush(new CmppConnectResp(header, respBody));
}

private void processSubmit(ChannelHandlerContext ctx, CmppSubmit message) {
Expand Down
Loading

0 comments on commit 327791f

Please sign in to comment.