INT-3101 Allow PPC for 'durable' in GF CQ Adapter
JIRA: https://jira.spring.io/browse/INT-3101 Change schema type from xsd:boolean to union with string and boolean.
This commit is contained in:
@@ -110,12 +110,15 @@
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="durable" use="optional" type="xsd:boolean" default="false">
|
||||
<xsd:attribute name="durable" use="optional" default="false">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Indicates if the query is a durable subscription
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:annotation>
|
||||
<xsd:simpleType>
|
||||
<xsd:union memberTypes="xsd:string xsd:boolean"/>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
</xsd:extension>
|
||||
</xsd:complexContent>
|
||||
|
||||
@@ -1,13 +1,23 @@
|
||||
<?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:gfe="http://www.springframework.org/schema/gemfire"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:gfe="http://www.springframework.org/schema/gemfire"
|
||||
xmlns:int="http://www.springframework.org/schema/integration"
|
||||
xmlns:util="http://www.springframework.org/schema/util" xmlns:int-gfe="http://www.springframework.org/schema/integration/gemfire"
|
||||
xmlns:util="http://www.springframework.org/schema/util"
|
||||
xmlns:int-gfe="http://www.springframework.org/schema/integration/gemfire"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/integration/gemfire http://www.springframework.org/schema/integration/gemfire/spring-integration-gemfire.xsd
|
||||
http://www.springframework.org/schema/gemfire http://www.springframework.org/schema/gemfire/spring-gemfire.xsd
|
||||
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">
|
||||
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
|
||||
|
||||
<context:property-placeholder properties-ref="props" />
|
||||
|
||||
<util:properties id="props">
|
||||
<prop key="durable">true</prop>
|
||||
</util:properties>
|
||||
|
||||
<gfe:client-cache use-bean-factory-locator="false"
|
||||
id="client-cache" pool-name="client-pool" />
|
||||
@@ -22,9 +32,9 @@
|
||||
<gfe:cq-listener-container id="queryListenerContainer"
|
||||
cache="client-cache" />
|
||||
|
||||
<int-gfe:cq-inbound-channel-adapter
|
||||
<int-gfe:cq-inbound-channel-adapter id="withDurable"
|
||||
cq-listener-container="queryListenerContainer" query="select * from /test"
|
||||
channel="outputChannel1" durable="true" />
|
||||
channel="outputChannel1" durable="${durable}" />
|
||||
|
||||
<int:channel id="outputChannel1">
|
||||
<int:queue />
|
||||
|
||||
@@ -1,17 +1,21 @@
|
||||
/*
|
||||
* Copyright 2002-2011 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
|
||||
*
|
||||
*
|
||||
* 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.gemfire.inbound;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
|
||||
@@ -20,54 +24,57 @@ import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.integration.gemfire.fork.ForkUtil;
|
||||
import org.springframework.integration.test.util.TestUtils;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.PollableChannel;
|
||||
import org.springframework.integration.gemfire.fork.ForkUtil;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import com.gemstone.gemfire.cache.query.CqEvent;
|
||||
import com.gemstone.gemfire.internal.cache.LocalRegion;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
* @author David Turanski
|
||||
* @author Gary Russell
|
||||
*
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration
|
||||
public class CqInboundChannelAdapterTests {
|
||||
static ConfigurableApplicationContext staticCtx;
|
||||
|
||||
|
||||
@Autowired
|
||||
LocalRegion region;
|
||||
|
||||
|
||||
@Autowired
|
||||
ConfigurableApplicationContext applicationContext;
|
||||
|
||||
@Autowired
|
||||
|
||||
@Autowired
|
||||
PollableChannel outputChannel1;
|
||||
|
||||
@Autowired
|
||||
|
||||
@Autowired
|
||||
PollableChannel outputChannel2;
|
||||
|
||||
|
||||
@Autowired
|
||||
ContinuousQueryMessageProducer withDurable;
|
||||
|
||||
static OutputStream os;
|
||||
@BeforeClass
|
||||
public static void startUp() throws Exception {
|
||||
os = ForkUtil.cacheServer();
|
||||
}
|
||||
|
||||
|
||||
@Before
|
||||
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
staticCtx = applicationContext;
|
||||
assertTrue(TestUtils.getPropertyValue(withDurable, "durable", Boolean.class));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testCqEvent() throws InterruptedException {
|
||||
region.put("one",1);
|
||||
@@ -75,24 +82,24 @@ public class CqInboundChannelAdapterTests {
|
||||
assertNotNull(msg);
|
||||
assertTrue(msg.getPayload() instanceof CqEvent);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testPayloadExpression() throws InterruptedException {
|
||||
region.put("one",1);
|
||||
Message<?> msg = outputChannel2.receive(1000);
|
||||
assertNotNull(msg);
|
||||
assertEquals(1,msg.getPayload());
|
||||
assertEquals(1,msg.getPayload());
|
||||
}
|
||||
|
||||
|
||||
@AfterClass
|
||||
public static void cleanUp() {
|
||||
public static void cleanUp() {
|
||||
/*
|
||||
* Avoid shutdown errors
|
||||
*/
|
||||
staticCtx.close();
|
||||
sendSignal();
|
||||
}
|
||||
|
||||
|
||||
public static void sendSignal() {
|
||||
try {
|
||||
os.write("\n".getBytes());
|
||||
|
||||
Reference in New Issue
Block a user