当前位置: 首页>>代码示例>>Java>>正文


Java DataSmResult类代码示例

本文整理汇总了Java中org.jsmpp.session.DataSmResult的典型用法代码示例。如果您正苦于以下问题:Java DataSmResult类的具体用法?Java DataSmResult怎么用?Java DataSmResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DataSmResult类属于org.jsmpp.session包,在下文中一共展示了DataSmResult类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onAcceptDataSmSuccess

import org.jsmpp.session.DataSmResult; //导入依赖的package包/类
@Test
public void onAcceptDataSmSuccess() throws Exception {
    SMPPSession session = createMock(SMPPSession.class);
    DataSm dataSm = createMock(DataSm.class);
    Exchange exchange = createMock(Exchange.class);
    OptionalParameter[] optionalParameters = new OptionalParameter[]{};
    
    expect(endpoint.createOnAcceptDataSm(dataSm, "1"))
        .andReturn(exchange);
    processor.process(exchange);
    expect(exchange.getException()).andReturn(null);
    expect(dataSm.getOptionalParameters())
        .andReturn(optionalParameters);
    
    replay(endpoint, processor, exceptionHandler, session, dataSm, exchange);
    
    DataSmResult result = listener.onAcceptDataSm(dataSm, session);
    
    verify(endpoint, processor, exceptionHandler, session, dataSm, exchange);
    
    assertEquals("1", result.getMessageId());
    assertSame(optionalParameters, result.getOptionalParameters());
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:24,代码来源:MessageReceiverListenerImplTest.java

示例2: executeWithConfigurationData

import org.jsmpp.session.DataSmResult; //导入依赖的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

示例3: execute

import org.jsmpp.session.DataSmResult; //导入依赖的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

示例4: execute

import org.jsmpp.session.DataSmResult; //导入依赖的package包/类
@Override
public void execute(Exchange exchange) throws SmppException {
    DataSm dataSm = createDataSm(exchange);

    if (log.isDebugEnabled()) {
        log.debug("Sending a data short message for exchange id '{}'...", exchange.getExchangeId());
    }

    DataSmResult result;
    try {
        result = session.dataShortMessage(
                dataSm.getServiceType(),
                TypeOfNumber.valueOf(dataSm.getSourceAddrTon()),
                NumberingPlanIndicator.valueOf(dataSm.getSourceAddrNpi()),
                dataSm.getSourceAddr(),
                TypeOfNumber.valueOf(dataSm.getDestAddrTon()),
                NumberingPlanIndicator.valueOf(dataSm.getDestAddrNpi()),
                dataSm.getDestAddress(),
                new ESMClass(dataSm.getEsmClass()),
                new RegisteredDelivery(dataSm.getRegisteredDelivery()),
                DataCodings.newInstance(dataSm.getDataCoding()),
                dataSm.getOptionalParameters());
    } catch (Exception e) {
        throw new SmppException(e);
    }

    if (log.isDebugEnabled()) {
        log.debug("Sent a data short message for exchange id '{}' and message id '{}'",
                exchange.getExchangeId(), result.getMessageId());
    }

    Message message = getResponseMessage(exchange);
    message.setHeader(SmppConstants.ID, result.getMessageId());
    message.setHeader(SmppConstants.OPTIONAL_PARAMETERS, createOptionalParameterByName(result.getOptionalParameters()));
    message.setHeader(SmppConstants.OPTIONAL_PARAMETER, createOptionalParameterByCode(result.getOptionalParameters()));
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:37,代码来源:SmppDataSmCommand.java

示例5: executeWithOptionalParameter

import org.jsmpp.session.DataSmResult; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void executeWithOptionalParameter() throws Exception {
    Exchange exchange = new DefaultExchange(new DefaultCamelContext(), ExchangePattern.InOut);
    exchange.getIn().setHeader(SmppConstants.COMMAND, "DataSm");
    Map<String, String> optionalParameters = new LinkedHashMap<String, String>();
    optionalParameters.put("SOURCE_SUBADDRESS", "1292");
    optionalParameters.put("ADDITIONAL_STATUS_INFO_TEXT", "urgent");
    optionalParameters.put("DEST_ADDR_SUBUNIT", "4");
    optionalParameters.put("DEST_TELEMATICS_ID", "2");
    optionalParameters.put("QOS_TIME_TO_LIVE", "3600000");
    optionalParameters.put("ALERT_ON_MESSAGE_DELIVERY", null);
    // fall back test for vendor specific optional parameter 
    optionalParameters.put("0x2150", "0815");
    optionalParameters.put("0x2151", "0816");
    optionalParameters.put("0x2152", "6");
    optionalParameters.put("0x2153", "9");
    optionalParameters.put("0x2154", "7400000");
    optionalParameters.put("0x2155", null);
    exchange.getIn().setHeader(SmppConstants.OPTIONAL_PARAMETERS, optionalParameters);
    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)),
            eq(new OptionalParameter.Source_subaddress("1292".getBytes())),
            eq(new OptionalParameter.Additional_status_info_text("urgent")),
            eq(new OptionalParameter.Dest_addr_subunit((byte) 4)),
            eq(new OptionalParameter.Dest_telematics_id((short) 2)),
            eq(new OptionalParameter.Qos_time_to_live(3600000)),
            eq(new OptionalParameter.Alert_on_message_delivery((byte) 0))))
        .andReturn(new DataSmResult(new MessageId("1"), new OptionalParameter[] {new OptionalParameter.Source_subaddress("1292".getBytes()),
            new OptionalParameter.Additional_status_info_text("urgent"),
            new OptionalParameter.Dest_addr_subunit((byte) 4),
            new OptionalParameter.Dest_telematics_id((short) 2),
            new OptionalParameter.Qos_time_to_live(3600000),
            new OptionalParameter.Alert_on_message_delivery((byte) 0)}));

    replay(session);

    command.execute(exchange);

    verify(session);

    assertEquals(3, exchange.getOut().getHeaders().size());
    assertEquals("1", exchange.getOut().getHeader(SmppConstants.ID));

    Map<String, String> optParamMap = exchange.getOut().getHeader(SmppConstants.OPTIONAL_PARAMETERS, Map.class);
    assertEquals(6, optParamMap.size());
    assertEquals("1292", optParamMap.get("SOURCE_SUBADDRESS"));
    assertEquals("urgent", optParamMap.get("ADDITIONAL_STATUS_INFO_TEXT"));
    assertEquals("4", optParamMap.get("DEST_ADDR_SUBUNIT"));
    assertEquals("2", optParamMap.get("DEST_TELEMATICS_ID"));
    assertEquals("3600000", optParamMap.get("QOS_TIME_TO_LIVE"));
    assertEquals("0", optParamMap.get("ALERT_ON_MESSAGE_DELIVERY"));

    Map<Short, Object> optionalResultParameter = exchange.getOut().getHeader(SmppConstants.OPTIONAL_PARAMETER, Map.class);
    assertEquals(6, optionalResultParameter.size());
    assertArrayEquals("1292".getBytes("UTF-8"), (byte[]) optionalResultParameter.get(Short.valueOf((short) 0x0202)));
    assertEquals("urgent", optionalResultParameter.get(Short.valueOf((short) 0x001D)));
    assertEquals(Byte.valueOf((byte) 4), optionalResultParameter.get(Short.valueOf((short) 0x0005)));
    assertEquals(Short.valueOf((short) 2), optionalResultParameter.get(Short.valueOf((short) 0x0008)));
    assertEquals(Integer.valueOf(3600000), optionalResultParameter.get(Short.valueOf((short) 0x0017)));
    assertEquals((byte) 0, optionalResultParameter.get(Short.valueOf((short) 0x130C)));
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:64,代码来源:SmppDataSmCommandTest.java

