當前位置: 首頁>>代碼示例>>Java>>正文


Java DataCodings類代碼示例

本文整理匯總了Java中org.jsmpp.bean.DataCodings的典型用法代碼示例。如果您正苦於以下問題:Java DataCodings類的具體用法?Java DataCodings怎麽用?Java DataCodings使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


DataCodings類屬於org.jsmpp.bean包,在下文中一共展示了DataCodings類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: executeWithConfigurationData

import org.jsmpp.bean.DataCodings; //導入依賴的package包/類
@Test
public void executeWithConfigurationData() throws Exception {
    Exchange exchange = new DefaultExchange(new DefaultCamelContext(), ExchangePattern.InOut);
    exchange.getIn().setHeader(SmppConstants.COMMAND, "SubmitSm");
    exchange.getIn().setHeader(SmppConstants.ID, "1");
    exchange.getIn().setBody("1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890");
    expect(session.submitShortMessage(eq("CMT"), eq(TypeOfNumber.UNKNOWN), eq(NumberingPlanIndicator.UNKNOWN), eq("1616"),
            eq(TypeOfNumber.UNKNOWN), eq(NumberingPlanIndicator.UNKNOWN), eq("1717"), eq(new ESMClass()), eq((byte) 0), eq((byte) 1),
            (String) isNull(), (String) isNull(), eq(new RegisteredDelivery(SMSCDeliveryReceipt.SUCCESS_FAILURE)), eq(ReplaceIfPresentFlag.DEFAULT.value()),
            eq(DataCodings.newInstance((byte) 0)), eq((byte) 0),
            aryEq("1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890".getBytes())))
            .andReturn("1");

    replay(session);

    command.execute(exchange);

    verify(session);

    assertEquals(Arrays.asList("1"), exchange.getOut().getHeader(SmppConstants.ID));
    assertEquals(1, exchange.getOut().getHeader(SmppConstants.SENT_MESSAGE_COUNT));
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:23,代碼來源:SmppSubmitSmCommandTest.java

示例2: alphabetUpdatesDataCoding

import org.jsmpp.bean.DataCodings; //導入依賴的package包/類
@Test
public void alphabetUpdatesDataCoding() throws Exception {
    final byte incorrectDataCoding = (byte)0x00;
    byte[] body = {'A', 'B', 'C'};

    Exchange exchange = new DefaultExchange(new DefaultCamelContext(), ExchangePattern.InOut);
    exchange.getIn().setHeader(SmppConstants.COMMAND, "SubmitSm");
    exchange.getIn().setHeader(SmppConstants.ALPHABET, Alphabet.ALPHA_8_BIT.value());
    exchange.getIn().setBody(body);
    expect(session.submitShortMessage(eq("CMT"), eq(TypeOfNumber.UNKNOWN), eq(NumberingPlanIndicator.UNKNOWN), eq("1616"), eq(TypeOfNumber.UNKNOWN), eq(NumberingPlanIndicator.UNKNOWN),
            eq("1717"), eq(new ESMClass()), eq((byte) 0), eq((byte) 1), (String) isNull(), (String) isNull(), eq(new RegisteredDelivery(SMSCDeliveryReceipt.SUCCESS_FAILURE)),
            eq(ReplaceIfPresentFlag.DEFAULT.value()), not(eq(DataCodings.newInstance(incorrectDataCoding))), eq((byte) 0), aryEq(body)))
            .andReturn("1");

    replay(session);

    command.execute(exchange);

    verify(session);
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:21,代碼來源:SmppSubmitSmCommandTest.java

示例3: executeWithConfigurationData

import org.jsmpp.bean.DataCodings; //導入依賴的package包/類
@Test
public void executeWithConfigurationData() throws Exception {
    Exchange exchange = new DefaultExchange(new DefaultCamelContext(), ExchangePattern.InOut);
    exchange.getIn().setHeader(SmppConstants.COMMAND, "DataSm");
    expect(session.dataShortMessage(eq("CMT"), eq(TypeOfNumber.UNKNOWN), eq(NumberingPlanIndicator.UNKNOWN), eq("1616"),
            eq(TypeOfNumber.UNKNOWN), eq(NumberingPlanIndicator.UNKNOWN), eq("1717"), eq(new ESMClass()),
            eq(new RegisteredDelivery((byte) 1)), eq(DataCodings.newInstance((byte) 0))))
        .andReturn(new DataSmResult(new MessageId("1"), null));

    replay(session);

    command.execute(exchange);

    verify(session);

    assertEquals("1", exchange.getOut().getHeader(SmppConstants.ID));
    assertNull(exchange.getOut().getHeader(SmppConstants.OPTIONAL_PARAMETERS));
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:19,代碼來源:SmppDataSmCommandTest.java

示例4: execute

import org.jsmpp.bean.DataCodings; //導入依賴的package包/類
@Test
public void execute() throws Exception {
    Exchange exchange = new DefaultExchange(new DefaultCamelContext(), ExchangePattern.InOut);
    exchange.getIn().setHeader(SmppConstants.COMMAND, "DataSm");
    exchange.getIn().setHeader(SmppConstants.SERVICE_TYPE, "XXX");
    exchange.getIn().setHeader(SmppConstants.SOURCE_ADDR_TON, TypeOfNumber.NATIONAL.value());
    exchange.getIn().setHeader(SmppConstants.SOURCE_ADDR_NPI, NumberingPlanIndicator.NATIONAL.value());
    exchange.getIn().setHeader(SmppConstants.SOURCE_ADDR, "1818");
    exchange.getIn().setHeader(SmppConstants.DEST_ADDR_TON, TypeOfNumber.INTERNATIONAL.value());
    exchange.getIn().setHeader(SmppConstants.DEST_ADDR_NPI, NumberingPlanIndicator.INTERNET.value());
    exchange.getIn().setHeader(SmppConstants.DEST_ADDR, "1919");
    exchange.getIn().setHeader(SmppConstants.REGISTERED_DELIVERY, new RegisteredDelivery(SMSCDeliveryReceipt.FAILURE).value());
    expect(session.dataShortMessage(eq("XXX"), eq(TypeOfNumber.NATIONAL), eq(NumberingPlanIndicator.NATIONAL), eq("1818"),
            eq(TypeOfNumber.INTERNATIONAL), eq(NumberingPlanIndicator.INTERNET), eq("1919"), eq(new ESMClass()),
            eq(new RegisteredDelivery((byte) 2)), eq(DataCodings.newInstance((byte) 0))))
        .andReturn(new DataSmResult(new MessageId("1"), null));

    replay(session);

    command.execute(exchange);

    verify(session);

    assertEquals("1", exchange.getOut().getHeader(SmppConstants.ID));
    assertNull(exchange.getOut().getHeader(SmppConstants.OPTIONAL_PARAMETERS));
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:27,代碼來源:SmppDataSmCommandTest.java

示例5: executeWithConfigurationData

import org.jsmpp.bean.DataCodings; //導入依賴的package包/類
@Test
public void executeWithConfigurationData() throws Exception {
    Exchange exchange = new DefaultExchange(new DefaultCamelContext(), ExchangePattern.InOut);
    exchange.getIn().setHeader(SmppConstants.COMMAND, "SubmitMulti");
    exchange.getIn().setHeader(SmppConstants.ID, "1");
    exchange.getIn().setBody("short message body");
    expect(session.submitMultiple(eq("CMT"), eq(TypeOfNumber.UNKNOWN), eq(NumberingPlanIndicator.UNKNOWN), eq("1616"),
            aryEq(new Address[]{new Address(TypeOfNumber.UNKNOWN, NumberingPlanIndicator.UNKNOWN, "1717")}),
            eq(new ESMClass()), eq((byte) 0), eq((byte) 1), (String) isNull(), (String) isNull(), eq(new RegisteredDelivery(SMSCDeliveryReceipt.SUCCESS_FAILURE)),
            eq(ReplaceIfPresentFlag.DEFAULT), eq(DataCodings.newInstance((byte) 0)), eq((byte) 0), aryEq("short message body".getBytes())))
            .andReturn(new SubmitMultiResult("1", new UnsuccessDelivery(new Address(TypeOfNumber.UNKNOWN, NumberingPlanIndicator.UNKNOWN, "1717"), 0)));

    replay(session);

    command.execute(exchange);

    verify(session);

    assertEquals(Arrays.asList("1"), exchange.getOut().getHeader(SmppConstants.ID));
    assertEquals(1, exchange.getOut().getHeader(SmppConstants.SENT_MESSAGE_COUNT));
    assertNotNull(exchange.getOut().getHeader(SmppConstants.ERROR));
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:23,代碼來源:SmppSubmitMultiCommandTest.java

示例6: messageWaitingDiscardMessageInactiveVoicemail

import org.jsmpp.bean.DataCodings; //導入依賴的package包/類
@Test
public void messageWaitingDiscardMessageInactiveVoicemail() {
    // 11010000
    MessageWaitingDataCoding dataCoding = new MessageWaitingDataCoding(
            IndicationSense.INACTIVE,
            IndicationType.VOICEMAIL_MESSAGE_WAITING,
            Alphabet.ALPHA_DEFAULT);
    byte expected = (byte)0xd0;

    assertEquals(dataCoding.toByte(), expected, "Datacoding differs");
    
    DataCoding buildedInstance = DataCodings.newInstance(dataCoding.toByte());
    assertEquals(buildedInstance, dataCoding);
    
    assertTrue(dataCoding.isStoreMessage());
}
 
開發者ID:opentelecoms-org,項目名稱:jsmpp,代碼行數:17,代碼來源:MessageWaitingDataCodingStoreMessageAlphaDefaultTest.java

示例7: messageWaitingDiscardMessageInactiveFax

import org.jsmpp.bean.DataCodings; //導入依賴的package包/類
@Test
public void messageWaitingDiscardMessageInactiveFax() {
    // 11010001
    MessageWaitingDataCoding dataCoding = new MessageWaitingDataCoding(
            IndicationSense.INACTIVE,
            IndicationType.FAX_MESSAGE_WAITING, 
            Alphabet.ALPHA_DEFAULT);
    byte expected = (byte)0xd1;
    
    assertEquals(dataCoding.toByte(), expected);
    
    DataCoding buildedInstance = DataCodings.newInstance(dataCoding.toByte());
    assertEquals(buildedInstance, dataCoding);
    
    assertTrue(dataCoding.isStoreMessage());
}
 
開發者ID:opentelecoms-org,項目名稱:jsmpp,代碼行數:17,代碼來源:MessageWaitingDataCodingStoreMessageAlphaDefaultTest.java

示例8: messageWaitingDiscardMessageInactiveElecmail

import org.jsmpp.bean.DataCodings; //導入依賴的package包/類
@Test
public void messageWaitingDiscardMessageInactiveElecmail() {
    // 11010010
    MessageWaitingDataCoding dataCoding = new MessageWaitingDataCoding(
            IndicationSense.INACTIVE,
            IndicationType.ELECTRONIC_MESSAGE_WAITING, 
            Alphabet.ALPHA_DEFAULT);
    byte expected = (byte)0xd2;
    
    assertEquals(dataCoding.toByte(), expected);
    
    DataCoding buildedInstance = DataCodings.newInstance(dataCoding.toByte());
    assertEquals(buildedInstance, dataCoding);
    
    assertTrue(dataCoding.isStoreMessage());
}
 
開發者ID:opentelecoms-org,項目名稱:jsmpp,代碼行數:17,代碼來源:MessageWaitingDataCodingStoreMessageAlphaDefaultTest.java

示例9: messageWaitingDiscardMessageInactiveOther

import org.jsmpp.bean.DataCodings; //導入依賴的package包/類
@Test
public void messageWaitingDiscardMessageInactiveOther() {
    // 11010011
    MessageWaitingDataCoding dataCoding = new MessageWaitingDataCoding(
            IndicationSense.INACTIVE,
            IndicationType.OTHER_MESSAGE_WAITING, 
            Alphabet.ALPHA_DEFAULT);
    byte expected = (byte)0xd3;
    
    assertEquals(dataCoding.toByte(), expected);
    
    DataCoding buildedInstance = DataCodings.newInstance(dataCoding.toByte());
    assertEquals(buildedInstance, dataCoding);
    
    assertTrue(dataCoding.isStoreMessage());
}
 
開發者ID:opentelecoms-org,項目名稱:jsmpp,代碼行數:17,代碼來源:MessageWaitingDataCodingStoreMessageAlphaDefaultTest.java

示例10: messageWaitingDiscardMessageActiveVoicemail

import org.jsmpp.bean.DataCodings; //導入依賴的package包/類
@Test
public void messageWaitingDiscardMessageActiveVoicemail() {
    // 11011000
    MessageWaitingDataCoding dataCoding = new MessageWaitingDataCoding(
            IndicationSense.ACTIVE,
            IndicationType.VOICEMAIL_MESSAGE_WAITING, 
            Alphabet.ALPHA_DEFAULT);
    byte expected = (byte)0xd8;
    
    assertEquals(dataCoding.toByte(), expected);
    
    DataCoding buildedInstance = DataCodings.newInstance(dataCoding.toByte());
    assertEquals(buildedInstance, dataCoding);
    
    assertTrue(dataCoding.isStoreMessage());
}
 
開發者ID:opentelecoms-org,項目名稱:jsmpp,代碼行數:17,代碼來源:MessageWaitingDataCodingStoreMessageAlphaDefaultTest.java

示例11: messageWaitingDiscardMessageActiveFax

import org.jsmpp.bean.DataCodings; //導入依賴的package包/類
@Test
public void messageWaitingDiscardMessageActiveFax() {
    // 11011001
    MessageWaitingDataCoding dataCoding = new MessageWaitingDataCoding(
            IndicationSense.ACTIVE,
            IndicationType.FAX_MESSAGE_WAITING, 
            Alphabet.ALPHA_DEFAULT);
    byte expected = (byte)0xd9;
    
    assertEquals(dataCoding.toByte(), expected);
    
    DataCoding buildedInstance = DataCodings.newInstance(dataCoding.toByte());
    assertEquals(buildedInstance, dataCoding);
    
    assertTrue(dataCoding.isStoreMessage());
}
 
開發者ID:opentelecoms-org,項目名稱:jsmpp,代碼行數:17,代碼來源:MessageWaitingDataCodingStoreMessageAlphaDefaultTest.java

示例12: messageWaitingDiscardMessageActiveElecmail

import org.jsmpp.bean.DataCodings; //導入依賴的package包/類
@Test
public void messageWaitingDiscardMessageActiveElecmail() {
    // 11011010
    MessageWaitingDataCoding dataCoding = new MessageWaitingDataCoding(
            IndicationSense.ACTIVE,
            IndicationType.ELECTRONIC_MESSAGE_WAITING, 
            Alphabet.ALPHA_DEFAULT);
    byte expected = (byte)0xda;
    
    assertEquals(dataCoding.toByte(), expected);
    
    DataCoding buildedInstance = DataCodings.newInstance(dataCoding.toByte());
    assertEquals(buildedInstance, dataCoding);
    
    assertTrue(dataCoding.isStoreMessage());
}
 
開發者ID:opentelecoms-org,項目名稱:jsmpp,代碼行數:17,代碼來源:MessageWaitingDataCodingStoreMessageAlphaDefaultTest.java

示例13: messageWaitingDiscardMessageActiveOther

import org.jsmpp.bean.DataCodings; //導入依賴的package包/類
@Test
public void messageWaitingDiscardMessageActiveOther() {
    // 11011011
    MessageWaitingDataCoding dataCoding = new MessageWaitingDataCoding(
            IndicationSense.ACTIVE,
            IndicationType.OTHER_MESSAGE_WAITING, 
            Alphabet.ALPHA_DEFAULT);
    byte expected = (byte)0xdb;
    
    assertEquals(dataCoding.toByte(), expected);
    
    DataCoding buildedInstance = DataCodings.newInstance(dataCoding.toByte());
    assertEquals(buildedInstance, dataCoding);
    
    assertTrue(dataCoding.isStoreMessage());
}
 
開發者ID:opentelecoms-org,項目名稱:jsmpp,代碼行數:17,代碼來源:MessageWaitingDataCodingStoreMessageAlphaDefaultTest.java

示例14: messageWaitingDiscardMessageInactiveVoicemail

import org.jsmpp.bean.DataCodings; //導入依賴的package包/類
@Test
public void messageWaitingDiscardMessageInactiveVoicemail() {
    // 11100000
    MessageWaitingDataCoding dataCoding = new MessageWaitingDataCoding(
            IndicationSense.INACTIVE,
            IndicationType.VOICEMAIL_MESSAGE_WAITING,
            Alphabet.ALPHA_UCS2);
    byte expected = (byte)0xe0;

    assertEquals(dataCoding.toByte(), expected, "Datacoding differs");
    
    DataCoding buildedInstance = DataCodings.newInstance(dataCoding.toByte());
    assertEquals(buildedInstance, dataCoding);
    
    assertTrue(dataCoding.isStoreMessage());
}
 
開發者ID:opentelecoms-org,項目名稱:jsmpp,代碼行數:17,代碼來源:MessageWaitingDataCodingStoreMessageAlphaUCS2Test.java

示例15: messageWaitingDiscardMessageInactiveFax

import org.jsmpp.bean.DataCodings; //導入依賴的package包/類
@Test
public void messageWaitingDiscardMessageInactiveFax() {
    // 11100001
    MessageWaitingDataCoding dataCoding = new MessageWaitingDataCoding(
            IndicationSense.INACTIVE,
            IndicationType.FAX_MESSAGE_WAITING, 
            Alphabet.ALPHA_UCS2);
    byte expected = (byte)0xe1;
    
    assertEquals(dataCoding.toByte(), expected);
    
    DataCoding buildedInstance = DataCodings.newInstance(dataCoding.toByte());
    assertEquals(buildedInstance, dataCoding);
    
    assertTrue(dataCoding.isStoreMessage());
}
 
開發者ID:opentelecoms-org,項目名稱:jsmpp,代碼行數:17,代碼來源:MessageWaitingDataCodingStoreMessageAlphaUCS2Test.java


注:本文中的org.jsmpp.bean.DataCodings類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。