Search in sources :

Example 1 with SmsMmsNotificationMessage

use of org.marre.wap.push.SmsMmsNotificationMessage 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 2 with SmsMmsNotificationMessage

use of org.marre.wap.push.SmsMmsNotificationMessage in project SMSGate by Lihuanghe.

the class TestSMPP2CMPPDeliverCodec method testMMSPUSH.

@Test
public void testMMSPUSH() {
    CmppDeliverRequestMessage 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);
    msg.setMsgContent(mms);
    mms.setTransactionId("ABC");
    CmppDeliverRequestMessage result = testWapCodec(msg);
    SmsMmsNotificationMessage smsmsg = (SmsMmsNotificationMessage) result.getSmsMessage();
    Assert.assertEquals(smsmsg.getContentLocation_(), smsmsg.getContentLocation_());
}
Also used : CmppDeliverRequestMessage(com.zx.sms.codec.cmpp.msg.CmppDeliverRequestMessage) SmsMmsNotificationMessage(org.marre.wap.push.SmsMmsNotificationMessage) Test(org.junit.Test)

Example 3 with SmsMmsNotificationMessage

use of org.marre.wap.push.SmsMmsNotificationMessage in project SMSGate by Lihuanghe.

the class TestSMPP2CMPPSubmitCodec 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 4 with SmsMmsNotificationMessage

use of org.marre.wap.push.SmsMmsNotificationMessage in project SMSGate by Lihuanghe.

the class TestSerializeSmsMessage method test.

@Test
public void test() throws IOException, ClassNotFoundException {
    List<SmsMessage> list = new ArrayList<SmsMessage>();
    list.add(CMPPCommonUtil.buildTextMessage("test"));
    list.add(new SmsPortAddressedTextMessage(SmsPort.NOKIA_CLI_LOGO, SmsPort.NOKIA_IAC, "testporttext"));
    list.add(new SmsMmsNotificationMessage("http://www.baidu.com/abc/sfd", 50 * 1024));
    WapSIPush si = new WapSIPush("http://www.baidu.com", "baidu");
    SmsMessage siwap = new SmsWapPushMessage(si);
    list.add(siwap);
    WapSLPush sl = new WapSLPush("http://www.baidu.com");
    SmsMessage slwap = new SmsWapPushMessage(sl);
    list.add(slwap);
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    ObjectOutputStream out = new ObjectOutputStream(bos);
    out.writeObject(list);
    byte[] b = bos.toByteArray();
    System.out.println(b.length);
    ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(b));
    List<SmsMessage> result = (List<SmsMessage>) in.readObject();
    Assert.assertEquals(((SmsTextMessage) list.get(0)).getText(), ((SmsTextMessage) result.get(0)).getText());
    Assert.assertEquals(((SmsPortAddressedTextMessage) list.get(1)).getText(), ((SmsPortAddressedTextMessage) result.get(1)).getText());
    Assert.assertEquals(((SmsPortAddressedTextMessage) list.get(1)).getDcs().getValue(), ((SmsPortAddressedTextMessage) result.get(1)).getDcs().getValue());
    Assert.assertEquals(((SmsPortAddressedTextMessage) list.get(1)).getDestPort_(), ((SmsPortAddressedTextMessage) result.get(1)).getDestPort_());
    Assert.assertEquals(((SmsPortAddressedTextMessage) list.get(1)).getOrigPort_(), ((SmsPortAddressedTextMessage) result.get(1)).getOrigPort_());
    Assert.assertEquals(((SmsMmsNotificationMessage) list.get(2)).getContentLocation_(), ((SmsMmsNotificationMessage) result.get(2)).getContentLocation_());
    Assert.assertEquals(((SmsMmsNotificationMessage) list.get(2)).getDestPort_(), ((SmsMmsNotificationMessage) result.get(2)).getDestPort_());
    Assert.assertEquals(((SmsMmsNotificationMessage) list.get(2)).getOrigPort_(), ((SmsMmsNotificationMessage) result.get(2)).getOrigPort_());
    Assert.assertEquals(((SmsWapPushMessage) list.get(3)).getDestPort_(), ((SmsWapPushMessage) result.get(3)).getDestPort_());
    Assert.assertEquals(((SmsWapPushMessage) list.get(3)).getOrigPort_(), ((SmsWapPushMessage) result.get(3)).getOrigPort_());
    Assert.assertEquals(((WapSIPush) ((SmsWapPushMessage) list.get(3)).getWbxml()).getUri(), ((WapSIPush) ((SmsWapPushMessage) result.get(3)).getWbxml()).getUri());
    Assert.assertEquals(((SmsWapPushMessage) list.get(4)).getDestPort_(), ((SmsWapPushMessage) result.get(4)).getDestPort_());
    Assert.assertEquals(((SmsWapPushMessage) list.get(4)).getOrigPort_(), ((SmsWapPushMessage) result.get(4)).getOrigPort_());
    Assert.assertEquals(((WapSLPush) ((SmsWapPushMessage) list.get(4)).getWbxml()).getUri(), ((WapSLPush) ((SmsWapPushMessage) result.get(4)).getWbxml()).getUri());
}
Also used : SmsWapPushMessage(org.marre.wap.push.SmsWapPushMessage) ArrayList(java.util.ArrayList) ByteArrayOutputStream(java.io.ByteArrayOutputStream) WapSIPush(org.marre.wap.push.WapSIPush) ObjectOutputStream(java.io.ObjectOutputStream) SmsMmsNotificationMessage(org.marre.wap.push.SmsMmsNotificationMessage) SmsMessage(org.marre.sms.SmsMessage) ByteArrayInputStream(java.io.ByteArrayInputStream) ArrayList(java.util.ArrayList) List(java.util.List) SmsPortAddressedTextMessage(org.marre.sms.SmsPortAddressedTextMessage) WapSLPush(org.marre.wap.push.WapSLPush) ObjectInputStream(java.io.ObjectInputStream) Test(org.junit.Test)

