/** * Tests creating a cache whose keys are constrained */ public void testConstrainedKeys() throws CacheException { CacheCreation cache = new CacheCreation(); RegionAttributesCreation attrs = new RegionAttributesCreation(cache); attrs.setKeyConstraint(String.class); cache.createRegion("root", attrs); testXml(cache); }
public void testBridgeLoadProbe() { CacheCreation cache = new CacheCreation(); CacheServer server = cache.addCacheServer(); server.setPort(AvailablePortHelper.getRandomAvailableTCPPort()); server.setLoadProbe(new MyLoadProbe()); testXml(cache); Cache c= getCache(); server = c.getCacheServers().get(0); Assert.assertEquals(MyLoadProbe.class,server.getLoadProbe().getClass()); }
public void testLoadPollInterval() { CacheCreation cache = new CacheCreation(); CacheServer server = cache.addCacheServer(); server.setPort(AvailablePortHelper.getRandomAvailableTCPPort()); server.setLoadPollInterval(12345); testXml(cache); Cache c = getCache(); server = c.getCacheServers().get(0); Assert.assertEquals(12345, server.getLoadPollInterval()); }
/** * Tests a cache listener with no parameters * * @since 4.0 */ public void testTransactionListener() { CacheCreation cache = new CacheCreation(); CacheTransactionManagerCreation txMgrCreation = new CacheTransactionManagerCreation(); txMgrCreation.setListener(new MyTestTransactionListener()); cache.addCacheTransactionManagerCreation(txMgrCreation); testXml(cache); }
public void testNoConnectionPools() throws CacheException { CacheCreation cache = new CacheCreation(); RegionAttributesCreation attrs = new RegionAttributesCreation(cache); attrs.setPoolName("mypool"); cache.createVMRegion("rootNORMAL", attrs); try { testXml(cache); fail("expected IllegalStateException"); } catch (IllegalStateException expected) { } } public void testAlreadyExistingPool() throws CacheException {
/** * Tests a cache listener with no parameters */ public void testCacheListener() throws CacheException { CacheCreation cache = new CacheCreation(); RegionAttributesCreation attrs = new RegionAttributesCreation(cache); CacheListener listener = new MyTestCacheListener(); attrs.setCacheListener(listener); cache.createRegion("root", attrs); testXml(cache); }
/** * Tests the <code>overflowThreshold</code> and * <code>persistBackup</code> related attributes */ public void testOverflowAndBackup() throws CacheException { CacheCreation cache = new CacheCreation(); RegionAttributesCreation attrs = new RegionAttributesCreation(cache); attrs.setMirrorType(MirrorType.KEYS_VALUES); attrs.setPersistBackup(true); cache.createRegion("root", attrs); testXml(cache); }
public void testDefaultCacheServerBindAddress() throws CacheException { CacheCreation cache = new CacheCreation(); CacheServer bs = cache.addCacheServer(); bs.setPort(AvailablePortHelper.getRandomAvailableTCPPort()); testXml(cache); Cache c = getCache(); assertNotNull(c); CacheServer server = (CacheServer)cache.getCacheServers().iterator().next(); assertNotNull(server); assertEquals(CacheServer.DEFAULT_BIND_ADDRESS, server.getBindAddress()); } public void testCacheServerBindAddress() throws CacheException {
/** * Tests creating a cache with entries defined in the root region */ public void testEntriesInRootRegion() throws CacheException { CacheCreation cache = new CacheCreation(); RegionCreation root = (RegionCreation) cache.createRegion("root", new RegionAttributesCreation(cache)); root.put("KEY1", "VALUE1"); root.put("KEY2", "VALUE2"); root.put("KEY3", "VALUE3"); testXml(cache); }
public void testCacheServerEnableTcpNoDelay() throws CacheException { CacheCreation cache = new CacheCreation(); CacheServer cs = cache.addCacheServer(); cs.setTcpNoDelay(true); RegionAttributesCreation attrs = new RegionAttributesCreation(cache); attrs.setDataPolicy(DataPolicy.NORMAL); cache.createVMRegion("rootNORMAL", attrs); testXml(cache); }
public void testCacheServerDisableTcpNoDelay() throws CacheException { CacheCreation cache = new CacheCreation(); CacheServer cs = cache.addCacheServer(); cs.setTcpNoDelay(false); RegionAttributesCreation attrs = new RegionAttributesCreation(cache); attrs.setDataPolicy(DataPolicy.NORMAL); cache.createVMRegion("rootNORMAL", attrs); testXml(cache); }
public void testEvictionLRUEntryAttributes() throws Exception { final String rName = getUniqueName(); CacheCreation cache = new CacheCreation(); RegionAttributesCreation attrs = new RegionAttributesCreation(cache); attrs.setEvictionAttributes(EvictionAttributes.createLRUEntryAttributes(80, EvictionAction.LOCAL_DESTROY)); cache.createRegion(rName, attrs); testXml(cache); }
/** * Tests declarative bridge servers * * @since 4.0 */ public void testBridgeServers() { CacheCreation cache = new CacheCreation(); BridgeServer bridge1 = cache.addBridgeServer(); setBridgeAttributes(bridge1); BridgeServer bridge2 = cache.addBridgeServer(); bridge2.setPort(AvailablePortHelper.getRandomAvailableTCPPort()); testXml(cache); }
public void testEvictionLRUMemoryAttributes() throws Exception { final String rName = getUniqueName(); CacheCreation cache = new CacheCreation(); RegionAttributesCreation attrs = new RegionAttributesCreation(cache); attrs.setEvictionAttributes(EvictionAttributes.createLRUMemoryAttributes(10, new EvictionObjectSizer())); cache.createRegion(rName, attrs); testXml(cache); }
public void testEvictionLRUHeapAttributes() throws Exception { final String rName = getUniqueName(); CacheCreation cache = new CacheCreation(); RegionAttributesCreation attrs = new RegionAttributesCreation(cache); attrs.setEvictionAttributes(EvictionAttributes .createLRUHeapAttributes(new EvictionObjectSizer(), EvictionAction.LOCAL_DESTROY)); cache.createRegion(rName, attrs); testXml(cache); }
/** * 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()); } }
public void testREPLICATE_PROXY() throws CacheException { CacheCreation cache = new CacheCreation(); RegionCreation root = (RegionCreation) cache.createRegion("replicateProxy", "REPLICATE_PROXY"); testXml(cache); GemFireCacheImpl c = (GemFireCacheImpl) getCache(); Region r = c.getRegion("replicateProxy"); assertNotNull(r); RegionAttributes ra = r.getAttributes(); assertEquals(DataPolicy.EMPTY, ra.getDataPolicy()); assertEquals(Scope.DISTRIBUTED_ACK, ra.getScope()); }
/** * 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()); }