INT-3926: Add <poller> for all outbound tags

JIRA: https://jira.spring.io/browse/INT-3926

* Add `<poller>` for all `<outbound-adapter(gateway)>`
* Add/modify tests for `<queue>` as an input channel and particular `<poller>`
* Move XSD from the `xml` package to the `config` level to achieve the consistency throughout the project.
This commit is contained in:
Artem Bilan
2016-01-06 19:06:03 -05:00
committed by Gary Russell
parent afc286a66a
commit 74cbc58698
29 changed files with 149 additions and 83 deletions

View File

@@ -134,7 +134,7 @@
writes Message to a Gemfire cache
</xsd:documentation>
</xsd:annotation>
<xsd:choice minOccurs="0" maxOccurs="2">
<xsd:choice minOccurs="0" maxOccurs="3">
<xsd:element name="cache-entries" type="beans:mapType"
minOccurs="0" maxOccurs="1">
<xsd:annotation>
@@ -144,6 +144,7 @@
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element ref="integration:poller" minOccurs="0" maxOccurs="1"/>
<xsd:element name="request-handler-advice-chain" type="integration:handlerAdviceChainType" minOccurs="0"
maxOccurs="1"/>
</xsd:choice>

View File

@@ -10,9 +10,12 @@
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
<int:channel id="input"/>
<int:channel id="input">
<int:queue/>
</int:channel>
<int-gfe:outbound-channel-adapter id="adapter" region="region" channel="input" auto-startup="false" phase="2">
<int:poller fixed-delay="100"/>
<int-gfe:request-handler-advice-chain>
<bean class="org.springframework.integration.gemfire.config.xml.GemfireOutboundChannelAdapterParserTests$FooAdvice"/>
</int-gfe:request-handler-advice-chain>

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2016 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
@@ -14,9 +14,13 @@
package org.springframework.integration.gemfire.config.xml;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.springframework.integration.gemfire.config.xml.ParserTestUtil.createFakeParserContext;
import static org.springframework.integration.gemfire.config.xml.ParserTestUtil.loadXMLFrom;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.w3c.dom.Element;
@@ -30,20 +34,23 @@ import org.springframework.integration.handler.advice.AbstractRequestHandlerAdvi
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.support.GenericMessage;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
/**
* @author Dan Oxlade
* @author Liujiong
* @author Artem Bilan
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration
@DirtiesContext
public class GemfireOutboundChannelAdapterParserTests {
private GemfireOutboundChannelAdapterParser underTest = new GemfireOutboundChannelAdapterParser();
private volatile static int adviceCalled;
private static final CountDownLatch adviceCalled = new CountDownLatch(1);
@Autowired
@Qualifier("adapter")
@@ -60,11 +67,11 @@ public class GemfireOutboundChannelAdapterParserTests {
}
@Test
public void withAdvice() {
public void withAdvice() throws InterruptedException {
adapter1.start();
MessageChannel channel = ctx.getBean("input", MessageChannel.class);
channel.send(new GenericMessage<String>("foo"));
assertEquals(1, adviceCalled);
assertTrue(adviceCalled.await(10, TimeUnit.SECONDS));
}
@Test
@@ -81,7 +88,7 @@ public class GemfireOutboundChannelAdapterParserTests {
@Override
protected Object doInvoke(ExecutionCallback callback, Object target, Message<?> message) throws Exception {
adviceCalled++;
adviceCalled.countDown();
return null;
}