Example 5 with SmsMmsNotificationMessage

use of org.marre.wap.push.SmsMmsNotificationMessage in project SMSGate by Lihuanghe.

the class TestCmppDeliverRequestMessageCodec method testMMSPUSH.

@Test
public void testMMSPUSH() {
    CmppDeliverRequestMessage 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);
    msg.setMsgContent(mms);
    mms.setTransactionId("ABC");
    CmppDeliverRequestMessage result = testWapCodec(msg);
    SmsMmsNotificationMessage smsmsg = (SmsMmsNotificationMessage) result.getSmsMessage();
    Assert.assertEquals(smsmsg.getContentLocation_(), smsmsg.getContentLocation_());
}
Also used : CmppDeliverRequestMessage(com.zx.sms.codec.cmpp.msg.CmppDeliverRequestMessage) SmsMmsNotificationMessage(org.marre.wap.push.SmsMmsNotificationMessage) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)5 SmsMmsNotificationMessage (org.marre.wap.push.SmsMmsNotificationMessage)5 CmppDeliverRequestMessage (com.zx.sms.codec.cmpp.msg.CmppDeliverRequestMessage)2 CmppSubmitRequestMessage (com.zx.sms.codec.cmpp.msg.CmppSubmitRequestMessage)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 ObjectInputStream (java.io.ObjectInputStream)1 ObjectOutputStream (java.io.ObjectOutputStream)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 SmsMessage (org.marre.sms.SmsMessage)1 SmsPortAddressedTextMessage (org.marre.sms.SmsPortAddressedTextMessage)1 SmsWapPushMessage (org.marre.wap.push.SmsWapPushMessage)1 WapSIPush (org.marre.wap.push.WapSIPush)1 WapSLPush (org.marre.wap.push.WapSLPush)1