示例6: executeWithOptionalParameterNewStyle

import org.jsmpp.session.DataSmResult; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void executeWithOptionalParameterNewStyle() throws Exception {
    Exchange exchange = new DefaultExchange(new DefaultCamelContext(), ExchangePattern.InOut);
    exchange.getIn().setHeader(SmppConstants.COMMAND, "DataSm");
    Map<Short, Object> optionalParameters = new LinkedHashMap<Short, Object>();
    // standard optional parameter
    optionalParameters.put(Short.valueOf((short) 0x0202), "1292".getBytes("UTF-8"));
    optionalParameters.put(Short.valueOf((short) 0x001D), "urgent");
    optionalParameters.put(Short.valueOf((short) 0x0005), Byte.valueOf("4"));
    optionalParameters.put(Short.valueOf((short) 0x0008), Short.valueOf((short) 2));
    optionalParameters.put(Short.valueOf((short) 0x0017), Integer.valueOf(3600000));
    optionalParameters.put(Short.valueOf((short) 0x130C), null);
    // vendor specific optional parameter
    optionalParameters.put(Short.valueOf((short) 0x2150), "0815".getBytes("UTF-8"));
    optionalParameters.put(Short.valueOf((short) 0x2151), "0816");
    optionalParameters.put(Short.valueOf((short) 0x2152), Byte.valueOf("6"));
    optionalParameters.put(Short.valueOf((short) 0x2153), Short.valueOf((short) 9));
    optionalParameters.put(Short.valueOf((short) 0x2154), Integer.valueOf(7400000));
    optionalParameters.put(Short.valueOf((short) 0x2155), null);
    exchange.getIn().setHeader(SmppConstants.OPTIONAL_PARAMETER, optionalParameters);
    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)),
            eq(new OptionalParameter.OctetString(Tag.SOURCE_SUBADDRESS, "1292")),
            eq(new OptionalParameter.COctetString(Tag.ADDITIONAL_STATUS_INFO_TEXT.code(), "urgent")),
            eq(new OptionalParameter.Byte(Tag.DEST_ADDR_SUBUNIT, (byte) 4)),
            eq(new OptionalParameter.Short(Tag.DEST_TELEMATICS_ID.code(), (short) 2)),
            eq(new OptionalParameter.Int(Tag.QOS_TIME_TO_LIVE, 3600000)),
            eq(new OptionalParameter.Null(Tag.ALERT_ON_MESSAGE_DELIVERY)),
            eq(new OptionalParameter.OctetString((short) 0x2150, "1292", "UTF-8")),
            eq(new OptionalParameter.COctetString((short) 0x2151, "0816")),
            eq(new OptionalParameter.Byte((short) 0x2152, (byte) 6)),
            eq(new OptionalParameter.Short((short) 0x2153, (short) 9)),
            eq(new OptionalParameter.Int((short) 0x2154, 7400000)),
            eq(new OptionalParameter.Null((short) 0x2155))))
        .andReturn(new DataSmResult(new MessageId("1"), new OptionalParameter[]{
            new OptionalParameter.Source_subaddress("1292".getBytes()), new OptionalParameter.Additional_status_info_text("urgent"),
            new OptionalParameter.Dest_addr_subunit((byte) 4), new OptionalParameter.Dest_telematics_id((short) 2),
            new OptionalParameter.Qos_time_to_live(3600000), new OptionalParameter.Alert_on_message_delivery((byte) 0)}));

    replay(session);

    command.execute(exchange);

    verify(session);

    assertEquals(3, exchange.getOut().getHeaders().size());
    assertEquals("1", exchange.getOut().getHeader(SmppConstants.ID));

    Map<String, String> optParamMap = exchange.getOut().getHeader(SmppConstants.OPTIONAL_PARAMETERS, Map.class);
    assertEquals(6, optParamMap.size());
    assertEquals("1292", optParamMap.get("SOURCE_SUBADDRESS"));
    assertEquals("urgent", optParamMap.get("ADDITIONAL_STATUS_INFO_TEXT"));
    assertEquals("4", optParamMap.get("DEST_ADDR_SUBUNIT"));
    assertEquals("2", optParamMap.get("DEST_TELEMATICS_ID"));
    assertEquals("3600000", optParamMap.get("QOS_TIME_TO_LIVE"));
    assertEquals("0", optParamMap.get("ALERT_ON_MESSAGE_DELIVERY"));

    Map<Short, Object> optionalResultParameter = exchange.getOut().getHeader(SmppConstants.OPTIONAL_PARAMETER, Map.class);
    assertEquals(6, optionalResultParameter.size());
    assertArrayEquals("1292".getBytes("UTF-8"), (byte[]) optionalResultParameter.get(Short.valueOf((short) 0x0202)));
    assertEquals("urgent", optionalResultParameter.get(Short.valueOf((short) 0x001D)));
    assertEquals(Byte.valueOf((byte) 4), optionalResultParameter.get(Short.valueOf((short) 0x0005)));
    assertEquals(Short.valueOf((short) 2), optionalResultParameter.get(Short.valueOf((short) 0x0008)));
    assertEquals(Integer.valueOf(3600000), optionalResultParameter.get(Short.valueOf((short) 0x0017)));
    assertEquals((byte) 0, optionalResultParameter.get(Short.valueOf((short) 0x130C)));
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:69,代码来源:SmppDataSmCommandTest.java

