Merge pull request #7 from dturanski/continuous
renamed Continous* to Continuous*
This commit is contained in:
@@ -23,9 +23,9 @@ import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
||||
import org.springframework.beans.factory.support.ManagedSet;
|
||||
import org.springframework.beans.factory.xml.AbstractSimpleBeanDefinitionParser;
|
||||
import org.springframework.beans.factory.xml.ParserContext;
|
||||
import org.springframework.data.gemfire.listener.ContinousQueryDefinition;
|
||||
import org.springframework.data.gemfire.listener.ContinousQueryListenerContainer;
|
||||
import org.springframework.data.gemfire.listener.adapter.ContinousQueryListenerAdapter;
|
||||
import org.springframework.data.gemfire.listener.ContinuousQueryDefinition;
|
||||
import org.springframework.data.gemfire.listener.ContinuousQueryListenerContainer;
|
||||
import org.springframework.data.gemfire.listener.adapter.ContinuousQueryListenerAdapter;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.util.xml.DomUtils;
|
||||
@@ -41,8 +41,8 @@ import org.w3c.dom.NamedNodeMap;
|
||||
class GemfireListenerContainerParser extends AbstractSimpleBeanDefinitionParser {
|
||||
|
||||
@Override
|
||||
protected Class<ContinousQueryListenerContainer> getBeanClass(Element element) {
|
||||
return ContinousQueryListenerContainer.class;
|
||||
protected Class<ContinuousQueryListenerContainer> getBeanClass(Element element) {
|
||||
return ContinuousQueryListenerContainer.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -85,14 +85,14 @@ class GemfireListenerContainerParser extends AbstractSimpleBeanDefinitionParser
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses a listener definition. Returns the listener bean reference definition (of a {@link ContinousQueryDefinition}).
|
||||
* Parses a listener definition. Returns the listener bean reference definition (of a {@link ContinuousQueryDefinition}).
|
||||
*
|
||||
* @param element
|
||||
* @return
|
||||
*/
|
||||
private BeanDefinition parseListener(Element element) {
|
||||
|
||||
BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(ContinousQueryListenerAdapter.class);
|
||||
BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(ContinuousQueryListenerAdapter.class);
|
||||
builder.addConstructorArgReference(element.getAttribute("ref"));
|
||||
|
||||
String attr = element.getAttribute("method");
|
||||
@@ -100,7 +100,7 @@ class GemfireListenerContainerParser extends AbstractSimpleBeanDefinitionParser
|
||||
builder.addPropertyValue("defaultListenerMethod", attr);
|
||||
}
|
||||
|
||||
BeanDefinitionBuilder defBuilder = BeanDefinitionBuilder.genericBeanDefinition(ContinousQueryDefinition.class);
|
||||
BeanDefinitionBuilder defBuilder = BeanDefinitionBuilder.genericBeanDefinition(ContinuousQueryDefinition.class);
|
||||
|
||||
attr = element.getAttribute("name");
|
||||
if (StringUtils.hasText(attr)) {
|
||||
|
||||
@@ -27,31 +27,31 @@ import com.gemstone.gemfire.cache.query.CqQuery;
|
||||
*
|
||||
* @author Costin Leau
|
||||
*/
|
||||
public class ContinousQueryDefinition implements InitializingBean {
|
||||
public class ContinuousQueryDefinition implements InitializingBean {
|
||||
|
||||
private String name = null, query = null;
|
||||
private ContinuousQueryListener listener = null;
|
||||
private boolean durable = false;
|
||||
|
||||
public ContinousQueryDefinition() {
|
||||
public ContinuousQueryDefinition() {
|
||||
}
|
||||
|
||||
public ContinousQueryDefinition(String query, ContinuousQueryListener listener) {
|
||||
public ContinuousQueryDefinition(String query, ContinuousQueryListener listener) {
|
||||
this(query, listener, false);
|
||||
}
|
||||
|
||||
public ContinousQueryDefinition(String query, ContinuousQueryListener listener, boolean durable) {
|
||||
public ContinuousQueryDefinition(String query, ContinuousQueryListener listener, boolean durable) {
|
||||
this.query = query;
|
||||
this.listener = listener;
|
||||
this.durable = durable;
|
||||
afterPropertiesSet();
|
||||
}
|
||||
|
||||
public ContinousQueryDefinition(String name, String query, ContinuousQueryListener listener) {
|
||||
public ContinuousQueryDefinition(String name, String query, ContinuousQueryListener listener) {
|
||||
this(name, query, listener, false);
|
||||
}
|
||||
|
||||
public ContinousQueryDefinition(String name, String query, ContinuousQueryListener listener, boolean durable) {
|
||||
public ContinuousQueryDefinition(String name, String query, ContinuousQueryListener listener, boolean durable) {
|
||||
this.name = name;
|
||||
this.query = query;
|
||||
this.listener = listener;
|
||||
@@ -51,7 +51,7 @@ import com.gemstone.gemfire.internal.concurrent.ConcurrentHashSet;
|
||||
*
|
||||
* @author Costin Leau
|
||||
*/
|
||||
public class ContinousQueryListenerContainer implements InitializingBean, DisposableBean, BeanNameAware, SmartLifecycle {
|
||||
public class ContinuousQueryListenerContainer implements InitializingBean, DisposableBean, BeanNameAware, SmartLifecycle {
|
||||
|
||||
private class EventDispatcherAdapter implements CqListener {
|
||||
private final ContinuousQueryListener delegate;
|
||||
@@ -78,7 +78,7 @@ public class ContinousQueryListenerContainer implements InitializingBean, Dispos
|
||||
/**
|
||||
* Default thread name prefix: "ContinousQueryListenerContainer-".
|
||||
*/
|
||||
public static final String DEFAULT_THREAD_NAME_PREFIX = ClassUtils.getShortName(ContinousQueryListenerContainer.class)
|
||||
public static final String DEFAULT_THREAD_NAME_PREFIX = ClassUtils.getShortName(ContinuousQueryListenerContainer.class)
|
||||
+ "-";
|
||||
|
||||
private Executor subscriptionExecutor;
|
||||
@@ -92,7 +92,7 @@ public class ContinousQueryListenerContainer implements InitializingBean, Dispos
|
||||
private volatile boolean initialized = false;
|
||||
private volatile boolean manageExecutor = false;
|
||||
|
||||
private Set<ContinousQueryDefinition> defs = new LinkedHashSet<ContinousQueryDefinition>();
|
||||
private Set<ContinuousQueryDefinition> defs = new LinkedHashSet<ContinuousQueryDefinition>();
|
||||
private Set<CqQuery> queries = new ConcurrentHashSet<CqQuery>();
|
||||
|
||||
private QueryService queryService;
|
||||
@@ -335,7 +335,7 @@ public class ContinousQueryListenerContainer implements InitializingBean, Dispos
|
||||
*
|
||||
* @param queries set of queries
|
||||
*/
|
||||
public void setQueryListeners(Set<ContinousQueryDefinition> queries) {
|
||||
public void setQueryListeners(Set<ContinuousQueryDefinition> queries) {
|
||||
defs.clear();
|
||||
defs.addAll(queries);
|
||||
}
|
||||
@@ -346,11 +346,11 @@ public class ContinousQueryListenerContainer implements InitializingBean, Dispos
|
||||
*
|
||||
* @param listener event cqQuery
|
||||
*/
|
||||
public void addListener(ContinousQueryDefinition cqQuery) {
|
||||
public void addListener(ContinuousQueryDefinition cqQuery) {
|
||||
doAddListener(cqQuery);
|
||||
}
|
||||
|
||||
private void initMapping(Set<ContinousQueryDefinition> queryDefinitions) {
|
||||
private void initMapping(Set<ContinuousQueryDefinition> queryDefinitions) {
|
||||
// stop the listener if currently running
|
||||
if (isRunning()) {
|
||||
stop();
|
||||
@@ -358,7 +358,7 @@ public class ContinousQueryListenerContainer implements InitializingBean, Dispos
|
||||
|
||||
closeQueries();
|
||||
|
||||
for (ContinousQueryDefinition def : queryDefinitions) {
|
||||
for (ContinuousQueryDefinition def : queryDefinitions) {
|
||||
addCQuery(def);
|
||||
}
|
||||
|
||||
@@ -368,7 +368,7 @@ public class ContinousQueryListenerContainer implements InitializingBean, Dispos
|
||||
}
|
||||
}
|
||||
|
||||
private void doAddListener(ContinousQueryDefinition def) {
|
||||
private void doAddListener(ContinuousQueryDefinition def) {
|
||||
CqQuery cq = addCQuery(def);
|
||||
|
||||
if (isRunning()) {
|
||||
@@ -376,7 +376,7 @@ public class ContinousQueryListenerContainer implements InitializingBean, Dispos
|
||||
}
|
||||
}
|
||||
|
||||
private CqQuery addCQuery(ContinousQueryDefinition def) {
|
||||
private CqQuery addCQuery(ContinuousQueryDefinition def) {
|
||||
try {
|
||||
CqAttributesFactory caf = new CqAttributesFactory();
|
||||
caf.addCqListener(new EventDispatcherAdapter(def.getListener()));
|
||||
@@ -17,13 +17,13 @@
|
||||
package org.springframework.data.gemfire.listener;
|
||||
|
||||
import org.springframework.dao.InvalidDataAccessApiUsageException;
|
||||
import org.springframework.data.gemfire.listener.adapter.ContinousQueryListenerAdapter;
|
||||
import org.springframework.data.gemfire.listener.adapter.ContinuousQueryListenerAdapter;
|
||||
|
||||
/**
|
||||
* Exception thrown when the execution of a listener method failed.
|
||||
*
|
||||
* @author Costin Leau
|
||||
* @see ContinousQueryListenerAdapter
|
||||
* @see ContinuousQueryListenerAdapter
|
||||
*/
|
||||
public class GemfireListenerExecutionFailedException extends InvalidDataAccessApiUsageException {
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ import com.gemstone.gemfire.cache.query.CqQuery;
|
||||
* @author Costin Leau
|
||||
* @see org.springframework.jms.listener.adapter.MessageListenerAdapter
|
||||
*/
|
||||
public class ContinousQueryListenerAdapter implements ContinuousQueryListener {
|
||||
public class ContinuousQueryListenerAdapter implements ContinuousQueryListener {
|
||||
|
||||
private class MethodInvoker {
|
||||
private final Object delegate;
|
||||
@@ -192,18 +192,18 @@ public class ContinousQueryListenerAdapter implements ContinuousQueryListener {
|
||||
private MethodInvoker invoker;
|
||||
|
||||
/**
|
||||
* Create a new {@link ContinousQueryListenerAdapter} with default settings.
|
||||
* Create a new {@link ContinuousQueryListenerAdapter} with default settings.
|
||||
*/
|
||||
public ContinousQueryListenerAdapter() {
|
||||
public ContinuousQueryListenerAdapter() {
|
||||
setDelegate(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new {@link ContinousQueryListenerAdapter} for the given delegate.
|
||||
* Create a new {@link ContinuousQueryListenerAdapter} for the given delegate.
|
||||
*
|
||||
* @param delegate the delegate object
|
||||
*/
|
||||
public ContinousQueryListenerAdapter(Object delegate) {
|
||||
public ContinuousQueryListenerAdapter(Object delegate) {
|
||||
setDelegate(delegate);
|
||||
}
|
||||
|
||||
@@ -1108,7 +1108,7 @@ Required.
|
||||
<xsd:attribute name="query" type="xsd:string" use="required">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The query for the GemFire continous query.
|
||||
The query for the GemFire continuous query.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
@@ -1123,14 +1123,14 @@ interface or provide a method named 'handleEvent'.
|
||||
<xsd:attribute name="name" type="xsd:string" use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The name of the resulting GemFire continous query. Useful for monitoring and statistics querying.
|
||||
The name of the resulting GemFire continuous query. Useful for monitoring and statistics querying.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="durable" type="xsd:string" use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Whether the resulting GemFire continous query is durable or not.
|
||||
Whether the resulting GemFire continuous query is durable or not.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.springframework.data.gemfire.ForkUtil;
|
||||
import org.springframework.data.gemfire.listener.adapter.ContinousQueryListenerAdapter;
|
||||
import org.springframework.data.gemfire.listener.adapter.ContinuousQueryListenerAdapter;
|
||||
|
||||
import com.gemstone.gemfire.cache.RegionService;
|
||||
import com.gemstone.gemfire.cache.client.ClientCacheFactory;
|
||||
@@ -38,7 +38,7 @@ import com.gemstone.gemfire.cache.query.CqEvent;
|
||||
public class ListenerContainerTests {
|
||||
|
||||
private final BlockingDeque<CqEvent> bag = new LinkedBlockingDeque<CqEvent>();
|
||||
protected ContinousQueryListenerContainer container;
|
||||
protected ContinuousQueryListenerContainer container;
|
||||
|
||||
private static RegionService cache = null;
|
||||
private static Pool pool = null;
|
||||
@@ -49,7 +49,7 @@ public class ListenerContainerTests {
|
||||
}
|
||||
};
|
||||
|
||||
private final ContinousQueryListenerAdapter adapter = new ContinousQueryListenerAdapter(handler);
|
||||
private final ContinuousQueryListenerAdapter adapter = new ContinuousQueryListenerAdapter(handler);
|
||||
|
||||
@BeforeClass
|
||||
public static void startUp() throws Exception {
|
||||
@@ -92,12 +92,12 @@ public class ListenerContainerTests {
|
||||
public void setUp() throws Exception {
|
||||
String query = "SELECT * from /test-cq";
|
||||
|
||||
container = new ContinousQueryListenerContainer();
|
||||
container = new ContinuousQueryListenerContainer();
|
||||
container.setCache(cache);
|
||||
//container.setPoolName("client");
|
||||
container.setBeanName("container");
|
||||
container.afterPropertiesSet();
|
||||
container.addListener(new ContinousQueryDefinition("test", query, adapter));
|
||||
container.addListener(new ContinuousQueryDefinition("test", query, adapter));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.springframework.context.support.GenericXmlApplicationContext;
|
||||
import org.springframework.data.gemfire.ForkUtil;
|
||||
import org.springframework.data.gemfire.listener.ContinousQueryListenerContainer;
|
||||
import org.springframework.data.gemfire.listener.ContinuousQueryListenerContainer;
|
||||
|
||||
import com.gemstone.gemfire.cache.Cache;
|
||||
import com.gemstone.gemfire.cache.client.Pool;
|
||||
@@ -51,7 +51,7 @@ public class ContainerXmlSetupTest {
|
||||
GenericXmlApplicationContext ctx = new GenericXmlApplicationContext(
|
||||
"/org/springframework/data/gemfire/listener/container.xml");
|
||||
|
||||
ContinousQueryListenerContainer container = ctx.getBean(ContinousQueryListenerContainer.class);
|
||||
ContinuousQueryListenerContainer container = ctx.getBean(ContinuousQueryListenerContainer.class);
|
||||
assertTrue(container.isRunning());
|
||||
|
||||
Cache cache = ctx.getBean("gemfire-cache", Cache.class);
|
||||
|
||||
@@ -37,11 +37,11 @@ import com.gemstone.gemfire.cache.query.internal.CqQueryImpl;
|
||||
*/
|
||||
public class QueryListenerAdapterTest {
|
||||
|
||||
private ContinousQueryListenerAdapter adapter;
|
||||
private ContinuousQueryListenerAdapter adapter;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
adapter = new ContinousQueryListenerAdapter();
|
||||
adapter = new ContinuousQueryListenerAdapter();
|
||||
}
|
||||
|
||||
CqEvent event() {
|
||||
@@ -113,14 +113,14 @@ public class QueryListenerAdapterTest {
|
||||
|
||||
@Test
|
||||
public void testThatTheDefaultHandlingMethodNameIsTheConstantDefault() throws Exception {
|
||||
assertEquals(ContinousQueryListenerAdapter.ORIGINAL_DEFAULT_LISTENER_METHOD, adapter.getDefaultListenerMethod());
|
||||
assertEquals(ContinuousQueryListenerAdapter.ORIGINAL_DEFAULT_LISTENER_METHOD, adapter.getDefaultListenerMethod());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAdapterWithListenerAndDefaultMessage() throws Exception {
|
||||
ContinuousQueryListener mock = mock(ContinuousQueryListener.class);
|
||||
|
||||
ContinousQueryListenerAdapter adapter = new ContinousQueryListenerAdapter(mock);
|
||||
ContinuousQueryListenerAdapter adapter = new ContinuousQueryListenerAdapter(mock);
|
||||
CqEvent event = event();
|
||||
adapter.onEvent(event);
|
||||
verify(mock).onEvent(event);
|
||||
@@ -129,7 +129,7 @@ public class QueryListenerAdapterTest {
|
||||
@Test
|
||||
public void testHandleEvent() throws Exception {
|
||||
Delegate mock = mock(Delegate.class);
|
||||
ContinousQueryListenerAdapter adapter = new ContinousQueryListenerAdapter(mock);
|
||||
ContinuousQueryListenerAdapter adapter = new ContinuousQueryListenerAdapter(mock);
|
||||
CqEvent event = event();
|
||||
|
||||
adapter.onEvent(event);
|
||||
@@ -139,7 +139,7 @@ public class QueryListenerAdapterTest {
|
||||
@Test
|
||||
public void testHandleArray() throws Exception {
|
||||
Delegate mock = mock(Delegate.class);
|
||||
ContinousQueryListenerAdapter adapter = new ContinousQueryListenerAdapter(mock);
|
||||
ContinuousQueryListenerAdapter adapter = new ContinuousQueryListenerAdapter(mock);
|
||||
adapter.setDefaultListenerMethod("handleArray");
|
||||
CqEvent event = event();
|
||||
adapter.onEvent(event);
|
||||
@@ -149,7 +149,7 @@ public class QueryListenerAdapterTest {
|
||||
@Test
|
||||
public void testHandleKey() throws Exception {
|
||||
Delegate mock = mock(Delegate.class);
|
||||
ContinousQueryListenerAdapter adapter = new ContinousQueryListenerAdapter(mock);
|
||||
ContinuousQueryListenerAdapter adapter = new ContinuousQueryListenerAdapter(mock);
|
||||
adapter.setDefaultListenerMethod("handleKey");
|
||||
CqEvent event = event();
|
||||
|
||||
@@ -160,7 +160,7 @@ public class QueryListenerAdapterTest {
|
||||
@Test
|
||||
public void testHandleKV() throws Exception {
|
||||
Delegate mock = mock(Delegate.class);
|
||||
ContinousQueryListenerAdapter adapter = new ContinousQueryListenerAdapter(mock);
|
||||
ContinuousQueryListenerAdapter adapter = new ContinuousQueryListenerAdapter(mock);
|
||||
adapter.setDefaultListenerMethod("handleKV");
|
||||
CqEvent event = event();
|
||||
|
||||
@@ -171,7 +171,7 @@ public class QueryListenerAdapterTest {
|
||||
@Test
|
||||
public void testHandleEx() throws Exception {
|
||||
Delegate mock = mock(Delegate.class);
|
||||
ContinousQueryListenerAdapter adapter = new ContinousQueryListenerAdapter(mock);
|
||||
ContinuousQueryListenerAdapter adapter = new ContinuousQueryListenerAdapter(mock);
|
||||
adapter.setDefaultListenerMethod("handleEx");
|
||||
CqEvent event = event();
|
||||
|
||||
@@ -182,7 +182,7 @@ public class QueryListenerAdapterTest {
|
||||
@Test
|
||||
public void testHandleOps() throws Exception {
|
||||
Delegate mock = mock(Delegate.class);
|
||||
ContinousQueryListenerAdapter adapter = new ContinousQueryListenerAdapter(mock);
|
||||
ContinuousQueryListenerAdapter adapter = new ContinuousQueryListenerAdapter(mock);
|
||||
adapter.setDefaultListenerMethod("handleOps");
|
||||
CqEvent event = event();
|
||||
|
||||
@@ -193,7 +193,7 @@ public class QueryListenerAdapterTest {
|
||||
@Test
|
||||
public void testHandleAll() throws Exception {
|
||||
Delegate mock = mock(Delegate.class);
|
||||
ContinousQueryListenerAdapter adapter = new ContinousQueryListenerAdapter(mock);
|
||||
ContinuousQueryListenerAdapter adapter = new ContinuousQueryListenerAdapter(mock);
|
||||
adapter.setDefaultListenerMethod("handleAll");
|
||||
CqEvent event = event();
|
||||
|
||||
@@ -205,7 +205,7 @@ public class QueryListenerAdapterTest {
|
||||
@Test
|
||||
public void testInvalid() throws Exception {
|
||||
Delegate mock = mock(Delegate.class);
|
||||
ContinousQueryListenerAdapter adapter = new ContinousQueryListenerAdapter(mock);
|
||||
ContinuousQueryListenerAdapter adapter = new ContinuousQueryListenerAdapter(mock);
|
||||
adapter.setDefaultListenerMethod("handleInvalid");
|
||||
|
||||
adapter.onEvent(event());
|
||||
|
||||
Reference in New Issue
Block a user