INTEXT-107 Upgrade to Spring Integration 4.0
JIRA: https://jira.spring.io/browse/INTEXT-107 * Upgrade to Gradle 1.12 * Fix compile warnings * Fix XSD declaration * Get rid of `EasyMock`
This commit is contained in:
committed by
Artem Bilan
parent
2b049dd478
commit
7590253871
@@ -2,88 +2,73 @@ description = 'Spring Integration Smpp Adapter'
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
maven { url 'https://repo.springsource.org/plugins-snapshot' }
|
||||
maven { url 'https://repo.spring.io/plugins-release' }
|
||||
}
|
||||
dependencies {
|
||||
classpath 'org.springframework.build.gradle:docbook-reference-plugin:0.1.5'
|
||||
classpath 'org.springframework.build.gradle:docbook-reference-plugin:0.2.8'
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'java'
|
||||
apply from: "${rootProject.projectDir}/publish-maven.gradle"
|
||||
apply from: "${rootProject.projectDir}/publish-maven.gradle"
|
||||
apply plugin: 'eclipse'
|
||||
apply plugin: 'idea'
|
||||
|
||||
group = 'org.springframework.integration'
|
||||
|
||||
repositories {
|
||||
maven { url 'http://repo.springsource.org/libs-milestone' }
|
||||
maven { url 'http://repo.springsource.org/plugins-release' }
|
||||
maven { url 'http://repo.spring.io/libs-milestone' }
|
||||
}
|
||||
|
||||
sourceCompatibility=1.6
|
||||
targetCompatibility=1.6
|
||||
sourceCompatibility = 1.6
|
||||
targetCompatibility = 1.6
|
||||
|
||||
ext {
|
||||
jacocoVersion = '0.7.0.201403182114'
|
||||
jsmppVersion = '2.1.0'
|
||||
slf4jVersion = '1.6.6'
|
||||
slf4jVersion = '1.7.7'
|
||||
commonsLangVersion = '2.6'
|
||||
commonsBeanUtilsVersion= '1.8.3'
|
||||
easymockVersion = '2.3'
|
||||
junitVersion = '4.10'
|
||||
log4jVersion = '1.2.12'
|
||||
mockitoVersion = '1.9.0'
|
||||
springVersion = '3.1.3.RELEASE'
|
||||
springIntegrationVersion = '2.2.2.RELEASE'
|
||||
commonsBeanUtilsVersion = '1.8.3'
|
||||
springIntegrationVersion = '4.0.2.RELEASE'
|
||||
|
||||
idPrefix = 'smpp'
|
||||
|
||||
linkHomepage = 'https://github.com/SpringSource/spring-integration-extensions'
|
||||
linkCi = 'https://build.springsource.org/browse/INTEXT'
|
||||
linkIssue = 'https://jira.springsource.org/browse/INTEXT'
|
||||
linkScmUrl = 'https://github.com/SpringSource/spring-integration-extensions'
|
||||
linkScmConnection = 'https://github.com/SpringSource/spring-integration-extensions.git'
|
||||
linkScmDevConnection = 'git@github.com:SpringSource/spring-integration-extensions.git'
|
||||
|
||||
linkHomepage = 'https://github.com/spring-projects/spring-integration-extensions'
|
||||
linkCi = 'https://build.spring.io/browse/INTEXT'
|
||||
linkIssue = 'https://jira.spring.io/browse/INTEXT'
|
||||
linkScmUrl = 'https://github.com/spring-projects/spring-integration-extensions'
|
||||
linkScmConnection = 'https://github.com/spring-projects/spring-integration-extensions.git'
|
||||
linkScmDevConnection = 'git@github.com:spring-projects/spring-integration-extensions.git'
|
||||
}
|
||||
|
||||
eclipse {
|
||||
project {
|
||||
natures += 'org.springframework.ide.eclipse.core.springnature'
|
||||
}
|
||||
}
|
||||
eclipse.project.natures += 'org.springframework.ide.eclipse.core.springnature'
|
||||
|
||||
sourceSets {
|
||||
test {
|
||||
resources {
|
||||
srcDirs = ['src/test/resources', 'src/test/java']
|
||||
}
|
||||
}
|
||||
}
|
||||
sourceSets.test.resources.srcDirs = ['src/test/resources', 'src/test/java']
|
||||
|
||||
// See http://www.gradle.org/docs/current/userguide/dependency_management.html#sub:configurations
|
||||
// and http://www.gradle.org/docs/current/dsl/org.gradle.api.artifacts.ConfigurationContainer.html
|
||||
configurations {
|
||||
jacoco //Configuration Group used by Sonar to provide Code Coverage using JaCoCo
|
||||
all*.exclude group: 'commons-logging', module: 'commons-logging'
|
||||
all*.exclude group: 'log4j', module: 'log4j'
|
||||
all*.exclude group: 'org.slf4j', module: 'slf4j-log4j12'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile "com.googlecode.jsmpp:jsmpp:$jsmppVersion"
|
||||
compile "org.slf4j:slf4j-log4j12:$slf4jVersion"
|
||||
compile "org.slf4j:jcl-over-slf4j:$slf4jVersion"
|
||||
compile "commons-lang:commons-lang:$commonsLangVersion"
|
||||
compile "commons-beanutils:commons-beanutils:$commonsBeanUtilsVersion"
|
||||
compile "org.springframework.integration:spring-integration-core:$springIntegrationVersion"
|
||||
|
||||
testCompile "org.springframework.integration:spring-integration-test:$springIntegrationVersion"
|
||||
testCompile "junit:junit-dep:$junitVersion"
|
||||
testCompile "log4j:log4j:$log4jVersion"
|
||||
testCompile "org.mockito:mockito-all:$mockitoVersion"
|
||||
testCompile "org.springframework:spring-test:$springVersion"
|
||||
testCompile "org.easymock:easymockclassextension:$easymockVersion"
|
||||
jacoco group: "org.jacoco", name: "org.jacoco.agent", version: "0.5.6.201201232323", classifier: "runtime"
|
||||
|
||||
jacoco "org.jacoco:org.jacoco.agent:$jacocoVersion:runtime"
|
||||
}
|
||||
|
||||
// enable all compiler warnings; individual projects may customize further
|
||||
ext.xLintArg = '-Xlint:all'
|
||||
[compileJava, compileTestJava]*.options*.compilerArgs = [xLintArg]
|
||||
[compileJava, compileTestJava]*.options*.compilerArgs = ['-Xlint:all,-options']
|
||||
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
|
||||
|
||||
test {
|
||||
// suppress all console output during testing unless running `gradle -i`
|
||||
@@ -143,8 +128,6 @@ task api(type: Javadoc) {
|
||||
task schemaZip(type: Zip) {
|
||||
group = 'Distribution'
|
||||
classifier = 'schema'
|
||||
description = "Builds -${classifier} archive containing all " +
|
||||
"XSDs for deployment at static.springframework.org/schema."
|
||||
|
||||
def Properties schemas = new Properties();
|
||||
def shortName = idPrefix.replaceFirst("${idPrefix}-", '')
|
||||
@@ -158,7 +141,7 @@ task schemaZip(type: Zip) {
|
||||
it.path.endsWith(schemas.get(key))
|
||||
}
|
||||
assert xsdFile != null
|
||||
into ("integration/${shortName}") {
|
||||
into("integration/${shortName}") {
|
||||
from xsdFile.path
|
||||
}
|
||||
}
|
||||
@@ -167,18 +150,16 @@ task schemaZip(type: Zip) {
|
||||
task docsZip(type: Zip) {
|
||||
group = 'Distribution'
|
||||
classifier = 'docs'
|
||||
description = "Builds -${classifier} archive containing api and reference " +
|
||||
"for deployment at static.springframework.org/spring-integration/docs."
|
||||
|
||||
from('src/dist') {
|
||||
include 'changelog.txt'
|
||||
}
|
||||
|
||||
from (api) {
|
||||
from(api) {
|
||||
into 'api'
|
||||
}
|
||||
|
||||
from (reference) {
|
||||
from(reference) {
|
||||
into 'reference'
|
||||
}
|
||||
}
|
||||
@@ -187,7 +168,7 @@ task distZip(type: Zip, dependsOn: [docsZip, schemaZip]) {
|
||||
group = 'Distribution'
|
||||
classifier = 'dist'
|
||||
description = "Builds -${classifier} archive, containing all jars and docs, " +
|
||||
"suitable for community download page."
|
||||
"suitable for community download page."
|
||||
|
||||
ext.baseDir = "${project.name}-${project.version}";
|
||||
|
||||
@@ -206,7 +187,7 @@ task distZip(type: Zip, dependsOn: [docsZip, schemaZip]) {
|
||||
into "${baseDir}/schema"
|
||||
}
|
||||
|
||||
into ("${baseDir}/libs") {
|
||||
into("${baseDir}/libs") {
|
||||
from project.jar
|
||||
from project.sourcesJar
|
||||
from project.javadocJar
|
||||
@@ -219,7 +200,7 @@ task depsZip(type: Zip, dependsOn: distZip) { zipTask ->
|
||||
group = 'Distribution'
|
||||
classifier = 'dist-with-deps'
|
||||
description = "Builds -${classifier} archive, containing everything " +
|
||||
"in the -${distZip.classifier} archive plus all dependencies."
|
||||
"in the -${distZip.classifier} archive plus all dependencies."
|
||||
|
||||
from zipTree(distZip.archivePath)
|
||||
|
||||
@@ -255,5 +236,6 @@ task dist(dependsOn: assemble) {
|
||||
|
||||
task wrapper(type: Wrapper) {
|
||||
description = 'Generates gradlew[.bat] scripts'
|
||||
gradleVersion = '1.6'
|
||||
gradleVersion = '1.12'
|
||||
distributionUrl = "http://services.gradle.org/distributions/gradle-${gradleVersion}-all.zip"
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -1,6 +1,6 @@
|
||||
#Wed May 15 22:15:12 EDT 2013
|
||||
#Tue Jun 24 12:16:31 EEST 2014
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=http\://services.gradle.org/distributions/gradle-1.6-bin.zip
|
||||
distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip
|
||||
|
||||
@@ -31,10 +31,10 @@ def customizePom(pom, gradleProject) {
|
||||
generatedPom.project {
|
||||
name = gradleProject.description
|
||||
description = gradleProject.description
|
||||
url = 'https://github.com/SpringSource/spring-integration-extensions'
|
||||
url = linkHomepage
|
||||
organization {
|
||||
name = 'SpringSource'
|
||||
url = 'http://springsource.org'
|
||||
name = 'SpringIO'
|
||||
url = 'http://spring.io'
|
||||
}
|
||||
licenses {
|
||||
license {
|
||||
@@ -44,9 +44,9 @@ def customizePom(pom, gradleProject) {
|
||||
}
|
||||
}
|
||||
scm {
|
||||
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'
|
||||
url = linkScmUrl
|
||||
connection = 'scm:git:' + linkScmConnection
|
||||
developerConnection = 'scm:git:' + linkScmDevConnection
|
||||
}
|
||||
|
||||
developers {
|
||||
|
||||
@@ -22,7 +22,7 @@ import org.jsmpp.session.ClientSession;
|
||||
import org.jsmpp.session.SMPPSession;
|
||||
import org.jsmpp.util.AbsoluteTimeFormatter;
|
||||
import org.jsmpp.util.TimeFormatter;
|
||||
import org.springframework.integration.Message;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.integration.support.MessageBuilder;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
@@ -18,8 +18,8 @@ package org.springframework.integration.smpp.inbound;
|
||||
import org.jsmpp.bean.BindType;
|
||||
import org.jsmpp.bean.DeliverSm;
|
||||
import org.jsmpp.bean.DeliveryReceipt;
|
||||
import org.springframework.integration.Message;
|
||||
import org.springframework.integration.MessageChannel;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageChannel;
|
||||
import org.springframework.integration.core.MessagingTemplate;
|
||||
import org.springframework.integration.endpoint.AbstractEndpoint;
|
||||
import org.springframework.integration.smpp.core.AbstractReceivingMessageListener;
|
||||
|
||||
@@ -19,7 +19,7 @@ import org.jsmpp.bean.BindType;
|
||||
import org.jsmpp.bean.DeliverSm;
|
||||
import org.jsmpp.bean.DeliveryReceipt;
|
||||
import org.jsmpp.bean.TypeOfNumber;
|
||||
import org.springframework.integration.Message;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.integration.gateway.MessagingGatewaySupport;
|
||||
import org.springframework.integration.smpp.core.AbstractReceivingMessageListener;
|
||||
import org.springframework.integration.smpp.core.SmesMessageSpecification;
|
||||
|
||||
@@ -18,10 +18,10 @@ import org.jsmpp.bean.BindType;
|
||||
import org.jsmpp.bean.TypeOfNumber;
|
||||
import org.jsmpp.util.AbsoluteTimeFormatter;
|
||||
import org.jsmpp.util.TimeFormatter;
|
||||
import org.springframework.integration.Message;
|
||||
import org.springframework.integration.MessagingException;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessagingException;
|
||||
import org.springframework.integration.context.IntegrationObjectSupport;
|
||||
import org.springframework.integration.core.MessageHandler;
|
||||
import org.springframework.messaging.MessageHandler;
|
||||
import org.springframework.integration.smpp.core.SmesMessageSpecification;
|
||||
import org.springframework.integration.smpp.session.ExtendedSmppSession;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
@@ -18,7 +18,7 @@ import org.jsmpp.bean.BindType;
|
||||
import org.jsmpp.bean.TypeOfNumber;
|
||||
import org.jsmpp.util.AbsoluteTimeFormatter;
|
||||
import org.jsmpp.util.TimeFormatter;
|
||||
import org.springframework.integration.Message;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.integration.handler.AbstractReplyProducingMessageHandler;
|
||||
import org.springframework.integration.smpp.core.SmesMessageSpecification;
|
||||
import org.springframework.integration.smpp.session.ExtendedSmppSession;
|
||||
@@ -44,8 +44,8 @@ import org.springframework.util.StringUtils;
|
||||
*/
|
||||
public class SmppOutboundGateway extends AbstractReplyProducingMessageHandler {
|
||||
@Override
|
||||
protected void onInit() {
|
||||
super.onInit();
|
||||
protected void doInit() {
|
||||
super.doInit();
|
||||
Assert.isTrue(
|
||||
this.smppSession.getBindType().equals(BindType.BIND_TX) ||
|
||||
this.smppSession.getBindType().equals(BindType.BIND_TRX),
|
||||
|
||||
@@ -14,20 +14,35 @@
|
||||
*/
|
||||
package org.springframework.integration.smpp.session;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.jsmpp.InvalidResponseException;
|
||||
import org.jsmpp.PDUException;
|
||||
import org.jsmpp.bean.*;
|
||||
import org.jsmpp.bean.Address;
|
||||
import org.jsmpp.bean.BindType;
|
||||
import org.jsmpp.bean.DataCoding;
|
||||
import org.jsmpp.bean.ESMClass;
|
||||
import org.jsmpp.bean.NumberingPlanIndicator;
|
||||
import org.jsmpp.bean.OptionalParameter;
|
||||
import org.jsmpp.bean.RegisteredDelivery;
|
||||
import org.jsmpp.bean.ReplaceIfPresentFlag;
|
||||
import org.jsmpp.bean.SubmitMultiResult;
|
||||
import org.jsmpp.bean.TypeOfNumber;
|
||||
import org.jsmpp.extra.NegativeResponseException;
|
||||
import org.jsmpp.extra.ResponseTimeoutException;
|
||||
import org.jsmpp.extra.SessionState;
|
||||
import org.jsmpp.session.*;
|
||||
import org.jsmpp.session.ClientSession;
|
||||
import org.jsmpp.session.DataSmResult;
|
||||
import org.jsmpp.session.MessageReceiverListener;
|
||||
import org.jsmpp.session.QuerySmResult;
|
||||
import org.jsmpp.session.SMPPSession;
|
||||
import org.jsmpp.session.SessionStateListener;
|
||||
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.context.Lifecycle;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Adapts to the {@link ClientSession} API, while also providing the callbacks for the Spring container
|
||||
*
|
||||
@@ -120,7 +135,23 @@ public class ExtendedSmppSessionAdaptingDelegate implements /*Lifecycle,*/ Exten
|
||||
return session.submitShortMessage(serviceType, sourceAddrTon, sourceAddrNpi, sourceAddr, destAddrTon, destAddrNpi, destinationAddr, esmClass, protocolId, priorityFlag, scheduleDeliveryTime, validityPeriod, registeredDelivery, replaceIfPresentFlag, dataCoding, smDefaultMsgId, shortMessage, optionalParameters);
|
||||
}
|
||||
|
||||
public SubmitMultiResult submitMultiple(String serviceType, TypeOfNumber sourceAddrTon, NumberingPlanIndicator sourceAddrNpi, String sourceAddr, Address[] destinationAddresses, ESMClass esmClass, byte protocolId, byte priorityFlag, String scheduleDeliveryTime, String validityPeriod, RegisteredDelivery registeredDelivery, ReplaceIfPresentFlag replaceIfPresentFlag, DataCoding dataCoding, byte smDefaultMsgId, byte[] shortMessage, OptionalParameter[] optionalParameters) throws PDUException, ResponseTimeoutException, InvalidResponseException, NegativeResponseException, IOException {
|
||||
public SubmitMultiResult submitMultiple(String serviceType,
|
||||
TypeOfNumber sourceAddrTon,
|
||||
NumberingPlanIndicator sourceAddrNpi,
|
||||
String sourceAddr,
|
||||
Address[] destinationAddresses,
|
||||
ESMClass esmClass,
|
||||
byte protocolId,
|
||||
byte priorityFlag,
|
||||
String scheduleDeliveryTime,
|
||||
String validityPeriod,
|
||||
RegisteredDelivery registeredDelivery,
|
||||
ReplaceIfPresentFlag replaceIfPresentFlag,
|
||||
DataCoding dataCoding,
|
||||
byte smDefaultMsgId,
|
||||
byte[] shortMessage,
|
||||
OptionalParameter... optionalParameters) throws PDUException, ResponseTimeoutException,
|
||||
InvalidResponseException, NegativeResponseException, IOException {
|
||||
return session.submitMultiple(
|
||||
serviceType, sourceAddrTon, sourceAddrNpi, sourceAddr, destinationAddresses, esmClass, protocolId, priorityFlag, scheduleDeliveryTime, validityPeriod, registeredDelivery, replaceIfPresentFlag, dataCoding, smDefaultMsgId, shortMessage, optionalParameters
|
||||
);
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
http\://www.springframework.org/schema/integration/smpp/spring-integration-smpp-2.2.xsd=org/springframework/integration/smpp/config/xml/spring-integration-smpp-2.2.xsd
|
||||
http\://www.springframework.org/schema/integration/smpp/spring-integration-smpp.xsd=org/springframework/integration/smpp/config/xml/spring-integration-smpp-2.2.xsd
|
||||
http\://www.springframework.org/schema/integration/smpp/spring-integration-smpp-1.0.xsd=org/springframework/integration/smpp/config/xml/spring-integration-smpp-1.0.xsd
|
||||
http\://www.springframework.org/schema/integration/smpp/spring-integration-smpp.xsd=org/springframework/integration/smpp/config/xml/spring-integration-smpp-1.0.xsd
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<xsd:import namespace="http://www.springframework.org/schema/beans" />
|
||||
<xsd:import namespace="http://www.springframework.org/schema/tool" />
|
||||
<xsd:import namespace="http://www.springframework.org/schema/integration"
|
||||
schemaLocation="http://www.springframework.org/schema/integration/spring-integration-2.2.xsd" />
|
||||
schemaLocation="http://www.springframework.org/schema/integration/spring-integration-4.0.xsd" />
|
||||
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
@@ -381,7 +381,7 @@
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
</xsd:attributeGroup>
|
||||
|
||||
|
||||
<xsd:complexType name="smppGatewayType">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
@@ -15,12 +15,51 @@
|
||||
*/
|
||||
package org.springframework.integration.smpp;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.SocketException;
|
||||
import java.net.SocketTimeoutException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
|
||||
import org.jsmpp.PDUStringException;
|
||||
import org.jsmpp.SMPPConstant;
|
||||
import org.jsmpp.bean.*;
|
||||
import org.jsmpp.bean.CancelSm;
|
||||
import org.jsmpp.bean.DataCodings;
|
||||
import org.jsmpp.bean.DataSm;
|
||||
import org.jsmpp.bean.DeliveryReceipt;
|
||||
import org.jsmpp.bean.ESMClass;
|
||||
import org.jsmpp.bean.GSMSpecificFeature;
|
||||
import org.jsmpp.bean.MessageMode;
|
||||
import org.jsmpp.bean.MessageType;
|
||||
import org.jsmpp.bean.NumberingPlanIndicator;
|
||||
import org.jsmpp.bean.QuerySm;
|
||||
import org.jsmpp.bean.RegisteredDelivery;
|
||||
import org.jsmpp.bean.ReplaceSm;
|
||||
import org.jsmpp.bean.SMSCDeliveryReceipt;
|
||||
import org.jsmpp.bean.SubmitMulti;
|
||||
import org.jsmpp.bean.SubmitMultiResult;
|
||||
import org.jsmpp.bean.SubmitSm;
|
||||
import org.jsmpp.bean.TypeOfNumber;
|
||||
import org.jsmpp.bean.UnsuccessDelivery;
|
||||
import org.jsmpp.extra.ProcessRequestException;
|
||||
import org.jsmpp.extra.SessionState;
|
||||
import org.jsmpp.session.*;
|
||||
import org.jsmpp.session.BindRequest;
|
||||
import org.jsmpp.session.DataSmResult;
|
||||
import org.jsmpp.session.QuerySmResult;
|
||||
import org.jsmpp.session.SMPPServerSession;
|
||||
import org.jsmpp.session.SMPPServerSessionListener;
|
||||
import org.jsmpp.session.ServerMessageReceiverListener;
|
||||
import org.jsmpp.session.ServerResponseDeliveryAdapter;
|
||||
import org.jsmpp.session.Session;
|
||||
import org.jsmpp.util.DeliveryReceiptState;
|
||||
import org.jsmpp.util.MessageIDGenerator;
|
||||
import org.jsmpp.util.MessageId;
|
||||
@@ -28,16 +67,6 @@ import org.jsmpp.util.RandomMessageIDGenerator;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
import java.io.IOException;
|
||||
import java.net.SocketException;
|
||||
import java.net.SocketTimeoutException;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
/**
|
||||
* This is mock SMPP server connection which copied from jsmpp-examples (git clone https://github.com/otnateos/jsmpp.git)
|
||||
* with additional functionality:
|
||||
@@ -395,9 +424,8 @@ public class MockSmppServer extends ServerResponseDeliveryAdapter implements Run
|
||||
|
||||
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()});
|
||||
logger.debug("Forwards incoming message {} to session {}. from {} to {}", new String(message),
|
||||
destination.getSessionId(), submitSm.getSourceAddr(), submitSm.getDestAddress());
|
||||
destination.deliverShortMessage("mc",
|
||||
TypeOfNumber.valueOf(submitSm.getSourceAddrTon()),
|
||||
NumberingPlanIndicator.valueOf(submitSm.getSourceAddrNpi()),
|
||||
|
||||
@@ -19,11 +19,11 @@ import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.integration.Message;
|
||||
import org.springframework.integration.MessageChannel;
|
||||
import org.springframework.integration.MessagingException;
|
||||
import org.springframework.integration.core.MessageHandler;
|
||||
import org.springframework.integration.core.SubscribableChannel;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageChannel;
|
||||
import org.springframework.messaging.MessagingException;
|
||||
import org.springframework.messaging.MessageHandler;
|
||||
import org.springframework.messaging.SubscribableChannel;
|
||||
import org.springframework.integration.smpp.core.SmppConstants;
|
||||
import org.springframework.integration.support.MessageBuilder;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
|
||||
@@ -24,10 +24,10 @@ import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.integration.Message;
|
||||
import org.springframework.integration.MessagingException;
|
||||
import org.springframework.integration.core.MessageHandler;
|
||||
import org.springframework.integration.core.SubscribableChannel;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessagingException;
|
||||
import org.springframework.messaging.MessageHandler;
|
||||
import org.springframework.messaging.SubscribableChannel;
|
||||
import org.springframework.integration.smpp.core.SmppConstants;
|
||||
import org.springframework.integration.support.MessageBuilder;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
|
||||
@@ -14,26 +14,27 @@
|
||||
*/
|
||||
package org.springframework.integration.smpp;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.integration.Message;
|
||||
import org.springframework.integration.MessagingException;
|
||||
import org.springframework.integration.core.MessageHandler;
|
||||
import org.springframework.integration.core.SubscribableChannel;
|
||||
import org.springframework.integration.handler.AbstractReplyProducingMessageHandler;
|
||||
import org.springframework.integration.smpp.core.SmesMessageSpecification;
|
||||
import org.springframework.integration.smpp.session.ExtendedSmppSession;
|
||||
import org.springframework.integration.support.MessageBuilder;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageHandler;
|
||||
import org.springframework.messaging.MessagingException;
|
||||
import org.springframework.messaging.SubscribableChannel;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
@ContextConfiguration("classpath:TestSmppInboundGateway-context.xml")
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
public class TestSmppInboundGateway {
|
||||
@@ -105,7 +106,7 @@ public class TestSmppInboundGateway {
|
||||
this.in2.subscribe(replyHandler);
|
||||
|
||||
// outbound gateway send
|
||||
logger.debug("Sending message from: {} to: {} message: '{}'", new String[] {fromPhone, toPhone, smsRequest});
|
||||
logger.debug("Sending message from: {} to: {} message: '{}'", fromPhone, toPhone, smsRequest);
|
||||
SmesMessageSpecification.newSmesMessageSpecification(outSession, this.fromPhone, this.toPhone, this.smsRequest).send();
|
||||
/*Message<String> smsMsg = MessageBuilder.withPayload(smsRequest)
|
||||
.setHeader(SmppConstants.SRC_ADDR, fromPhone)
|
||||
|
||||
@@ -21,8 +21,8 @@ import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.integration.Message;
|
||||
import org.springframework.integration.MessageChannel;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageChannel;
|
||||
import org.springframework.integration.smpp.core.SmppConstants;
|
||||
import org.springframework.integration.smpp.session.ExtendedSmppSession;
|
||||
import org.springframework.integration.support.MessageBuilder;
|
||||
|
||||
@@ -18,9 +18,9 @@ import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.integration.Message;
|
||||
import org.springframework.integration.MessageChannel;
|
||||
import org.springframework.integration.MessagingException;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageChannel;
|
||||
import org.springframework.messaging.MessagingException;
|
||||
import org.springframework.integration.core.MessagingTemplate;
|
||||
import org.springframework.integration.smpp.core.SmppConstants;
|
||||
import org.springframework.integration.support.MessageBuilder;
|
||||
|
||||
@@ -21,8 +21,8 @@ import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.integration.Message;
|
||||
import org.springframework.integration.MessageChannel;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageChannel;
|
||||
import org.springframework.integration.core.MessagingTemplate;
|
||||
import org.springframework.integration.smpp.core.SmppConstants;
|
||||
import org.springframework.integration.smpp.session.ExtendedSmppSession;
|
||||
|
||||
@@ -18,9 +18,9 @@ import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.integration.Message;
|
||||
import org.springframework.integration.MessageChannel;
|
||||
import org.springframework.integration.MessagingException;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageChannel;
|
||||
import org.springframework.messaging.MessagingException;
|
||||
import org.springframework.integration.core.MessagingTemplate;
|
||||
import org.springframework.integration.smpp.core.SmppConstants;
|
||||
import org.springframework.integration.support.MessageBuilder;
|
||||
|
||||
@@ -15,11 +15,9 @@
|
||||
package org.springframework.integration.smpp.config.xml;
|
||||
|
||||
import org.jsmpp.bean.BindType;
|
||||
import org.springframework.integration.smpp.session.ExtendedSmppSession;
|
||||
import org.mockito.Mockito;
|
||||
|
||||
import static org.easymock.EasyMock.createNiceMock;
|
||||
import static org.easymock.EasyMock.expect;
|
||||
import static org.easymock.EasyMock.replay;
|
||||
import org.springframework.integration.smpp.session.ExtendedSmppSession;
|
||||
|
||||
/**
|
||||
* Mock smpp session factory for testing.
|
||||
@@ -29,16 +27,14 @@ import static org.easymock.EasyMock.replay;
|
||||
public class MockSmppSessionFactory {
|
||||
|
||||
public static ExtendedSmppSession getOutSmppSession() {
|
||||
ExtendedSmppSession mock = createNiceMock(ExtendedSmppSession.class);
|
||||
expect(mock.getBindType()).andReturn(BindType.BIND_TX).anyTimes();
|
||||
replay(mock);
|
||||
ExtendedSmppSession mock = Mockito.mock(ExtendedSmppSession.class);
|
||||
Mockito.when(mock.getBindType()).thenReturn(BindType.BIND_TRX);
|
||||
return mock;
|
||||
}
|
||||
|
||||
public static ExtendedSmppSession getInSmppSession() {
|
||||
ExtendedSmppSession mock = createNiceMock(ExtendedSmppSession.class);
|
||||
expect(mock.getBindType()).andReturn(BindType.BIND_RX).anyTimes();
|
||||
replay(mock);
|
||||
ExtendedSmppSession mock = Mockito.mock(ExtendedSmppSession.class);
|
||||
Mockito.when(mock.getBindType()).thenReturn(BindType.BIND_TRX);
|
||||
return mock;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,9 +18,9 @@ import org.junit.After;
|
||||
import org.junit.Test;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.integration.Message;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.integration.channel.AbstractMessageChannel;
|
||||
import org.springframework.integration.core.MessageHandler;
|
||||
import org.springframework.messaging.MessageHandler;
|
||||
import org.springframework.integration.core.MessagingTemplate;
|
||||
import org.springframework.integration.endpoint.AbstractEndpoint;
|
||||
import org.springframework.integration.endpoint.EventDrivenConsumer;
|
||||
|
||||
@@ -18,9 +18,9 @@ import org.junit.After;
|
||||
import org.junit.Test;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.integration.Message;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.integration.channel.AbstractMessageChannel;
|
||||
import org.springframework.integration.core.MessageHandler;
|
||||
import org.springframework.messaging.MessageHandler;
|
||||
import org.springframework.integration.endpoint.AbstractEndpoint;
|
||||
import org.springframework.integration.endpoint.EventDrivenConsumer;
|
||||
import org.springframework.integration.handler.advice.AbstractRequestHandlerAdvice;
|
||||
|
||||
@@ -18,14 +18,14 @@
|
||||
<int:channel id="replyChannel" />
|
||||
<int:channel id="errorChannel" />
|
||||
|
||||
<bean id="inboundMapper" class="org.easymock.EasyMock"
|
||||
factory-method="createNiceMock">
|
||||
<bean id="inboundMapper" class="org.mockito.Mockito"
|
||||
factory-method="mock">
|
||||
<constructor-arg
|
||||
value="org.springframework.integration.mapping.InboundMessageMapper" />
|
||||
</bean>
|
||||
|
||||
<bean id="outboundMapper" class="org.easymock.EasyMock"
|
||||
factory-method="createNiceMock">
|
||||
<bean id="outboundMapper" class="org.mockito.Mockito"
|
||||
factory-method="mock">
|
||||
<constructor-arg
|
||||
value="org.springframework.integration.mapping.OutboundMessageMapper" />
|
||||
</bean>
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
<int:channel id="in" />
|
||||
<int:channel id="out" />
|
||||
|
||||
<bean id="timeFormatter" class="org.easymock.EasyMock"
|
||||
factory-method="createNiceMock">
|
||||
<bean id="timeFormatter" class="org.mockito.Mockito"
|
||||
factory-method="mock">
|
||||
<constructor-arg value="org.jsmpp.util.TimeFormatter" />
|
||||
</bean>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user