Search in sources :

Example 1 with SmsTextMessage

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());
}
Also used : SmsTextMessage(org.marre.sms.SmsTextMessage) CmppSubmitRequestMessage(com.zx.sms.codec.cmpp.msg.CmppSubmitRequestMessage) SmsDcs(org.marre.sms.SmsDcs) ByteBuf(io.netty.buffer.ByteBuf) MsgId(com.zx.sms.common.util.MsgId) Test(org.junit.Test)

Example 2 with SmsTextMessage

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());
}
Also used : SmsTextMessage(org.marre.sms.SmsTextMessage) CmppSubmitRequestMessage(com.zx.sms.codec.cmpp.msg.CmppSubmitRequestMessage) SmsDcs(org.marre.sms.SmsDcs) Test(org.junit.Test)

Example 3 with SmsTextMessage

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());
}
Also used : SmsTextMessage(org.marre.sms.SmsTextMessage) CmppSubmitRequestMessage(com.zx.sms.codec.cmpp.msg.CmppSubmitRequestMessage) Test(org.junit.Test)

Example 4 with SmsTextMessage

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());
}
Also used : SmsTextMessage(org.marre.sms.SmsTextMessage) CmppSubmitRequestMessage(com.zx.sms.codec.cmpp.msg.CmppSubmitRequestMessage) Test(org.junit.Test)

Example 5 with SmsTextMessage

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);
    }
}
Also used : SmsTextMessage(org.marre.sms.SmsTextMessage) LongMessageFrame(com.zx.sms.codec.cmpp.wap.LongMessageFrame) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)8 SmsTextMessage (org.marre.sms.SmsTextMessage)8 CmppSubmitRequestMessage (com.zx.sms.codec.cmpp.msg.CmppSubmitRequestMessage)4 SubmitSm (com.zx.sms.codec.smpp.msg.SubmitSm)3 SmsDcs (org.marre.sms.SmsDcs)2 LongMessageFrame (com.zx.sms.codec.cmpp.wap.LongMessageFrame)1 MsgId (com.zx.sms.common.util.MsgId)1 ByteBuf (io.netty.buffer.ByteBuf)1