示例7: onAcceptDataSm

import org.jsmpp.session.DataSmResult; //导入依赖的package包/类
public DataSmResult onAcceptDataSm(DataSm dataSm, Session source)
        throws ProcessRequestException {
    LOGGER.info("DataSm not implemented");
    throw new ProcessRequestException(DATASM_NOT_IMPLEMENTED, SMPPConstant.STAT_ESME_RINVCMDID);
}
 
开发者ID:opentelecoms-org,项目名称:jsmpp,代码行数:6,代码来源:MessageReceiverListenerImpl.java

示例8: onAcceptDataSm

import org.jsmpp.session.DataSmResult; //导入依赖的package包/类
public DataSmResult onAcceptDataSm(DataSm dataSm, Session source)
        throws ProcessRequestException {
    LOGGER.info("Accepting DataSm, but not implemented");
    throw new ProcessRequestException(DATASM_NOT_IMPLEMENTED, SMPPConstant.STAT_ESME_RSYSERR);
}
 
开发者ID:opentelecoms-org,项目名称:jsmpp,代码行数:6,代码来源:SMPPServerSimulator.java

示例9: onAcceptDataSm

import org.jsmpp.session.DataSmResult; //导入依赖的package包/类
public DataSmResult onAcceptDataSm(DataSm dataSm, Session source)
        throws ProcessRequestException {
    LOGGER.warn("DataSm not implemented");
    throw new ProcessRequestException(DATASM_NOT_IMPLEMENTED, SMPPConstant.STAT_ESME_RSYSERR);
}
 
