Permalink
Browse files

INTDSLGROOVY-17 Update to SI 4.0.0

  • Loading branch information...
1 parent 92a0627 commit 836d37b039cde3a8d8e066575ac8941289c891b5 @garyrussell garyrussell committed with Artem Bilan Mar 25, 2014
View
@@ -103,6 +103,7 @@ project('spring-integration-dsl-groovy-http') {
dependencies {
compile project(":spring-integration-dsl-groovy-core")
compile "org.springframework.integration:spring-integration-http:$springIntegrationVersion"
+ testCompile "javax.servlet:javax.servlet-api:$servletApiVersion"
}
}
View
@@ -1,9 +1,9 @@
-version = 1.0.0.BUILD-SNAPSHOT
+version = 1.1.0.BUILD-SNAPSHOT
activeMqVersion = 5.9.0
groovyVersion = 2.1.6
jmsApiVersion = 1.1-rev-1
junitVersion = 4.8.2
log4jVersion = 1.2.14
mockitoVersion = 1.9.0
servletApiVersion = 3.1.0
-springIntegrationVersion = 3.0.1.RELEASE
+springIntegrationVersion = 4.0.0.BUILD-SNAPSHOT
@@ -1,17 +1,29 @@
+/*
+ * Copyright 2002-2014 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.dsl.groovy
import groovy.transform.CompileStatic
-import groovy.transform.TypeCheckingMode
import java.lang.reflect.GenericArrayType
import java.lang.reflect.Method
import java.lang.reflect.ParameterizedType
import org.apache.commons.logging.Log
import org.apache.commons.logging.LogFactory
-import org.springframework.integration.Message
-import org.springframework.integration.MessageChannel
+
import org.springframework.integration.support.MessageBuilder
+import org.springframework.messaging.Message
+import org.springframework.messaging.MessageChannel
/**
*
@@ -147,18 +159,15 @@ class ClosureInvokingReleaseStrategy extends MultiMessageClosureInvoker {
}
@CompileStatic
-class ClosureInvokingChannelInterceptor implements org.springframework.integration.channel.ChannelInterceptor {
+class ClosureInvokingChannelInterceptor implements org.springframework.messaging.support.ChannelInterceptor {
protected Log logger = LogFactory.getLog(this.class)
private final org.springframework.integration.dsl.groovy.ChannelInterceptor interceptor
ClosureInvokingChannelInterceptor(org.springframework.integration.dsl.groovy.ChannelInterceptor interceptor){
this.interceptor = interceptor
}
- /* (non-Javadoc)
- * @see org.springframework.integration.channel.ChannelInterceptor#preSend(org.springframework.integration.Message, org.springframework.integration.MessageChannel)
- */
- Message preSend(Message message, MessageChannel channel) {
+ Message<?> preSend(Message message, MessageChannel channel) {
if (!interceptor.preSend){
return message
}
@@ -173,9 +182,6 @@ class ClosureInvokingChannelInterceptor implements org.springframework.integrati
result as Message
}
- /* (non-Javadoc)
- * @see org.springframework.integration.channel.ChannelInterceptor#postSend(org.springframework.integration.Message, org.springframework.integration.MessageChannel, boolean)
- */
void postSend(Message message, MessageChannel channel, boolean sent) {
if (!interceptor.postSend){
return
@@ -197,7 +203,7 @@ class ClosureInvokingChannelInterceptor implements org.springframework.integrati
/* (non-Javadoc)
* @see org.springframework.integration.channel.ChannelInterceptor#postReceive(org.springframework.integration.Message, org.springframework.integration.MessageChannel)
*/
- Message postReceive(Message message, MessageChannel channel) {
+ Message<?> postReceive(Message message, MessageChannel channel) {
if (!interceptor.postReceive){
return message
}
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2012 the original author or authors.
+ * Copyright 2002-2014 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
@@ -13,18 +13,19 @@
package org.springframework.integration.dsl.groovy
import groovy.transform.PackageScope
+
import org.springframework.context.ApplicationContext
import org.springframework.context.support.GenericXmlApplicationContext
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer
+import org.springframework.core.env.MutablePropertySources
+import org.springframework.core.env.PropertiesPropertySource
+import org.springframework.core.io.ByteArrayResource
import org.springframework.integration.channel.QueueChannel
import org.springframework.integration.dsl.groovy.builder.AbstractIntegrationBuilderModuleSupport
import org.springframework.integration.dsl.groovy.builder.dom.IntegrationDomSupport
-import org.springframework.integration.message.GenericMessage
import org.springframework.integration.support.MessageBuilder
-import org.springframework.integration.Message
-import org.springframework.core.env.MutablePropertySources
-import org.springframework.core.env.PropertiesPropertySource
-import org.springframework.core.io.ByteArrayResource
+import org.springframework.messaging.Message
+import org.springframework.messaging.support.GenericMessage
/**
* @author David Turanski
@@ -37,7 +38,7 @@ class IntegrationContext extends BaseIntegrationComposition {
/**
* Send a message without expecting a reply
- *
+ *
* @param inputChannelName
* @param msgOrPayload either a Message or an Object used as a Message payload
* @return true if the send succeeded
@@ -49,12 +50,12 @@ class IntegrationContext extends BaseIntegrationComposition {
new GenericMessage(msgOrPayload)
inputChannel.send(messageToSend)
}
-
+
/**
* Send a message and receive a reply
* @param inputChannelName
* @param msgOrPayload either a Message or an Object used as a Message payload
- * @return the result. If the input object is a Message, also returns a Message
+ * @return the result. If the input object is a Message, also returns a Message
* otherwise the payload is returned
*/
//TODO: Add error routing
@@ -77,25 +78,25 @@ class IntegrationContext extends BaseIntegrationComposition {
(msgOrPayload instanceof Message) ? result : result?.payload
}
-
+
Message<?> receive(String channelName, long timeout = 0) {
-
+
def ac = createApplicationContext()
def channel = ac.getBean(channelName)
-
+
Message<?> msg
if (timeout){
msg = channel.receive(timeout)
} else {
msg = channel.receive()
}
-
+
msg
}
-
+
/**
- *
+ *
* @return all defined MessageFlows
*/
List<MessageFlow> getMessageFlows() {
@@ -128,7 +129,7 @@ class IntegrationContext extends BaseIntegrationComposition {
* @param integrationContextsToMerge a list of {@link IntegrationContext} from other builder instances to merge.
* @return the application context
*/
- ApplicationContext createApplicationContext(ApplicationContext parentContext = null,
+ ApplicationContext createApplicationContext(ApplicationContext parentContext = null,
List<IntegrationContext> integrationContextsToMerge = null) {
if (!applicationContext){
applicationContext = new GenericXmlApplicationContext()
@@ -137,23 +138,23 @@ class IntegrationContext extends BaseIntegrationComposition {
}
def integrationDomSupport = new IntegrationDomSupport(this.moduleSupportInstances)
-
+
List<IntegrationContext> integrationContexts = [this];
if (integrationContextsToMerge) {
integrationContexts.addAll(integrationContextsToMerge)
}
-
+
ByteArrayResource[] resources = new ByteArrayResource[integrationContexts.size()]
integrationContexts.eachWithIndex {ic, i ->
- ic.applicationContext = applicationContext
+ ic.applicationContext = applicationContext
def xml = integrationDomSupport.translateToXML(ic)
resources[i] = new ByteArrayResource(xml.getBytes())
}
applicationContext.load(resources)
- boolean propertyConfigurerPresent =
+ boolean propertyConfigurerPresent =
this.applicationContext.getBeanDefinitionNames().find {name->
name.startsWith("org.springframework.context.support.PropertySourcesPlaceholderConfigurer")
}
@@ -162,7 +163,7 @@ class IntegrationContext extends BaseIntegrationComposition {
placeholderConfigurer.setEnvironment(applicationContext.environment)
this.applicationContext.addBeanFactoryPostProcessor(placeholderConfigurer)
}
-
+
if ( properties ) {
MutablePropertySources propertySources = this.applicationContext.environment.propertySources
propertySources.addFirst(new PropertiesPropertySource("properties",properties))
@@ -171,13 +172,13 @@ class IntegrationContext extends BaseIntegrationComposition {
}
applicationContext
}
-
+
/**
* Create an application context
* @param integrationContextsToMerge a list of {@link IntegrationContext} from other builder instances to merge.
* @return the application context
*/
ApplicationContext createApplicationContext(List<IntegrationContext> integrationContextsToMerge) {
- this.createApplicationContext(null, integrationContextsToMerge)
+ this.createApplicationContext(null, integrationContextsToMerge)
}
}
@@ -1,6 +1,5 @@
-package org.springframework.integration.dsl.groovy
/*
- * Copyright 2002-2012 the original author or authors.
+ * Copyright 2002-2014 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
@@ -11,15 +10,15 @@ package org.springframework.integration.dsl.groovy
* 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.
*/
-import static org.junit.Assert.*
+package org.springframework.integration.dsl.groovy
+import static org.junit.Assert.*
import org.junit.Test
-import org.springframework.integration.support.MessageBuilder
-import org.springframework.integration.message.GenericMessage
-import org.springframework.integration.Message
-import java.lang.reflect.*
+import org.springframework.integration.support.MessageBuilder
+import org.springframework.messaging.Message
+import org.springframework.messaging.support.GenericMessage
/**
* @author David Turanski
@@ -1,6 +1,6 @@
package org.springframework.integration.dsl.groovy
/*
- * Copyright 2002-2012 the original author or authors.
+ * Copyright 2002-2014 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
@@ -11,14 +11,16 @@ package org.springframework.integration.dsl.groovy
* 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.
*/
+
import static org.junit.Assert.*
import org.junit.Test
-import org.springframework.integration.Message
-import org.springframework.integration.MessagingException
+
import org.springframework.integration.channel.DirectChannel
-import org.springframework.integration.core.MessageHandler
-import org.springframework.integration.message.GenericMessage
+import org.springframework.messaging.Message
+import org.springframework.messaging.MessageHandler
+import org.springframework.messaging.MessagingException
+import org.springframework.messaging.support.GenericMessage
/**
* @author David Turanski
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2012 the original author or authors.
+ * Copyright 2002-2014 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
@@ -15,8 +15,9 @@ package org.springframework.integration.dsl.groovy
import static org.junit.Assert.*
import org.junit.Test
-import org.springframework.integration.Message
-import org.springframework.integration.message.GenericMessage
+
+import org.springframework.messaging.Message
+import org.springframework.messaging.support.GenericMessage
/**
* @author David Turanski
*
@@ -57,8 +58,8 @@ class MultiMessageParameterTransformerTests {
def closure = {Message[] messages ->
(1..messages.length).each { i-> assert messages[i-1].payload as int == i}
}
-
-
+
+
multiMessageParameterTransformer = new MultiMessageParameterTransformer(closure)
def arg = multiMessageParameterTransformer.mapClosureArg(messageList)
assert arg instanceof Message[]
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2012 the original author or authors.
+ * Copyright 2002-2014 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
@@ -15,7 +15,8 @@ package org.springframework.integration.dsl.groovy.builder
import static org.junit.Assert.*
import org.junit.Test
-import org.springframework.integration.message.GenericMessage
+
+import org.springframework.messaging.support.GenericMessage
/**
* @author David Turanski
*

0 comments on commit 836d37b

Please sign in to comment.