Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added unit tests for deliver_sm parsing issues with 2 different SMSC …

…vendors
  • Loading branch information...
commit 4e8d9aae83592587e60123b94e8934ff8907e033 1 parent dedaa6d
@jjlauer jjlauer authored
View
8 src/main/java/com/cloudhopper/smpp/Version.java
@@ -1,19 +1,19 @@
/** DO NOT EDIT THIS FILE. IT IS AUTO GENERATED BY MAVEN */
package com.cloudhopper.smpp;
public final class Version {
- private static final String TIMESTAMP="20110726-2124";
+ private static final String TIMESTAMP="20110814-2028";
private static final String VERSION="4.1.0";
private static final String NAME="ch-smpp";
private static final String VENDOR="cloudhopper";
- private static final String LONG_VERSION="4.1.0 (Build @ 20110726-2124)";
+ private static final String LONG_VERSION="4.1.0 (Build @ 20110814-2028)";
/** Returns the library vendor such as "cloudhopper" */
static public String getVendor() { return VENDOR; }
- /** Returns the library build timestamp such as "20110726-2124" */
+ /** Returns the library build timestamp such as "20110814-2028" */
static public String getTimestamp() { return TIMESTAMP; }
/** Returns the library name such as "ch-smpp" */
static public String getName() { return NAME; }
/** Returns the library version such as "4.1.0" */
static public String getVersion() { return VERSION; }
- /** Returns a longer library version that includes the timestamp such as "4.1.0 (Build @ 20110726-2124)" */
+ /** Returns a longer library version that includes the timestamp such as "4.1.0 (Build @ 20110814-2028)" */
static public String getLongVersion() { return LONG_VERSION; }
}
View
34 src/test/java/com/cloudhopper/smpp/transcoder/PduDecoderTest.java
@@ -1205,7 +1205,6 @@ public void decodeWAUMalformedPacket() throws Exception {
*/
}
-
@Test
public void decodeSubmitSmWith255ByteShortMessage() throws Exception {
String text255 = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum in orci magna. Etiam auctor ultrices lacus vel suscipit. Maecenas eget faucibus purus. Etiam aliquet mollis fermentum. Proin vel augue arcu. Praesent venenatis tristique ante turpis duis.";
@@ -1244,4 +1243,37 @@ public void decodeSubmitSmWith255ByteShortMessage() throws Exception {
// interesting -- this example has optional parameters it happened to skip...
Assert.assertEquals(0, buffer.readableBytes());
}
+
+ @Ignore @Test
+ public void decodeDeliverSMWithCorrectTotalByteLengthButInvalidShortMessageLength() throws Exception {
+ // short_message is only 8 bytes, but short_message_length claims it should be 16
+ // the problem is that the pdu_length in the header IS set to the correct length
+ // this normally causes an IndexOutOfBoundsException on the ByteBuffer read, but
+ // this should probably be caught and have a specific exception thrown instead!
+ // MX nextel parsing exception in real world
+ ChannelBuffer buffer = BufferHelper.createBuffer("00000039000000050000000000000001000101393939393139393134353933000000363436340000000000000000080010c1e1e9edf3faf1fc");
+
+ DeliverSm pdu = (DeliverSm)transcoder.decode(buffer);
+
+ // 999919914593
+ }
+
+ @Test
+ public void decodeDeliverSMWithNotPerSpecSequenceNumberButNeedsToBeValid() throws Exception {
+ ChannelBuffer buffer = BufferHelper.createBuffer("000000390000000500000000806A179B000101393939393139393134353933000000363436340000000000000000080008c1e1e9edf3faf1fc");
+
+ DeliverSm pdu = (DeliverSm)transcoder.decode(buffer);
+
+ // confirm the sequence number was parsed ok
+ Assert.assertEquals(pdu.getSequenceNumber(), 0x806A179B);
+
+ // make sure the pdu is correct on a reply
+ DeliverSmResp pduResponse = pdu.createResponse();
+
+ ChannelBuffer respbuf = transcoder.encode(pduResponse);
+ String actualHex = BufferHelper.createHexString(respbuf).toUpperCase();
+ String expectedHex = "000000118000000500000000806A179B00";
+
+ Assert.assertEquals(expectedHex, actualHex);
+ }
}
Please sign in to comment.
Something went wrong with that request. Please try again.