Projects >> spring-data-gemfire >>f1a2ab2666c8015a2c985465f7248e89b13fab04

Chunk
Conflicting content
		DisposableBean {
public class ClientRegionFactoryBean extends RegionLookupFactoryBean implements BeanFactoryAware,

<<<<<<< HEAD
	private static final Log log = LogFactory.getLog(ClientRegionFactoryBean.class);

	private boolean close = false;
	private boolean destroy = false;

	private BeanFactory beanFactory;

	private CacheListener[] cacheListeners;

	private CacheLoader cacheLoader;

	private CacheWriter cacheWriter;
=======
	private boolean close = true;
	private boolean destroy = false;

	private BeanFactory beanFactory;

	private Boolean persistent;

	private CacheListener[] cacheListeners;
>>>>>>> 0f819f2e04382756d50be6177e7f5766012ed8a3

	private ClientRegionShortcut shortcut = null;
Solution content
public class ClientRegionFactoryBean extends RegionLookupFactoryBean implements BeanFactoryAware,
		DisposableBean {

	private static final Log log = LogFactory.getLog(ClientRegionFactoryBean.class);

	private boolean close = false;
	private boolean destroy = false;

	private BeanFactory beanFactory;

	private Boolean persistent;

	private CacheListener[] cacheListeners;

	private CacheLoader cacheLoader;

	private CacheWriter cacheWriter;

	private ClientRegionShortcut shortcut = null;
File
ClientRegionFactoryBean.java
Developer's decision
Combination
Kind of conflict
Attribute
Method invocation
Chunk
Conflicting content
	private DataPolicy dataPolicy;

	private Interest[] interests;
<<<<<<< HEAD

	private RegionAttributes attributes;

	private Resource snapshot;

	private String dataPolicyName;
=======

	private RegionAttributes attributes;

	private Resource snapshot;

>>>>>>> 0f819f2e04382756d50be6177e7f5766012ed8a3
	private String diskStoreName;
	private String poolName;
Solution content
	private DataPolicy dataPolicy;

	private Interest[] interests;

	private RegionAttributes attributes;

	private Resource snapshot;

	private String diskStoreName;
	private String poolName;
File
ClientRegionFactoryBean.java
Developer's decision
Version 2
Kind of conflict
Attribute
Chunk
Conflicting content
	@Override
	protected Region lookupFallback(GemFireCache cache, String regionName) throws Exception {
<<<<<<< HEAD
		Assert.isTrue(cache instanceof ClientCache, String.format("Unable to create regions from %1$s", cache));

		// TODO reference to an internal GemFire class!
		if (cache instanceof GemFireCacheImpl) {
			Assert.isTrue(((GemFireCacheImpl) cache).isClient(), "A client-cache instance is required");
		}

		Assert.isTrue(!(StringUtils.hasText(dataPolicyName) && dataPolicy != null),
			"Only one of 'dataPolicy' or 'dataPolicyName' can be set");

		if (StringUtils.hasText(dataPolicyName)) {
			dataPolicy = new DataPolicyConverter().convert(dataPolicyName);
			Assert.notNull(dataPolicy, "Data policy " + dataPolicyName + " is invalid");
		}

		// first look at shortcut
		ClientRegionShortcut shortcut = this.shortcut;

		if (shortcut == null) {
			if (dataPolicy != null) {
				if (DataPolicy.EMPTY.equals(dataPolicy)) {
					shortcut = ClientRegionShortcut.PROXY;
				}
				else if (DataPolicy.NORMAL.equals(this.dataPolicy)) {
					shortcut = ClientRegionShortcut.CACHING_PROXY;
				}
				else if (DataPolicy.PERSISTENT_REPLICATE.equals(dataPolicy)) {
					shortcut = ClientRegionShortcut.LOCAL_PERSISTENT;
				}
				else {
					shortcut = ClientRegionShortcut.LOCAL;
				}
			}
			else {
				shortcut = ClientRegionShortcut.LOCAL;
			}
		}

		ClientRegionFactory factory = ((ClientCache) cache).createClientRegionFactory(shortcut);
=======
		Assert.isTrue(cache instanceof ClientCache, "Unable to create regions from " + cache);

		// TODO use of GemFire internal class!
		if (cache instanceof GemFireCacheImpl) {
			Assert.isTrue(((GemFireCacheImpl) cache).isClient(), "A client-cache instance is required.");
		}

		final ClientCache clientCache = (ClientCache) cache;

		// first look at shortcut
		ClientRegionFactory factory = clientCache.createClientRegionFactory(resolveClientRegionShortcut());
>>>>>>> 0f819f2e04382756d50be6177e7f5766012ed8a3

		// map the attributes onto the client
		if (attributes != null) {
Solution content
	@Override
	protected Region lookupFallback(GemFireCache cache, String regionName) throws Exception {
		Assert.isTrue(cache instanceof ClientCache, String.format("Unable to create regions from %1$s", cache));

		// TODO reference to an internal GemFire class!
		if (cache instanceof GemFireCacheImpl) {
			Assert.isTrue(((GemFireCacheImpl) cache).isClient(), "A client-cache instance is required.");
		}

		final ClientCache clientCache = (ClientCache) cache;

		ClientRegionFactory factory = clientCache.createClientRegionFactory(resolveClientRegionShortcut());

		// map region attributes onto the client region factory
		if (attributes != null) {
File
ClientRegionFactoryBean.java
Developer's decision
Combination
Kind of conflict
Cast expression
Comment
If statement
Method invocation
Variable
Chunk
Conflicting content
			factory.setDiskStoreName(diskStoreName);
		}

<<<<<<< HEAD
		Region clientRegion = factory.create(regionName);
		log.info("Created new cache region [" + regionName + "]");

		if (snapshot != null) {
			clientRegion.loadSnapshot(snapshot.getInputStream());
		}

		return clientRegion;
	}

	private void addCacheListeners(ClientRegionFactory factory) {
		if (attributes != null) {
			CacheListener[] listeners = attributes.getCacheListeners();

			if (!ObjectUtils.isEmpty(listeners)) {
				for (CacheListener listener : listeners) {
					factory.addCacheListener(listener);
				}
			}
		}

		if (!ObjectUtils.isEmpty(cacheListeners)) {
			for (CacheListener listener : cacheListeners) {
				factory.addCacheListener(listener);
			}
		}
=======
		Region region = factory.create(regionName);
		log.info("Created new cache region [" + regionName + "]");

		if (snapshot != null) {
			region.loadSnapshot(snapshot.getInputStream());
		}

		return region;
	}

	protected ClientRegionShortcut resolveClientRegionShortcut() {
		ClientRegionShortcut resolvedShortcut = this.shortcut;

		if (resolvedShortcut == null) {
			if (this.dataPolicy != null) {
				assertDataPolicyAndPersistentAttributeAreCompatible(this.dataPolicy);

				if (DataPolicy.EMPTY.equals(this.dataPolicy)) {
					resolvedShortcut = ClientRegionShortcut.PROXY;
				}
				else if (DataPolicy.NORMAL.equals(this.dataPolicy)) {
					resolvedShortcut = ClientRegionShortcut.CACHING_PROXY;
				}
				else if (DataPolicy.PERSISTENT_REPLICATE.equals(this.dataPolicy)) {
					resolvedShortcut = ClientRegionShortcut.LOCAL_PERSISTENT;
				}
				else {
					// NOTE the Data Policy validation is based on the ClientRegionShortcut initialization logic
					// in com.gemstone.gemfire.internal.cache.GemFireCacheImpl.initializeClientRegionShortcuts
					throw new IllegalArgumentException(String.format(
						"Data Policy '%1$s' is invalid for Client Regions.", this.dataPolicy));
				}
			}
			else {
				resolvedShortcut = (isPersistent() ? ClientRegionShortcut.LOCAL_PERSISTENT
					: ClientRegionShortcut.LOCAL);
			}

		}

		// NOTE the ClientRegionShortcut and Persistent attribute will be compatible if the shortcut was derived from
		// the Data Policy.
		assertClientRegionShortcutAndPersistentAttributeAreCompatible(resolvedShortcut);

		return resolvedShortcut;
>>>>>>> 0f819f2e04382756d50be6177e7f5766012ed8a3
	}

	protected void postProcess(Region region) {
Solution content
			factory.setDiskStoreName(diskStoreName);
		}

		Region clientRegion = factory.create(regionName);
		log.info("Created new cache region [" + regionName + "]");

		if (snapshot != null) {
			clientRegion.loadSnapshot(snapshot.getInputStream());
		}

		return clientRegion;
	}

	protected ClientRegionShortcut resolveClientRegionShortcut() {
		ClientRegionShortcut resolvedShortcut = this.shortcut;

		if (resolvedShortcut == null) {
			if (this.dataPolicy != null) {
				assertDataPolicyAndPersistentAttributeAreCompatible(this.dataPolicy);

				if (DataPolicy.EMPTY.equals(this.dataPolicy)) {
					resolvedShortcut = ClientRegionShortcut.PROXY;
				}
				else if (DataPolicy.NORMAL.equals(this.dataPolicy)) {
					resolvedShortcut = ClientRegionShortcut.CACHING_PROXY;
				}
				else if (DataPolicy.PERSISTENT_REPLICATE.equals(this.dataPolicy)) {
					resolvedShortcut = ClientRegionShortcut.LOCAL_PERSISTENT;
				}
				else {
					// NOTE the Data Policy validation is based on the ClientRegionShortcut initialization logic
					// in com.gemstone.gemfire.internal.cache.GemFireCacheImpl.initializeClientRegionShortcuts
					throw new IllegalArgumentException(String.format(
						"Data Policy '%1$s' is invalid for Client Regions.", this.dataPolicy));
				}
			}
			else {
				resolvedShortcut = (isPersistent() ? ClientRegionShortcut.LOCAL_PERSISTENT
					: ClientRegionShortcut.LOCAL);
			}

		}

		// NOTE the ClientRegionShortcut and Persistent attribute will be compatible if the shortcut was derived from
		// the Data Policy.
		assertClientRegionShortcutAndPersistentAttributeAreCompatible(resolvedShortcut);

		return resolvedShortcut;
	}
File
ClientRegionFactoryBean.java
Developer's decision
Combination
Kind of conflict
Attribute
Comment
If statement
Method invocation
Method signature
Return statement
Variable
Chunk
Conflicting content
	}
	}

	/**
<<<<<<< HEAD
	 * Sets the CacheLoader used to load data local to the client's Region on cache misses.
	 * 

* @param cacheLoader a GemFire CacheLoader used to load data into the client Region. * @see com.gemstone.gemfire.cache.CacheLoader */ public void setCacheLoader(CacheLoader cacheLoader) { this.cacheLoader = cacheLoader; } /** * Sets the CacheWriter used to perform a synchronous write-behind when data is put into the client's Region. *

* @param cacheWriter the GemFire CacheWriter used to perform synchronous write-behinds on put ops. * @see com.gemstone.gemfire.cache.CacheWriter */ public void setCacheWriter(CacheWriter cacheWriter) { this.cacheWriter = cacheWriter; /** * Sets the data policy. Used only when a new region is created. * * @param dataPolicy the region data policy ======= * Sets the Data Policy. Used only when a new Region is created. *

* @param dataPolicy the client Region's Data Policy. * @see com.gemstone.gemfire.cache.DataPolicy >>>>>>> 0f819f2e04382756d50be6177e7f5766012ed8a3 */ public void setDataPolicy(DataPolicy dataPolicy) { this.dataPolicy = dataPolicy;

Solution content
	 */
	public void setDataPolicy(DataPolicy dataPolicy) {
	/**
	 * Sets the CacheLoader used to load data local to the client's Region on cache misses.
	 * 

* @param cacheLoader a GemFire CacheLoader used to load data into the client Region. * @see com.gemstone.gemfire.cache.CacheLoader */ public void setCacheLoader(CacheLoader cacheLoader) { this.cacheLoader = cacheLoader; } /** * Sets the CacheWriter used to perform a synchronous write-behind when data is put into the client's Region. *

* @param cacheWriter the GemFire CacheWriter used to perform synchronous write-behinds on put ops. * @see com.gemstone.gemfire.cache.CacheWriter */ public void setCacheWriter(CacheWriter cacheWriter) { this.cacheWriter = cacheWriter; } /** * Sets the Data Policy. Used only when a new Region is created. *

* @param dataPolicy the client Region's Data Policy. * @see com.gemstone.gemfire.cache.DataPolicy this.dataPolicy = dataPolicy;

File
ClientRegionFactoryBean.java
Developer's decision
Combination
Kind of conflict
Comment
Method declaration
Chunk
Conflicting content
		this.diskStoreName = diskStoreName;
	}

<<<<<<< HEAD
	/**
	 * Sets the region attributes used for the region used by this factory.
	 * Allows maximum control in specifying the region settings. Used only when
	 * a new region is created. Note that using this method allows for advanced
	 * customization of the region - while it provides a lot of flexibility,
	 * note that it's quite easy to create misconfigured regions (especially in
	 * a client/server scenario).
	 * 
	 * @param attributes the attributes to set on a newly created region
	 */
	public void setAttributes(RegionAttributes attributes) {
		this.attributes = attributes;
	}

=======
>>>>>>> 0f819f2e04382756d50be6177e7f5766012ed8a3
}
Solution content
	}

	/**
	 * Sets the snapshots used for loading a newly created region. That
	 * is, the snapshot will be used only when a new region is created -
	 * if the region already exists, no loading will be performed.
	 * 

* @param snapshot the snapshot to set * @see #setName(String) */ public void setSnapshot(Resource snapshot) { this.snapshot = snapshot; } }

File
ClientRegionFactoryBean.java
Developer's decision
Manual
Kind of conflict
Comment
Method declaration
Chunk
Conflicting content
import org.w3c.dom.Element;

/**
<<<<<<< HEAD
 * Parser for <client-region;gt; definitions.
=======
 * Parser for <client-region;gt; bean definitions.
>>>>>>> 0f819f2e04382756d50be6177e7f5766012ed8a3
 * 

* To avoid eager evaluations, the region interests are declared as nested definition. *

Solution content
import org.w3c.dom.Element;

/**
 * Parser for <client-region;gt; bean definitions.
 * 

* To avoid eager evaluations, the region interests are declared as nested definition. *

File
ClientRegionParser.java
Developer's decision
Version 2
Kind of conflict
Comment
Chunk
Conflicting content
		String cacheRefAttributeValue = element.getAttribute("cache-ref");
	protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
		super.doParse(element, builder);

<<<<<<< HEAD
		String cacheRefAttribute = element.getAttribute("cache-ref");

		builder.addPropertyReference("cache", (StringUtils.hasText(cacheRefAttribute) ? cacheRefAttribute
			: GemfireConstants.DEFAULT_GEMFIRE_CACHE_NAME));

		ParsingUtils.setPropertyValue(element, builder, "close");
		ParsingUtils.setPropertyValue(element, builder, "destroy");
		ParsingUtils.setPropertyValue(element, builder, "data-policy", "dataPolicyName");
		ParsingUtils.setPropertyValue(element, builder, "name");
		ParsingUtils.setPropertyValue(element, builder, "pool-name");
		ParsingUtils.setPropertyValue(element, builder, "shortcut");

		parseDiskStoreAttribute(element, builder);

		boolean dataPolicyFrozen = false;

		// TODO why is the DataPolicy determined in the ClientRegionParser and not in the ClientRegionFactoryBean when evaluating the configuration settings?
		// set the persistent policy
		if (Boolean.parseBoolean(element.getAttribute("persistent"))) {
			builder.addPropertyValue("dataPolicy", DataPolicy.PERSISTENT_REPLICATE);
			dataPolicyFrozen = true;
		}

		// eviction + expiration + overflow + optional client region attributes
		BeanDefinitionBuilder regionAttributesBuilder = BeanDefinitionBuilder.genericBeanDefinition(
			RegionAttributesFactoryBean.class);

		boolean overwriteDataPolicy = ParsingUtils.parseEviction(parserContext, element, regionAttributesBuilder);

		ParsingUtils.parseOptionalRegionAttributes(parserContext, element, regionAttributesBuilder);
		ParsingUtils.parseStatistics(element, regionAttributesBuilder);
		// NOTE parsing 'expiration' attributes must happen after parsing the user-defined setting for 'statistics'
		// in GemFire this attribute corresponds to the RegionAttributes 'statistics-enabled' setting).  If the user
		// configured expiration settings (any?), then statistics must be enabled, regardless if the user explicitly
		// disabled them.
		ParsingUtils.parseExpiration(parserContext, element, regionAttributesBuilder);

		// TODO understand why this determination is not made in the FactoryBean?
		if (!dataPolicyFrozen && overwriteDataPolicy) {
			builder.addPropertyValue("dataPolicy", DataPolicy.NORMAL);
		}
=======
		validateDataPolicyShortcutMutualExclusion(element, parserContext);


		builder.addPropertyReference("cache", (StringUtils.hasText(cacheRefAttributeValue) ? cacheRefAttributeValue
			: GemfireConstants.DEFAULT_GEMFIRE_CACHE_NAME));

		ParsingUtils.setPropertyValue(element, builder, "close");
		ParsingUtils.setPropertyValue(element, builder, "destroy");
		ParsingUtils.setPropertyValue(element, builder, "data-policy", "dataPolicyName");
		ParsingUtils.setPropertyValue(element, builder, "name");
		ParsingUtils.setPropertyValue(element, builder, "persistent");
		ParsingUtils.setPropertyValue(element, builder, "pool-name");
		ParsingUtils.setPropertyValue(element, builder, "shortcut");

		String diskStoreRefAttributeValue = element.getAttribute("disk-store-ref");

		if (StringUtils.hasText(diskStoreRefAttributeValue)) {
			ParsingUtils.setPropertyValue(element, builder, "disk-store-ref", "diskStoreName");
			builder.addDependsOn(diskStoreRefAttributeValue);
		}

		// Client RegionAttributes for overflow/eviction, expiration and statistics
		BeanDefinitionBuilder regionAttributesBuilder = BeanDefinitionBuilder.genericBeanDefinition(
			RegionAttributesFactoryBean.class);

		ParsingUtils.parseOptionalRegionAttributes(parserContext, element, regionAttributesBuilder);
		ParsingUtils.parseStatistics(element, regionAttributesBuilder);
		ParsingUtils.parseEviction(parserContext, element, regionAttributesBuilder);
		ParsingUtils.parseExpiration(parserContext, element, regionAttributesBuilder);
>>>>>>> 0f819f2e04382756d50be6177e7f5766012ed8a3

		builder.addPropertyValue("attributes", regionAttributesBuilder.getBeanDefinition());
Solution content
	protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
		super.doParse(element, builder);

		validateDataPolicyShortcutMutualExclusion(element, parserContext);

		String cacheRefAttributeValue = element.getAttribute("cache-ref");

		builder.addPropertyReference("cache", (StringUtils.hasText(cacheRefAttributeValue) ? cacheRefAttributeValue
			: GemfireConstants.DEFAULT_GEMFIRE_CACHE_NAME));

		ParsingUtils.setPropertyValue(element, builder, "close");
		ParsingUtils.setPropertyValue(element, builder, "destroy");
		ParsingUtils.setPropertyValue(element, builder, "data-policy", "dataPolicyName");
		ParsingUtils.setPropertyValue(element, builder, "name");
		ParsingUtils.setPropertyValue(element, builder, "persistent");
		ParsingUtils.setPropertyValue(element, builder, "pool-name");
		ParsingUtils.setPropertyValue(element, builder, "shortcut");

		parseDiskStoreAttribute(element, builder);

		// Client RegionAttributes for overflow/eviction, expiration and statistics
		BeanDefinitionBuilder regionAttributesBuilder = BeanDefinitionBuilder.genericBeanDefinition(
			RegionAttributesFactoryBean.class);

		ParsingUtils.parseOptionalRegionAttributes(parserContext, element, regionAttributesBuilder);
		ParsingUtils.parseStatistics(element, regionAttributesBuilder);
		ParsingUtils.parseEviction(parserContext, element, regionAttributesBuilder);
		ParsingUtils.parseExpiration(parserContext, element, regionAttributesBuilder);

		builder.addPropertyValue("attributes", regionAttributesBuilder.getBeanDefinition());
File
ClientRegionParser.java
Developer's decision
Combination
Kind of conflict
Comment
If statement
Method invocation
Variable
Chunk
Conflicting content
		List subElements = DomUtils.getChildElements(element);
		ManagedList interests = new ManagedList();

<<<<<<< HEAD
		// parse nested elements
=======
>>>>>>> 0f819f2e04382756d50be6177e7f5766012ed8a3
		for (Element subElement : subElements) {
			String subElementLocalName = subElement.getLocalName();
Solution content
		List subElements = DomUtils.getChildElements(element);
		ManagedList interests = new ManagedList();

		for (Element subElement : subElements) {
			String subElementLocalName = subElement.getLocalName();
File
ClientRegionParser.java
Developer's decision
Version 2
Kind of conflict
Comment
Chunk
Conflicting content
		for (Element subElement : subElements) {
			String subElementLocalName = subElement.getLocalName();

<<<<<<< HEAD
			if ("cache-listener".equals(subElementLocalName)) {
				builder.addPropertyValue("cacheListeners", ParsingUtils.parseRefOrNestedBeanDeclaration(
					parserContext, subElement, builder));
			}
			else if ("cache-loader".equals(subElementLocalName)) {
				builder.addPropertyValue("cacheLoader", ParsingUtils.parseRefOrNestedBeanDeclaration(
					parserContext, subElement, builder));
			}
			else if ("cache-writer".equals(subElementLocalName)) {
				builder.addPropertyValue("cacheWriter", ParsingUtils.parseRefOrNestedBeanDeclaration(
					parserContext, subElement, builder));
			}
			else if ("key-interest".equals(subElementLocalName)) {
				interests.add(parseKeyInterest(parserContext, subElement));
			}
			else if ("regex-interest".equals(subElementLocalName)) {
				interests.add(parseRegexInterest(parserContext, subElement));
			}
		}

		// TODO is adding an 'interests' property really based on whether there are "sub-elements", or should it be based on whether there are "interests" (as in 'key-interest' and 'regex-interest')?
		if (!subElements.isEmpty()) {
=======
			if ("cache-listener".equals(name)) {
				builder.addPropertyValue("cacheListeners", ParsingUtils.parseRefOrNestedBeanDeclaration(
					parserContext, subElement, builder));
			}
			else if ("key-interest".equals(name)) {
				interests.add(parseKeyInterest(subElement, parserContext));
			}
			else if ("regex-interest".equals(name)) {
				interests.add(parseRegexInterest(subElement));
			}
		}

		if (!interests.isEmpty()) {
>>>>>>> 0f819f2e04382756d50be6177e7f5766012ed8a3
			builder.addPropertyValue("interests", interests);
		}
	}
Solution content
		for (Element subElement : subElements) {
			String subElementLocalName = subElement.getLocalName();

			if ("cache-listener".equals(subElementLocalName)) {
				builder.addPropertyValue("cacheListeners", ParsingUtils.parseRefOrNestedBeanDeclaration(
					parserContext, subElement, builder));
			}
			else if ("cache-loader".equals(subElementLocalName)) {
				builder.addPropertyValue("cacheLoader", ParsingUtils.parseRefOrNestedBeanDeclaration(
					parserContext, subElement, builder));
			}
			else if ("cache-writer".equals(subElementLocalName)) {
				builder.addPropertyValue("cacheWriter", ParsingUtils.parseRefOrNestedBeanDeclaration(
					parserContext, subElement, builder));
			}
			else if ("key-interest".equals(subElementLocalName)) {
				interests.add(parseKeyInterest(subElement, parserContext));
			}
			else if ("regex-interest".equals(subElementLocalName)) {
				interests.add(parseRegexInterest(subElement));
			}
		}

		if (!interests.isEmpty()) {
			builder.addPropertyValue("interests", interests);
		}
	}
File
ClientRegionParser.java
Developer's decision
Combination
Kind of conflict
Comment
If statement
Chunk
Conflicting content
		}
	}

<<<<<<< HEAD
	private void parseDiskStoreAttribute(Element element, BeanDefinitionBuilder builder) {
		String diskStoreRefAttribute = element.getAttribute("disk-store-ref");

		if (StringUtils.hasText(diskStoreRefAttribute)) {
			builder.addPropertyValue("diskStoreName", diskStoreRefAttribute);
			builder.addDependsOn(diskStoreRefAttribute);
=======
	private void validateDataPolicyShortcutMutualExclusion(final Element element, final ParserContext parserContext) {
		if (element.hasAttribute("data-policy") && element.hasAttribute("shortcut")) {
			parserContext.getReaderContext().error(String.format(
				"Only one of [data-policy, shortcut] may be specified with element '%1$s'.", element.getTagName()),
					element);
>>>>>>> 0f819f2e04382756d50be6177e7f5766012ed8a3
		}
	}
Solution content
		}
	}

	private void parseDiskStoreAttribute(final Element element, final BeanDefinitionBuilder builder) {
		String diskStoreRefAttribute = element.getAttribute("disk-store-ref");

		if (StringUtils.hasText(diskStoreRefAttribute)) {
			builder.addPropertyValue("diskStoreName", diskStoreRefAttribute);
			builder.addDependsOn(diskStoreRefAttribute);
		}
	}

	private void validateDataPolicyShortcutMutualExclusion(final Element element, final ParserContext parserContext) {
		if (element.hasAttribute("data-policy") && element.hasAttribute("shortcut")) {
			parserContext.getReaderContext().error(String.format(
				"Only one of [data-policy, shortcut] may be specified with element '%1$s'.", element.getTagName()),
					element);
		}
	}
File
ClientRegionParser.java
Developer's decision
Manual
Kind of conflict
If statement
Method invocation
Method signature
Variable
Chunk
Conflicting content
	protected void doParseRegion(Element element, ParserContext parserContext, BeanDefinitionBuilder builder,
			boolean subRegion) {
		throw new UnsupportedOperationException(String.format(
<<<<<<< HEAD
			"doParseRegion(:Element, :ParserContext, :BeanDefinitionBuilder, subRegion:boolean) is not supported on %1$s",
			getClass().getName()));
	}

	private Object parseKeyInterest(ParserContext parserContext, Element subElement) {
		BeanDefinitionBuilder keyInterestBuilder = BeanDefinitionBuilder.genericBeanDefinition(Interest.class);

		parseCommonInterestAttributes(subElement, keyInterestBuilder);

		Object key = ParsingUtils.parseRefOrNestedBeanDeclaration(parserContext, subElement, keyInterestBuilder,
			"key-ref");

		keyInterestBuilder.addConstructorArgValue(key);
=======
			"doParseRegion(:Element, :ParserContext, :BeanDefinitionBuilder, :boolean) is not supported on %1$s",
				getClass().getName()));
	}

	private Object parseKeyInterest(Element keyInterestElement, ParserContext parserContext) {
		BeanDefinitionBuilder keyInterestBuilder = BeanDefinitionBuilder.genericBeanDefinition(Interest.class);

		parseCommonInterestAttributes(keyInterestElement, keyInterestBuilder);
		keyInterestBuilder.addConstructorArgValue(ParsingUtils.parseRefOrNestedBeanDeclaration(parserContext,
			keyInterestElement, keyInterestBuilder, "key-ref"));
>>>>>>> 0f819f2e04382756d50be6177e7f5766012ed8a3

		return keyInterestBuilder.getBeanDefinition();
	}
Solution content
	protected void doParseRegion(Element element, ParserContext parserContext, BeanDefinitionBuilder builder,
			boolean subRegion) {
		throw new UnsupportedOperationException(String.format(
			"doParseRegion(:Element, :ParserContext, :BeanDefinitionBuilder, :boolean) is not supported on %1$s",
				getClass().getName()));
	}

	private Object parseKeyInterest(Element keyInterestElement, ParserContext parserContext) {
		BeanDefinitionBuilder keyInterestBuilder = BeanDefinitionBuilder.genericBeanDefinition(Interest.class);

		parseCommonInterestAttributes(keyInterestElement, keyInterestBuilder);
		keyInterestBuilder.addConstructorArgValue(ParsingUtils.parseRefOrNestedBeanDeclaration(parserContext,
			keyInterestElement, keyInterestBuilder, "key-ref"));

		return keyInterestBuilder.getBeanDefinition();
	}
File
ClientRegionParser.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Method signature
Throw statement
Variable
Chunk
Conflicting content
	private Object parseRegexInterest(Element regexInterestElement) {
		BeanDefinitionBuilder regexInterestBuilder = BeanDefinitionBuilder.genericBeanDefinition(RegexInterest.class);

<<<<<<< HEAD
		parseCommonInterestAttributes(subElement, regexInterestBuilder);
		ParsingUtils.setPropertyValue(subElement, regexInterestBuilder, "pattern", "key");
=======
		parseCommonInterestAttributes(regexInterestElement, regexInterestBuilder);
		ParsingUtils.setPropertyValue(regexInterestElement, regexInterestBuilder, "pattern", "key");
>>>>>>> 0f819f2e04382756d50be6177e7f5766012ed8a3

		return regexInterestBuilder.getBeanDefinition();
	}
Solution content
	private Object parseRegexInterest(Element regexInterestElement) {
		BeanDefinitionBuilder regexInterestBuilder = BeanDefinitionBuilder.genericBeanDefinition(RegexInterest.class);

		parseCommonInterestAttributes(regexInterestElement, regexInterestBuilder);
		ParsingUtils.setPropertyValue(regexInterestElement, regexInterestBuilder, "pattern", "key");

		return regexInterestBuilder.getBeanDefinition();
	}
File
ClientRegionParser.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Chunk
Conflicting content
 * @author John Blum
 */
abstract class ParsingUtils {
<<<<<<< HEAD

	private static Log log = LogFactory.getLog(ParsingUtils.class);

	static final String GEMFIRE_VERSION = CacheFactory.getVersion();
=======

	private static final Log log = LogFactory.getLog(ParsingUtils.class);
>>>>>>> 0f819f2e04382756d50be6177e7f5766012ed8a3

	static void setPropertyValue(Element element, BeanDefinitionBuilder builder, String attributeName,
			String propertyName, Object defaultValue) {
Solution content
 * @author John Blum
 */
abstract class ParsingUtils {

	private static final Log log = LogFactory.getLog(ParsingUtils.class);

	static void setPropertyValue(Element element, BeanDefinitionBuilder builder, String attributeName,
			String propertyName, Object defaultValue) {
File
ParsingUtils.java
Developer's decision
Version 2
Kind of conflict
Attribute
Method invocation
Chunk
Conflicting content
 */
package org.springframework.data.gemfire.client;

<<<<<<< HEAD
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
=======
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
>>>>>>> 0f819f2e04382756d50be6177e7f5766012ed8a3

import org.junit.After;
import org.junit.Before;
Solution content
 */
package org.springframework.data.gemfire.client;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

import org.junit.After;
import org.junit.Before;
File
ClientRegionFactoryBeanTest.java
Developer's decision
Combination
Kind of conflict
Import
Chunk
Conflicting content
	}
	@Test
<<<<<<< HEAD

	}

	public void testLookupFallbackFailingToUseProvidedShortcut() throws Exception {
		ClientRegionFactoryBean fb = new ClientRegionFactoryBean();

		fb.setShortcut(ClientRegionShortcut.CACHING_PROXY);

		Pool pool = Mockito.mock(Pool.class);
		
		BeanFactory beanFactory = Mockito.mock(BeanFactory.class);
		
		Mockito.when(beanFactory.getBean(Pool.class)).thenReturn(pool);
		
		fb.setBeanFactory(beanFactory);

		String regionName = "regionName";
		ClientCache cache = Mockito.mock(ClientCache.class);

		@SuppressWarnings("unchecked")
		ClientRegionFactory factory = Mockito.mock(ClientRegionFactory.class);
		Mockito.when(cache.createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY)).thenReturn(factory);

		@SuppressWarnings("unchecked")
		Region region = Mockito.mock(Region.class);
		Mockito.when(factory.create(regionName)).thenReturn(region);

		Region result = fb.lookupFallback(cache, regionName);

		assertSame(region, result);
	}

	@Test
	public void testCloseDestroySettings() {
		final ClientRegionFactoryBean factory = new ClientRegionFactoryBean();

		assertNotNull(factory);
		assertFalse(factory.isClose());
		assertFalse(factory.isDestroy());

		factory.setClose(false);

		assertFalse(factory.isClose());
		assertFalse(factory.isDestroy()); // when destroy is false it remains false even when setClose(false) is called

		factory.setClose(true);

		assertTrue(factory.isClose()); // calling setClose(true) should set close to true
		assertFalse(factory.isDestroy());

		factory.setDestroy(false);

		assertTrue(factory.isClose()); // calling setDestroy(false) should have no affect on close
		assertFalse(factory.isDestroy());

		factory.setDestroy(true);

		assertFalse(factory.isClose()); // setting destroy to true should set close to false
		assertTrue(factory.isDestroy()); // calling setDestroy(true) should set destroy to true

		factory.setClose(false);

		assertFalse(factory.isClose());
		assertTrue(factory.isDestroy()); // calling setClose(false) should have no affect on destroy

		factory.setDestroy(false);

		assertFalse(factory.isClose()); // setting destroy back to false should have no affect on close
		assertFalse(factory.isDestroy());

		factory.setDestroy(true);

		assertFalse(factory.isClose());
		assertTrue(factory.isDestroy());

		factory.setClose(true);

		assertTrue(factory.isClose());
		assertFalse(factory.isDestroy()); // setting close to true should set destroy to false
=======
	public void testResolveClientRegionShortcut() throws Exception {
		assertNull(TestUtils.readField("dataPolicy", factoryBean));
		assertNull(TestUtils.readField("persistent", factoryBean));
		assertNull(TestUtils.readField("shortcut", factoryBean));
		assertEquals(ClientRegionShortcut.LOCAL, factoryBean.resolveClientRegionShortcut());
	}

	@Test
	public void testResolveClientRegionShortcutWhenNotPersistent() throws Exception {
		factoryBean.setPersistent(false);

		assertNull(TestUtils.readField("dataPolicy", factoryBean));
		assertTrue(factoryBean.isNotPersistent());
		assertNull(TestUtils.readField("shortcut", factoryBean));
		assertEquals(ClientRegionShortcut.LOCAL, factoryBean.resolveClientRegionShortcut());
	}

	@Test
	public void testResolveClientRegionShortcutWhenPersistent() throws Exception {
		factoryBean.setPersistent(true);

		assertNull(TestUtils.readField("dataPolicy", factoryBean));
		assertTrue(factoryBean.isPersistent());
		assertNull(TestUtils.readField("shortcut", factoryBean));
		assertEquals(ClientRegionShortcut.LOCAL_PERSISTENT, factoryBean.resolveClientRegionShortcut());
	}

	@Test
	public void testResolveClientRegionShortcutUsingShortcut() throws Exception {
		factoryBean.setShortcut(ClientRegionShortcut.CACHING_PROXY_OVERFLOW);

		assertNull(TestUtils.readField("dataPolicy", factoryBean));
		assertNull(TestUtils.readField("persistent", factoryBean));
		assertEquals(ClientRegionShortcut.CACHING_PROXY_OVERFLOW, factoryBean.resolveClientRegionShortcut());
	}

	@Test
	public void testResolveClientRegionShortcutUsingShortcutWhenNotPersistent() throws Exception {
		factoryBean.setPersistent(false);
		factoryBean.setShortcut(ClientRegionShortcut.CACHING_PROXY_HEAP_LRU);

		assertNull(TestUtils.readField("dataPolicy", factoryBean));
		assertTrue(factoryBean.isNotPersistent());
		assertEquals(ClientRegionShortcut.CACHING_PROXY_HEAP_LRU, factoryBean.resolveClientRegionShortcut());
	}

	@Test(expected = IllegalArgumentException.class)
	public void testResolveClientRegionShortcutUsingShortcutWhenPersistent() throws Exception {
		try {
			factoryBean.setPersistent(true);
			factoryBean.setShortcut(ClientRegionShortcut.CACHING_PROXY);

			assertNull(TestUtils.readField("dataPolicy", factoryBean));
			assertTrue(factoryBean.isPersistent());

			factoryBean.resolveClientRegionShortcut();
		}
		catch (IllegalArgumentException e) {
			assertEquals("Client Region Shortcut 'CACHING_PROXY' is invalid when persistent is true.", e.getMessage());
			throw e;
		}
	}

	@Test
	public void testResolveClientRegionShortcutUsingPersistentShortcut() throws Exception {
		factoryBean.setShortcut(ClientRegionShortcut.LOCAL_PERSISTENT);

		assertNull(TestUtils.readField("dataPolicy", factoryBean));
		assertNull(TestUtils.readField("persistent", factoryBean));
		assertEquals(ClientRegionShortcut.LOCAL_PERSISTENT, factoryBean.resolveClientRegionShortcut());
	}

	@Test(expected = IllegalArgumentException.class)
	public void testResolveClientRegionShortcutUsingPersistentShortcutWhenNotPersistent() throws Exception {
		try {
			factoryBean.setPersistent(false);
			factoryBean.setShortcut(ClientRegionShortcut.LOCAL_PERSISTENT);

			assertNull(TestUtils.readField("dataPolicy", factoryBean));
			assertTrue(factoryBean.isNotPersistent());

			factoryBean.resolveClientRegionShortcut();
		}
		catch (IllegalArgumentException e) {
			assertEquals("Client Region Shortcut 'LOCAL_PERSISTENT' is invalid when persistent is false.", e.getMessage());
			throw e;
		}
	}

	@Test
	public void testResolveClientRegionShortcutUsingPersistentShortcutWhenPersistent() throws Exception {
		factoryBean.setPersistent(true);
		factoryBean.setShortcut(ClientRegionShortcut.LOCAL_PERSISTENT_OVERFLOW);

		assertNull(TestUtils.readField("dataPolicy", factoryBean));
		assertTrue(factoryBean.isPersistent());
		assertEquals(ClientRegionShortcut.LOCAL_PERSISTENT_OVERFLOW, factoryBean.resolveClientRegionShortcut());
	}

	@Test
	public void testResolveClientRegionShortcutUsingEmptyDataPolicy() throws Exception {
		factoryBean.setDataPolicy(DataPolicy.EMPTY);

		assertNull(TestUtils.readField("persistent", factoryBean));
		assertNull(TestUtils.readField("shortcut", factoryBean));
		assertEquals(ClientRegionShortcut.PROXY, factoryBean.resolveClientRegionShortcut());
	@Test
	public void testResolveClientRegionShortcutUsingNormalDataPolicyWhenNotPersistent() throws Exception {
		factoryBean.setDataPolicy(DataPolicy.NORMAL);
		factoryBean.setPersistent(false);

		assertTrue(factoryBean.isNotPersistent());
		assertNull(TestUtils.readField("shortcut", factoryBean));
		assertEquals(ClientRegionShortcut.CACHING_PROXY, factoryBean.resolveClientRegionShortcut());
	}

	@Test(expected = IllegalArgumentException.class)
	public void testResolveClientRegionShortcutUsingNormalDataPolicyWhenPersistent() throws Exception {
		try {
			factoryBean.setDataPolicy(DataPolicy.NORMAL);
			factoryBean.setPersistent(true);

			assertTrue(factoryBean.isPersistent());
			assertNull(TestUtils.readField("shortcut", factoryBean));

			factoryBean.resolveClientRegionShortcut();
		}
		catch (IllegalArgumentException e) {
			assertEquals("Data Policy 'NORMAL' is invalid when persistent is true.", e.getMessage());
			throw e;
		}
	}

	@Test
	public void testResolveClientRegionShortcutUsingPersistentReplicateDataPolicy() throws Exception {
		factoryBean.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE);

		assertNull(TestUtils.readField("persistent", factoryBean));
		assertNull(TestUtils.readField("shortcut", factoryBean));
		assertEquals(ClientRegionShortcut.LOCAL_PERSISTENT, factoryBean.resolveClientRegionShortcut());
	}

	@Test(expected = IllegalArgumentException.class)
	public void testResolveClientRegionShortcutUsingPersistentReplicateDataPolicyWhenNotPersistent() throws Exception {
		try {
			factoryBean.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE);
			factoryBean.setPersistent(false);

			assertTrue(factoryBean.isNotPersistent());
			assertNull(TestUtils.readField("shortcut", factoryBean));

			factoryBean.resolveClientRegionShortcut();
		}
		catch (IllegalArgumentException e) {
			assertEquals("Data Policy 'PERSISTENT_REPLICATE' is invalid when persistent is false.", e.getMessage());
			throw e;
		}
	}

	@Test
	public void testResolveClientRegionShortcutUsingPersistentReplicateDataPolicyWhenPersistent() throws Exception {
		factoryBean.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE);
		factoryBean.setPersistent(true);

		assertNull(TestUtils.readField("shortcut", factoryBean));
		assertTrue(factoryBean.isPersistent());
		assertEquals(ClientRegionShortcut.LOCAL_PERSISTENT, factoryBean.resolveClientRegionShortcut());
>>>>>>> 0f819f2e04382756d50be6177e7f5766012ed8a3
	}

}
Solution content
	}

	@Test
	public void testCloseDestroySettings() {
		final ClientRegionFactoryBean factory = new ClientRegionFactoryBean();

		assertNotNull(factory);
		assertFalse(factory.isClose());
		assertFalse(factory.isDestroy());

		factory.setClose(false);

		assertFalse(factory.isClose());
		assertFalse(factory.isDestroy()); // when destroy is false it remains false even when setClose(false) is called

		factory.setClose(true);

		assertTrue(factory.isClose()); // calling setClose(true) should set close to true
		assertFalse(factory.isDestroy());

		factory.setDestroy(false);

		assertTrue(factory.isClose()); // calling setDestroy(false) should have no affect on close
		assertFalse(factory.isDestroy());

		factory.setDestroy(true);

		assertFalse(factory.isClose()); // setting destroy to true should set close to false
		assertTrue(factory.isDestroy()); // calling setDestroy(true) should set destroy to true

		factory.setClose(false);

		assertFalse(factory.isClose());
		assertTrue(factory.isDestroy()); // calling setClose(false) should have no affect on destroy

		factory.setDestroy(false);

		assertFalse(factory.isClose()); // setting destroy back to false should have no affect on close
		assertFalse(factory.isDestroy());

		factory.setDestroy(true);

		assertFalse(factory.isClose());
		assertTrue(factory.isDestroy());

		factory.setClose(true);

		assertTrue(factory.isClose());
		assertFalse(factory.isDestroy()); // setting close to true should set destroy to false
	}

	@Test
	public void testResolveClientRegionShortcut() throws Exception {
		assertNull(TestUtils.readField("dataPolicy", factoryBean));
		assertNull(TestUtils.readField("persistent", factoryBean));
		assertNull(TestUtils.readField("shortcut", factoryBean));
		assertEquals(ClientRegionShortcut.LOCAL, factoryBean.resolveClientRegionShortcut());
	}

	@Test
	public void testResolveClientRegionShortcutWhenNotPersistent() throws Exception {
		factoryBean.setPersistent(false);

		assertNull(TestUtils.readField("dataPolicy", factoryBean));
		assertTrue(factoryBean.isNotPersistent());
		assertNull(TestUtils.readField("shortcut", factoryBean));
		assertEquals(ClientRegionShortcut.LOCAL, factoryBean.resolveClientRegionShortcut());
	}

	@Test
	public void testResolveClientRegionShortcutWhenPersistent() throws Exception {
		factoryBean.setPersistent(true);

		assertNull(TestUtils.readField("dataPolicy", factoryBean));
		assertTrue(factoryBean.isPersistent());
		assertNull(TestUtils.readField("shortcut", factoryBean));
		assertEquals(ClientRegionShortcut.LOCAL_PERSISTENT, factoryBean.resolveClientRegionShortcut());
	}

	@Test
	public void testResolveClientRegionShortcutUsingShortcut() throws Exception {
		factoryBean.setShortcut(ClientRegionShortcut.CACHING_PROXY_OVERFLOW);

		assertNull(TestUtils.readField("dataPolicy", factoryBean));
		assertNull(TestUtils.readField("persistent", factoryBean));
		assertEquals(ClientRegionShortcut.CACHING_PROXY_OVERFLOW, factoryBean.resolveClientRegionShortcut());
	}

	@Test
	public void testResolveClientRegionShortcutUsingShortcutWhenNotPersistent() throws Exception {
		factoryBean.setPersistent(false);
		factoryBean.setShortcut(ClientRegionShortcut.CACHING_PROXY_HEAP_LRU);

		assertNull(TestUtils.readField("dataPolicy", factoryBean));
		assertTrue(factoryBean.isNotPersistent());
		assertEquals(ClientRegionShortcut.CACHING_PROXY_HEAP_LRU, factoryBean.resolveClientRegionShortcut());
	}

	@Test(expected = IllegalArgumentException.class)
	public void testResolveClientRegionShortcutUsingShortcutWhenPersistent() throws Exception {
		try {
			factoryBean.setPersistent(true);
			factoryBean.setShortcut(ClientRegionShortcut.CACHING_PROXY);

			assertNull(TestUtils.readField("dataPolicy", factoryBean));
			assertTrue(factoryBean.isPersistent());

			factoryBean.resolveClientRegionShortcut();
		}
		catch (IllegalArgumentException e) {
			assertEquals("Client Region Shortcut 'CACHING_PROXY' is invalid when persistent is true.", e.getMessage());
			throw e;
		}
	}

	@Test
	public void testResolveClientRegionShortcutUsingPersistentShortcut() throws Exception {
		factoryBean.setShortcut(ClientRegionShortcut.LOCAL_PERSISTENT);

		assertNull(TestUtils.readField("dataPolicy", factoryBean));
		assertNull(TestUtils.readField("persistent", factoryBean));
		assertEquals(ClientRegionShortcut.LOCAL_PERSISTENT, factoryBean.resolveClientRegionShortcut());
	}

	@Test(expected = IllegalArgumentException.class)
	public void testResolveClientRegionShortcutUsingPersistentShortcutWhenNotPersistent() throws Exception {
		try {
			factoryBean.setPersistent(false);
			factoryBean.setShortcut(ClientRegionShortcut.LOCAL_PERSISTENT);

			assertNull(TestUtils.readField("dataPolicy", factoryBean));
			assertTrue(factoryBean.isNotPersistent());

			factoryBean.resolveClientRegionShortcut();
		}
		catch (IllegalArgumentException e) {
			assertEquals("Client Region Shortcut 'LOCAL_PERSISTENT' is invalid when persistent is false.", e.getMessage());
			throw e;
		}
	}

	@Test
	public void testResolveClientRegionShortcutUsingPersistentShortcutWhenPersistent() throws Exception {
		factoryBean.setPersistent(true);
		factoryBean.setShortcut(ClientRegionShortcut.LOCAL_PERSISTENT_OVERFLOW);

		assertNull(TestUtils.readField("dataPolicy", factoryBean));
		assertTrue(factoryBean.isPersistent());
		assertEquals(ClientRegionShortcut.LOCAL_PERSISTENT_OVERFLOW, factoryBean.resolveClientRegionShortcut());
	}

	@Test
	public void testResolveClientRegionShortcutUsingEmptyDataPolicy() throws Exception {
		factoryBean.setDataPolicy(DataPolicy.EMPTY);

		assertNull(TestUtils.readField("persistent", factoryBean));
		assertNull(TestUtils.readField("shortcut", factoryBean));
		assertEquals(ClientRegionShortcut.PROXY, factoryBean.resolveClientRegionShortcut());
	}

	@Test
	public void testResolveClientRegionShortcutUsingNormalDataPolicyWhenNotPersistent() throws Exception {
		factoryBean.setDataPolicy(DataPolicy.NORMAL);
		factoryBean.setPersistent(false);

		assertTrue(factoryBean.isNotPersistent());
		assertNull(TestUtils.readField("shortcut", factoryBean));
		assertEquals(ClientRegionShortcut.CACHING_PROXY, factoryBean.resolveClientRegionShortcut());
	}

	@Test(expected = IllegalArgumentException.class)
	public void testResolveClientRegionShortcutUsingNormalDataPolicyWhenPersistent() throws Exception {
		try {
			factoryBean.setDataPolicy(DataPolicy.NORMAL);
			factoryBean.setPersistent(true);

			assertTrue(factoryBean.isPersistent());
			assertNull(TestUtils.readField("shortcut", factoryBean));

			factoryBean.resolveClientRegionShortcut();
		}
		catch (IllegalArgumentException e) {
			assertEquals("Data Policy 'NORMAL' is invalid when persistent is true.", e.getMessage());
			throw e;
		}
	}

	@Test
	public void testResolveClientRegionShortcutUsingPersistentReplicateDataPolicy() throws Exception {
		factoryBean.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE);

		assertNull(TestUtils.readField("persistent", factoryBean));
		assertNull(TestUtils.readField("shortcut", factoryBean));
		assertEquals(ClientRegionShortcut.LOCAL_PERSISTENT, factoryBean.resolveClientRegionShortcut());
	}

	@Test(expected = IllegalArgumentException.class)
	public void testResolveClientRegionShortcutUsingPersistentReplicateDataPolicyWhenNotPersistent() throws Exception {
		try {
			factoryBean.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE);
			factoryBean.setPersistent(false);

			assertTrue(factoryBean.isNotPersistent());
			assertNull(TestUtils.readField("shortcut", factoryBean));

			factoryBean.resolveClientRegionShortcut();
		}
		catch (IllegalArgumentException e) {
			assertEquals("Data Policy 'PERSISTENT_REPLICATE' is invalid when persistent is false.", e.getMessage());
			throw e;
		}
	}

	@Test
	public void testResolveClientRegionShortcutUsingPersistentReplicateDataPolicyWhenPersistent() throws Exception {
		factoryBean.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE);
		factoryBean.setPersistent(true);

		assertNull(TestUtils.readField("shortcut", factoryBean));
		assertTrue(factoryBean.isPersistent());
		assertEquals(ClientRegionShortcut.LOCAL_PERSISTENT, factoryBean.resolveClientRegionShortcut());
	}

}
File
ClientRegionFactoryBeanTest.java
Developer's decision
Combination
Kind of conflict
Annotation
Comment
Method declaration
Method invocation
Method signature
Variable