INTEXT-32 - Cleanup
* Ensure ASL license headers are present * Add "@since" with "1.0" to the Java source files * Cleanup * The mockSmppServer server port is dynamically chosen * Centralize the mockSmppServer bean declaration to reduce duplication
This commit is contained in:
@@ -1 +1 @@
|
||||
version=2.2.0.BUILD-SNAPSHOT
|
||||
version=1.0.0.BUILD-SNAPSHOT
|
||||
|
||||
@@ -31,7 +31,7 @@ def customizePom(pom, gradleProject) {
|
||||
generatedPom.project {
|
||||
name = gradleProject.description
|
||||
description = gradleProject.description
|
||||
url = 'https://github.com/SpringSource/spring-integration'
|
||||
url = 'https://github.com/SpringSource/spring-integration-extensions'
|
||||
organization {
|
||||
name = 'SpringSource'
|
||||
url = 'http://springsource.org'
|
||||
@@ -44,17 +44,27 @@ def customizePom(pom, gradleProject) {
|
||||
}
|
||||
}
|
||||
scm {
|
||||
url = 'https://github.com/SpringSource/spring-integration'
|
||||
connection = 'scm:git:git://github.com/SpringSource/spring-integration'
|
||||
developerConnection = 'scm:git:git://github.com/SpringSource/spring-integration'
|
||||
url = 'https://github.com/SpringSource/spring-integration-extensions'
|
||||
connection = 'scm:git:git://github.com/SpringSource/spring-integration-extensions'
|
||||
developerConnection = 'scm:git:git://github.com/SpringSource/spring-integration-extensions'
|
||||
}
|
||||
|
||||
developers {
|
||||
developer {
|
||||
id = 'not specified'
|
||||
id = 'otnateos'
|
||||
name = 'Johanes Soetanto'
|
||||
email = 'not specified'
|
||||
}
|
||||
developer {
|
||||
id = 'ghillert'
|
||||
name = 'Gunnar Hillert'
|
||||
email = 'ghillert@vmware.com'
|
||||
}
|
||||
developer {
|
||||
id = 'joshlong'
|
||||
name = 'Josh Long'
|
||||
email = 'jolong@vmware.com'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -27,29 +27,29 @@ import org.w3c.dom.Element;
|
||||
* The Smpp Inbound Channel adapter parser
|
||||
*
|
||||
* @author Johanes Soetanto
|
||||
* @since 2.2
|
||||
* @since 1.0
|
||||
*
|
||||
*/
|
||||
public class SmppInboundChannelAdapterParser extends AbstractChannelAdapterParser {
|
||||
|
||||
@Override
|
||||
protected boolean shouldGenerateId() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected boolean shouldGenerateId() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean shouldGenerateIdAsFallback() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
protected boolean shouldGenerateIdAsFallback() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AbstractBeanDefinition doParse(Element e, ParserContext context, String channelName) {
|
||||
final BeanDefinitionBuilder builder = BeanDefinitionBuilder
|
||||
.genericBeanDefinition(SmppInboundChannelAdapter.class);
|
||||
SmppParserUtils.setSession(e, "smpp-session-ref", "session", "smppSession", context, builder);
|
||||
builder.addPropertyReference("channel", channelName);
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, e, "auto-startup","autoStartup");
|
||||
return builder.getBeanDefinition();
|
||||
}
|
||||
@Override
|
||||
protected AbstractBeanDefinition doParse(Element e, ParserContext context, String channelName) {
|
||||
final BeanDefinitionBuilder builder = BeanDefinitionBuilder
|
||||
.genericBeanDefinition(SmppInboundChannelAdapter.class);
|
||||
SmppParserUtils.setSession(e, "smpp-session-ref", "session", "smppSession", context, builder);
|
||||
builder.addPropertyReference("channel", channelName);
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, e, "auto-startup","autoStartup");
|
||||
return builder.getBeanDefinition();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -26,40 +26,40 @@ import org.w3c.dom.Element;
|
||||
* The Parser for Smpp Inbound Gateway.
|
||||
*
|
||||
* @author Johanes Soetanto
|
||||
* @since 2.2
|
||||
* @since 1.0
|
||||
*
|
||||
*/
|
||||
public class SmppInboundGatewayParser extends AbstractInboundGatewayParser {
|
||||
|
||||
@Override
|
||||
protected Class<?> getBeanClass(Element element) {
|
||||
return SmppInboundGateway.class;
|
||||
}
|
||||
@Override
|
||||
protected Class<?> getBeanClass(Element element) {
|
||||
return SmppInboundGateway.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isEligibleAttribute(String n) {
|
||||
return !n.equals("source-address") && !n.equals("source-ton") && !n.equals("smpp-session-ref")
|
||||
&& !n.equals("request-mapper") && !n.equals("reply-mapper")
|
||||
&& super.isEligibleAttribute(n);
|
||||
}
|
||||
@Override
|
||||
protected boolean isEligibleAttribute(String n) {
|
||||
return !n.equals("source-address") && !n.equals("source-ton") && !n.equals("smpp-session-ref")
|
||||
&& !n.equals("request-mapper") && !n.equals("reply-mapper")
|
||||
&& super.isEligibleAttribute(n);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
|
||||
super.doParse(element, parserContext, builder);
|
||||
// because session need parserContext
|
||||
SmppParserUtils.setSession(element, "smpp-session-ref", "session", "smppSession", parserContext, builder);
|
||||
}
|
||||
@Override
|
||||
protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
|
||||
super.doParse(element, parserContext, builder);
|
||||
// because session need parserContext
|
||||
SmppParserUtils.setSession(element, "smpp-session-ref", "session", "smppSession", parserContext, builder);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doPostProcess(BeanDefinitionBuilder builder, Element e) {
|
||||
// value
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, e, "source-address", "defaultSourceAddress");
|
||||
SmppParserUtils.setTon(e, "source-ton", "defaultSourceAddressTypeOfNumber", builder);
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, e, "reply-timeout", "replyTimeout");
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, e, "request-timeout", "requestTimeout");
|
||||
@Override
|
||||
protected void doPostProcess(BeanDefinitionBuilder builder, Element e) {
|
||||
// value
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, e, "source-address", "defaultSourceAddress");
|
||||
SmppParserUtils.setTon(e, "source-ton", "defaultSourceAddressTypeOfNumber", builder);
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, e, "reply-timeout", "replyTimeout");
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, e, "request-timeout", "requestTimeout");
|
||||
|
||||
// reference
|
||||
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, e, "request-mapper", "requestMapper");
|
||||
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, e, "reply-mapper", "replyMapper");
|
||||
}
|
||||
// reference
|
||||
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, e, "request-mapper", "requestMapper");
|
||||
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, e, "reply-mapper", "replyMapper");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -21,7 +21,7 @@ import org.springframework.integration.config.xml.AbstractIntegrationNamespaceHa
|
||||
* The namespace handler for the Smpp namespace
|
||||
*
|
||||
* @author Johanes Soetanto
|
||||
* @since 2.2
|
||||
* @since 1.0
|
||||
*
|
||||
*/
|
||||
public class SmppNamespaceHandler extends AbstractIntegrationNamespaceHandler {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -27,7 +27,7 @@ import org.w3c.dom.Element;
|
||||
* The parser for the Smpp Outbound Channel Adapter.
|
||||
*
|
||||
* @author Johanes Soetanto
|
||||
* @since 2.2
|
||||
* @since 1.0
|
||||
*
|
||||
*/
|
||||
public class SmppOutboundChannelAdapterParser extends AbstractOutboundChannelAdapterParser {
|
||||
@@ -40,12 +40,12 @@ public class SmppOutboundChannelAdapterParser extends AbstractOutboundChannelAda
|
||||
@Override
|
||||
protected AbstractBeanDefinition parseConsumer(Element e, ParserContext parserContext) {
|
||||
final BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(SmppOutboundChannelAdapter.class);
|
||||
// value attributes
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, e, "source-address", "defaultSourceAddress");
|
||||
SmppParserUtils.setTon(e, "source-ton", "defaultSourceAddressTypeOfNumber", builder);
|
||||
// reference attributes
|
||||
SmppParserUtils.setSession(e, "smpp-session-ref", "session", "smppSession", parserContext, builder);
|
||||
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, e, "time-formatter", "timeFormatter");
|
||||
// value attributes
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, e, "source-address", "defaultSourceAddress");
|
||||
SmppParserUtils.setTon(e, "source-ton", "defaultSourceAddressTypeOfNumber", builder);
|
||||
// reference attributes
|
||||
SmppParserUtils.setSession(e, "smpp-session-ref", "session", "smppSession", parserContext, builder);
|
||||
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, e, "time-formatter", "timeFormatter");
|
||||
return builder.getBeanDefinition();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -24,25 +24,25 @@ import org.w3c.dom.Element;
|
||||
|
||||
/**
|
||||
* The Parser for Smpp Outbound Gateway.
|
||||
*
|
||||
*
|
||||
* @author Johanes Soetanto
|
||||
* @since 2.2
|
||||
* @since 1.0
|
||||
*
|
||||
*/
|
||||
public class SmppOutboundGatewayParser extends AbstractConsumerEndpointParser {
|
||||
@Override
|
||||
protected BeanDefinitionBuilder parseHandler(Element e, ParserContext parserContext) {
|
||||
final BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(SmppOutboundGateway.class);
|
||||
// value attributes
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, e, "source-address", "defaultSourceAddress");
|
||||
// value attributes
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, e, "source-address", "defaultSourceAddress");
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, e, "reply-timeout", "sendTimeout");
|
||||
SmppParserUtils.setTon(e, "source-ton", "defaultSourceAddressTypeOfNumber", builder);
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, e, "order");
|
||||
// reference attributes
|
||||
SmppParserUtils.setSession(e, "smpp-session-ref", "session", "smppSession", parserContext, builder);
|
||||
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, e, "reply-channel", "outputChannel");
|
||||
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, e, "time-formatter", "timeFormatter");
|
||||
return builder;
|
||||
SmppParserUtils.setTon(e, "source-ton", "defaultSourceAddressTypeOfNumber", builder);
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, e, "order");
|
||||
// reference attributes
|
||||
SmppParserUtils.setSession(e, "smpp-session-ref", "session", "smppSession", parserContext, builder);
|
||||
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, e, "reply-channel", "outputChannel");
|
||||
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, e, "time-formatter", "timeFormatter");
|
||||
return builder;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -35,7 +35,7 @@ import org.w3c.dom.Element;
|
||||
* respective {@link BeanDefinition}s.
|
||||
*
|
||||
* @author Johanes Soetanto
|
||||
* @since 2.2
|
||||
* @since 1.0
|
||||
*
|
||||
*/
|
||||
public final class SmppParserUtils {
|
||||
@@ -45,89 +45,89 @@ public final class SmppParserUtils {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
static void setSession(Element e, String sessionAttribute, String sessionChild, String propName,
|
||||
ParserContext context, BeanDefinitionBuilder builder) {
|
||||
final String sessionRef = e.getAttribute(sessionAttribute);
|
||||
final Element sessionElement = DomUtils.getChildElementByTagName(e, sessionChild);
|
||||
if(StringUtils.hasText(sessionRef)) {
|
||||
if(sessionElement != null) {
|
||||
context.getReaderContext().error("Child element '"+sessionChild+"' is not allowed when attribute '"
|
||||
+sessionAttribute+"' has been specified", context.extractSource(sessionElement));
|
||||
}
|
||||
builder.addPropertyReference(propName, sessionRef);
|
||||
} else if(sessionElement != null) {
|
||||
final String ref = sessionElement.getAttribute("ref");
|
||||
//
|
||||
BeanComponentDefinition innerBean = IntegrationNamespaceUtils
|
||||
.parseInnerHandlerDefinition(sessionElement, context);
|
||||
if (StringUtils.hasText(ref)) {
|
||||
builder.addPropertyReference(propName, ref);
|
||||
} else if (innerBean != null) {
|
||||
builder.addPropertyValue(propName, innerBean);
|
||||
}
|
||||
} else {
|
||||
context.getReaderContext().error("Child element '"+sessionChild+"' or '"+sessionAttribute+"' attribute "
|
||||
+ "need to be specified", context.extractSource(e));
|
||||
}
|
||||
}
|
||||
static void setSession(Element e, String sessionAttribute, String sessionChild, String propName,
|
||||
ParserContext context, BeanDefinitionBuilder builder) {
|
||||
final String sessionRef = e.getAttribute(sessionAttribute);
|
||||
final Element sessionElement = DomUtils.getChildElementByTagName(e, sessionChild);
|
||||
if(StringUtils.hasText(sessionRef)) {
|
||||
if(sessionElement != null) {
|
||||
context.getReaderContext().error("Child element '"+sessionChild+"' is not allowed when attribute '"
|
||||
+sessionAttribute+"' has been specified", context.extractSource(sessionElement));
|
||||
}
|
||||
builder.addPropertyReference(propName, sessionRef);
|
||||
} else if(sessionElement != null) {
|
||||
final String ref = sessionElement.getAttribute("ref");
|
||||
//
|
||||
BeanComponentDefinition innerBean = IntegrationNamespaceUtils
|
||||
.parseInnerHandlerDefinition(sessionElement, context);
|
||||
if (StringUtils.hasText(ref)) {
|
||||
builder.addPropertyReference(propName, ref);
|
||||
} else if (innerBean != null) {
|
||||
builder.addPropertyValue(propName, innerBean);
|
||||
}
|
||||
} else {
|
||||
context.getReaderContext().error("Child element '"+sessionChild+"' or '"+sessionAttribute+"' attribute "
|
||||
+ "need to be specified", context.extractSource(e));
|
||||
}
|
||||
}
|
||||
|
||||
static void setTon(Element e, String tonAttribute, String propName, BeanDefinitionBuilder builder) {
|
||||
final String ton = e.getAttribute(tonAttribute);
|
||||
if (StringUtils.hasText(ton)) {
|
||||
final RootBeanDefinition tonDef = new RootBeanDefinition(TypeOfNumber.class);
|
||||
tonDef.setUniqueFactoryMethodName("valueOf");
|
||||
tonDef.getConstructorArgumentValues().addGenericArgumentValue(getByteTon(ton));
|
||||
builder.addPropertyValue(propName, tonDef);
|
||||
}
|
||||
}
|
||||
static void setTon(Element e, String tonAttribute, String propName, BeanDefinitionBuilder builder) {
|
||||
final String ton = e.getAttribute(tonAttribute);
|
||||
if (StringUtils.hasText(ton)) {
|
||||
final RootBeanDefinition tonDef = new RootBeanDefinition(TypeOfNumber.class);
|
||||
tonDef.setUniqueFactoryMethodName("valueOf");
|
||||
tonDef.getConstructorArgumentValues().addGenericArgumentValue(getByteTon(ton));
|
||||
builder.addPropertyValue(propName, tonDef);
|
||||
}
|
||||
}
|
||||
|
||||
static void setNpi(Element e, String npiAttribute, String propName, BeanDefinitionBuilder builder) {
|
||||
final String npi = e.getAttribute(npiAttribute);
|
||||
if (StringUtils.hasText(npi)) {
|
||||
final RootBeanDefinition npiDef = new RootBeanDefinition(NumberingPlanIndicator.class);
|
||||
npiDef.setUniqueFactoryMethodName("valueOf");
|
||||
npiDef.getConstructorArgumentValues().addGenericArgumentValue(getByteNpi(npi));
|
||||
builder.addPropertyValue(propName, npiDef);
|
||||
}
|
||||
}
|
||||
static void setNpi(Element e, String npiAttribute, String propName, BeanDefinitionBuilder builder) {
|
||||
final String npi = e.getAttribute(npiAttribute);
|
||||
if (StringUtils.hasText(npi)) {
|
||||
final RootBeanDefinition npiDef = new RootBeanDefinition(NumberingPlanIndicator.class);
|
||||
npiDef.setUniqueFactoryMethodName("valueOf");
|
||||
npiDef.getConstructorArgumentValues().addGenericArgumentValue(getByteNpi(npi));
|
||||
builder.addPropertyValue(propName, npiDef);
|
||||
}
|
||||
}
|
||||
|
||||
static void setBindType(Element e, String bindAttribute, String propName, BeanDefinitionBuilder builder) {
|
||||
final String bt = e.getAttribute(bindAttribute);
|
||||
if (StringUtils.hasText(bt)) {
|
||||
final RootBeanDefinition bindTypeDef = new RootBeanDefinition(BindType.class);
|
||||
bindTypeDef.setUniqueFactoryMethodName("valueOf");
|
||||
bindTypeDef.getConstructorArgumentValues().addGenericArgumentValue(getByteBind(bt));
|
||||
builder.addPropertyValue(propName, bindTypeDef);
|
||||
}
|
||||
}
|
||||
static void setBindType(Element e, String bindAttribute, String propName, BeanDefinitionBuilder builder) {
|
||||
final String bt = e.getAttribute(bindAttribute);
|
||||
if (StringUtils.hasText(bt)) {
|
||||
final RootBeanDefinition bindTypeDef = new RootBeanDefinition(BindType.class);
|
||||
bindTypeDef.setUniqueFactoryMethodName("valueOf");
|
||||
bindTypeDef.getConstructorArgumentValues().addGenericArgumentValue(getByteBind(bt));
|
||||
builder.addPropertyValue(propName, bindTypeDef);
|
||||
}
|
||||
}
|
||||
|
||||
private static byte getByteTon(String t) {
|
||||
if ("ABBREVIATED".equals(t)) return SMPPConstant.TON_ABBREVIATED;
|
||||
if ("ALPHANUMERIC".equals(t)) return SMPPConstant.TON_ALPHANUMERIC;
|
||||
if ("SUBSCRIBER_NUMBER".equals(t))return SMPPConstant.TON_SUBSCRIBER_NUMBER;
|
||||
if ("NETWORK_SPECIFIC".equals(t))return SMPPConstant.TON_NETWORK_SPECIFIC;
|
||||
if ("NATIONAL".equals(t)) return SMPPConstant.TON_NATIONAL;
|
||||
if ("INTERNATIONAL".equals(t))return SMPPConstant.TON_INTERNATIONAL;
|
||||
return SMPPConstant.TON_UNKNOWN;
|
||||
}
|
||||
private static byte getByteTon(String t) {
|
||||
if ("ABBREVIATED".equals(t)) return SMPPConstant.TON_ABBREVIATED;
|
||||
if ("ALPHANUMERIC".equals(t)) return SMPPConstant.TON_ALPHANUMERIC;
|
||||
if ("SUBSCRIBER_NUMBER".equals(t))return SMPPConstant.TON_SUBSCRIBER_NUMBER;
|
||||
if ("NETWORK_SPECIFIC".equals(t))return SMPPConstant.TON_NETWORK_SPECIFIC;
|
||||
if ("NATIONAL".equals(t)) return SMPPConstant.TON_NATIONAL;
|
||||
if ("INTERNATIONAL".equals(t))return SMPPConstant.TON_INTERNATIONAL;
|
||||
return SMPPConstant.TON_UNKNOWN;
|
||||
}
|
||||
|
||||
private static byte getByteNpi(String n) {
|
||||
if ("WAP".equals(n)) return SMPPConstant.NPI_WAP;
|
||||
if ("INTERNET".equals(n)) return SMPPConstant.NPI_INTERNET;
|
||||
if ("ERMES".equals(n)) return SMPPConstant.NPI_ERMES;
|
||||
if ("PRIVATE".equals(n)) return SMPPConstant.NPI_PRIVATE;
|
||||
if ("NATIONAL".equals(n)) return SMPPConstant.NPI_NATIONAL;
|
||||
if ("LAND_MOBILE".equals(n)) return SMPPConstant.NPI_LAND_MOBILE;
|
||||
if ("TELEX".equals(n)) return SMPPConstant.NPI_TELEX;
|
||||
if ("DATA".equals(n)) return SMPPConstant.NPI_DATA;
|
||||
if ("ISDN".equals(n)) return SMPPConstant.NPI_ISDN;
|
||||
return SMPPConstant.NPI_UNKNOWN;
|
||||
}
|
||||
private static byte getByteNpi(String n) {
|
||||
if ("WAP".equals(n)) return SMPPConstant.NPI_WAP;
|
||||
if ("INTERNET".equals(n)) return SMPPConstant.NPI_INTERNET;
|
||||
if ("ERMES".equals(n)) return SMPPConstant.NPI_ERMES;
|
||||
if ("PRIVATE".equals(n)) return SMPPConstant.NPI_PRIVATE;
|
||||
if ("NATIONAL".equals(n)) return SMPPConstant.NPI_NATIONAL;
|
||||
if ("LAND_MOBILE".equals(n)) return SMPPConstant.NPI_LAND_MOBILE;
|
||||
if ("TELEX".equals(n)) return SMPPConstant.NPI_TELEX;
|
||||
if ("DATA".equals(n)) return SMPPConstant.NPI_DATA;
|
||||
if ("ISDN".equals(n)) return SMPPConstant.NPI_ISDN;
|
||||
return SMPPConstant.NPI_UNKNOWN;
|
||||
}
|
||||
|
||||
private static byte getByteBind(String b) {
|
||||
if ("BIND_RX".equals(b)) return SMPPConstant.CID_BIND_RECEIVER;
|
||||
if ("BIND_TX".equals(b)) return SMPPConstant.CID_BIND_TRANSMITTER;
|
||||
return SMPPConstant.CID_BIND_TRANSCEIVER;
|
||||
}
|
||||
private static byte getByteBind(String b) {
|
||||
if ("BIND_RX".equals(b)) return SMPPConstant.CID_BIND_RECEIVER;
|
||||
if ("BIND_TX".equals(b)) return SMPPConstant.CID_BIND_TRANSMITTER;
|
||||
return SMPPConstant.CID_BIND_TRANSCEIVER;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.integration.smpp.core;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
@@ -10,7 +25,7 @@ import org.jsmpp.session.Session;
|
||||
|
||||
/**
|
||||
* @author Josh Long
|
||||
* @since 2.1
|
||||
* @since 1.0
|
||||
*/
|
||||
abstract public class AbstractReceivingMessageListener implements MessageReceiverListener {
|
||||
|
||||
@@ -28,9 +43,9 @@ abstract public class AbstractReceivingMessageListener implements MessageReceive
|
||||
logger.error("Failed getting delivery receipt", e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
} else {
|
||||
} else {
|
||||
try {// this is an actual SMS message
|
||||
byte[] shortMessage = deliverSm.getShortMessage();
|
||||
byte[] shortMessage = deliverSm.getShortMessage();
|
||||
String txtSms = shortMessage == null ? new String() : new String(shortMessage);
|
||||
logger.debug("Receiving message : " + txtSms);
|
||||
onTextMessage(deliverSm, txtSms);
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.integration.smpp.core;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
@@ -20,7 +35,7 @@ import static org.springframework.integration.smpp.core.SmppConstants.*;
|
||||
* fluent API to help make specifying all these parameters just a <em>tiny</em> bit easier. For internal use only.
|
||||
*
|
||||
* @author Josh Long
|
||||
* @since 2.1
|
||||
* @since 1.0
|
||||
*/
|
||||
public class SmesMessageSpecification {
|
||||
|
||||
@@ -103,12 +118,12 @@ public class SmesMessageSpecification {
|
||||
* this method will take an inbound Spring Integration {@link Message} and map it to a {@link SmesMessageSpecification}
|
||||
* which we can use to send the SMS message.
|
||||
*
|
||||
* @param msg a new {@link Message}
|
||||
* @param msg a new {@link Message}
|
||||
* @param smppSession the SMPPSession
|
||||
* @return a {@link SmesMessageSpecification}
|
||||
*/
|
||||
public static SmesMessageSpecification fromMessage(ClientSession smppSession, Message<?> msg) {
|
||||
if (log.isDebugEnabled()) log.debug("Message: "+msg);
|
||||
if (log.isDebugEnabled()) log.debug("Message: "+msg);
|
||||
String srcAddy = valueIfHeaderExists(SRC_ADDR, msg);
|
||||
String dstAddy = valueIfHeaderExists(DST_ADDR, msg);
|
||||
String smsTxt = valueIfHeaderExists(SMS_MSG, msg);
|
||||
|
||||
@@ -1,9 +1,23 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.integration.smpp.core;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Josh Long
|
||||
* @since 1.0
|
||||
*/
|
||||
public abstract class SmppConstants {
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -20,7 +20,7 @@ package org.springframework.integration.smpp.core;
|
||||
* Smpp adapter specific message headers.
|
||||
*
|
||||
* @author Johanes Soetanto
|
||||
* @since 2.2
|
||||
* @since 1.0
|
||||
*/
|
||||
public class SmppHeaders {
|
||||
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.integration.smpp.inbound;
|
||||
|
||||
import org.jsmpp.bean.BindType;
|
||||
@@ -16,9 +31,9 @@ import org.springframework.util.Assert;
|
||||
* Supports receiving messages of a payload specified by the SMPP protocol from a <em>short message service center</em> (SMSC).
|
||||
*
|
||||
* @author Josh Long
|
||||
* @since 2.1
|
||||
* <p/>
|
||||
* todo find some way to configure the {@link java.util.concurrent.Executor}running for the JSMPP library
|
||||
* @since 1.0
|
||||
*
|
||||
* TODO find some way to configure the {@link java.util.concurrent.Executor} running for the JSMPP library
|
||||
*/
|
||||
public class SmppInboundChannelAdapter extends AbstractEndpoint {
|
||||
|
||||
@@ -46,27 +61,27 @@ public class SmppInboundChannelAdapter extends AbstractEndpoint {
|
||||
"receiving messages or both sending *and* receiving messages!");
|
||||
}
|
||||
|
||||
/**
|
||||
* Set smpp session
|
||||
* @param s smpp session
|
||||
*/
|
||||
/**
|
||||
* Set smpp session
|
||||
* @param s smpp session
|
||||
*/
|
||||
public void setSmppSession(ExtendedSmppSession s) {
|
||||
this.smppSession = s;
|
||||
}
|
||||
|
||||
private AbstractReceivingMessageListener abstractReceivingMessageListener =
|
||||
new AbstractReceivingMessageListener() {
|
||||
@Override
|
||||
protected void onDeliveryReceipt(DeliverSm deliverSm, String ogMessageId, DeliveryReceipt deliveryReceipt) throws Exception {
|
||||
// noop don't care
|
||||
}
|
||||
private AbstractReceivingMessageListener abstractReceivingMessageListener =
|
||||
new AbstractReceivingMessageListener() {
|
||||
@Override
|
||||
protected void onDeliveryReceipt(DeliverSm deliverSm, String ogMessageId, DeliveryReceipt deliveryReceipt) throws Exception {
|
||||
// noop don't care
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onTextMessage(DeliverSm deliverSm, String txtMessage) throws Exception {
|
||||
Message<?> msg = SmesMessageSpecification.toMessageFromSms(deliverSm, txtMessage);
|
||||
messagingTemplate.send(msg);
|
||||
}
|
||||
};
|
||||
@Override
|
||||
protected void onTextMessage(DeliverSm deliverSm, String txtMessage) throws Exception {
|
||||
Message<?> msg = SmesMessageSpecification.toMessageFromSms(deliverSm, txtMessage);
|
||||
messagingTemplate.send(msg);
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
protected void doStart() {
|
||||
@@ -79,9 +94,8 @@ public class SmppInboundChannelAdapter extends AbstractEndpoint {
|
||||
this.smppSession.stop();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getComponentType() {
|
||||
return "smpp:inbound-channel-adapter";
|
||||
}
|
||||
@Override
|
||||
public String getComponentType() {
|
||||
return "smpp:inbound-channel-adapter";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.integration.smpp.inbound;
|
||||
|
||||
import org.jsmpp.bean.BindType;
|
||||
@@ -14,10 +29,10 @@ import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* what'running an inbound gateway in this case? Receive a text message and then automatically send a response.
|
||||
* What'running an inbound gateway in this case? Receive a text message and then automatically send a response.
|
||||
*
|
||||
* @author Josh Long
|
||||
* @since 2.1
|
||||
* @since 1.0
|
||||
*/
|
||||
public class SmppInboundGateway extends MessagingGatewaySupport {
|
||||
|
||||
@@ -25,18 +40,18 @@ public class SmppInboundGateway extends MessagingGatewaySupport {
|
||||
private TypeOfNumber defaultSourceAddressTypeOfNumber;
|
||||
private String defaultSourceAddress;
|
||||
|
||||
/**
|
||||
* Set default source address type of number.
|
||||
* @param defaultSourceAddressTypeOfNumber default address type of number.
|
||||
*/
|
||||
/**
|
||||
* Set default source address type of number.
|
||||
* @param defaultSourceAddressTypeOfNumber default address type of number.
|
||||
*/
|
||||
public void setDefaultSourceAddressTypeOfNumber(TypeOfNumber defaultSourceAddressTypeOfNumber) {
|
||||
this.defaultSourceAddressTypeOfNumber = defaultSourceAddressTypeOfNumber;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set default source address.
|
||||
* @param defaultSourceAddress default source address
|
||||
*/
|
||||
/**
|
||||
* Set default source address.
|
||||
* @param defaultSourceAddress default source address
|
||||
*/
|
||||
public void setDefaultSourceAddress(String defaultSourceAddress) {
|
||||
this.defaultSourceAddress = defaultSourceAddress;
|
||||
}
|
||||
@@ -126,8 +141,8 @@ public class SmppInboundGateway extends MessagingGatewaySupport {
|
||||
this.smppSession.stop();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getComponentType() {
|
||||
return "smpp:inbound-gateway";
|
||||
}
|
||||
@Override
|
||||
public String getComponentType() {
|
||||
return "smpp:inbound-gateway";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
/* Copyright 2002-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.integration.smpp.outbound;
|
||||
|
||||
import org.jsmpp.bean.BindType;
|
||||
@@ -21,7 +35,7 @@ import org.springframework.util.StringUtils;
|
||||
* This adapter supports <em>mobile terminated (MT)</em> messaging, where the recipient is a directory phone number.
|
||||
*
|
||||
* @author Josh Long
|
||||
* @since 2.1
|
||||
* @since 1.0
|
||||
*/
|
||||
public class SmppOutboundChannelAdapter extends IntegrationObjectSupport implements MessageHandler {
|
||||
|
||||
@@ -33,17 +47,14 @@ public class SmppOutboundChannelAdapter extends IntegrationObjectSupport impleme
|
||||
|
||||
private ExtendedSmppSession smppSession;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public void setDefaultSourceAddress(String defaultSourceAddress) {
|
||||
this.defaultSourceAddress = defaultSourceAddress;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public void setDefaultSourceAddressTypeOfNumber(TypeOfNumber defaultSourceAddressTypeOfNumber) {
|
||||
this.defaultSourceAddressTypeOfNumber = defaultSourceAddressTypeOfNumber;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public void setTimeFormatter(TimeFormatter timeFormatter) {
|
||||
this.timeFormatter = timeFormatter;
|
||||
}
|
||||
@@ -77,7 +88,7 @@ public class SmppOutboundChannelAdapter extends IntegrationObjectSupport impleme
|
||||
this.smppSession = s;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public void handleMessage(Message<?> message) throws MessagingException {
|
||||
|
||||
try {
|
||||
@@ -99,8 +110,8 @@ public class SmppOutboundChannelAdapter extends IntegrationObjectSupport impleme
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getComponentType() {
|
||||
return "smpp:outbound-channel-adapter";
|
||||
}
|
||||
@Override
|
||||
public String getComponentType() {
|
||||
return "smpp:outbound-channel-adapter";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
/* Copyright 2002-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.integration.smpp.outbound;
|
||||
|
||||
import org.jsmpp.bean.BindType;
|
||||
@@ -26,12 +40,12 @@ import org.springframework.util.StringUtils;
|
||||
* <p/>
|
||||
*
|
||||
* @author Josh Long
|
||||
* @since 2.1
|
||||
* @since 1.0
|
||||
*/
|
||||
public class SmppOutboundGateway extends AbstractReplyProducingMessageHandler {
|
||||
@Override
|
||||
protected void onInit() {
|
||||
Assert.isTrue(
|
||||
Assert.isTrue(
|
||||
this.smppSession.getBindType().equals(BindType.BIND_TX) ||
|
||||
this.smppSession.getBindType().equals(BindType.BIND_TRX),
|
||||
"the smppSession's bindType must be BindType.BIND_TX or BindType.BIND_TRX");
|
||||
@@ -65,17 +79,14 @@ public class SmppOutboundGateway extends AbstractReplyProducingMessageHandler {
|
||||
|
||||
private ExtendedSmppSession smppSession;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public void setDefaultSourceAddress(String defaultSourceAddress) {
|
||||
this.defaultSourceAddress = defaultSourceAddress;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public void setDefaultSourceAddressTypeOfNumber(TypeOfNumber defaultSourceAddressTypeOfNumber) {
|
||||
this.defaultSourceAddressTypeOfNumber = defaultSourceAddressTypeOfNumber;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public void setTimeFormatter(TimeFormatter timeFormatter) {
|
||||
this.timeFormatter = timeFormatter;
|
||||
}
|
||||
@@ -95,8 +106,8 @@ public class SmppOutboundGateway extends AbstractReplyProducingMessageHandler {
|
||||
this.smppSession = s;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getComponentType() {
|
||||
return "smpp:outbound-gateway";
|
||||
}
|
||||
@Override
|
||||
public String getComponentType() {
|
||||
return "smpp:outbound-gateway";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
/* Copyright 2002-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.integration.smpp.session;
|
||||
|
||||
import org.jsmpp.bean.AlertNotification;
|
||||
@@ -18,7 +32,7 @@ import java.util.concurrent.CopyOnWriteArraySet;
|
||||
* This class delegates all calls to as many {@link MessageReceiverListener}s as you'd like, regardless of when the registered listener was added.
|
||||
*
|
||||
* @author Josh Long
|
||||
* @since 2.1
|
||||
* @since 1.0
|
||||
*/
|
||||
public class DelegatingMessageReceiverListener implements MessageReceiverListener {
|
||||
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
/* Copyright 2002-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.integration.smpp.session;
|
||||
|
||||
import org.jsmpp.bean.BindType;
|
||||
@@ -10,9 +24,10 @@ import org.jsmpp.session.MessageReceiverListener;
|
||||
* <ol><li>supports registration of multiple {@link org.jsmpp.session.MessageReceiverListener}s</li></ol>
|
||||
*
|
||||
* @author Josh Long
|
||||
* @since 2.1
|
||||
* @since 1.0
|
||||
*/
|
||||
public interface ExtendedSmppSession extends ClientSession {
|
||||
|
||||
/**
|
||||
* a {@link MessageReceiverListener} implementation to be added to the set of existing listeners.
|
||||
* <p/>
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
/* Copyright 2002-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.integration.smpp.session;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
@@ -18,7 +32,7 @@ import java.io.IOException;
|
||||
* Adapts to the {@link ClientSession} API, while also providing the callbacks for the Spring container
|
||||
*
|
||||
* @author Josh Long
|
||||
* @since 2.1
|
||||
* @since 1.0
|
||||
*/
|
||||
public class ExtendedSmppSessionAdaptingDelegate implements /*Lifecycle,*/ ExtendedSmppSession, InitializingBean {
|
||||
|
||||
@@ -92,8 +106,8 @@ public class ExtendedSmppSessionAdaptingDelegate implements /*Lifecycle,*/ Exten
|
||||
}
|
||||
|
||||
public String submitShortMessage(String serviceType, TypeOfNumber sourceAddrTon, NumberingPlanIndicator sourceAddrNpi,
|
||||
String sourceAddr, TypeOfNumber destAddrTon, NumberingPlanIndicator destAddrNpi,
|
||||
String destinationAddr, ESMClass esmClass, byte protocolId, byte priorityFlag, String scheduleDeliveryTime, String validityPeriod, RegisteredDelivery registeredDelivery, byte replaceIfPresentFlag, DataCoding dataCoding, byte smDefaultMsgId, byte[] shortMessage, OptionalParameter... optionalParameters) throws PDUException, ResponseTimeoutException, InvalidResponseException, NegativeResponseException, IOException {
|
||||
String sourceAddr, TypeOfNumber destAddrTon, NumberingPlanIndicator destAddrNpi,
|
||||
String destinationAddr, ESMClass esmClass, byte protocolId, byte priorityFlag, String scheduleDeliveryTime, String validityPeriod, RegisteredDelivery registeredDelivery, byte replaceIfPresentFlag, DataCoding dataCoding, byte smDefaultMsgId, byte[] shortMessage, OptionalParameter... optionalParameters) throws PDUException, ResponseTimeoutException, InvalidResponseException, NegativeResponseException, IOException {
|
||||
return session.submitShortMessage(serviceType, sourceAddrTon, sourceAddrNpi, sourceAddr, destAddrTon, destAddrNpi, destinationAddr, esmClass, protocolId, priorityFlag, scheduleDeliveryTime, validityPeriod, registeredDelivery, replaceIfPresentFlag, dataCoding, smDefaultMsgId, shortMessage, optionalParameters);
|
||||
}
|
||||
|
||||
@@ -108,7 +122,7 @@ public class ExtendedSmppSessionAdaptingDelegate implements /*Lifecycle,*/ Exten
|
||||
}
|
||||
|
||||
public void cancelShortMessage(String serviceType, String messageId, TypeOfNumber sourceAddrTon, NumberingPlanIndicator sourceAddrNpi, String sourceAddr,
|
||||
TypeOfNumber destAddrTon, NumberingPlanIndicator destAddrNpi, String destinationAddress) throws PDUException, ResponseTimeoutException, InvalidResponseException, NegativeResponseException, IOException {
|
||||
TypeOfNumber destAddrTon, NumberingPlanIndicator destAddrNpi, String destinationAddress) throws PDUException, ResponseTimeoutException, InvalidResponseException, NegativeResponseException, IOException {
|
||||
session.cancelShortMessage(serviceType, messageId, sourceAddrTon, sourceAddrNpi, sourceAddr, destAddrTon, destAddrNpi, destinationAddress);
|
||||
}
|
||||
|
||||
@@ -165,6 +179,6 @@ public class ExtendedSmppSessionAdaptingDelegate implements /*Lifecycle,*/ Exten
|
||||
}
|
||||
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
log.debug( "afterPropertiesSet!");
|
||||
log.debug( "afterPropertiesSet!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
/* Copyright 2002-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.integration.smpp.session;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
@@ -55,7 +69,7 @@ import java.util.Set;
|
||||
* @see org.jsmpp.session.SMPPSession#SMPPSession()
|
||||
* @see org.jsmpp.session.SMPPSession#connectAndBind(String, int, org.jsmpp.session.BindParameter)
|
||||
* @see org.jsmpp.session.SMPPSession#connectAndBind(String, int, org.jsmpp.bean.BindType, String, String, String, org.jsmpp.bean.TypeOfNumber, org.jsmpp.bean.NumberingPlanIndicator, String, long)
|
||||
* @since 2.1
|
||||
* @since 1.0
|
||||
*/
|
||||
public class SmppSessionFactoryBean implements FactoryBean<ExtendedSmppSession>, SmartLifecycle, InitializingBean {
|
||||
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
/* Copyright 2002-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.integration.smpp.util;
|
||||
|
||||
import org.springframework.core.NamedThreadLocal;
|
||||
@@ -10,7 +24,7 @@ import java.lang.reflect.Method;
|
||||
* exception was thrown.
|
||||
*
|
||||
* @author Josh Long
|
||||
* @since 2.1
|
||||
* @since 1.0
|
||||
*/
|
||||
abstract public class CurrentExecutingMethodHolder {
|
||||
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
/* Copyright 2002-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.integration.smpp.util;
|
||||
|
||||
import org.aopalliance.intercept.MethodInterceptor;
|
||||
@@ -11,7 +25,7 @@ import org.aopalliance.intercept.MethodInvocation;
|
||||
* In a sense, this is like JavaScript's method arity feature.
|
||||
*
|
||||
* @author Josh Long
|
||||
* @since 2.1
|
||||
* @since 1.0
|
||||
*/
|
||||
public class CurrentMethodExposingMethodInterceptor implements MethodInterceptor {
|
||||
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.integration.smpp;
|
||||
|
||||
import org.jsmpp.PDUStringException;
|
||||
@@ -28,315 +43,321 @@ import java.util.concurrent.TimeoutException;
|
||||
* <li>Forward incoming submit_sm to client connected as Receiver/Transceiver</li>
|
||||
* </ul>
|
||||
* @author Johanes Soetanto
|
||||
* @since 2.2
|
||||
* @since 1.0
|
||||
*/
|
||||
public class MockSmppServer extends ServerResponseDeliveryAdapter implements Runnable, ServerMessageReceiverListener {
|
||||
private static final Logger logger = LoggerFactory.getLogger(MockSmppServer.class);
|
||||
private String systemId;
|
||||
private String password;
|
||||
private int port;
|
||||
private Map<SMPPServerSession,String> connectionSessionMap = new HashMap<SMPPServerSession,String>();
|
||||
private static final Logger logger = LoggerFactory.getLogger(MockSmppServer.class);
|
||||
private String systemId;
|
||||
private String password;
|
||||
private int port;
|
||||
private Map<SMPPServerSession,String> connectionSessionMap = new HashMap<SMPPServerSession,String>();
|
||||
|
||||
private final ExecutorService execService = Executors.newFixedThreadPool(5);
|
||||
private final ExecutorService execServiceDelReceipt = Executors.newFixedThreadPool(100);
|
||||
private final MessageIDGenerator messageIDGenerator = new RandomMessageIDGenerator();
|
||||
private final ExecutorService execService = Executors.newFixedThreadPool(5);
|
||||
private final ExecutorService execServiceDelReceipt = Executors.newFixedThreadPool(100);
|
||||
private final MessageIDGenerator messageIDGenerator = new RandomMessageIDGenerator();
|
||||
|
||||
public MockSmppServer(int port, String systemId, String password) throws IOException {
|
||||
this.systemId = systemId;
|
||||
this.password = password;
|
||||
this.port = port;
|
||||
}
|
||||
public MockSmppServer(int port, String systemId, String password) throws IOException {
|
||||
this.systemId = systemId;
|
||||
this.password = password;
|
||||
this.port = port;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
try {
|
||||
SMPPServerSessionListener sessionListener = new SMPPServerSessionListener(port);
|
||||
logger.info("Listening on port {}", port);
|
||||
while (true) {
|
||||
SMPPServerSession serverSession = sessionListener.accept();
|
||||
logger.info("Accepting connection for session {}", serverSession.getSessionId());
|
||||
serverSession.setMessageReceiverListener(this);
|
||||
serverSession.setResponseDeliveryListener(this);
|
||||
execService.execute(new WaitBindTask(serverSession, systemId, password, connectionSessionMap));
|
||||
}
|
||||
} catch (IOException e) {
|
||||
logger.error("IO error occurred", e);
|
||||
}
|
||||
}
|
||||
public void run() {
|
||||
try {
|
||||
SMPPServerSessionListener sessionListener = new SMPPServerSessionListener(port);
|
||||
logger.info("Listening on port {}", port);
|
||||
while (true) {
|
||||
SMPPServerSession serverSession = sessionListener.accept();
|
||||
logger.info("Accepting connection for session {}", serverSession.getSessionId());
|
||||
serverSession.setMessageReceiverListener(this);
|
||||
serverSession.setResponseDeliveryListener(this);
|
||||
execService.execute(new WaitBindTask(serverSession, systemId, password, connectionSessionMap));
|
||||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
logger.error("IO error occurred", e);
|
||||
}
|
||||
}
|
||||
|
||||
public QuerySmResult onAcceptQuerySm(QuerySm querySm,
|
||||
SMPPServerSession source) throws ProcessRequestException {
|
||||
logger.info("Accepting query sm, but not implemented");
|
||||
return null;
|
||||
}
|
||||
public QuerySmResult onAcceptQuerySm(QuerySm querySm,
|
||||
SMPPServerSession source) throws ProcessRequestException {
|
||||
logger.info("Accepting query sm, but not implemented");
|
||||
return null;
|
||||
}
|
||||
|
||||
public MessageId onAcceptSubmitSm(SubmitSm submitSm,
|
||||
SMPPServerSession source) throws ProcessRequestException {
|
||||
MessageId messageId = messageIDGenerator.newMessageId();
|
||||
logger.debug("Receiving submit_sm '{}', and will return message id {}",
|
||||
new String(submitSm.getShortMessage()), messageId);
|
||||
if (SMSCDeliveryReceipt.SUCCESS.containedIn(submitSm.getRegisteredDelivery())
|
||||
|| SMSCDeliveryReceipt.SUCCESS_FAILURE.containedIn(submitSm.getRegisteredDelivery())) {
|
||||
execServiceDelReceipt.execute(new DeliveryReceiptTask(source, submitSm, messageId));
|
||||
public MessageId onAcceptSubmitSm(SubmitSm submitSm,
|
||||
SMPPServerSession source) throws ProcessRequestException {
|
||||
MessageId messageId = messageIDGenerator.newMessageId();
|
||||
logger.debug("Receiving submit_sm '{}', and will return message id {}",
|
||||
new String(submitSm.getShortMessage()), messageId);
|
||||
if (SMSCDeliveryReceipt.SUCCESS.containedIn(submitSm.getRegisteredDelivery())
|
||||
|| SMSCDeliveryReceipt.SUCCESS_FAILURE.containedIn(submitSm.getRegisteredDelivery())) {
|
||||
execServiceDelReceipt.execute(new DeliveryReceiptTask(source, submitSm, messageId));
|
||||
|
||||
}
|
||||
// on single submit_sm we forward it to any receiver listening to specific address range
|
||||
execServiceDelReceipt.execute(new MessageForwardTask(submitSm, connectionSessionMap));
|
||||
return messageId;
|
||||
}
|
||||
}
|
||||
// on single submit_sm we forward it to any receiver listening to specific address range
|
||||
execServiceDelReceipt.execute(new MessageForwardTask(submitSm, connectionSessionMap));
|
||||
return messageId;
|
||||
}
|
||||
|
||||
public void onSubmitSmRespSent(MessageId messageId,
|
||||
SMPPServerSession source) {
|
||||
logger.debug("submit_sm_resp with message_id {} has been sent", messageId);
|
||||
}
|
||||
public void onSubmitSmRespSent(MessageId messageId,
|
||||
SMPPServerSession source) {
|
||||
logger.debug("submit_sm_resp with message_id {} has been sent", messageId);
|
||||
}
|
||||
|
||||
public SubmitMultiResult onAcceptSubmitMulti(SubmitMulti submitMulti,
|
||||
SMPPServerSession source) throws ProcessRequestException {
|
||||
MessageId messageId = messageIDGenerator.newMessageId();
|
||||
logger.debug("Receiving submit_multi_sm '{}', and will return message id {}",
|
||||
new String(submitMulti.getShortMessage()), messageId);
|
||||
if (SMSCDeliveryReceipt.SUCCESS.containedIn(submitMulti.getRegisteredDelivery())
|
||||
|| SMSCDeliveryReceipt.SUCCESS_FAILURE.containedIn(submitMulti.getRegisteredDelivery())) {
|
||||
execServiceDelReceipt.execute(new DeliveryReceiptTask(source, submitMulti, messageId));
|
||||
}
|
||||
public SubmitMultiResult onAcceptSubmitMulti(SubmitMulti submitMulti,
|
||||
SMPPServerSession source) throws ProcessRequestException {
|
||||
MessageId messageId = messageIDGenerator.newMessageId();
|
||||
logger.debug("Receiving submit_multi_sm '{}', and will return message id {}",
|
||||
new String(submitMulti.getShortMessage()), messageId);
|
||||
if (SMSCDeliveryReceipt.SUCCESS.containedIn(submitMulti.getRegisteredDelivery())
|
||||
|| SMSCDeliveryReceipt.SUCCESS_FAILURE.containedIn(submitMulti.getRegisteredDelivery())) {
|
||||
execServiceDelReceipt.execute(new DeliveryReceiptTask(source, submitMulti, messageId));
|
||||
}
|
||||
|
||||
return new SubmitMultiResult(messageId.getValue(), new UnsuccessDelivery[0]);
|
||||
}
|
||||
return new SubmitMultiResult(messageId.getValue(), new UnsuccessDelivery[0]);
|
||||
}
|
||||
|
||||
public DataSmResult onAcceptDataSm(DataSm dataSm, Session source)
|
||||
throws ProcessRequestException {
|
||||
return null;
|
||||
}
|
||||
public DataSmResult onAcceptDataSm(DataSm dataSm, Session source)
|
||||
throws ProcessRequestException {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void onAcceptCancelSm(CancelSm cancelSm, SMPPServerSession source)
|
||||
throws ProcessRequestException {
|
||||
}
|
||||
public void onAcceptCancelSm(CancelSm cancelSm, SMPPServerSession source)
|
||||
throws ProcessRequestException {
|
||||
}
|
||||
|
||||
public void onAcceptReplaceSm(ReplaceSm replaceSm, SMPPServerSession source)
|
||||
throws ProcessRequestException {
|
||||
}
|
||||
public void onAcceptReplaceSm(ReplaceSm replaceSm, SMPPServerSession source)
|
||||
throws ProcessRequestException {
|
||||
}
|
||||
|
||||
private static class WaitBindTask implements Runnable {
|
||||
private final SMPPServerSession serverSession;
|
||||
private final String systemId;
|
||||
private final String password;
|
||||
private final Map<SMPPServerSession,String> connectionSessionMap;
|
||||
private static class WaitBindTask implements Runnable {
|
||||
private final SMPPServerSession serverSession;
|
||||
private final String systemId;
|
||||
private final String password;
|
||||
private final Map<SMPPServerSession,String> connectionSessionMap;
|
||||
|
||||
public WaitBindTask(SMPPServerSession serverSession, String systemId, String password,
|
||||
Map<SMPPServerSession,String> connectionSessionMap) {
|
||||
this.serverSession = serverSession;
|
||||
this.systemId = systemId;
|
||||
this.password = password;
|
||||
this.connectionSessionMap = connectionSessionMap;
|
||||
}
|
||||
public WaitBindTask(SMPPServerSession serverSession, String systemId, String password,
|
||||
Map<SMPPServerSession,String> connectionSessionMap) {
|
||||
this.serverSession = serverSession;
|
||||
this.systemId = systemId;
|
||||
this.password = password;
|
||||
this.connectionSessionMap = connectionSessionMap;
|
||||
}
|
||||
|
||||
private void registerBindRequest(BindRequest bindRequest) {
|
||||
final String range = bindRequest.getAddressRange() == null ? "" : bindRequest.getAddressRange();
|
||||
connectionSessionMap.put(serverSession, range);
|
||||
logger.debug("Register bind session {} on address range {}", serverSession.getSessionId(), range);
|
||||
}
|
||||
private void registerBindRequest(BindRequest bindRequest) {
|
||||
final String range = bindRequest.getAddressRange() == null ? "" : bindRequest.getAddressRange();
|
||||
connectionSessionMap.put(serverSession, range);
|
||||
logger.debug("Register bind session {} on address range {}", serverSession.getSessionId(), range);
|
||||
}
|
||||
|
||||
public void run() {
|
||||
try {
|
||||
BindRequest bindRequest = serverSession.waitForBind(1000);
|
||||
try {
|
||||
if(bindRequest.getSystemId().equals(systemId) && bindRequest.getPassword().equals(password)) {
|
||||
bindRequest.accept(systemId);
|
||||
registerBindRequest(bindRequest);
|
||||
} else {
|
||||
logger.error("Invalid systemId/password");
|
||||
bindRequest.reject(SMPPConstant.STAT_ESME_RINVPASWD);
|
||||
}
|
||||
} catch (PDUStringException e) {
|
||||
logger.error("Invalid system id", e);
|
||||
bindRequest.reject(SMPPConstant.STAT_ESME_RSYSERR);
|
||||
}
|
||||
public void run() {
|
||||
try {
|
||||
BindRequest bindRequest = serverSession.waitForBind(1000);
|
||||
try {
|
||||
if(bindRequest.getSystemId().equals(systemId) && bindRequest.getPassword().equals(password)) {
|
||||
bindRequest.accept(systemId);
|
||||
registerBindRequest(bindRequest);
|
||||
}
|
||||
else {
|
||||
logger.error("Invalid systemId/password");
|
||||
bindRequest.reject(SMPPConstant.STAT_ESME_RINVPASWD);
|
||||
}
|
||||
}
|
||||
catch (PDUStringException e) {
|
||||
logger.error("Invalid system id", e);
|
||||
bindRequest.reject(SMPPConstant.STAT_ESME_RSYSERR);
|
||||
}
|
||||
|
||||
} catch (IllegalStateException e) {
|
||||
logger.error("System error", e);
|
||||
} catch (TimeoutException e) {
|
||||
logger.warn("Wait for bind has reach timeout", e);
|
||||
} catch (IOException e) {
|
||||
logger.error("Failed accepting bind request for session {}", serverSession.getSessionId());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (IllegalStateException e) {
|
||||
logger.error("System error", e);
|
||||
}
|
||||
catch (TimeoutException e) {
|
||||
logger.warn("Wait for bind has reach timeout", e);
|
||||
}
|
||||
catch (IOException e) {
|
||||
logger.error("Failed accepting bind request for session {}", serverSession.getSessionId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class DeliveryReceiptTask implements Runnable {
|
||||
private final SMPPServerSession session;
|
||||
private final MessageId messageId;
|
||||
private static class DeliveryReceiptTask implements Runnable {
|
||||
private final SMPPServerSession session;
|
||||
private final MessageId messageId;
|
||||
|
||||
private final TypeOfNumber sourceAddrTon;
|
||||
private final NumberingPlanIndicator sourceAddrNpi;
|
||||
private final String sourceAddress;
|
||||
private final TypeOfNumber sourceAddrTon;
|
||||
private final NumberingPlanIndicator sourceAddrNpi;
|
||||
private final String sourceAddress;
|
||||
|
||||
private final TypeOfNumber destAddrTon;
|
||||
private final NumberingPlanIndicator destAddrNpi;
|
||||
private final String destAddress;
|
||||
private final TypeOfNumber destAddrTon;
|
||||
private final NumberingPlanIndicator destAddrNpi;
|
||||
private final String destAddress;
|
||||
|
||||
private final int totalSubmitted;
|
||||
private final int totalDelivered;
|
||||
private final int totalSubmitted;
|
||||
private final int totalDelivered;
|
||||
|
||||
private final byte[] shortMessage;
|
||||
private final byte[] shortMessage;
|
||||
|
||||
public DeliveryReceiptTask(SMPPServerSession session,
|
||||
SubmitSm submitSm, MessageId messageId) {
|
||||
this.session = session;
|
||||
this.messageId = messageId;
|
||||
public DeliveryReceiptTask(SMPPServerSession session,
|
||||
SubmitSm submitSm, MessageId messageId) {
|
||||
this.session = session;
|
||||
this.messageId = messageId;
|
||||
|
||||
// reversing destination to source
|
||||
sourceAddrTon = TypeOfNumber.valueOf(submitSm.getDestAddrTon());
|
||||
sourceAddrNpi = NumberingPlanIndicator.valueOf(submitSm.getDestAddrNpi());
|
||||
sourceAddress = submitSm.getDestAddress();
|
||||
// reversing destination to source
|
||||
sourceAddrTon = TypeOfNumber.valueOf(submitSm.getDestAddrTon());
|
||||
sourceAddrNpi = NumberingPlanIndicator.valueOf(submitSm.getDestAddrNpi());
|
||||
sourceAddress = submitSm.getDestAddress();
|
||||
|
||||
// reversing source to destination
|
||||
destAddrTon = TypeOfNumber.valueOf(submitSm.getSourceAddrTon());
|
||||
destAddrNpi = NumberingPlanIndicator.valueOf(submitSm.getSourceAddrNpi());
|
||||
destAddress = submitSm.getSourceAddr();
|
||||
// reversing source to destination
|
||||
destAddrTon = TypeOfNumber.valueOf(submitSm.getSourceAddrTon());
|
||||
destAddrNpi = NumberingPlanIndicator.valueOf(submitSm.getSourceAddrNpi());
|
||||
destAddress = submitSm.getSourceAddr();
|
||||
|
||||
totalSubmitted = totalDelivered = 1;
|
||||
totalSubmitted = totalDelivered = 1;
|
||||
|
||||
shortMessage = submitSm.getShortMessage();
|
||||
}
|
||||
shortMessage = submitSm.getShortMessage();
|
||||
}
|
||||
|
||||
public DeliveryReceiptTask(SMPPServerSession session,
|
||||
SubmitMulti submitMulti, MessageId messageId) {
|
||||
this.session = session;
|
||||
this.messageId = messageId;
|
||||
public DeliveryReceiptTask(SMPPServerSession session,
|
||||
SubmitMulti submitMulti, MessageId messageId) {
|
||||
this.session = session;
|
||||
this.messageId = messageId;
|
||||
|
||||
// set to unknown and null, since it was submit_multi
|
||||
sourceAddrTon = TypeOfNumber.UNKNOWN;
|
||||
sourceAddrNpi = NumberingPlanIndicator.UNKNOWN;
|
||||
sourceAddress = null;
|
||||
// set to unknown and null, since it was submit_multi
|
||||
sourceAddrTon = TypeOfNumber.UNKNOWN;
|
||||
sourceAddrNpi = NumberingPlanIndicator.UNKNOWN;
|
||||
sourceAddress = null;
|
||||
|
||||
// reversing source to destination
|
||||
destAddrTon = TypeOfNumber.valueOf(submitMulti.getSourceAddrTon());
|
||||
destAddrNpi = NumberingPlanIndicator.valueOf(submitMulti.getSourceAddrNpi());
|
||||
destAddress = submitMulti.getSourceAddr();
|
||||
// reversing source to destination
|
||||
destAddrTon = TypeOfNumber.valueOf(submitMulti.getSourceAddrTon());
|
||||
destAddrNpi = NumberingPlanIndicator.valueOf(submitMulti.getSourceAddrNpi());
|
||||
destAddress = submitMulti.getSourceAddr();
|
||||
|
||||
// distribution list assumed only contains single address
|
||||
totalSubmitted = totalDelivered = submitMulti.getDestAddresses().length;
|
||||
// distribution list assumed only contains single address
|
||||
totalSubmitted = totalDelivered = submitMulti.getDestAddresses().length;
|
||||
|
||||
shortMessage = submitMulti.getShortMessage();
|
||||
}
|
||||
shortMessage = submitMulti.getShortMessage();
|
||||
}
|
||||
|
||||
public void run() {
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
SessionState state = session.getSessionState();
|
||||
if (!state.isReceivable()) {
|
||||
logger.debug("Not sending delivery receipt for message id {} since session state is {}",
|
||||
messageId, state);
|
||||
return;
|
||||
}
|
||||
String stringValue = Integer.valueOf(messageId.getValue(), 16).toString();
|
||||
try {
|
||||
public void run() {
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
SessionState state = session.getSessionState();
|
||||
if (!state.isReceivable()) {
|
||||
logger.debug("Not sending delivery receipt for message id {} since session state is {}",
|
||||
messageId, state);
|
||||
return;
|
||||
}
|
||||
String stringValue = Integer.valueOf(messageId.getValue(), 16).toString();
|
||||
try {
|
||||
|
||||
DeliveryReceipt delRec = new DeliveryReceipt(stringValue, totalSubmitted, totalDelivered, new Date(),
|
||||
new Date(), DeliveryReceiptState.DELIVRD, null, new String(shortMessage));
|
||||
session.deliverShortMessage(
|
||||
"mc",
|
||||
sourceAddrTon,
|
||||
sourceAddrNpi,
|
||||
sourceAddress,
|
||||
destAddrTon,
|
||||
destAddrNpi,
|
||||
destAddress,
|
||||
new ESMClass(MessageMode.DEFAULT, MessageType.SMSC_DEL_RECEIPT, GSMSpecificFeature.DEFAULT),
|
||||
(byte)0,
|
||||
(byte)0,
|
||||
new RegisteredDelivery(0),
|
||||
DataCodings.ZERO,
|
||||
delRec.toString().getBytes());
|
||||
logger.debug("Sending delivery receipt for message id " + messageId + ":" + stringValue);
|
||||
} catch (Exception e) {
|
||||
logger.error("Failed sending delivery_receipt for message id " + messageId + ":" + stringValue, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
DeliveryReceipt delRec = new DeliveryReceipt(stringValue, totalSubmitted, totalDelivered, new Date(),
|
||||
new Date(), DeliveryReceiptState.DELIVRD, null, new String(shortMessage));
|
||||
session.deliverShortMessage(
|
||||
"mc",
|
||||
sourceAddrTon,
|
||||
sourceAddrNpi,
|
||||
sourceAddress,
|
||||
destAddrTon,
|
||||
destAddrNpi,
|
||||
destAddress,
|
||||
new ESMClass(MessageMode.DEFAULT, MessageType.SMSC_DEL_RECEIPT, GSMSpecificFeature.DEFAULT),
|
||||
(byte)0,
|
||||
(byte)0,
|
||||
new RegisteredDelivery(0),
|
||||
DataCodings.ZERO,
|
||||
delRec.toString().getBytes());
|
||||
logger.debug("Sending delivery receipt for message id " + messageId + ":" + stringValue);
|
||||
} catch (Exception e) {
|
||||
logger.error("Failed sending delivery_receipt for message id " + messageId + ":" + stringValue, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class MessageForwardTask implements Runnable {
|
||||
private final SubmitSm submitSm;
|
||||
private final SMPPServerSession destination;
|
||||
private static class MessageForwardTask implements Runnable {
|
||||
private final SubmitSm submitSm;
|
||||
private final SMPPServerSession destination;
|
||||
|
||||
public MessageForwardTask(SubmitSm submitSm, Map<SMPPServerSession,String> connectedSessionMap) {
|
||||
this.submitSm = submitSm;
|
||||
public MessageForwardTask(SubmitSm submitSm, Map<SMPPServerSession,String> connectedSessionMap) {
|
||||
this.submitSm = submitSm;
|
||||
|
||||
// I choose possible receiver
|
||||
final List<SMPPServerSession> possibleReceivers = new ArrayList<SMPPServerSession>();
|
||||
final String destAddress = submitSm.getDestAddress();
|
||||
if (destAddress != null) {
|
||||
for (SMPPServerSession receiver : connectedSessionMap.keySet()) {
|
||||
if (receiver.getSessionState().isReceivable()) {
|
||||
// the connected session can receive and address match
|
||||
if (destAddressMatch(destAddress, connectedSessionMap.get(receiver))) {
|
||||
possibleReceivers.add(receiver);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(possibleReceivers.size() > 1)
|
||||
logger.warn("There are {} receivers for number {}. This may have unintended result in your test"
|
||||
, possibleReceivers.size(), submitSm.getDestAddress());
|
||||
this.destination = possibleReceivers.isEmpty() ? null : possibleReceivers.get(0);
|
||||
}
|
||||
// I choose possible receiver
|
||||
final List<SMPPServerSession> possibleReceivers = new ArrayList<SMPPServerSession>();
|
||||
final String destAddress = submitSm.getDestAddress();
|
||||
if (destAddress != null) {
|
||||
for (SMPPServerSession receiver : connectedSessionMap.keySet()) {
|
||||
if (receiver.getSessionState().isReceivable()) {
|
||||
// the connected session can receive and address match
|
||||
if (destAddressMatch(destAddress, connectedSessionMap.get(receiver))) {
|
||||
possibleReceivers.add(receiver);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(possibleReceivers.size() > 1)
|
||||
logger.warn("There are {} receivers for number {}. This may have unintended result in your test"
|
||||
, possibleReceivers.size(), submitSm.getDestAddress());
|
||||
this.destination = possibleReceivers.isEmpty() ? null : possibleReceivers.get(0);
|
||||
}
|
||||
|
||||
private boolean destAddressMatch(String destAddress, String receiverAddressRange) {
|
||||
if(receiverAddressRange.equals(""))
|
||||
return false; // not listening to any address
|
||||
if (destAddress.equals(receiverAddressRange))
|
||||
return true;
|
||||
String[] listeningAddressRange = receiverAddressRange.split(",");
|
||||
for (String addr : listeningAddressRange) {
|
||||
if(destAddress.equals(addr))
|
||||
return true;
|
||||
if(destAddress.matches(addr))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
private boolean destAddressMatch(String destAddress, String receiverAddressRange) {
|
||||
if(receiverAddressRange.equals(""))
|
||||
return false; // not listening to any address
|
||||
if (destAddress.equals(receiverAddressRange))
|
||||
return true;
|
||||
String[] listeningAddressRange = receiverAddressRange.split(",");
|
||||
for (String addr : listeningAddressRange) {
|
||||
if(destAddress.equals(addr))
|
||||
return true;
|
||||
if(destAddress.matches(addr))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
if (destination == null) {
|
||||
// no receiver listening for message, so nothing to do here
|
||||
return;
|
||||
}
|
||||
public void run() {
|
||||
if (destination == null) {
|
||||
// no receiver listening for message, so nothing to do here
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
final byte[] message = submitSm.getShortMessage();
|
||||
logger.debug("Forwards incoming message {} to session {}. from {} to {}",
|
||||
new String[] {new String(message), destination.getSessionId(),
|
||||
submitSm.getSourceAddr(), submitSm.getDestAddress()});
|
||||
destination.deliverShortMessage("mc",
|
||||
TypeOfNumber.valueOf(submitSm.getSourceAddrTon()),
|
||||
NumberingPlanIndicator.valueOf(submitSm.getSourceAddrNpi()),
|
||||
submitSm.getSourceAddr(),
|
||||
TypeOfNumber.valueOf(submitSm.getDestAddrTon()),
|
||||
NumberingPlanIndicator.valueOf(submitSm.getDestAddrNpi()),
|
||||
submitSm.getDestAddress(),
|
||||
new ESMClass(MessageMode.DEFAULT, MessageType.DEFAULT, GSMSpecificFeature.DEFAULT),
|
||||
(byte) 0,
|
||||
(byte) 0,
|
||||
new RegisteredDelivery(0),
|
||||
DataCodings.ZERO,
|
||||
message);
|
||||
} catch (Exception e) {
|
||||
logger.error("Fail forwarding message to consumer: " + destination.getSessionId(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
try {
|
||||
final byte[] message = submitSm.getShortMessage();
|
||||
logger.debug("Forwards incoming message {} to session {}. from {} to {}",
|
||||
new String[] {new String(message), destination.getSessionId(),
|
||||
submitSm.getSourceAddr(), submitSm.getDestAddress()});
|
||||
destination.deliverShortMessage("mc",
|
||||
TypeOfNumber.valueOf(submitSm.getSourceAddrTon()),
|
||||
NumberingPlanIndicator.valueOf(submitSm.getSourceAddrNpi()),
|
||||
submitSm.getSourceAddr(),
|
||||
TypeOfNumber.valueOf(submitSm.getDestAddrTon()),
|
||||
NumberingPlanIndicator.valueOf(submitSm.getDestAddrNpi()),
|
||||
submitSm.getDestAddress(),
|
||||
new ESMClass(MessageMode.DEFAULT, MessageType.DEFAULT, GSMSpecificFeature.DEFAULT),
|
||||
(byte) 0,
|
||||
(byte) 0,
|
||||
new RegisteredDelivery(0),
|
||||
DataCodings.ZERO,
|
||||
message);
|
||||
} catch (Exception e) {
|
||||
logger.error("Fail forwarding message to consumer: " + destination.getSessionId(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
public void onPostConstruct() {
|
||||
logger.debug("Starting mock SMPP server");
|
||||
execService.submit(this);
|
||||
}
|
||||
@PostConstruct
|
||||
public void onPostConstruct() {
|
||||
logger.debug("Starting mock SMPP server");
|
||||
execService.submit(this);
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
public void onDestroy() {
|
||||
logger.debug("Destroying mock SMPP server");
|
||||
connectionSessionMap.clear();
|
||||
}
|
||||
@PreDestroy
|
||||
public void onDestroy() {
|
||||
logger.debug("Destroying mock SMPP server");
|
||||
connectionSessionMap.clear();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
/* Copyright 2002-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.integration.smpp;
|
||||
|
||||
import org.junit.Before;
|
||||
@@ -22,55 +36,58 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
* Demonstrates that the {@link org.springframework.integration.smpp.session.SmppSessionFactoryBean} works, too.
|
||||
*
|
||||
* @author Josh Long
|
||||
* @since 2.1
|
||||
* @since 1.0
|
||||
*/
|
||||
@ContextConfiguration("classpath:TestSmppConnection-context.xml")
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
public class TestSmppConnection {
|
||||
|
||||
@Value("${smpp.systemId}")
|
||||
String destination;
|
||||
@Value("${smpp.systemId}")
|
||||
private String destination;
|
||||
|
||||
@Autowired SubscribableChannel inboundChannel;
|
||||
@Autowired MessageChannel outboundChannel;
|
||||
@Autowired SubscribableChannel receiptChannel;
|
||||
@Autowired
|
||||
private SubscribableChannel inboundChannel;
|
||||
|
||||
Message<String> messageOut;
|
||||
@Autowired
|
||||
private MessageChannel outboundChannel;
|
||||
|
||||
AtomicInteger count = new AtomicInteger();
|
||||
@Autowired
|
||||
private SubscribableChannel receiptChannel;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
messageOut = MessageBuilder.withPayload("This is the message")
|
||||
.setHeader(SmppConstants.DST_ADDR, destination)
|
||||
.setHeader(SmppConstants.SRC_ADDR, destination)
|
||||
.build();
|
||||
}
|
||||
private Message<String> messageOut;
|
||||
|
||||
private AtomicInteger count = new AtomicInteger();
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
messageOut = MessageBuilder.withPayload("This is the message")
|
||||
.setHeader(SmppConstants.DST_ADDR, destination)
|
||||
.setHeader(SmppConstants.SRC_ADDR, destination)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSmppConnection() throws Throwable {
|
||||
MessageHandler standardInboundHandler = new MessageHandler() {
|
||||
@Override
|
||||
public void handleMessage(Message<?> message) throws MessagingException {
|
||||
System.out.println("Standard Inbound channel receive: " + message);
|
||||
count.incrementAndGet();
|
||||
}
|
||||
};
|
||||
MessageHandler receiptHandler = new MessageHandler() {
|
||||
@Override
|
||||
public void handleMessage(Message<?> message) throws MessagingException {
|
||||
String received = message.getPayload().toString();
|
||||
System.out.println("Outbound channel output receive receipt: " + received);
|
||||
}
|
||||
};
|
||||
inboundChannel.subscribe(standardInboundHandler);
|
||||
receiptChannel.subscribe(receiptHandler);
|
||||
MessageHandler standardInboundHandler = new MessageHandler() {
|
||||
@Override
|
||||
public void handleMessage(Message<?> message) throws MessagingException {
|
||||
System.out.println("Standard Inbound channel receive: " + message);
|
||||
count.incrementAndGet();
|
||||
}
|
||||
};
|
||||
MessageHandler receiptHandler = new MessageHandler() {
|
||||
@Override
|
||||
public void handleMessage(Message<?> message) throws MessagingException {
|
||||
String received = message.getPayload().toString();
|
||||
System.out.println("Outbound channel output receive receipt: " + received);
|
||||
}
|
||||
};
|
||||
inboundChannel.subscribe(standardInboundHandler);
|
||||
receiptChannel.subscribe(receiptHandler);
|
||||
|
||||
outboundChannel.send(messageOut);
|
||||
outboundChannel.send(messageOut);
|
||||
|
||||
Thread.sleep(5000);
|
||||
Thread.sleep(5000);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,21 @@
|
||||
/* Copyright 2002-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.integration.smpp;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import org.jsmpp.bean.SMSCDeliveryReceipt;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
@@ -19,23 +33,22 @@ import org.springframework.integration.support.MessageBuilder;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
@ContextConfiguration("classpath:TestSmppInboundChannelAdapter-context.xml")
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
public class TestSmppInboundChannelAdapter {
|
||||
|
||||
private String smsMessageToSend = "test SMPP message being sent from this time:"+ System.currentTimeMillis()+".";
|
||||
|
||||
@Value("${test.dst.number}") String number;
|
||||
|
||||
private Log log = LogFactory.getLog(getClass());
|
||||
@Value("${test.dst.number}")
|
||||
private String number;
|
||||
|
||||
private AtomicInteger atomicInteger = new AtomicInteger();
|
||||
|
||||
@Value("#{outbound}") SubscribableChannel out;
|
||||
@Value("#{outbound}")
|
||||
private SubscribableChannel out;
|
||||
|
||||
@Value("#{inbound}") SubscribableChannel in;
|
||||
@Value("#{inbound}")
|
||||
private SubscribableChannel in;
|
||||
|
||||
@Autowired
|
||||
private ApplicationContext context;
|
||||
@@ -45,7 +58,7 @@ public class TestSmppInboundChannelAdapter {
|
||||
Assert.assertNotNull(this.number);
|
||||
}
|
||||
|
||||
String lastReceivedSms = null ;
|
||||
private String lastReceivedSms = null ;
|
||||
|
||||
@Test
|
||||
public void testReceiving() throws Throwable {
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
/* Copyright 2002-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.integration.smpp;
|
||||
|
||||
import org.junit.Assert;
|
||||
@@ -24,7 +38,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
public class TestSmppInboundGateway {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(TestSmppInboundGateway.class);
|
||||
private final Logger logger = LoggerFactory.getLogger(TestSmppInboundGateway.class);
|
||||
|
||||
@Value("#{out1}") SubscribableChannel out1;
|
||||
@Value("#{out2}") SubscribableChannel out2;
|
||||
@@ -68,39 +82,39 @@ public class TestSmppInboundGateway {
|
||||
|
||||
|
||||
MessageHandler inboundMessageHandler = new AbstractReplyProducingMessageHandler() {
|
||||
@Override
|
||||
protected Object handleRequestMessage(Message<?> requestMessage) {
|
||||
logger.debug("Processing incoming message for inbound-gw and produce a reply");
|
||||
Assert.assertEquals(requestMessage.getPayload(), smsRequest);
|
||||
count.incrementAndGet();
|
||||
return MessageBuilder.withPayload(
|
||||
smsResponse).copyHeadersIfAbsent( requestMessage.getHeaders()).build();
|
||||
@Override
|
||||
protected Object handleRequestMessage(Message<?> requestMessage) {
|
||||
logger.debug("Processing incoming message for inbound-gw and produce a reply");
|
||||
Assert.assertEquals(requestMessage.getPayload(), smsRequest);
|
||||
count.incrementAndGet();
|
||||
return MessageBuilder.withPayload(
|
||||
smsResponse).copyHeadersIfAbsent( requestMessage.getHeaders()).build();
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
this.in1.subscribe(inboundMessageHandler);
|
||||
|
||||
// this is handler for reply from inbound-gateway
|
||||
MessageHandler replyHandler = new MessageHandler() {
|
||||
@Override
|
||||
public void handleMessage(Message<?> message) throws MessagingException {
|
||||
logger.debug("Reply handler receives: "+message.getPayload());
|
||||
Assert.assertEquals(message.getPayload(), smsResponse);
|
||||
}
|
||||
};
|
||||
this.in2.subscribe(replyHandler);
|
||||
// this is handler for reply from inbound-gateway
|
||||
MessageHandler replyHandler = new MessageHandler() {
|
||||
@Override
|
||||
public void handleMessage(Message<?> message) throws MessagingException {
|
||||
logger.debug("Reply handler receives: "+message.getPayload());
|
||||
Assert.assertEquals(message.getPayload(), smsResponse);
|
||||
}
|
||||
};
|
||||
this.in2.subscribe(replyHandler);
|
||||
|
||||
// outbound gateway send
|
||||
logger.debug("Sending message from: {} to: {} message: '{}'", new String[] {fromPhone, toPhone, smsRequest});
|
||||
SmesMessageSpecification.newSmesMessageSpecification(outSession, this.fromPhone, this.toPhone, this.smsRequest).send();
|
||||
/*Message<String> smsMsg = MessageBuilder.withPayload(smsRequest)
|
||||
.setHeader(SmppConstants.SRC_ADDR, fromPhone)
|
||||
.setHeader(SmppConstants.DST_ADDR, toPhone)
|
||||
.setHeader(SmppConstants.REGISTERED_DELIVERY_MODE, SMSCDeliveryReceipt.SUCCESS)
|
||||
.build();
|
||||
out2.send(smsMsg);*/
|
||||
// outbound gateway send
|
||||
logger.debug("Sending message from: {} to: {} message: '{}'", new String[] {fromPhone, toPhone, smsRequest});
|
||||
SmesMessageSpecification.newSmesMessageSpecification(outSession, this.fromPhone, this.toPhone, this.smsRequest).send();
|
||||
/*Message<String> smsMsg = MessageBuilder.withPayload(smsRequest)
|
||||
.setHeader(SmppConstants.SRC_ADDR, fromPhone)
|
||||
.setHeader(SmppConstants.DST_ADDR, toPhone)
|
||||
.setHeader(SmppConstants.REGISTERED_DELIVERY_MODE, SMSCDeliveryReceipt.SUCCESS)
|
||||
.build();
|
||||
out2.send(smsMsg);*/
|
||||
|
||||
Thread.sleep(1000 * 10);
|
||||
Thread.sleep(1000 * 10);
|
||||
|
||||
Assert.assertEquals(this.count.intValue(),1);
|
||||
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
/* Copyright 2002-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.integration.smpp;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
@@ -19,13 +33,12 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
* exercises the outbound adapter.
|
||||
*
|
||||
* @author Josh Long
|
||||
* @since 2.1
|
||||
* @since 1.0
|
||||
*/
|
||||
@ContextConfiguration("classpath:TestSmppOutboundChannelAdapter-context.xml")
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
public class TestSmppOutboundChannelAdapter {
|
||||
|
||||
|
||||
private Log log = LogFactory.getLog(getClass());
|
||||
|
||||
@Value("#{session}")
|
||||
@@ -37,11 +50,9 @@ public class TestSmppOutboundChannelAdapter {
|
||||
private String smsMessageToSend = "jSMPP is truly a convenient, and powerful API for SMPP " +
|
||||
"on the Java and Spring Integration platforms (sent " + System.currentTimeMillis() + ")";
|
||||
|
||||
|
||||
@Before
|
||||
public void start (){
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
/* Copyright 2002-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.integration.smpp;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
@@ -16,13 +30,13 @@ import org.springframework.integration.support.MessageBuilder;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
/***
|
||||
/**
|
||||
* Simple tests for the gateway which differs from the outbound adapter only in that it supports
|
||||
* sending the message ID back
|
||||
*
|
||||
*
|
||||
* @author Josh Long
|
||||
* @since 2.1
|
||||
* @since 1.0
|
||||
*/
|
||||
@ContextConfiguration("classpath:TestSmppOutboundGateway-context.xml")
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
|
||||
@@ -1,5 +1,22 @@
|
||||
/* Copyright 2002-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.integration.smpp;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.jsmpp.bean.AlertNotification;
|
||||
@@ -11,8 +28,8 @@ import org.jsmpp.session.DataSmResult;
|
||||
import org.jsmpp.session.MessageReceiverListener;
|
||||
import org.jsmpp.session.SMPPSession;
|
||||
import org.jsmpp.session.Session;
|
||||
import org.jsmpp.util.AbsoluteTimeFormatter;
|
||||
import org.junit.*;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
@@ -21,23 +38,22 @@ import org.springframework.integration.smpp.session.DelegatingMessageReceiverLis
|
||||
import org.springframework.integration.smpp.session.ExtendedSmppSession;
|
||||
import org.springframework.integration.smpp.session.ExtendedSmppSessionAdaptingDelegate;
|
||||
import org.springframework.integration.smpp.session.SmppSessionFactoryBean;
|
||||
import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Simple test, more of the SMPP API than anything, at the moment.
|
||||
* <p/>
|
||||
* Demonstrates that the {@link org.springframework.integration.smpp.session.SmppSessionFactoryBean} works, too.
|
||||
*
|
||||
* @author Josh Long
|
||||
* @since 2.1
|
||||
* @since 1.0
|
||||
*/
|
||||
@ContextConfiguration("classpath:TestSmppSessionFactoryBean-context.xml")
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@DirtiesContext
|
||||
public class TestSmppSessionFactoryBean {
|
||||
|
||||
private Log logger = LogFactory.getLog(getClass());
|
||||
@@ -46,18 +62,16 @@ public class TestSmppSessionFactoryBean {
|
||||
@Qualifier("session")
|
||||
private ExtendedSmppSessionAdaptingDelegate smppSession;
|
||||
|
||||
private AbsoluteTimeFormatter timeFormatter = new AbsoluteTimeFormatter();
|
||||
|
||||
@Value("${smpp.host}")
|
||||
@Value("${smpp.host}")
|
||||
private String host;
|
||||
|
||||
@Value("${smpp.port}")
|
||||
@Value("#{smppPort}")
|
||||
private int port;
|
||||
|
||||
@Value("${smpp.systemId}")
|
||||
@Value("${smpp.systemId}")
|
||||
private String systemId;
|
||||
|
||||
@Value("${smpp.password}")
|
||||
@Value("${smpp.password}")
|
||||
private String password;
|
||||
|
||||
@Test
|
||||
@@ -128,6 +142,6 @@ public class TestSmppSessionFactoryBean {
|
||||
|
||||
BindType bindType = smppSession.getBindType();
|
||||
|
||||
Assert.assertNotNull("the bind type should not be null", bindType);
|
||||
Assert.assertNotNull("the bind type should not be null", bindType);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
/* Copyright 2002-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.integration.smpp.config.xml;
|
||||
|
||||
import org.jsmpp.bean.BindType;
|
||||
@@ -10,21 +24,21 @@ import static org.easymock.EasyMock.replay;
|
||||
/**
|
||||
* Mock smpp session factory for testing.
|
||||
* @author Johanes Soetanto
|
||||
* @since 2.2
|
||||
* @since 1.0
|
||||
*/
|
||||
public class MockSmppSessionFactory {
|
||||
|
||||
public static ExtendedSmppSession getOutSmppSession() {
|
||||
ExtendedSmppSession mock = createNiceMock(ExtendedSmppSession.class);
|
||||
expect(mock.getBindType()).andReturn(BindType.BIND_TX).anyTimes();
|
||||
replay(mock);
|
||||
return mock;
|
||||
}
|
||||
public static ExtendedSmppSession getOutSmppSession() {
|
||||
ExtendedSmppSession mock = createNiceMock(ExtendedSmppSession.class);
|
||||
expect(mock.getBindType()).andReturn(BindType.BIND_TX).anyTimes();
|
||||
replay(mock);
|
||||
return mock;
|
||||
}
|
||||
|
||||
public static ExtendedSmppSession getInSmppSession() {
|
||||
ExtendedSmppSession mock = createNiceMock(ExtendedSmppSession.class);
|
||||
expect(mock.getBindType()).andReturn(BindType.BIND_RX).anyTimes();
|
||||
replay(mock);
|
||||
return mock;
|
||||
}
|
||||
public static ExtendedSmppSession getInSmppSession() {
|
||||
ExtendedSmppSession mock = createNiceMock(ExtendedSmppSession.class);
|
||||
expect(mock.getBindType()).andReturn(BindType.BIND_RX).anyTimes();
|
||||
replay(mock);
|
||||
return mock;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
uytea * Copyright 2002-2012 the original author or authors.
|
||||
uytea * Copyright 2002-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
@@ -27,7 +27,7 @@ import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* @author Johanes Soetanto
|
||||
* @since 2.2
|
||||
* @since 1.0
|
||||
*
|
||||
*/
|
||||
public class SmppInboundChannelAdapterParserTests {
|
||||
@@ -45,10 +45,10 @@ public class SmppInboundChannelAdapterParserTests {
|
||||
assertEquals("out", outputChannel.getComponentName());
|
||||
|
||||
ExtendedSmppSession session = TestUtils.getPropertyValue(consumer, "smppSession", ExtendedSmppSession.class);
|
||||
assertNotNull(session);
|
||||
assertNotNull(session);
|
||||
|
||||
boolean autoStartup = TestUtils.getPropertyValue(consumer, "autoStartup" , Boolean.class);
|
||||
assertTrue(autoStartup);
|
||||
boolean autoStartup = TestUtils.getPropertyValue(consumer, "autoStartup" , Boolean.class);
|
||||
assertTrue(autoStartup);
|
||||
}
|
||||
|
||||
@After
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
@@ -30,7 +30,7 @@ import static org.junit.Assert.assertNotNull;
|
||||
|
||||
/**
|
||||
* @author Johanes Soetanto
|
||||
* @since 2.2
|
||||
* @since 1.0
|
||||
*
|
||||
*/
|
||||
public class SmppInboundGatewayParserTests {
|
||||
@@ -43,42 +43,40 @@ public class SmppInboundGatewayParserTests {
|
||||
public void testRetrievingInboundGatewayParser() throws Exception {
|
||||
setUp("SmppInboundGatewayParserTests.xml", getClass(), "smppInboundGateway");
|
||||
|
||||
// reply timeout
|
||||
// reply timeout
|
||||
long requestTimeout = TestUtils.getPropertyValue(gateway, "messagingTemplate.sendTimeout", Long.class);
|
||||
assertEquals(10000, requestTimeout);
|
||||
|
||||
// request timeout
|
||||
long replyTimeout = TestUtils.getPropertyValue(gateway, "messagingTemplate.receiveTimeout", Long.class);
|
||||
assertEquals(5000, replyTimeout);
|
||||
// request timeout
|
||||
long replyTimeout = TestUtils.getPropertyValue(gateway, "messagingTemplate.receiveTimeout", Long.class);
|
||||
assertEquals(5000, replyTimeout);
|
||||
|
||||
ExtendedSmppSession session = TestUtils.getPropertyValue(gateway, "smppSession", ExtendedSmppSession.class);
|
||||
assertNotNull(session);
|
||||
System.out.println("Session: "+session);
|
||||
ExtendedSmppSession session = TestUtils.getPropertyValue(gateway, "smppSession", ExtendedSmppSession.class);
|
||||
assertNotNull(session);
|
||||
System.out.println("Session: "+session);
|
||||
|
||||
TypeOfNumber ton = TestUtils.getPropertyValue(gateway, "defaultSourceAddressTypeOfNumber", TypeOfNumber.class);
|
||||
assertEquals(ton, TypeOfNumber.INTERNATIONAL);
|
||||
TypeOfNumber ton = TestUtils.getPropertyValue(gateway, "defaultSourceAddressTypeOfNumber", TypeOfNumber.class);
|
||||
assertEquals(ton, TypeOfNumber.INTERNATIONAL);
|
||||
|
||||
String sourceAddress = TestUtils.getPropertyValue(gateway, "defaultSourceAddress", String.class);
|
||||
assertEquals("123456789", sourceAddress);
|
||||
String sourceAddress = TestUtils.getPropertyValue(gateway, "defaultSourceAddress", String.class);
|
||||
assertEquals("123456789", sourceAddress);
|
||||
|
||||
// channels
|
||||
AbstractMessageChannel requestChannel = TestUtils.getPropertyValue(gateway, "requestChannel", AbstractMessageChannel.class);
|
||||
assertEquals("requestChannel", requestChannel.getComponentName());
|
||||
AbstractMessageChannel outputChannel = TestUtils.getPropertyValue(gateway, "replyChannel", AbstractMessageChannel.class);
|
||||
assertEquals("replyChannel", outputChannel.getComponentName());
|
||||
AbstractMessageChannel errorChannel = TestUtils.getPropertyValue(gateway, "errorChannel", AbstractMessageChannel.class);
|
||||
assertEquals("errorChannel", errorChannel.getComponentName());
|
||||
// channels
|
||||
AbstractMessageChannel requestChannel = TestUtils.getPropertyValue(gateway, "requestChannel", AbstractMessageChannel.class);
|
||||
assertEquals("requestChannel", requestChannel.getComponentName());
|
||||
AbstractMessageChannel outputChannel = TestUtils.getPropertyValue(gateway, "replyChannel", AbstractMessageChannel.class);
|
||||
assertEquals("replyChannel", outputChannel.getComponentName());
|
||||
AbstractMessageChannel errorChannel = TestUtils.getPropertyValue(gateway, "errorChannel", AbstractMessageChannel.class);
|
||||
assertEquals("errorChannel", errorChannel.getComponentName());
|
||||
|
||||
// mappers
|
||||
InboundMessageMapper<?> inboundMessageMapper = TestUtils.getPropertyValue(gateway, "requestMapper", InboundMessageMapper.class);
|
||||
assertNotNull(inboundMessageMapper);
|
||||
OutboundMessageMapper<?> outboundMessageMapper = TestUtils.getPropertyValue(gateway, "messageConverter.outboundMessageMapper", OutboundMessageMapper.class);
|
||||
assertNotNull(outboundMessageMapper);
|
||||
// mappers
|
||||
InboundMessageMapper<?> inboundMessageMapper = TestUtils.getPropertyValue(gateway, "requestMapper", InboundMessageMapper.class);
|
||||
assertNotNull(inboundMessageMapper);
|
||||
OutboundMessageMapper<?> outboundMessageMapper = TestUtils.getPropertyValue(gateway, "messageConverter.outboundMessageMapper", OutboundMessageMapper.class);
|
||||
assertNotNull(outboundMessageMapper);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
if (context != null) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
@@ -35,7 +35,7 @@ import static org.junit.Assert.assertNotNull;
|
||||
/**
|
||||
*
|
||||
* @author Johanes Soetanto
|
||||
* @since 2.2
|
||||
* @since 1.0
|
||||
*
|
||||
*/
|
||||
public class SmppOutboundChannelAdapterParserTests {
|
||||
@@ -52,29 +52,29 @@ public class SmppOutboundChannelAdapterParserTests {
|
||||
final AbstractMessageChannel inputChannel = TestUtils.getPropertyValue(this.consumer, "inputChannel", AbstractMessageChannel.class);
|
||||
assertEquals("target", inputChannel.getComponentName());
|
||||
|
||||
final SmppOutboundChannelAdapter gateway = TestUtils.getPropertyValue(this.consumer, "handler", SmppOutboundChannelAdapter.class);
|
||||
final SmppOutboundChannelAdapter gateway = TestUtils.getPropertyValue(this.consumer, "handler", SmppOutboundChannelAdapter.class);
|
||||
|
||||
ExtendedSmppSession session = TestUtils.getPropertyValue(gateway, "smppSession", ExtendedSmppSession.class);
|
||||
assertNotNull(session);
|
||||
ExtendedSmppSession session = TestUtils.getPropertyValue(gateway, "smppSession", ExtendedSmppSession.class);
|
||||
assertNotNull(session);
|
||||
|
||||
TypeOfNumber ton = TestUtils.getPropertyValue(gateway, "defaultSourceAddressTypeOfNumber", TypeOfNumber.class);
|
||||
assertEquals(ton, TypeOfNumber.SUBSCRIBER_NUMBER);
|
||||
TypeOfNumber ton = TestUtils.getPropertyValue(gateway, "defaultSourceAddressTypeOfNumber", TypeOfNumber.class);
|
||||
assertEquals(ton, TypeOfNumber.SUBSCRIBER_NUMBER);
|
||||
|
||||
String sourceAddress = TestUtils.getPropertyValue(gateway, "defaultSourceAddress", String.class);
|
||||
assertEquals("12345", sourceAddress);
|
||||
String sourceAddress = TestUtils.getPropertyValue(gateway, "defaultSourceAddress", String.class);
|
||||
assertEquals("12345", sourceAddress);
|
||||
|
||||
// this is not set, should be default value
|
||||
TimeFormatter timeFormatter = TestUtils.getPropertyValue(gateway, "timeFormatter", TimeFormatter.class);
|
||||
assertNotNull(timeFormatter);
|
||||
// this is not set, should be default value
|
||||
TimeFormatter timeFormatter = TestUtils.getPropertyValue(gateway, "timeFormatter", TimeFormatter.class);
|
||||
assertNotNull(timeFormatter);
|
||||
|
||||
// I send message
|
||||
Message<String> message = MessageBuilder.withPayload("Yuhuu !!! i am connected using Spring Integration namespace")
|
||||
.setHeader(SmppConstants.SRC_ADDR, "pavel")
|
||||
.setHeader(SmppConstants.DST_ADDR, "pavel")
|
||||
.build();
|
||||
// I send message
|
||||
Message<String> message = MessageBuilder.withPayload("Yuhuu !!! i am connected using Spring Integration namespace")
|
||||
.setHeader(SmppConstants.SRC_ADDR, "pavel")
|
||||
.setHeader(SmppConstants.DST_ADDR, "pavel")
|
||||
.build();
|
||||
|
||||
MessagingTemplate template = context.getBean("messagingTemplate", MessagingTemplate.class);
|
||||
template.send("target", message);
|
||||
MessagingTemplate template = context.getBean("messagingTemplate", MessagingTemplate.class);
|
||||
template.send("target", message);
|
||||
}
|
||||
|
||||
@After
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
@@ -30,7 +30,7 @@ import static org.junit.Assert.assertNotNull;
|
||||
|
||||
/**
|
||||
* @author Johanes Soetanto
|
||||
* @since 2.2
|
||||
* @since 1.0
|
||||
*
|
||||
*/
|
||||
public class SmppOutboundGatewayParserTests {
|
||||
@@ -52,28 +52,26 @@ public class SmppOutboundGatewayParserTests {
|
||||
long sendTimeout = TestUtils.getPropertyValue(gateway, "messagingTemplate.sendTimeout", Long.class);
|
||||
assertEquals(100, sendTimeout);
|
||||
|
||||
ExtendedSmppSession session = TestUtils.getPropertyValue(gateway, "smppSession", ExtendedSmppSession.class);
|
||||
assertNotNull(session);
|
||||
ExtendedSmppSession session = TestUtils.getPropertyValue(gateway, "smppSession", ExtendedSmppSession.class);
|
||||
assertNotNull(session);
|
||||
|
||||
TypeOfNumber ton = TestUtils.getPropertyValue(gateway, "defaultSourceAddressTypeOfNumber", TypeOfNumber.class);
|
||||
assertEquals(ton, TypeOfNumber.NETWORK_SPECIFIC);
|
||||
TypeOfNumber ton = TestUtils.getPropertyValue(gateway, "defaultSourceAddressTypeOfNumber", TypeOfNumber.class);
|
||||
assertEquals(ton, TypeOfNumber.NETWORK_SPECIFIC);
|
||||
|
||||
String sourceAddress = TestUtils.getPropertyValue(gateway, "defaultSourceAddress", String.class);
|
||||
assertEquals("123456789", sourceAddress);
|
||||
String sourceAddress = TestUtils.getPropertyValue(gateway, "defaultSourceAddress", String.class);
|
||||
assertEquals("123456789", sourceAddress);
|
||||
|
||||
int order = TestUtils.getPropertyValue(gateway, "order", Integer.class);
|
||||
assertEquals(17, order);
|
||||
int order = TestUtils.getPropertyValue(gateway, "order", Integer.class);
|
||||
assertEquals(17, order);
|
||||
|
||||
AbstractMessageChannel outputChannel = TestUtils.getPropertyValue(gateway, "outputChannel", AbstractMessageChannel.class);
|
||||
assertEquals("out", outputChannel.getComponentName());
|
||||
AbstractMessageChannel outputChannel = TestUtils.getPropertyValue(gateway, "outputChannel", AbstractMessageChannel.class);
|
||||
assertEquals("out", outputChannel.getComponentName());
|
||||
|
||||
// this is not set, should be default value
|
||||
TimeFormatter timeFormatter = TestUtils.getPropertyValue(gateway, "timeFormatter", TimeFormatter.class);
|
||||
assertNotNull(timeFormatter);
|
||||
// this is not set, should be default value
|
||||
TimeFormatter timeFormatter = TestUtils.getPropertyValue(gateway, "timeFormatter", TimeFormatter.class);
|
||||
assertNotNull(timeFormatter);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
if (context != null) {
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
/* Copyright 2002-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.integration.smpp.util;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
@@ -8,7 +22,7 @@ import org.springframework.aop.framework.ProxyFactoryBean;
|
||||
|
||||
/**
|
||||
* @author Josh Long
|
||||
* @since 2.1
|
||||
* @since 1.0
|
||||
*/
|
||||
public class TestCurrentExecutingMethodAdvice {
|
||||
static String currentMethodName() {
|
||||
@@ -19,11 +33,11 @@ public class TestCurrentExecutingMethodAdvice {
|
||||
public TestClassWithAMethod() {
|
||||
}
|
||||
|
||||
private Log l = LogFactory.getLog(getClass());
|
||||
private Log log = LogFactory.getLog(getClass());
|
||||
|
||||
public void testMe() throws Throwable {
|
||||
Assert.assertEquals("testMe", currentMethodName());
|
||||
l.debug("The currently executing method name is " + currentMethodName());
|
||||
log.debug("The currently executing method name is " + currentMethodName());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,51 +1,54 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
|
||||
xmlns:integration="http://www.springframework.org/schema/integration"
|
||||
xmlns:smpp="http://www.springframework.org/schema/integration/smpp"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xmlns:int="http://www.springframework.org/schema/integration"
|
||||
xmlns:int-smpp="http://www.springframework.org/schema/integration/smpp"
|
||||
xsi:schemaLocation="
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
|
||||
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
|
||||
http://www.springframework.org/schema/integration/smpp http://www.springframework.org/schema/integration/smpp/spring-integration-smpp.xsd">
|
||||
|
||||
<context:property-placeholder location="smpp.properties" />
|
||||
<import resource="classpath:smppConnection-context.xml"/>
|
||||
|
||||
<bean id="mockSmppServer" class="org.springframework.integration.smpp.MockSmppServer">
|
||||
<constructor-arg value="${smpp.port}"/>
|
||||
<constructor-arg value="${smpp.systemId}"/>
|
||||
<constructor-arg value="${smpp.password}"/>
|
||||
</bean>
|
||||
<int:channel id="inboundChannel" />
|
||||
<int:channel id="outboundChannel" />
|
||||
<int:channel id="receiptChannel" />
|
||||
|
||||
<integration:channel id="inboundChannel" />
|
||||
<integration:channel id="outboundChannel" />
|
||||
<integration:channel id="receiptChannel" />
|
||||
|
||||
<bean id="session"
|
||||
class="org.springframework.integration.smpp.session.SmppSessionFactoryBean">
|
||||
<!-- <bean id="session" class="org.springframework.integration.smpp.session.SmppSessionFactoryBean">
|
||||
<property name="host" value="${smpp.host}" />
|
||||
<property name="port" value="${smpp.port}" />
|
||||
<property name="port" ref="smppPort" />
|
||||
<property name="password" value="${smpp.password}" />
|
||||
<property name="systemId" value="${smpp.systemId}" />
|
||||
<property name="bindType" value="BIND_RX" />
|
||||
<property name="autoStartup" value="true" />
|
||||
<property name="addressRange" value="${smpp.systemId}" />
|
||||
</bean> -->
|
||||
|
||||
<bean id="session" class="org.springframework.integration.smpp.session.SmppSessionFactoryBean">
|
||||
<property name="host" value="smpp.activexperts-labs.com" />
|
||||
<property name="port" value="2775" />
|
||||
<property name="password" value="812056" />
|
||||
<property name="systemId" value="AX005" />
|
||||
<property name="bindType" value="BIND_RX" />
|
||||
<property name="autoStartup" value="true" />
|
||||
<property name="addressRange" value="${smpp.systemId}" />
|
||||
</bean>
|
||||
|
||||
<bean id="session2"
|
||||
class="org.springframework.integration.smpp.session.SmppSessionFactoryBean">
|
||||
<bean id="session2" class="org.springframework.integration.smpp.session.SmppSessionFactoryBean">
|
||||
<property name="host" value="${smpp.host}" />
|
||||
<property name="port" value="${smpp.port}" />
|
||||
<property name="port" ref="smppPort" />
|
||||
<property name="password" value="${smpp.password}" />
|
||||
<property name="systemId" value="${smpp.systemId}" />
|
||||
<property name="bindType" value="BIND_TX" />
|
||||
<property name="autoStartup" value="true" />
|
||||
</bean>
|
||||
|
||||
<smpp:inbound-channel-adapter channel="inboundChannel"
|
||||
<int-smpp:inbound-channel-adapter channel="inboundChannel"
|
||||
smpp-session-ref="session" />
|
||||
|
||||
<smpp:outbound-gateway request-channel="outboundChannel"
|
||||
<int-smpp:outbound-gateway request-channel="outboundChannel"
|
||||
reply-channel="receiptChannel" smpp-session-ref="session2" />
|
||||
|
||||
</beans>
|
||||
|
||||
@@ -8,22 +8,12 @@
|
||||
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
|
||||
|
||||
<context:property-placeholder location="smpp.properties" />
|
||||
|
||||
<bean id="mockSmppServer" class="org.springframework.integration.smpp.MockSmppServer">
|
||||
<constructor-arg value="${smpp.port}"/>
|
||||
<constructor-arg value="${smpp.systemId}"/>
|
||||
<constructor-arg value="${smpp.password}"/>
|
||||
</bean>
|
||||
|
||||
<context:annotation-config />
|
||||
<import resource="classpath:smppConnection-context.xml"/>
|
||||
|
||||
<!-- SENDS SMSs to a specific number -->
|
||||
<bean
|
||||
class="org.springframework.integration.smpp.session.SmppSessionFactoryBean"
|
||||
id="outboundSession">
|
||||
<bean id="outboundSession" class="org.springframework.integration.smpp.session.SmppSessionFactoryBean">
|
||||
<property name="host" value="${smpp.host}" />
|
||||
<property name="port" value="${smpp.port}" />
|
||||
<property name="port" ref="smppPort" />
|
||||
<property name="bindType" value="BIND_TX" />
|
||||
<property name="password" value="${smpp.password}" />
|
||||
<property name="addressRange" value="${test.dst.number}" />
|
||||
@@ -31,11 +21,10 @@
|
||||
</bean>
|
||||
|
||||
<!-- RECEIVES SMSs from a specific number -->
|
||||
<bean
|
||||
class="org.springframework.integration.smpp.session.SmppSessionFactoryBean"
|
||||
id="inboundSession">
|
||||
<bean id="inboundSession"
|
||||
class="org.springframework.integration.smpp.session.SmppSessionFactoryBean">
|
||||
<property name="host" value="${smpp.host}" />
|
||||
<property name="port" value="${smpp.port}" />
|
||||
<property name="port" ref="smppPort" />
|
||||
<property name="bindType" value="BIND_RX" />
|
||||
<property name="password" value="${smpp.password}" />
|
||||
<property name="addressRange" value="${test.dst.number}" />
|
||||
@@ -45,15 +34,12 @@
|
||||
<property name="systemId" value="${smpp.systemId}" />
|
||||
</bean>
|
||||
|
||||
<bean class="org.springframework.integration.smpp.inbound.SmppInboundChannelAdapter"
|
||||
id="smppInboundChannelAdapter">
|
||||
<bean id="smppInboundChannelAdapter" class="org.springframework.integration.smpp.inbound.SmppInboundChannelAdapter">
|
||||
<property name="smppSession" ref="inboundSession" />
|
||||
<property name="channel" ref="inbound" />
|
||||
</bean>
|
||||
|
||||
<bean
|
||||
class="org.springframework.integration.smpp.outbound.SmppOutboundChannelAdapter"
|
||||
id="smppOutboundChannelAdapter">
|
||||
<bean id="smppOutboundChannelAdapter" class="org.springframework.integration.smpp.outbound.SmppOutboundChannelAdapter">
|
||||
<property name="smppSession" ref="outboundSession" />
|
||||
</bean>
|
||||
|
||||
|
||||
@@ -1,69 +1,58 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:int="http://www.springframework.org/schema/integration"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:int="http://www.springframework.org/schema/integration"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xsi:schemaLocation="
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
|
||||
|
||||
<context:property-placeholder location="smpp.properties" />
|
||||
|
||||
<bean id="mockSmppServer" class="org.springframework.integration.smpp.MockSmppServer">
|
||||
<constructor-arg value="${smpp.port}"/>
|
||||
<constructor-arg value="${smpp.systemId}"/>
|
||||
<constructor-arg value="${smpp.password}"/>
|
||||
</bean>
|
||||
|
||||
<context:annotation-config />
|
||||
<import resource="classpath:smppConnection-context.xml"/>
|
||||
|
||||
<!-- SENDS SMSs to a specific number -->
|
||||
<bean
|
||||
class="org.springframework.integration.smpp.session.SmppSessionFactoryBean"
|
||||
id="outboundSession">
|
||||
<bean id="outboundSession"
|
||||
class="org.springframework.integration.smpp.session.SmppSessionFactoryBean">
|
||||
<property name="host" value="${smpp.host}" />
|
||||
<property name="port" value="${smpp.port}" />
|
||||
<property name="port" ref="smppPort" />
|
||||
<property name="password" value="${smpp.password}" />
|
||||
<property name="addressRange" value="1111" />
|
||||
<property name="systemId" value="${smpp.systemId}" />
|
||||
</bean>
|
||||
|
||||
<!-- RECEIVES SMSs from a specific number -->
|
||||
<bean
|
||||
class="org.springframework.integration.smpp.session.SmppSessionFactoryBean"
|
||||
id="inboundSession">
|
||||
<bean id="inboundSession"
|
||||
class="org.springframework.integration.smpp.session.SmppSessionFactoryBean">
|
||||
<property name="host" value="${smpp.host}" />
|
||||
<property name="port" value="${smpp.port}" />
|
||||
<property name="port" ref="smppPort" />
|
||||
<property name="password" value="${smpp.password}" />
|
||||
<property name="addressRange" value="33333" />
|
||||
<property name="systemId" value="${smpp.systemId}" />
|
||||
</bean>
|
||||
|
||||
<bean class="org.springframework.integration.smpp.inbound.SmppInboundGateway"
|
||||
id="inboundGateway">
|
||||
<bean id="inboundGateway" class="org.springframework.integration.smpp.inbound.SmppInboundGateway">
|
||||
<property name="smppSession" ref="inboundSession" />
|
||||
<property name="requestChannel" ref="in1" />
|
||||
<property name="replyChannel" ref="out1" />
|
||||
</bean>
|
||||
|
||||
<!-- listening for inbound traffic for the original sender for reply from inbound-gw -->
|
||||
<bean class="org.springframework.integration.smpp.inbound.SmppInboundChannelAdapter"
|
||||
id="smppInboundChannelAdapter">
|
||||
<property name="smppSession" ref="outboundSession"/>
|
||||
<property name="channel" ref="in2"/>
|
||||
</bean>
|
||||
<!-- listening for inbound traffic for the original sender for reply from
|
||||
inbound-gw -->
|
||||
<bean id="smppInboundChannelAdapter"
|
||||
class="org.springframework.integration.smpp.inbound.SmppInboundChannelAdapter">
|
||||
<property name="smppSession" ref="outboundSession" />
|
||||
<property name="channel" ref="in2" />
|
||||
</bean>
|
||||
|
||||
<!--<bean class="org.springframework.integration.smpp.outbound.SmppOutboundChannelAdapter"
|
||||
id="smppOutboundChannelAdapter">
|
||||
<property name="smppSession" ref="outboundSession"/>
|
||||
</bean>
|
||||
<int:outbound-channel-adapter ref="smppOutboundChannelAdapter" channel="out2"/>-->
|
||||
<!--<bean class="org.springframework.integration.smpp.outbound.SmppOutboundChannelAdapter"
|
||||
id="smppOutboundChannelAdapter"> <property name="smppSession" ref="outboundSession"/>
|
||||
</bean> <int:outbound-channel-adapter ref="smppOutboundChannelAdapter" channel="out2"/> -->
|
||||
|
||||
<!-- channels for internal receive and reply -->
|
||||
<!-- channels for internal receive and reply -->
|
||||
<int:channel id="out1" />
|
||||
<int:channel id="in1" />
|
||||
|
||||
<!-- channels for sending outgoing and receive reply -->
|
||||
<!-- channels for sending outgoing and receive reply -->
|
||||
<int:channel id="out2" />
|
||||
<int:channel id="in2" />
|
||||
|
||||
|
||||
@@ -1,40 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:int="http://www.springframework.org/schema/integration"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:int="http://www.springframework.org/schema/integration"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xsi:schemaLocation="
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
|
||||
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
|
||||
|
||||
<context:property-placeholder location="smpp.properties" />
|
||||
<import resource="classpath:smppConnection-context.xml"/>
|
||||
|
||||
<bean id="mockSmppServer" class="org.springframework.integration.smpp.MockSmppServer">
|
||||
<constructor-arg value="${smpp.port}"/>
|
||||
<constructor-arg value="${smpp.systemId}"/>
|
||||
<constructor-arg value="${smpp.password}"/>
|
||||
</bean>
|
||||
|
||||
<context:annotation-config />
|
||||
|
||||
<bean
|
||||
class="org.springframework.integration.smpp.session.SmppSessionFactoryBean"
|
||||
id="session">
|
||||
<bean id="session"
|
||||
class="org.springframework.integration.smpp.session.SmppSessionFactoryBean">
|
||||
<property name="host" value="${smpp.host}" />
|
||||
<property name="port" value="${smpp.port}" />
|
||||
<property name="port" ref="smppPort" />
|
||||
<property name="bindType" value="BIND_TX" />
|
||||
<property name="password" value="${smpp.password}" />
|
||||
<property name="systemId" value="${smpp.systemId}" />
|
||||
</bean>
|
||||
|
||||
<bean
|
||||
class="org.springframework.integration.smpp.outbound.SmppOutboundChannelAdapter"
|
||||
id="adapter">
|
||||
<bean id="adapter" class="org.springframework.integration.smpp.outbound.SmppOutboundChannelAdapter">
|
||||
<property name="smppSession" ref="session" />
|
||||
</bean>
|
||||
|
||||
<int:channel id="outboundSms" />
|
||||
|
||||
<int:outbound-channel-adapter channel="outboundSms"
|
||||
ref="adapter" />
|
||||
<int:outbound-channel-adapter channel="outboundSms" ref="adapter" />
|
||||
</beans>
|
||||
|
||||
@@ -1,40 +1,30 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:int="http://www.springframework.org/schema/integration"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:int="http://www.springframework.org/schema/integration"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xsi:schemaLocation="
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
|
||||
|
||||
<context:property-placeholder location="smpp.properties" />
|
||||
<import resource="classpath:smppConnection-context.xml"/>
|
||||
|
||||
<bean id="mockSmppServer" class="org.springframework.integration.smpp.MockSmppServer">
|
||||
<constructor-arg value="${smpp.port}"/>
|
||||
<constructor-arg value="${smpp.systemId}"/>
|
||||
<constructor-arg value="${smpp.password}"/>
|
||||
</bean>
|
||||
|
||||
<context:annotation-config />
|
||||
|
||||
<bean
|
||||
class="org.springframework.integration.smpp.session.SmppSessionFactoryBean"
|
||||
id="session">
|
||||
<bean id="session"
|
||||
class="org.springframework.integration.smpp.session.SmppSessionFactoryBean">
|
||||
<property name="host" value="${smpp.host}" />
|
||||
<property name="port" value="${smpp.port}" />
|
||||
<property name="port" ref="smppPort" />
|
||||
<property name="password" value="${smpp.password}" />
|
||||
<property name="systemId" value="${smpp.systemId}" />
|
||||
<property name="bindType" value="BIND_TX" />
|
||||
</bean>
|
||||
|
||||
<bean
|
||||
class="org.springframework.integration.smpp.outbound.SmppOutboundGateway"
|
||||
id="adapter">
|
||||
<bean id="adapter"
|
||||
class="org.springframework.integration.smpp.outbound.SmppOutboundGateway">
|
||||
<property name="smppSession" ref="session" />
|
||||
</bean>
|
||||
|
||||
<int:channel id="outboundSms" />
|
||||
|
||||
<int:outbound-channel-adapter channel="outboundSms"
|
||||
ref="adapter" />
|
||||
<int:outbound-channel-adapter channel="outboundSms" ref="adapter" />
|
||||
</beans>
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xmlns:int="http://www.springframework.org/schema/integration"
|
||||
xmlns:int-smpp="http://www.springframework.org/schema/integration/smpp"
|
||||
xsi:schemaLocation="
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
|
||||
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
|
||||
http://www.springframework.org/schema/integration/smpp http://www.springframework.org/schema/integration/smpp/spring-integration-smpp.xsd">
|
||||
|
||||
<import resource="classpath:smppConnection-context.xml"/>
|
||||
|
||||
<int:channel id="inboundChannel" />
|
||||
<int:channel id="outboundChannel" />
|
||||
<int:channel id="receiptChannel" />
|
||||
|
||||
<bean id="session"
|
||||
class="org.springframework.integration.smpp.session.SmppSessionFactoryBean">
|
||||
<property name="host" value="${smpp.host}" />
|
||||
<property name="port" ref="smppPort" />
|
||||
<property name="password" value="${smpp.password}" />
|
||||
<property name="systemId" value="${smpp.systemId}" />
|
||||
<property name="bindType" value="BIND_RX" />
|
||||
<property name="autoStartup" value="true" />
|
||||
<property name="addressRange" value="${smpp.systemId}" />
|
||||
</bean>
|
||||
|
||||
<bean id="session2"
|
||||
class="org.springframework.integration.smpp.session.SmppSessionFactoryBean">
|
||||
<property name="host" value="${smpp.host}" />
|
||||
<property name="port" ref="smppPort" />
|
||||
<property name="password" value="${smpp.password}" />
|
||||
<property name="systemId" value="${smpp.systemId}" />
|
||||
<property name="bindType" value="BIND_TX" />
|
||||
<property name="autoStartup" value="true" />
|
||||
</bean>
|
||||
|
||||
<int-smpp:inbound-channel-adapter channel="inboundChannel"
|
||||
smpp-session-ref="session" />
|
||||
|
||||
<int-smpp:outbound-gateway request-channel="outboundChannel"
|
||||
reply-channel="receiptChannel" smpp-session-ref="session2" />
|
||||
|
||||
</beans>
|
||||
@@ -1,25 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:int="http://www.springframework.org/schema/integration"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:int="http://www.springframework.org/schema/integration"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xsi:schemaLocation="
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
|
||||
|
||||
<context:property-placeholder location="smpp.properties" />
|
||||
<import resource="classpath:smppConnection-context.xml"/>
|
||||
|
||||
<bean id="mockSmppServer" class="org.springframework.integration.smpp.MockSmppServer">
|
||||
<constructor-arg value="${smpp.port}"/>
|
||||
<constructor-arg value="${smpp.systemId}"/>
|
||||
<constructor-arg value="${smpp.password}"/>
|
||||
</bean>
|
||||
|
||||
<bean
|
||||
class="org.springframework.integration.smpp.session.SmppSessionFactoryBean"
|
||||
id="session">
|
||||
<bean id="session"
|
||||
class="org.springframework.integration.smpp.session.SmppSessionFactoryBean">
|
||||
<property name="host" value="${smpp.host}" />
|
||||
<property name="port" value="${smpp.port}" />
|
||||
<property name="port" ref="smppPort" />
|
||||
<property name="password" value="${smpp.password}" />
|
||||
<property name="systemId" value="${smpp.systemId}" />
|
||||
<property name="bindType" value="BIND_TX" />
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:int="http://www.springframework.org/schema/integration"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:int="http://www.springframework.org/schema/integration"
|
||||
xmlns:int-smpp="http://www.springframework.org/schema/integration/smpp"
|
||||
xsi:schemaLocation="
|
||||
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:int="http://www.springframework.org/schema/integration"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:int="http://www.springframework.org/schema/integration"
|
||||
xmlns:int-smpp="http://www.springframework.org/schema/integration/smpp"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xsi:schemaLocation="
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:int="http://www.springframework.org/schema/integration"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:int="http://www.springframework.org/schema/integration"
|
||||
xmlns:int-smpp="http://www.springframework.org/schema/integration/smpp"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xsi:schemaLocation="
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:int="http://www.springframework.org/schema/integration"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:int="http://www.springframework.org/schema/integration"
|
||||
xmlns:int-smpp="http://www.springframework.org/schema/integration/smpp"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xsi:schemaLocation="
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
smpp.host=127.0.0.1
|
||||
smpp.systemId=pavel
|
||||
smpp.password=wpsd
|
||||
smpp.port=2775
|
||||
|
||||
|
||||
test.dst.number=123456
|
||||
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
|
||||
xmlns:integration="http://www.springframework.org/schema/integration"
|
||||
xmlns:smpp="http://www.springframework.org/schema/integration/smpp"
|
||||
xsi:schemaLocation="
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
|
||||
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
|
||||
http://www.springframework.org/schema/integration/smpp http://www.springframework.org/schema/integration/smpp/spring-integration-smpp.xsd">
|
||||
|
||||
<context:property-placeholder location="smpp.properties" />
|
||||
|
||||
<bean id="tcpIpUtils" class="org.springframework.integration.test.util.SocketUtils" />
|
||||
|
||||
<bean id="smppPort" class="java.lang.Integer">
|
||||
<constructor-arg value="#{tcpIpUtils.findAvailableServerSocket(13000)}"/>
|
||||
</bean>
|
||||
|
||||
<bean id="mockSmppServer" class="org.springframework.integration.smpp.MockSmppServer">
|
||||
<constructor-arg ref="smppPort" />
|
||||
<constructor-arg value="${smpp.systemId}" />
|
||||
<constructor-arg value="${smpp.password}" />
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
Reference in New Issue
Block a user