Return-Path: X-Original-To: apmail-geode-commits-archive@minotaur.apache.org Delivered-To: apmail-geode-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9561E199FC for ; Thu, 7 Apr 2016 17:40:28 +0000 (UTC) Received: (qmail 44006 invoked by uid 500); 7 Apr 2016 17:40:28 -0000 Delivered-To: apmail-geode-commits-archive@geode.apache.org Received: (qmail 43975 invoked by uid 500); 7 Apr 2016 17:40:28 -0000 Mailing-List: contact commits-help@geode.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@geode.incubator.apache.org Delivered-To: mailing list commits@geode.incubator.apache.org Received: (qmail 43966 invoked by uid 99); 7 Apr 2016 17:40:28 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Apr 2016 17:40:28 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id E9A061A1235 for ; Thu, 7 Apr 2016 17:40:27 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -3.221 X-Spam-Level: X-Spam-Status: No, score=-3.221 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-0.001] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id yw24psXXsdIi for ; Thu, 7 Apr 2016 17:40:16 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with SMTP id 0DBEB5FB3C for ; Thu, 7 Apr 2016 17:40:14 +0000 (UTC) Received: (qmail 42967 invoked by uid 99); 7 Apr 2016 17:40:14 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Apr 2016 17:40:14 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 4E888DFDE0; Thu, 7 Apr 2016 17:40:14 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: jensdeppe@apache.org To: commits@geode.incubator.apache.org Date: Thu, 07 Apr 2016 17:40:16 -0000 Message-Id: <8e9f7665024e45439b115f86b48d681a@git.apache.org> In-Reply-To: <2c7afd4d46df4973bcea92cb880d9173@git.apache.org> References: <2c7afd4d46df4973bcea92cb880d9173@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [3/5] incubator-geode git commit: GEODE-386: Change xsd namespace to apache http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1458b985/geode-core/src/main/resources/META-INF/schemas/schema.pivotal.io/gemfire/cache/cache-9.0.xsd ---------------------------------------------------------------------- diff --git a/geode-core/src/main/resources/META-INF/schemas/schema.pivotal.io/gemfire/cache/cache-9.0.xsd b/geode-core/src/main/resources/META-INF/schemas/schema.pivotal.io/gemfire/cache/cache-9.0.xsd deleted file mode 100644 index 1cd3567..0000000 --- a/geode-core/src/main/resources/META-INF/schemas/schema.pivotal.io/gemfire/cache/cache-9.0.xsd +++ /dev/null @@ -1,1519 +0,0 @@ - - - - - - -If you are declaring a client cache then use this schema: - - - -The contents of a declarative XML file correspond to APIs found in the -com.gemstone.gemfire.cache and com.gemstone.gemfire.cache.client -packages. A declarative caching XML file is used to populate a Cache -or a ClientCache when it is created. - -The top-level element in this syntax is "cache" or "client-cache". -All elements are listed here in alphabetical order. - -The following conventions apply to all GemFire distributed cache -declarative caching XML file elements unless indicated otherwise. - -- In elements that contain PCDATA, leading and trailing whitespace in - the data may be ignored. - -- In elements whose value is an "enumerated type", the value is case - sensitive. - - ]]> - - - - - - - The "cache" element is the root element of the declarative cache file on a peer or server. This element configures a GemFire Cache and - describes the root regions it contains, if any. - - - - - - - - - - The "gateway-hub" element specifies a Gateway Hub that is - initialized when the Cache is declaratively initialized. - - - - - - - - The "gateway" element specifies a Gateway that is - initialized when a GatewayHub is declaratively initialized. - - - - - - - - - The "gateway-endpoint" element specifies an endpoint that is - initialized when a Gateway is declaratively - initialized. - - - - - - - - - - - - The "gateway-listener" element specifies a listener that is - initialized when a Gateway is declaratively initialized. - - - - - - - - - - - - - - The "gateway-queue" element specifies a queue that is - initialized when a Gateway is declaratively initialized. - As of - 6.5 overflow-directory is deprecated. Use disk-store-name instead. - As of 6.5 roll-oplogs is deprecated. Use disk-store-name instead. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - A "gateway-conflict-resolver" element describes a region's GatewayConflictResolver. - It is used to resolve inter-system concurrency - conflicts. - - - - - - - - - - - - - - - - - - - A "async-event-listener" element describes a region's AsyncEventListener. - - - - - - - - - - - - - - - - - - - - - - The "cache-server" element specifies a Cache Server that will accept requests from clients and that is started when the Cache is - declaratively initialized. - - - - - - - - - - - - - - - - - - - - - deprecated - - A "vm-root-region" element is the same as "region". - This element exists for backwards compatiblity and should not be used - in new xml files. - - - - - - - - - - - The backup element defines files or directories that should - be backed up when the system wide backup command is invoked. - Disk - stores with persistent data are automatically backed up, - they do not need to be listed with this element. - - - - - - - - - - - - - - - - - - - - The "client-cache" element is the root element of the declarative cache file on a client. This element configures a GemFire ClientCache - and describes the root regions it contains, if any. - - - - - - - - - - - - - - - - - - - - - - - - - - - - A "region" element describes a region (and its entries) in GemFire - distributed cache. It may be used to create a new region or may be - used to add new entries to an existing region. Note that the "name" - attribute specifies the simple name of the region; it cannot contain a - "/". - If "refid" - is set then it defines the default region attributes to use for this region. - A nested "region-attributes" element can override these defaults. - If the - nested "region-attributes" element has its own "refid" then it will cause the - "refid" on the region to be ignored. - "refid" can be set to the name of a - RegionShortcut or a ClientRegionShortcut - (see the javadocs of those enum classes for their names). - - - - - - - - An "index" element describes an index to be created on a region. - The index node, if any, should all come immediately after the - "region-attributes" node. There can be any number of functional types - of index on a Region, but only at max one index of type "primary-key". The - "name" attribute is a required field which identifies the name of the index. - - - - - - - - A functional type of index needs a from-clause, expression which are mandatory. - The import string is used for specifying the - type of Object in the region or - the type of Object which the indexed expression evaluates to. - - - - - - - - - - - - - A primary-key type of index needs a field attribute which is mandatory. - There should be only one or zero primary-index defined - for a region - - - - - - - - - - - - - - - - - - - - - - - - - - An "entry" element desribes an entry to be added to a region. Note - that if an entry with the given key already exists in the region, - it - will be replaced. - - - - - - - - A "key" element describes the key in a Region entry. - - - - - - - - - - - - - A "value" element describes the value in a Region entry - - - - - - - - - - - - - - - - - - - - - - - - - - - - A "key-constraint" element specifies the name of a class to which the - keys of a region are constrained. - - - - - - - A "value-constraint" element specifies the name of a class to which the - values of a region are constrained. - - - - - - - A "region-time-to-live" element specifies a Region's time to live. - - - - - - - - - - - - - A "region-idle-time" element specifies a Region's idle time. - Note that the APIs that correspond to this element add "out" to their - name. - See getRegionIdleTimeout and setRegionIdleTimeout. - - - - - - - - - - - - - A "entry-time-to-live" element specifies a Region's entries' time to - live. - - - - - - - - - - - - - A "entry-idle-time" element specifies a Region's entries' idle time. - Note that the APIs that correspond to this element add "out" to - their name. - See getEntryIdleTimeout and setEntryIdleTimeout. - - - - - - - - - - - - - A "disk-write-attributes" element describes how entry data is written - to disk. Deprecated as of 6.5 use disk-store instead. - - - - - - - - An "asynchronous-writes" element specifies how entry data should be - written to disk asynchronous. - Deprecated as of 6.5 use - disk-store instead. - - - - - - - - - - - A "synchronous-writes" element specifies that entry data should be - written to disk synchronously. - - - - - - - - - - - - - - - A "partition-attributes" element configures a region for partitioned - data storage. - - local-max-memory attribute added to - partition-attributes in release 5.1 - total-max-memory attribute added to partition-attributes in release 5.1 - total-num-buckets attribute added to - partition-attributes in release 5.1 - partition-resolver attribute added to partition-attributes in release 5.7 - partition-listener attribute added to - partition-attributes in release 6.1 - colocated-with attribute added to partition-attributes in release 5.7 - - - - - - - - A "partition-resolver" element describes a partitioned region's custom - PartitionResolver. - - - - - - - - - - - - - - - A "partition-listener" element describes a partitioned region's custom - PartitionListener. - - - - - - - - - - - - - - A "fixed-partition-attributes" element describes characteristics of a - partition in a Fixed Partitioned Region. - - - - - - - - - - - - - - - - - - - - - - - - A "membership-attributes" element configures a region for membership - constraints based on required roles. - - - - - - - - A "required-role" element specifies a role that is required for reliable - access to the region - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - A "subscription-attributes" element configures how a region subscribes - to remote distributed regions. - - - - - - - - - - - - - - - - - - - - A "cache-listener" element describes a region's CacheListener. - - - - - - - - - - - - - - A compressor registers a custom class which extends Compressor - to support compression on a region. - - - - - - - - - - - - - Create eviction attributes that monitor and control the size of the Region. - - - - - - - - Create an LRU eviction controller which performs the action if the - Region has more than the maximum number of Entries in the - Region. - - - - - - - - - - - - Create an LRU which evicts entries using the specified action - when the heap is over the resource manager - critical heap/off-heap percentage. - When the threshold has been exceeded each create or put operation - is required to evict the same size of data which was - added. The - optional class-name and parameters allow for the declaration - of an ObjectSizer, which will be used to determine data size. - The class - must implement the ObjectSizer interface. - - - - - - - - - - - - - - - Create an LRU that performs the action when the memory size of the Region is - over the maximum. The optional class-name and - parameters allow for the - declaration an ObjectSizer, which is used to measure the size of each Object - in the Region. The class must implement - the ObjectSizer interface. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - A "group" element specifies a single server group. - Deprecated as of 7.0 use the groups gemfire property instead. - - - - - - - A "client-subscription" element describes the eviction policy, capacity and overflow-directory for client subscription - config. The - overflow-directory attribute is deprecated as of 6.5 use disk-store-name instead. - - - - - - - - - - - - - - - - - - - - A "custom-load-probe" element describes a callback that reports the load on a cache-server. - - - - - - - - - - - - - - - - - - - - - - - - - - deprecated - - The "resource manager" element configures the behavior of the resource manager. - The resource manager provides support for resource - management of its associated Cache - - - - - - - - - - - The "function service" element configures the behavior of the function service. - The function service allows users to execute functions - on data stored in - GemFire - - - - - - - The "function" element defines a function for registration in the function service - - - - - - - - - - - - - - - - - A "cache-loader" element describes a region's CacheLoader. - - - - - - - - - - - - A "cache-transaction-manager" element allows insertion of cache-level - transaction listeners. - - - - - - - A "transaction-listener" describes a TransactionListener. - - - - - - - - - - - - - A "transaction-writer" describes a TransactionWriter. - - - - - - - - - - - - - - - - A "cache-writer" element describes a region's CacheWriter. - - - - - - - - - - - - A serialization-registration contains a set of serializer or - instantiator tags to register customer DataSerializer extensions - or - DataSerializable implementations respectively. - - - - - - - A serializer registers a custom class which extends DataSerializer - to support custom serialization of non-modifiable object types - inside - GemFire. The class must have a public zero-arg constructor. - - - - - - - - - - - - - An instantiator registers a custom class which implements the - DataSerializable interface to support custom object serialization - inside GemFire. The class must have a public zero-arg constructor. - - - - - - - - - - The id that the instantiator should associate with the DataSerializable - type. - - - - - - - - - - - - A "class-name" element specifies the name of a class, an - instance of which is created when a declarative cache XML file is - read. - - - - - - - - - - A "disk-store" element specifies a DiskStore for persistence. - - - - - - - - - - - - - - - - - - - - - A "hdfs-store" element specifies a HdfsStore for persistence. - - - - - - - - - - - - - - - - - - - - - - - - - - - - A "pdx" element specifies the configuration for the portable data exchange (PDX) method of serialization. - The "read-serialized" - attribute is "early access". - - - - - - - A "pdx-serializer" element describes a serializer used to serialize objects in the portable data exchange format. - - - - - - - - - - - - - - - - - - - - - A "pool" element specifies a client to server connection pool. - - - - - - - A "locator" element specifies the host and port that a server locator is listening on - - - - - - - - - - - A "server" element specifies the host and port that a cache server is listening on - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - A "declarable" element specifies a Declarable object to be placed in a - Region entry. - - - - - - - - - - - - A "disk-dir" element specifies one of a region or diskstore's disk directories. - - - - - - - - - A "disk-dirs" element specifies the region's disk directories. - - - - - - - - - - A "dynamic-region-factory" element configures a dynamic region factory for - this cache. If this optional element is missing then the - cache does not - support dynamic regions. - - The optional "disk-dir" sub-element can be used to specify the directory to - store the persistent files that are - used for dynamic region bookkeeping. - It defaults to the current directory. - - The pool-name attribute can be used to set the name of the connection - pool used - by client applications in a client/server cache configuration. - It should not be specified in servers or peers. - - - - - - - - - - - - - - An "expiration-attributes" element describes expiration. - - - - - - - The "custom-expiry" element specifies a callback that specifies - custom expiration attributes. See the CustomExpiry class. - - - - - - - - - - - - - - - - - - - - - - - - - - - - A "initializer" element specifies a Declarable object whose init method - will be called after all other cache.xml initialization is - complete. - - - - - - - - - - - - - - - - - - - A jndi-bindings element will contain the jndi-binding for each of the - datasources which are to be bound with the JNDI Context. - - - - - - - For every datasource which is bound to the JNDI tree, there will exist one - jndi-binding tag. This tag will describe the property - and - configuration of the - datasource. The attributes of jndi-binding are used for configuration by - GemFire, while the property element is used to - configure - the custom property - for the datasource. - - The "xa-datasource-class" must be set when type is XAPooledDataSource, - "conn-pooled-datasource-class" must be - set when type is PooledDataSource, - and "jdbc-driver-class" msut be set when the type is SimpleDataSource. - It - is advisable to set the user-name and - password as attributes - rather than as a property element. - Alternatively, they may both be set as attributes of - the jndi-binding tag - as well as an - attribute of the property tag. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - A "parameter" element describes a parameter used to initialize a - Declarable object. - - - - - - - - - - - - - A "string" element specifies a String to be placed in a Region entry. - - - - - - - - - - - Decimal version type. - - - - - - - - - - - http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1458b985/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml58DUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml58DUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml58DUnitTest.java index 2b2242b..c56b6ed 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml58DUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml58DUnitTest.java @@ -248,7 +248,7 @@ public class CacheXml58DUnitTest extends CacheXml57DUnitTest AttributesFactory fac = new AttributesFactory(attrs); // TODO mthomas 01/20/09 Move test back to using LRUHeap when config issues have settled -// if (getGemFireVersion().equals(CacheXml.VERSION_6_0)) { +// if (getGemFireVersion().equals(CacheXml.GEMFIRE_6_0)) { // fac.setEvictionAttributes(EvictionAttributes.createLRUHeapAttributes(null, // EvictionAction.OVERFLOW_TO_DISK)); // } else { @@ -303,7 +303,7 @@ public class CacheXml58DUnitTest extends CacheXml57DUnitTest assertEquals(regionAttrs.getEntryIdleTimeout().getTimeout(), expiration.getTimeout()); assertEquals(regionAttrs.getEntryTimeToLive().getTimeout(), expiration.getTimeout()); // TODO mthomas 01/20/09 Move test back to using LRUHeap when config issues have settled -// if (getGemFireVersion().equals(CacheXml.VERSION_6_0)) { +// if (getGemFireVersion().equals(CacheXml.GEMFIRE_6_0)) { // assertEquals(ea.getAlgorithm(),EvictionAlgorithm.LRU_HEAP); // } else { assertEquals(ea.getAlgorithm(),EvictionAlgorithm.LRU_MEMORY); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1458b985/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml90DUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml90DUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml90DUnitTest.java deleted file mode 100644 index 21e6c61..0000000 --- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml90DUnitTest.java +++ /dev/null @@ -1,234 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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 com.gemstone.gemfire.cache30; - -import com.gemstone.gemfire.cache.Cache; -import com.gemstone.gemfire.cache.Region; -import com.gemstone.gemfire.distributed.internal.DistributionConfig; -import com.gemstone.gemfire.internal.cache.LocalRegion; -import com.gemstone.gemfire.internal.cache.xmlcache.CacheCreation; -import com.gemstone.gemfire.internal.cache.xmlcache.CacheXml; -import com.gemstone.gemfire.internal.cache.xmlcache.RegionAttributesCreation; -import com.gemstone.gemfire.internal.cache.xmlcache.ResourceManagerCreation; -import com.gemstone.gemfire.internal.i18n.LocalizedStrings; -import com.gemstone.gemfire.test.dunit.IgnoredException; - - -public class CacheXml90DUnitTest extends CacheXml81DUnitTest { - private static final long serialVersionUID = -6437436147079728413L; - - public CacheXml90DUnitTest(String name) { - super(name); - } - - - // ////// Helper methods - - protected String getGemFireVersion() - { - return CacheXml.VERSION_9_0; - } - - @SuppressWarnings("rawtypes") - public void testEnableOffHeapMemory() { - try { - System.setProperty("gemfire."+DistributionConfig.OFF_HEAP_MEMORY_SIZE_NAME, "1m"); - - final String regionName = "testEnableOffHeapMemory"; - - final CacheCreation cache = new CacheCreation(); - final RegionAttributesCreation attrs = new RegionAttributesCreation(cache); - attrs.setOffHeap(true); - assertEquals(true, attrs.getOffHeap()); - - final Region regionBefore = cache.createRegion(regionName, attrs); - assertNotNull(regionBefore); - assertEquals(true, regionBefore.getAttributes().getOffHeap()); - - testXml(cache); - - final Cache c = getCache(); - assertNotNull(c); - - final Region regionAfter = c.getRegion(regionName); - assertNotNull(regionAfter); - assertEquals(true, regionAfter.getAttributes().getOffHeap()); - assertEquals(true, ((LocalRegion)regionAfter).getOffHeap()); - regionAfter.localDestroyRegion(); - } finally { - System.clearProperty("gemfire."+DistributionConfig.OFF_HEAP_MEMORY_SIZE_NAME); - } - } - - @SuppressWarnings("rawtypes") - public void testEnableOffHeapMemoryRootRegionWithoutOffHeapMemoryThrowsException() { - final String regionName = getUniqueName(); - - final CacheCreation cache = new CacheCreation(); - final RegionAttributesCreation attrs = new RegionAttributesCreation(cache); - attrs.setOffHeap(true); - assertEquals(true, attrs.getOffHeap()); - - final Region regionBefore = cache.createRegion(regionName, attrs); - assertNotNull(regionBefore); - assertEquals(true, regionBefore.getAttributes().getOffHeap()); - - IgnoredException expectedException = IgnoredException.addIgnoredException(LocalizedStrings. - LocalRegion_THE_REGION_0_WAS_CONFIGURED_TO_USE_OFF_HEAP_MEMORY_BUT_OFF_HEAP_NOT_CONFIGURED.toLocalizedString("/"+regionName)); - try { - testXml(cache); - } catch (IllegalStateException e) { - // expected - String msg = LocalizedStrings.LocalRegion_THE_REGION_0_WAS_CONFIGURED_TO_USE_OFF_HEAP_MEMORY_BUT_OFF_HEAP_NOT_CONFIGURED.toLocalizedString("/"+regionName); - assertEquals(msg, e.getMessage()); - } finally { - expectedException.remove(); - } - } - - @SuppressWarnings({ "rawtypes", "deprecation", "unchecked" }) - public void testEnableOffHeapMemorySubRegionWithoutOffHeapMemoryThrowsException() { - final String rootRegionName = getUniqueName(); - final String subRegionName = "subRegion"; - - final CacheCreation cache = new CacheCreation(); - final RegionAttributesCreation rootRegionAttrs = new RegionAttributesCreation(cache); - assertEquals(false, rootRegionAttrs.getOffHeap()); - - final Region rootRegionBefore = cache.createRegion(rootRegionName, rootRegionAttrs); - assertNotNull(rootRegionBefore); - assertEquals(false, rootRegionBefore.getAttributes().getOffHeap()); - - final RegionAttributesCreation subRegionAttrs = new RegionAttributesCreation(cache); - subRegionAttrs.setOffHeap(true); - assertEquals(true, subRegionAttrs.getOffHeap()); - - final Region subRegionBefore = rootRegionBefore.createSubregion(subRegionName, subRegionAttrs); - assertNotNull(subRegionBefore); - assertEquals(true, subRegionBefore.getAttributes().getOffHeap()); - - IgnoredException expectedException = IgnoredException.addIgnoredException(LocalizedStrings. - LocalRegion_THE_REGION_0_WAS_CONFIGURED_TO_USE_OFF_HEAP_MEMORY_BUT_OFF_HEAP_NOT_CONFIGURED.toLocalizedString("/"+rootRegionName+"/"+subRegionName)); - try { - testXml(cache); - } catch (IllegalStateException e) { - // expected - final String msg = LocalizedStrings.LocalRegion_THE_REGION_0_WAS_CONFIGURED_TO_USE_OFF_HEAP_MEMORY_BUT_OFF_HEAP_NOT_CONFIGURED. - toLocalizedString("/" + rootRegionName + "/" + subRegionName); - assertEquals(msg, e.getMessage()); - } finally { - expectedException.remove(); - } - } - - /** - * Test the ResourceManager element's critical-off-heap-percentage and - * eviction-off-heap-percentage attributes - * @throws Exception - */ - public void testResourceManagerThresholds() throws Exception { - CacheCreation cache = new CacheCreation(); - final float low = 90.0f; - final float high = 95.0f; - - try { - System.setProperty("gemfire."+DistributionConfig.OFF_HEAP_MEMORY_SIZE_NAME, "1m"); - - Cache c; - ResourceManagerCreation rmc = new ResourceManagerCreation(); - rmc.setEvictionOffHeapPercentage(low); - rmc.setCriticalOffHeapPercentage(high); - cache.setResourceManagerCreation(rmc); - testXml(cache); - { - c = getCache(); - assertEquals(low, c.getResourceManager().getEvictionOffHeapPercentage()); - assertEquals(high, c.getResourceManager().getCriticalOffHeapPercentage()); - } - closeCache(); - - rmc = new ResourceManagerCreation(); - // Set them to similar values - rmc.setEvictionOffHeapPercentage(low); - rmc.setCriticalOffHeapPercentage(low + 1); - cache.setResourceManagerCreation(rmc); - testXml(cache); - { - c = getCache(); - assertEquals(low, c.getResourceManager().getEvictionOffHeapPercentage()); - assertEquals(low + 1, c.getResourceManager().getCriticalOffHeapPercentage()); - } - closeCache(); - - rmc = new ResourceManagerCreation(); - rmc.setEvictionOffHeapPercentage(high); - rmc.setCriticalOffHeapPercentage(low); - cache.setResourceManagerCreation(rmc); - IgnoredException expectedException = IgnoredException.addIgnoredException(LocalizedStrings.MemoryMonitor_EVICTION_PERCENTAGE_LTE_CRITICAL_PERCENTAGE.toLocalizedString()); - try { - testXml(cache); - assertTrue(false); - } catch (IllegalArgumentException expected) { - } finally { - expectedException.remove(); - closeCache(); - } - - // Disable eviction - rmc = new ResourceManagerCreation(); - rmc.setEvictionOffHeapPercentage(0); - rmc.setCriticalOffHeapPercentage(low); - cache.setResourceManagerCreation(rmc); - testXml(cache); - { - c = getCache(); - assertEquals(0f, c.getResourceManager().getEvictionOffHeapPercentage()); - assertEquals(low, c.getResourceManager().getCriticalOffHeapPercentage()); - } - closeCache(); - - // Disable refusing ops in "red zone" - rmc = new ResourceManagerCreation(); - rmc.setEvictionOffHeapPercentage(low); - rmc.setCriticalOffHeapPercentage(0); - cache.setResourceManagerCreation(rmc); - testXml(cache); - { - c = getCache(); - assertEquals(low, c.getResourceManager().getEvictionOffHeapPercentage()); - assertEquals(0f, c.getResourceManager().getCriticalOffHeapPercentage()); - } - closeCache(); - - // Disable both - rmc = new ResourceManagerCreation(); - rmc.setEvictionOffHeapPercentage(0); - rmc.setCriticalOffHeapPercentage(0); - cache.setResourceManagerCreation(rmc); - testXml(cache); - c = getCache(); - assertEquals(0f, c.getResourceManager().getEvictionOffHeapPercentage()); - assertEquals(0f, c.getResourceManager().getCriticalOffHeapPercentage()); - } finally { - System.clearProperty("gemfire."+DistributionConfig.OFF_HEAP_MEMORY_SIZE_NAME); - } - } -}