Search in sources :

Example 6 with CmppSubmitRequestMessage

use of com.zx.sms.codec.cmpp.msg.CmppSubmitRequestMessage in project SMSGate by Lihuanghe.

the class TestCmppSubmitRequestMessageCodec method testPortTextSMSH.

@Test
public void testPortTextSMSH() {
    Random rnd_ = new Random();
    CmppSubmitRequestMessage msg = createTestReq("");
    SmsPortAddressedTextMessage textMsg = new SmsPortAddressedTextMessage(new SmsPort(rnd_.nextInt() & 0xffff, ""), new SmsPort(rnd_.nextInt() & 0xffff, ""), "这是一条端口文本短信");
    msg.setMsgContent(textMsg);
    CmppSubmitRequestMessage result = testWapCodec(msg);
    SmsPortAddressedTextMessage smsmsg = (SmsPortAddressedTextMessage) result.getSmsMessage();
    Assert.assertEquals(textMsg.getDestPort_(), smsmsg.getDestPort_());
    Assert.assertEquals(textMsg.getOrigPort_(), smsmsg.getOrigPort_());
    Assert.assertEquals(textMsg.getText(), smsmsg.getText());
}
Also used : Random(java.util.Random) SmsPort(org.marre.sms.SmsPort) CmppSubmitRequestMessage(com.zx.sms.codec.cmpp.msg.CmppSubmitRequestMessage) SmsPortAddressedTextMessage(org.marre.sms.SmsPortAddressedTextMessage) Test(org.junit.Test)

Example 7 with CmppSubmitRequestMessage

use of com.zx.sms.codec.cmpp.msg.CmppSubmitRequestMessage in project SMSGate by Lihuanghe.

the class TestCmppSubmitRequestMessageCodec method testMMSPUSH.

@Test
public void testMMSPUSH() {
    CmppSubmitRequestMessage msg = createTestReq("");
    SmsMmsNotificationMessage mms = new SmsMmsNotificationMessage("https://www.baidu.com/s?wd=SMPPv3.4%20%E9%95%BF%E7%9F%AD%E4%BF%A1&rsv_spt=1&rsv_iqid=0xdd4666100001e74c&issp=1&f=8&rsv_bp=1&rsv_idx=2&ie=utf-8&rqlang=cn&tn=baiduhome_pg&rsv_enter=0&oq=SMPPv%2526lt%253B.4%2520ton%2520npi&rsv_t=50fdNrphqry%2FYfHh29wvp8KzJ9ogqigiPr33FT%2FpcGQu6X34vByQNu4O%2FLNZgIiXdd16&inputT=3203&rsv_pq=d576ead9000016eb&rsv_sug3=60&rsv_sug1=15&rsv_sug7=000&rsv_sug2=0&rsv_sug4=3937&rsv_sug=1", 50 * 1024);
    mms.setFrom("10085");
    mms.setSubject("这是一条测试彩信,彩信消息ID是:121241");
    msg.setMsgContent(mms);
    CmppSubmitRequestMessage result = testWapCodec(msg);
    SmsMmsNotificationMessage smsmsg = (SmsMmsNotificationMessage) result.getSmsMessage();
    Assert.assertEquals(mms.getSubject_(), smsmsg.getSubject_());
    Assert.assertEquals(mms.getContentLocation_(), smsmsg.getContentLocation_());
    Assert.assertEquals(mms.getFrom_(), smsmsg.getFrom_());
}
Also used : CmppSubmitRequestMessage(com.zx.sms.codec.cmpp.msg.CmppSubmitRequestMessage) SmsMmsNotificationMessage(org.marre.wap.push.SmsMmsNotificationMessage) Test(org.junit.Test)

Example 8 with CmppSubmitRequestMessage

use of com.zx.sms.codec.cmpp.msg.CmppSubmitRequestMessage in project SMSGate by Lihuanghe.

the class TestCmppSubmitRequestMessageCodec method testSLPUSH.

@Test
public void testSLPUSH() {
    CmppSubmitRequestMessage msg = createTestReq("");
    WapSLPush sl = new WapSLPush("http://www.baidu.com");
    SmsMessage wap = new SmsWapPushMessage(sl);
    msg.setMsgContent(wap);
    CmppSubmitRequestMessage result = testWapCodec(msg);
    SmsWapPushMessage smsmsg = (SmsWapPushMessage) result.getSmsMessage();
    WapSLPush actsl = (WapSLPush) smsmsg.getWbxml();
    Assert.assertEquals(sl.getUri(), actsl.getUri());
}
Also used : SmsWapPushMessage(org.marre.wap.push.SmsWapPushMessage) SmsMessage(org.marre.sms.SmsMessage) CmppSubmitRequestMessage(com.zx.sms.codec.cmpp.msg.CmppSubmitRequestMessage) WapSLPush(org.marre.wap.push.WapSLPush) Test(org.junit.Test)

Example 9 with CmppSubmitRequestMessage

use of com.zx.sms.codec.cmpp.msg.CmppSubmitRequestMessage 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 10 with CmppSubmitRequestMessage

use of com.zx.sms.codec.cmpp.msg.CmppSubmitRequestMessage 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)

Aggregations

CmppSubmitRequestMessage (com.zx.sms.codec.cmpp.msg.CmppSubmitRequestMessage)39 Test (org.junit.Test)24 ByteBuf (io.netty.buffer.ByteBuf)21 MsgId (com.zx.sms.common.util.MsgId)9 SmsMessage (org.marre.sms.SmsMessage)6 SmsDcs (org.marre.sms.SmsDcs)5 SmsTextMessage (org.marre.sms.SmsTextMessage)4 SmsWapPushMessage (org.marre.wap.push.SmsWapPushMessage)4 CmppDeliverRequestMessage (com.zx.sms.codec.cmpp.msg.CmppDeliverRequestMessage)3 CmppSubmitResponseMessage (com.zx.sms.codec.cmpp.msg.CmppSubmitResponseMessage)3 CmppDeliverResponseMessage (com.zx.sms.codec.cmpp.msg.CmppDeliverResponseMessage)2 CmppQueryRequestMessage (com.zx.sms.codec.cmpp.msg.CmppQueryRequestMessage)2 CmppQueryResponseMessage (com.zx.sms.codec.cmpp.msg.CmppQueryResponseMessage)2 CmppReportRequestMessage (com.zx.sms.codec.cmpp.msg.CmppReportRequestMessage)2 ByteArrayInputStream (java.io.ByteArrayInputStream)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 ObjectInputStream (java.io.ObjectInputStream)2 ObjectOutputStream (java.io.ObjectOutputStream)2 HashMap (java.util.HashMap)2 Random (java.util.Random)2