use of org.marre.sms.SmsTextMessage in project SMSGate by Lihuanghe.
the class TestCmpp20SubmitRequestMessageCodec method testCodec.
@Test
public void testCodec() {
CmppSubmitRequestMessage msg = new CmppSubmitRequestMessage();
msg.setDestterminalId(new String[] { "13800138000", "13800138001", "138001380002" });
msg.setLinkID("0000");
String content = UUID.randomUUID().toString();
msg.setMsgContent(content);
msg.setMsgContent(new SmsTextMessage("你好,我是闪信!", new SmsDcs((byte) 15)));
msg.setMsgid(new MsgId());
msg.setServiceId("10086");
msg.setSrcId("10086");
ByteBuf buf = encode(msg);
ByteBuf copybuf = buf.copy();
int length = buf.readableBytes();
Assert.assertEquals(length, buf.readInt());
Assert.assertEquals(msg.getPacketType().getCommandId(), buf.readInt());
Assert.assertEquals(msg.getHeader().getSequenceId(), buf.readInt());
CmppSubmitRequestMessage result = decode(copybuf);
System.out.println(result);
Assert.assertEquals(msg.getHeader().getSequenceId(), result.getHeader().getSequenceId());
Assert.assertArrayEquals(msg.getDestterminalId(), result.getDestterminalId());
Assert.assertEquals(msg.getMsgContent(), result.getMsgContent());
Assert.assertEquals(msg.getServiceId(), result.getServiceId());
}
use of org.marre.sms.SmsTextMessage in project SMSGate by Lihuanghe.
the class TestCmppSubmitRequestMessageCodec method testGBKMsg.
@Test
public void testGBKMsg() {
CmppSubmitRequestMessage msg = createTestReq("");
msg.setMsgContent(new SmsTextMessage("有没有发现,使用模型的表达要清晰易懂很多,而且也不需要做关于组合品的判断了,因为我们在系统中引入了更加贴近现实的对象模型(CombineBackO123456", new SmsDcs((byte) 0x0f)));
CmppSubmitRequestMessage ret = testWapCodec(msg);
Assert.assertEquals(msg.getMsgContent(), ret.getMsgContent());
}
use of org.marre.sms.SmsTextMessage in project SMSGate by Lihuanghe.
the class TestCmppSubmitRequestMessageCodec method testseptedMsg.
@Test
public void testseptedMsg() {
String origin = "112aaaasssss2334455@£$¥èéùìòçØøÅåΔ_ΦΓΛΩΠΨΣΘΞ^{}\\[~]|€ÆæßÉ!\"#¤%&'()*+,-./0123456789:;<=>?¡ABCDEFGHIJKLMNOPQRSTUVWXYZÄÖÑܧ¿abcdefghijklmnopqrstuvwxyzäöñüà";
CmppSubmitRequestMessage msg = createTestReq(origin);
msg.setMsgContent(new SmsTextMessage(origin));
CmppSubmitRequestMessage ret = testWapCodec(msg);
Assert.assertEquals(msg.getMsgContent(), ret.getMsgContent());
}
use of org.marre.sms.SmsTextMessage in project SMSGate by Lihuanghe.
the class TestSMPP2CMPPSubmitCodec method testseptedMsg.
@Test
public void testseptedMsg() {
String origin = "112aaaasssss2334455@£$¥èéùìòçØøÅåΔ_ΦΓΛΩΠΨΣΘΞ^{}\\[~]|€ÆæßÉ!\"#¤%&'()*+,-./0123456789:;<=>?¡ABCDEFGHIJKLMNOPQRSTUVWXYZÄÖÑܧ¿abcdefghijklmnopqrstuvwxyzäöñüà";
System.out.println(origin);
CmppSubmitRequestMessage msg = createTestReq(origin);
msg.setMsgContent(new SmsTextMessage(origin));
CmppSubmitRequestMessage ret = testWapCodec(msg);
Assert.assertEquals(msg.getMsgContent(), ret.getMsgContent());
}
use of org.marre.sms.SmsTextMessage in project SMSGate by Lihuanghe.
the class TestLongMessageFrameHolder method test.
@Test
public void test() throws SmsException {
List<LongMessageFrame> l = LongMessageFrameHolder.INS.splitmsgcontent(new SmsTextMessage(s));
for (LongMessageFrame frame : l) {
String stmp = LongMessageFrameHolder.INS.getPartTextMsg(frame);
Assert.assertEquals(67, stmp.length());
System.out.println(stmp);
}
}
Aggregations