Search in sources :

Example 1 with WapSLPush

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

the class TestCmppDeliverRequestMessageCodec method testSLPUSH.

@Test
public void testSLPUSH() {
    CmppDeliverRequestMessage msg = createTestReq("");
    WapSLPush sl = new WapSLPush("http://www.baidu.com");
    SmsMessage wap = new SmsWapPushMessage(sl);
    msg.setMsgContent(wap);
    CmppDeliverRequestMessage 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) CmppDeliverRequestMessage(com.zx.sms.codec.cmpp.msg.CmppDeliverRequestMessage) SmsMessage(org.marre.sms.SmsMessage) WapSLPush(org.marre.wap.push.WapSLPush) Test(org.junit.Test)

Example 2 with WapSLPush

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

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

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

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

the class TestSMPP2CMPPDeliverCodec method testSLPUSH.

@Test
public void testSLPUSH() {
    CmppDeliverRequestMessage msg = createTestReq("");
    WapSLPush sl = new WapSLPush("http://www.baidu.com");
    SmsMessage wap = new SmsWapPushMessage(sl);
    msg.setMsgContent(wap);
    CmppDeliverRequestMessage 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) CmppDeliverRequestMessage(com.zx.sms.codec.cmpp.msg.CmppDeliverRequestMessage) SmsMessage(org.marre.sms.SmsMessage) WapSLPush(org.marre.wap.push.WapSLPush) Test(org.junit.Test)

Example 5 with WapSLPush

use of org.marre.wap.push.WapSLPush 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)

Aggregations

Test (org.junit.Test)5 SmsMessage (org.marre.sms.SmsMessage)5 SmsWapPushMessage (org.marre.wap.push.SmsWapPushMessage)5 WapSLPush (org.marre.wap.push.WapSLPush)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 SmsPortAddressedTextMessage (org.marre.sms.SmsPortAddressedTextMessage)1 SmsMmsNotificationMessage (org.marre.wap.push.SmsMmsNotificationMessage)1 WapSIPush (org.marre.wap.push.WapSIPush)1