开发者ID:opentelecoms-org,项目名称:jsmpp,代码行数:6,代码来源:StressServer.java

示例10: onAcceptDataSm

import org.jsmpp.session.DataSmResult; //导入依赖的package包/类
public DataSmResult onAcceptDataSm(DataSm dataSm, Session source) throws ProcessRequestException {
	LOG.debug("onAcceptDataSm '{}'", dataSm);
	return null;
}
 
开发者ID:groupe-sii,项目名称:ogham,代码行数:5,代码来源:JSMPPServerSimulator.java

示例11: onAcceptDataSm

import org.jsmpp.session.DataSmResult; //导入依赖的package包/类
@Override
public DataSmResult onAcceptDataSm(DataSm dataSm, Session session) throws ProcessRequestException {
    return null;
}
 
开发者ID:amalio,项目名称:spring-json-sms-gateway,代码行数:5,代码来源:SMSCListener.java

示例12: onAcceptDataSm

import org.jsmpp.session.DataSmResult; //导入依赖的package包/类
public DataSmResult onAcceptDataSm(DataSm dataSm) throws ProcessRequestException {
    return null;
}
 
开发者ID:wso2,项目名称:wso2-axis2-transports,代码行数:4,代码来源:SMPPListener.java

示例13: onAcceptDataSm

import org.jsmpp.session.DataSmResult; //导入依赖的package包/类
public DataSmResult onAcceptDataSm(DataSm dataSm, Session source) throws ProcessRequestException
{
	// ignored
	return null;
}
 
开发者ID:tdelenikas,项目名称:smslib-v3,代码行数:6,代码来源:JSMPPGateway.java

示例14: onAcceptDataSm

import org.jsmpp.session.DataSmResult; //导入依赖的package包/类
public DataSmResult onAcceptDataSm(DataSm dataSm, Session source)
        throws ProcessRequestException {
// ignored
    return null;
}
 
开发者ID:pioryan,项目名称:smslib,代码行数:6,代码来源:JSMPPGateway.java


注:本文中的org.jsmpp.session.DataSmResult类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。