SGF-81 - Fixed parsing of "use-bean-factory-locator" attribute.

This commit is contained in:
Oliver Gierke
2012-01-18 16:23:18 +00:00
parent e2690a6bc3
commit 1bdb42e12d
2 changed files with 10 additions and 5 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2011 the original author or authors.
* Copyright 2010-2012 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.
@@ -29,6 +29,7 @@ import org.w3c.dom.Element;
* Parser for <cache;gt; definitions.
*
* @author Costin Leau
* @author Oliver Gierke
*/
class CacheParser extends AbstractSingleBeanDefinitionParser {
@@ -48,6 +49,7 @@ class CacheParser extends AbstractSingleBeanDefinitionParser {
ParsingUtils.setPropertyValue(element, builder, "pdx-persistent", "pdxPersistent");
ParsingUtils.setPropertyValue(element, builder, "pdx-read-serialized", "pdxReadSerialized");
ParsingUtils.setPropertyValue(element, builder, "pdx-ignore-unread-fields", "pdxIgnoreUnreadFields");
ParsingUtils.setPropertyValue(element, builder, "use-bean-factory-locator", "useBeanFactoryLocator");
}
@Override

View File

@@ -16,10 +16,8 @@
package org.springframework.data.gemfire.config;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;
import org.junit.Test;
import org.springframework.core.io.Resource;
@@ -28,6 +26,7 @@ import org.springframework.data.gemfire.GemfireBeanFactoryLocator;
import org.springframework.data.gemfire.RecreatingContextTest;
import org.springframework.data.gemfire.TestUtils;
import org.springframework.data.gemfire.client.ClientCacheFactoryBean;
import org.springframework.test.util.ReflectionTestUtils;
/**
* @author Costin Leau
@@ -72,6 +71,10 @@ public class CacheNamespaceTest extends RecreatingContextTest {
public void testNoBeanFactory() throws Exception {
assertTrue(ctx.containsBean("no-bl"));
CacheFactoryBean cfb = (CacheFactoryBean) ctx.getBean("&no-bl");
assertThat((Boolean) ReflectionTestUtils.getField(cfb, "useBeanFactoryLocator"), is(false));
assertThat(ReflectionTestUtils.getField(cfb, "factoryLocator"), is(nullValue()));
GemfireBeanFactoryLocator locator = new GemfireBeanFactoryLocator();
try {
assertNotNull(locator.useBeanFactory("cache-with-name"));