SGF-186 - fixed BeanFactoryLocator issue
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?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:gfe-data="http://www.springframework.org/schema/data/gemfire"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/gemfire http://www.springframework.org/schema/gemfire/spring-gemfire-1.3.xsd
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/data/gemfire http://www.springframework.org/schema/data/gemfire/spring-data-gemfire-1.3.xsd">
|
||||
<!-- SGF-186 -->
|
||||
<gfe:client-cache/>
|
||||
<gfe:pool>
|
||||
<gfe:locator host="localhost" port="10334" />
|
||||
</gfe:pool>
|
||||
|
||||
<gfe-data:function-executions base-package="org.springframework.data.gemfire.function.config.four" />
|
||||
|
||||
</beans>
|
||||
Reference in New Issue
Block a user