/** * Test EnableGateway region attribute * @since 4.2 */ public void testEnableGatewayAttribute() throws CacheException { CacheCreation cache = new CacheCreation(); RegionAttributesCreation attrs = new RegionAttributesCreation(cache); attrs.setEnableGateway(true); cache.createRegion("root", attrs); testXml(cache); assertEquals(true, cache.getRegion("root").getAttributes().getEnableGateway()); }
/** * Test EnableBridgeConflation region attribute * @since 4.2 */ public void testEnableBridgeConflationAttribute() throws CacheException { CacheCreation cache = new CacheCreation(); RegionAttributesCreation attrs = new RegionAttributesCreation(cache); attrs.setEnableBridgeConflation(true); cache.createRegion("root", attrs); testXml(cache); assertEquals(true, cache.getRegion("root").getAttributes().getEnableBridgeConflation()); }
/** * Test EnableSubscriptionConflation region attribute * @since 5.7 */ public void testEnableSubscriptionConflationAttribute() throws CacheException { CacheCreation cache = new CacheCreation(); RegionAttributesCreation attrs = new RegionAttributesCreation(cache); attrs.setEnableSubscriptionConflation(true); cache.createRegion("root", attrs); testXml(cache); assertEquals(true, cache.getRegion("root").getAttributes().getEnableSubscriptionConflation()); } }
/** * Test EnableAsyncConflation region attribute * @since 4.2 */ public void testEnableAsyncConflationAttribute() throws CacheException { CacheCreation cache = new CacheCreation(); RegionAttributesCreation attrs = new RegionAttributesCreation(cache); attrs.setEnableAsyncConflation(true); cache.createRegion("root", attrs); testXml(cache); assertEquals(true, cache.getRegion("root").getAttributes().getEnableAsyncConflation()); } /**
/** * Tests the is-lock-grantor attribute in xml. */ public void testIsLockGrantorAttribute() throws CacheException { CacheCreation cache = new CacheCreation(); RegionAttributesCreation attrs = new RegionAttributesCreation(cache); attrs.setLockGrantor(true); attrs.setScope(Scope.GLOBAL); attrs.setMirrorType(MirrorType.KEYS_VALUES); cache.createRegion("root", attrs); testXml(cache); assertEquals(true, cache.getRegion("root").getAttributes().isLockGrantor()); }
/** * Tests a bridge client and special setCacheWriter behavior on * region attributes */ public void testBridgeClientAsLoader() throws CacheException { getSystem(); CacheCreation cache = new CacheCreation(); RegionAttributesCreation attrs = new RegionAttributesCreation(cache); final int[] ports = AvailablePortHelper.getRandomAvailableTCPPorts(1); BridgeClient bc = new TestBridgeClient(); Properties props = new Properties(); props.setProperty("endpoints", "server=" + DistributedTestCase.getIPLiteral() + ":" + ports[0]); bc.init(props); attrs.setCacheLoader(bc); cache.createRegion("root", attrs); testXml(cache); final Region ro = cache.getRegion("root"); assertSame(ro.getAttributes().getCacheLoader(), ro.getAttributes().getCacheWriter()); assertTrue(ro.getAttributes().getCacheLoader() instanceof TestBridgeClient); // now that a BridgeLoader creates its own pool make sure it exists assertEquals("pools="+PoolManager.getAll(), 1, PoolManager.getAll().size()); }
Region r = cache.getRegion("Quarter"); validateAttributes(r, fpattrsList, resolver, false);
/** * Tests a bridge client and special setCacheWriter behavior on * region attributes */ public void testBridgeClientAsWriter() throws CacheException { getSystem(); CacheCreation cache = new CacheCreation(); RegionAttributesCreation attrs = new RegionAttributesCreation(cache); final int[] ports = AvailablePortHelper.getRandomAvailableTCPPorts(1); BridgeClient bc = new TestBridgeClient(); Properties props = new Properties(); props.setProperty("endpoints", "server=" + DistributedTestCase.getIPLiteral() + ":" + ports[0]); bc.init(props); attrs.setCacheWriter(bc); cache.createRegion("root", attrs); testXml(cache); final Region ro = cache.getRegion("root"); assertSame(ro.getAttributes().getCacheLoader(), ro.getAttributes().getCacheWriter()); assertTrue(ro.getAttributes().getCacheWriter() instanceof TestBridgeClient); // now that a BridgeLoader creates its own pool make sure it exists assertEquals("pools="+PoolManager.getAll(), 1, PoolManager.getAll().size()); }
/** * Tests a bridge client and special setCacheLoader over-ride behavior on * region attributes */ public void testBridgeClientLoaderOverride() throws CacheException { getSystem(); CacheCreation cache = new CacheCreation(); RegionAttributesCreation attrs = new RegionAttributesCreation(cache); final int[] ports = AvailablePortHelper.getRandomAvailableTCPPorts(1); BridgeClient bc = new TestBridgeClient(); Properties props = new Properties(); props.setProperty("endpoints", "server=" + DistributedTestCase.getIPLiteral() + ":" + ports[0]); bc.init(props); attrs.setCacheWriter(bc); attrs.setCacheLoader(new CacheLoaderWithDeclarables()); cache.createRegion("root", attrs); testXml(cache); final Region ro = cache.getRegion("root"); assertTrue(ro.getAttributes().getCacheWriter() instanceof BridgeClient); assertTrue(ro.getAttributes().getCacheLoader() instanceof CacheLoaderWithDeclarables); // now that a BridgeLoader creates its own pool make sure it exists assertEquals("pools="+PoolManager.getAll(), 1, PoolManager.getAll().size()); }
/** * Tests a bridge client and special setCacheWriter over-ride behavior on * region attributes */ public void testBridgeClientWriterOverride() throws CacheException { getSystem(); CacheCreation cache = new CacheCreation(); RegionAttributesCreation attrs = new RegionAttributesCreation(cache); final int[] ports = AvailablePortHelper.getRandomAvailableTCPPorts(1); BridgeClient bc = new TestBridgeClient(); Properties props = new Properties(); props.setProperty("endpoints", "server=" + DistributedTestCase.getIPLiteral() + ":" + ports[0]); bc.init(props); attrs.setCacheLoader(bc); attrs.setCacheWriter(new MyTestCacheWriter()); cache.createRegion("root", attrs); testXml(cache); final Region ro = cache.getRegion("root"); assertTrue(ro.getAttributes().getCacheLoader() instanceof BridgeClient); assertTrue(ro.getAttributes().getCacheWriter() instanceof MyTestCacheWriter); // now that a BridgeLoader creates its own pool make sure it exists assertEquals("pools="+PoolManager.getAll(), 1, PoolManager.getAll().size()); }
cache.createRegion("Customer", attrs); customerRegion = cache.getRegion("Customer"); validateAttributes(customerRegion, fpattrsList, resolver, false); orderRegion = cache.getRegion("Order"); validateAttributes(orderRegion, fpattrsList, resolver, true); orderRegion = cache.getRegion("Order"); validateAttributes(orderRegion, fpattrsList, resolver, true);
/** * Make sure you can create a persistent partitioned region from xml. */ public void testPersistentPartition() throws CacheException { CacheCreation cache = new CacheCreation(); RegionAttributesCreation attrs = new RegionAttributesCreation(cache); attrs.setDataPolicy(DataPolicy.PERSISTENT_PARTITION); cache.createRegion("parRoot", attrs); Region r = cache.getRegion("parRoot"); assertEquals(DataPolicy.PERSISTENT_PARTITION, r.getAttributes().getDataPolicy()); testXml(cache); Cache c = getCache(); assertNotNull(c); Region region = c.getRegion("parRoot"); assertNotNull(region); assertEquals(DataPolicy.PERSISTENT_PARTITION, region.getAttributes().getDataPolicy()); // since CacheTestCase remoteTearDown does not destroy PartitionedRegion region.localDestroyRegion(); }
Region r = cache.getRegion("parRoot"); assertEquals(r.getAttributes().getPartitionAttributes().getRedundantCopies(),1); assertEquals(r.getAttributes().getPartitionAttributes().getLocalMaxMemory(),100);
cache.createRegion("parRoot", rootAttrs); Region r = cache.getRegion("parRoot"); assertNotNull(r); assertEquals(r.getAttributes().getPartitionAttributes().getRedundantCopies(),1);
cache.createRegion("parRoot", rootAttrs); Region r = cache.getRegion("parRoot"); assertNotNull(r); assertEquals(r.getAttributes().getPartitionAttributes().getRedundantCopies(),redundantCopies);
Region r = cache.getRegion("parRoot"); assertEquals(r.getAttributes().getPartitionAttributes().getRedundantCopies(),1); assertEquals(r.getAttributes().getPartitionAttributes().getLocalMaxMemory(),100);
Region r = cache.getRegion("parRoot"); assertEquals(r.getAttributes().getPartitionAttributes().getRedundantCopies(),1); assertEquals(r.getAttributes().getPartitionAttributes().getLocalMaxMemory(),100);