Adding additional integration tests to test the configuration of concurrent, parallel AsyncEventQueues and GatewaySenders in GemFire 8 using Spring Data GemFire.
This commit is contained in:
@@ -0,0 +1,107 @@
|
||||
/*
|
||||
* Copyright 2010-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.data.gemfire.wan;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.util.List;
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import com.gemstone.gemfire.cache.DataPolicy;
|
||||
import com.gemstone.gemfire.cache.Region;
|
||||
import com.gemstone.gemfire.cache.asyncqueue.AsyncEvent;
|
||||
import com.gemstone.gemfire.cache.asyncqueue.AsyncEventListener;
|
||||
import com.gemstone.gemfire.cache.asyncqueue.AsyncEventQueue;
|
||||
import com.gemstone.gemfire.cache.wan.GatewaySender;
|
||||
|
||||
/**
|
||||
* The CachePartitionRegionWithConcurrentParallelAsyncEventQueueAndGatewaySenderIntegrationTest class is a test suite
|
||||
* of test cases testing the concurrent, parallel functionality configuration of GemFire AsyncEventQueues
|
||||
* and GatewaySenders using Spring Data GemFire.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.junit.runner.RunWith
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringJUnit4ClassRunner
|
||||
* @see com.gemstone.gemfire.cache.asyncqueue.AsyncEventQueue
|
||||
* @see com.gemstone.gemfire.cache.wan.GatewaySender
|
||||
* @since 1.5.0
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration
|
||||
@SuppressWarnings("unused")
|
||||
public class CachePartitionRegionWithConcurrentParallelAsyncEventQueueAndGatewaySenderIntegrationTest {
|
||||
|
||||
@Autowired
|
||||
private AsyncEventQueue exampleQueue;
|
||||
|
||||
@Autowired
|
||||
private GatewaySender exampleGateway;
|
||||
|
||||
@Resource(name = "ExampleRegion")
|
||||
private Region<?, ?> exampleRegion;
|
||||
|
||||
@Test
|
||||
public void testPartitionRegionWithConcurrentParallelAsyncEventQueueAndGatewaySenderConfiguration() {
|
||||
assertNotNull("The 'ExampleRegion' PARTITION Region was not properly configured and initialized!", exampleRegion);
|
||||
assertEquals("ExampleRegion", exampleRegion.getName());
|
||||
assertEquals("/ExampleRegion", exampleRegion.getFullPath());
|
||||
assertNotNull(exampleRegion.getAttributes());
|
||||
assertEquals(DataPolicy.PARTITION, exampleRegion.getAttributes().getDataPolicy());
|
||||
assertTrue(exampleRegion.getAttributes().getAsyncEventQueueIds().contains("ExampleQueue"));
|
||||
assertTrue(exampleRegion.getAttributes().getGatewaySenderIds().contains("ExampleGateway"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConcurrentParallelAsyncEventQueue() {
|
||||
assertNotNull("The 'ExampleQueue' AsyncEventQueue was not properly configured and initialized!", exampleQueue);
|
||||
assertEquals("ExampleQueue", exampleQueue.getId());
|
||||
assertNotNull(exampleQueue.getAsyncEventListener());
|
||||
assertEquals(4, exampleQueue.getDispatcherThreads());
|
||||
assertTrue(exampleQueue.isParallel());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConcurrentParallelGatewaySender() {
|
||||
assertNotNull("The 'ExampleGateway' was not properly configured and initialized!", exampleGateway);
|
||||
assertEquals("ExampleGateway", exampleGateway.getId());
|
||||
assertEquals(123, exampleGateway.getRemoteDSId());
|
||||
assertEquals(8, exampleGateway.getDispatcherThreads());
|
||||
assertTrue(exampleGateway.isParallel());
|
||||
assertFalse(exampleGateway.isRunning());
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public static final class TestAsyncEventListener implements AsyncEventListener {
|
||||
@Override public boolean processEvents(final List<AsyncEvent> events) {
|
||||
return false;
|
||||
}
|
||||
@Override public void close() {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:gfe="http://www.springframework.org/schema/gemfire"
|
||||
xmlns:util="http://www.springframework.org/schema/util"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/gemfire http://www.springframework.org/schema/gemfire/spring-gemfire.xsd
|
||||
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
|
||||
">
|
||||
|
||||
<util:properties id="gemfireProperties">
|
||||
<prop key="name">CachePartitionRegionWithConcurrentParallelAsyncEventQueueAndGatewaySenderIntegrationTest</prop>
|
||||
<prop key="mcast-port">0</prop>
|
||||
<prop key="log-level">warning</prop>
|
||||
</util:properties>
|
||||
|
||||
<gfe:cache properties-ref="gemfireProperties"/>
|
||||
|
||||
<gfe:async-event-queue id="ExampleQueue" dispatcher-threads="4" parallel="true">
|
||||
<gfe:async-event-listener>
|
||||
<bean class="org.springframework.data.gemfire.wan.CachePartitionRegionWithConcurrentParallelAsyncEventQueueAndGatewaySenderIntegrationTest$TestAsyncEventListener"/>
|
||||
</gfe:async-event-listener>
|
||||
</gfe:async-event-queue>
|
||||
|
||||
<gfe:gateway-sender id="ExampleGateway" remote-distributed-system-id="123" parallel="true" dispatcher-threads="8"
|
||||
manual-start="true"/>
|
||||
|
||||
<gfe:partitioned-region id="ExampleRegion" persistent="false">
|
||||
<gfe:gateway-sender-ref bean="ExampleGateway"/>
|
||||
<gfe:async-event-queue-ref bean="ExampleQueue"/>
|
||||
</gfe:partitioned-region>
|
||||
|
||||
</beans>
|
||||
Reference in New Issue
Block a user