diff --git a/src/main/java/org/springframework/data/gemfire/CacheFactoryBean.java b/src/main/java/org/springframework/data/gemfire/CacheFactoryBean.java index 300cdc26..dda291bd 100644 --- a/src/main/java/org/springframework/data/gemfire/CacheFactoryBean.java +++ b/src/main/java/org/springframework/data/gemfire/CacheFactoryBean.java @@ -241,8 +241,8 @@ public class CacheFactoryBean implements BeanNameAware, BeanFactoryAware, BeanCl protected Object gatewayConflictResolver; private void init() throws Exception { - // initialize locator - if (useBeanFactoryLocator) { + + if (useBeanFactoryLocator && factoryLocator == null) { factoryLocator = new GemfireBeanFactoryLocator(); factoryLocator.setBeanFactory(beanFactory); factoryLocator.setBeanName(beanName); diff --git a/src/test/java/org/springframework/data/gemfire/function/config/FunctionsWithClientCacheTests.java b/src/test/java/org/springframework/data/gemfire/function/config/FunctionsWithClientCacheTests.java new file mode 100644 index 00000000..d28761ff --- /dev/null +++ b/src/test/java/org/springframework/data/gemfire/function/config/FunctionsWithClientCacheTests.java @@ -0,0 +1,36 @@ +/* + * Copyright 2002-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.function.config; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.data.gemfire.test.GemfireTestApplicationContextInitializer; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +/** + * @author David Turanski + * + */ +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(initializers = GemfireTestApplicationContextInitializer.class) +public class FunctionsWithClientCacheTests { + + + @Test + public void test() { + //Just make sure this comes up for SGF-186 + } + +} + diff --git a/src/test/java/org/springframework/data/gemfire/function/config/XmlConfiguredFunctionExecutionIntegrationTests.java b/src/test/java/org/springframework/data/gemfire/function/config/XmlConfiguredFunctionExecutionIntegrationTests.java index b58804c9..52e0d753 100644 --- a/src/test/java/org/springframework/data/gemfire/function/config/XmlConfiguredFunctionExecutionIntegrationTests.java +++ b/src/test/java/org/springframework/data/gemfire/function/config/XmlConfiguredFunctionExecutionIntegrationTests.java @@ -34,27 +34,23 @@ import com.gemstone.gemfire.cache.Region; * */ @RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(initializers=GemfireTestApplicationContextInitializer.class) +@ContextConfiguration(initializers = GemfireTestApplicationContextInitializer.class) public class XmlConfiguredFunctionExecutionIntegrationTests { @Autowired - ApplicationContext context; - + ApplicationContext context; + @Test public void testProxyFactoryBeanCreated() throws Exception { - OnRegionFunctionProxyFactoryBean factoryBean = (OnRegionFunctionProxyFactoryBean)context.getBean("&testFunction"); - Class serviceInterface = TestUtils.readField("serviceInterface",factoryBean); + OnRegionFunctionProxyFactoryBean factoryBean = (OnRegionFunctionProxyFactoryBean) context + .getBean("&testFunction"); + Class serviceInterface = TestUtils.readField("serviceInterface", factoryBean); assertEquals(serviceInterface, TestOnRegionFunction.class); - - Region r1 = context.getBean("r1",Region.class); - - GemfireOnRegionFunctionTemplate template = TestUtils.readField("gemfireFunctionOperations",factoryBean); - - assertSame(r1, TestUtils.readField("region",template)); + + Region r1 = context.getBean("r1", Region.class); + + GemfireOnRegionFunctionTemplate template = TestUtils.readField("gemfireFunctionOperations", factoryBean); + + assertSame(r1, TestUtils.readField("region", template)); } - + } - - - - - diff --git a/src/test/java/org/springframework/data/gemfire/function/config/four/TestFunctionExecution.java b/src/test/java/org/springframework/data/gemfire/function/config/four/TestFunctionExecution.java new file mode 100644 index 00000000..1093743c --- /dev/null +++ b/src/test/java/org/springframework/data/gemfire/function/config/four/TestFunctionExecution.java @@ -0,0 +1,10 @@ +package org.springframework.data.gemfire.function.config.four; + +import org.springframework.data.gemfire.function.annotation.FunctionId; +import org.springframework.data.gemfire.function.annotation.OnServer; + +@OnServer +public interface TestFunctionExecution { + @FunctionId("f1") + public String getString(Object arg1); +} \ No newline at end of file diff --git a/src/test/resources/org/springframework/data/gemfire/function/config/FunctionsWithClientCacheTests-context.xml b/src/test/resources/org/springframework/data/gemfire/function/config/FunctionsWithClientCacheTests-context.xml new file mode 100644 index 00000000..21384749 --- /dev/null +++ b/src/test/resources/org/springframework/data/gemfire/function/config/FunctionsWithClientCacheTests-context.xml @@ -0,0 +1,17 @@ + + + + + + + + + + +