You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by vf...@apache.org on 2015/11/25 20:07:49 UTC
[36/50] [abbrv] incubator-geode git commit: GEODE-243: remove
deprecated Bridge feature
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2eb4e175/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/BridgeWriterDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/BridgeWriterDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/BridgeWriterDUnitTest.java
deleted file mode 100644
index bb5850d..0000000
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/BridgeWriterDUnitTest.java
+++ /dev/null
@@ -1,418 +0,0 @@
-/*=========================================================================
- * Copyright (c) 2010-2014 Pivotal Software, Inc. All Rights Reserved.
- * This product is protected by U.S. and international copyright
- * and intellectual property laws. Pivotal products are covered by
- * one or more patents listed at http://www.pivotal.io/patents.
- *=========================================================================
- */
-package com.gemstone.gemfire.cache30;
-
-import java.io.IOException;
-import java.util.Properties;
-
-import com.gemstone.gemfire.cache.AttributesFactory;
-import com.gemstone.gemfire.cache.CacheException;
-import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.cache.Scope;
-import com.gemstone.gemfire.cache.client.internal.PoolImpl;
-import com.gemstone.gemfire.distributed.internal.DistributionConfig;
-import com.gemstone.gemfire.cache.client.SubscriptionNotEnabledException;
-
-import dunit.DistributedTestCase;
-import dunit.Host;
-import dunit.VM;
-
-/**
- * Tests the BridgeWriter API, including interaction with Region.
- *
- * @author Kirk Lund
- * @since 4.2.3
- */
-public class BridgeWriterDUnitTest extends BridgeTestCase {
-
- public BridgeWriterDUnitTest(String name) {
- super(name);
- }
-
- public void tearDown2() throws Exception {
- super.tearDown2();
- disconnectAllFromDS(); // cleans up bridge server and client and lonerDS
- }
-
- /**
- * Tests for Bug 35381 Calling register interest if
- * establishCallbackConnection is not set causes bridge server NPE.
- */
- public void testBug35381() throws Exception {
- final Host host = Host.getHost(0);
- final String name = this.getUniqueName();
- final int[] ports = new int[1]; // 1 server in this test
-
- final int whichVM = 0;
- final VM vm = Host.getHost(0).getVM(whichVM);
- vm.invoke(new CacheSerializableRunnable("Create bridge server") {
- public void run2() throws CacheException {
- getLogWriter().info("[testBug35381] Create BridgeServer");
- getSystem();
- AttributesFactory factory = new AttributesFactory();
- factory.setScope(Scope.LOCAL);
- Region region = createRegion(name, factory.create());
- assertNotNull(region);
- assertNotNull(getRootRegion().getSubregion(name));
- region.put("KEY-1", "VAL-1");
-
- try {
- bridgeServerPort = startBridgeServer(0);
- }
- catch (IOException e) {
- getLogWriter().error("startBridgeServer threw IOException", e);
- fail("startBridgeServer threw IOException " + e.getMessage());
- }
-
- assertTrue(bridgeServerPort != 0);
-
- getLogWriter().info("[testBug35381] port=" + bridgeServerPort);
- getLogWriter().info("[testBug35381] serverMemberId=" + getMemberId());
- }
- });
- ports[whichVM] = vm.invokeInt(BridgeWriterDUnitTest.class,
- "getBridgeServerPort");
- assertTrue(ports[whichVM] != 0);
-
- getLogWriter().info("[testBug35381] create bridge client");
- Properties config = new Properties();
- config.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
- config.setProperty(DistributionConfig.LOCATORS_NAME, "");
- getSystem(config);
- getCache();
-
- AttributesFactory factory = new AttributesFactory();
- factory.setScope(Scope.LOCAL);
-
- getLogWriter().info("[testBug35381] creating connection pool");
- boolean establishCallbackConnection = false; // SOURCE OF BUG 35381
- BridgeTestCase.configureConnectionPool(factory, getServerHostName(host), ports, establishCallbackConnection, -1, -1, null);
- Region region = createRegion(name, factory.create());
- assertNotNull(getRootRegion().getSubregion(name));
- try {
- region.registerInterest("KEY-1");
- fail("registerInterest failed to throw BridgeWriterException with establishCallbackConnection set to false");
- }
- catch (SubscriptionNotEnabledException expected) {
- }
- }
- protected static int bridgeServerPort;
- private static int getBridgeServerPort() {
- return bridgeServerPort;
- }
-
- /**
- * Tests failover of register interest from client point of view. Related
- * bugs include:
- *
- * <p>Bug 35654 "failed re-registration may never be detected and thus
- * may never re-re-register"
- *
- * <p>Bug 35639 "registerInterest re-registration happens everytime a healthy
- * server is detected"
- *
- * <p>Bug 35655 "a single failed re-registration causes all other pending
- * re-registrations to be cancelled"
- */
- public void _testRegisterInterestFailover() throws Exception {
- // controller is bridge client
-
- final Host host = Host.getHost(0);
- final String name = this.getUniqueName();
- final String regionName1 = name+"-1";
- final String regionName2 = name+"-2";
- final String regionName3 = name+"-3";
- final String key1 = "KEY-"+regionName1+"-1";
- final String key2 = "KEY-"+regionName1+"-2";
- final String key3 = "KEY-"+regionName1+"-3";
- final int[] ports = new int[3]; // 3 servers in this test
-
- // create first bridge server with region for client...
- final int firstServerIdx = 0;
- final VM firstServerVM = Host.getHost(0).getVM(firstServerIdx);
- firstServerVM.invoke(new CacheSerializableRunnable("Create first bridge server") {
- public void run2() throws CacheException {
- getLogWriter().info("[testRegisterInterestFailover] Create first bridge server");
- getSystem();
- AttributesFactory factory = new AttributesFactory();
- factory.setScope(Scope.LOCAL);
- Region region1 = createRootRegion(regionName1, factory.create());
- Region region2 = createRootRegion(regionName2, factory.create());
- Region region3 = createRootRegion(regionName3, factory.create());
- region1.put(key1, "VAL-1");
- region2.put(key2, "VAL-1");
- region3.put(key3, "VAL-1");
-
- try {
- bridgeServerPort = startBridgeServer(0);
- }
- catch (IOException e) {
- getLogWriter().error("startBridgeServer threw IOException", e);
- fail("startBridgeServer threw IOException " + e.getMessage());
- }
-
- assertTrue(bridgeServerPort != 0);
-
- getLogWriter().info("[testRegisterInterestFailover] " +
- "firstServer port=" + bridgeServerPort);
- getLogWriter().info("[testRegisterInterestFailover] " +
- "firstServer memberId=" + getMemberId());
- }
- });
-
- // create second bridge server missing region for client...
- final int secondServerIdx = 1;
- final VM secondServerVM = Host.getHost(0).getVM(secondServerIdx);
- secondServerVM.invoke(new CacheSerializableRunnable("Create second bridge server") {
- public void run2() throws CacheException {
- getLogWriter().info("[testRegisterInterestFailover] Create second bridge server");
- getSystem();
- AttributesFactory factory = new AttributesFactory();
- factory.setScope(Scope.LOCAL);
- Region region1 = createRootRegion(regionName1, factory.create());
- Region region3 = createRootRegion(regionName3, factory.create());
- region1.put(key1, "VAL-2");
- region3.put(key3, "VAL-2");
-
- try {
- bridgeServerPort = startBridgeServer(0);
- }
- catch (IOException e) {
- getLogWriter().error("startBridgeServer threw IOException", e);
- fail("startBridgeServer threw IOException " + e.getMessage());
- }
-
- assertTrue(bridgeServerPort != 0);
-
- getLogWriter().info("[testRegisterInterestFailover] " +
- "secondServer port=" + bridgeServerPort);
- getLogWriter().info("[testRegisterInterestFailover] " +
- "secondServer memberId=" + getMemberId());
- }
- });
-
- // get the bridge server ports...
- ports[firstServerIdx] = firstServerVM.invokeInt(
- BridgeWriterDUnitTest.class, "getBridgeServerPort");
- assertTrue(ports[firstServerIdx] != 0);
- ports[secondServerIdx] = secondServerVM.invokeInt(
- BridgeWriterDUnitTest.class, "getBridgeServerPort");
- assertTrue(ports[secondServerIdx] != 0);
- assertTrue(ports[firstServerIdx] != ports[secondServerIdx]);
-
- // stop second and third servers
- secondServerVM.invoke(new CacheSerializableRunnable("Stop second bridge server") {
- public void run2() throws CacheException {
- stopBridgeServers(getCache());
- }
- });
-
- // create the bridge client
- getLogWriter().info("[testBug35654] create bridge client");
- Properties config = new Properties();
- config.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
- config.setProperty(DistributionConfig.LOCATORS_NAME, "");
- getSystem(config);
- getCache();
-
- AttributesFactory factory = new AttributesFactory();
- factory.setScope(Scope.LOCAL);
-
- getLogWriter().info("[testRegisterInterestFailover] creating connection pool");
- boolean establishCallbackConnection = true;
- final PoolImpl p = (PoolImpl)BridgeTestCase.configureConnectionPool(factory, getServerHostName(host), ports, establishCallbackConnection, -1, -1, null);
-
- final Region region1 = createRootRegion(regionName1, factory.create());
- final Region region2 = createRootRegion(regionName2, factory.create());
- final Region region3 = createRootRegion(regionName3, factory.create());
-
- assertTrue(region1.getInterestList().isEmpty());
- assertTrue(region2.getInterestList().isEmpty());
- assertTrue(region3.getInterestList().isEmpty());
-
- region1.registerInterest(key1);
- region2.registerInterest(key2);
- region3.registerInterest(key3);
-
- assertTrue(region1.getInterestList().contains(key1));
- assertTrue(region2.getInterestList().contains(key2));
- assertTrue(region3.getInterestList().contains(key3));
-
- assertTrue(region1.getInterestListRegex().isEmpty());
- assertTrue(region2.getInterestListRegex().isEmpty());
- assertTrue(region3.getInterestListRegex().isEmpty());
-
- // get ConnectionProxy and wait until connected to first server
- WaitCriterion ev = new WaitCriterion() {
- public boolean done() {
- return p.getPrimaryPort() != -1;
- }
- public String description() {
- return "primary port remained invalid";
- }
- };
- DistributedTestCase.waitForCriterion(ev, 10 * 1000, 200, true);
- assertEquals(ports[firstServerIdx], p.getPrimaryPort());
-
- // assert intial values
- assertEquals("VAL-1", region1.get(key1));
- assertEquals("VAL-1", region2.get(key2));
- assertEquals("VAL-1", region3.get(key3));
-
- // do puts on server1 and make sure values come thru for all 3 registrations
- firstServerVM.invoke(new CacheSerializableRunnable("Puts from first bridge server") {
- public void run2() throws CacheException {
- Region region1 = getCache().getRegion(regionName1);
- region1.put(key1, "VAL-1-1");
- Region region2 = getCache().getRegion(regionName2);
- region2.put(key2, "VAL-1-1");
- Region region3 = getCache().getRegion(regionName3);
- region3.put(key3, "VAL-1-1");
- }
- });
-
- ev = new WaitCriterion() {
- public boolean done() {
- if (!"VAL-1-1".equals(region1.get(key1)) ||
- !"VAL-1-1".equals(region2.get(key2)) ||
- !"VAL-1-1".equals(region3.get(key3))
- ) return false;
- return true;
- }
- public String description() {
- return null;
- }
- };
- DistributedTestCase.waitForCriterion(ev, 10 * 1000, 200, true);
- assertEquals("VAL-1-1", region1.get(key1));
- assertEquals("VAL-1-1", region2.get(key2));
- assertEquals("VAL-1-1", region3.get(key3));
-
- // force failover to server 2
- secondServerVM.invoke(new CacheSerializableRunnable("Start second bridge server") {
- public void run2() throws CacheException {
- try {
- startBridgeServer(ports[secondServerIdx]);
- }
- catch (IOException e) {
- getLogWriter().error("startBridgeServer threw IOException", e);
- fail("startBridgeServer threw IOException " + e.getMessage());
- }
- }
- });
-
- firstServerVM.invoke(new CacheSerializableRunnable("Stop first bridge server") {
- public void run2() throws CacheException {
- stopBridgeServers(getCache());
- }
- });
-
- // wait for failover to second server
- ev = new WaitCriterion() {
- public boolean done() {
- return ports[secondServerIdx] == p.getPrimaryPort();
- }
- public String description() {
- return "primary port never became " + ports[secondServerIdx];
- }
- };
- DistributedTestCase.waitForCriterion(ev, 100 * 1000, 200, true);
-
- try {
- assertEquals(null, region2.get(key2));
- fail("CacheLoaderException expected");
- }
- catch (com.gemstone.gemfire.cache.CacheLoaderException e) {
- }
-
- // region2 registration should be gone now
- // do puts on server2 and make sure values come thru for only 2 registrations
- secondServerVM.invoke(new CacheSerializableRunnable("Puts from second bridge server") {
- public void run2() throws CacheException {
- AttributesFactory factory = new AttributesFactory();
- factory.setScope(Scope.LOCAL);
- createRootRegion(regionName2, factory.create());
- }
- });
-
- // assert that there is no actively registered interest on region2
- assertTrue(region2.getInterestList().isEmpty());
- assertTrue(region2.getInterestListRegex().isEmpty());
-
- region2.put(key2, "VAL-0");
-
- secondServerVM.invoke(new CacheSerializableRunnable("Put from second bridge server") {
- public void run2() throws CacheException {
- Region region1 = getCache().getRegion(regionName1);
- region1.put(key1, "VAL-2-2");
- Region region2 = getCache().getRegion(regionName2);
- region2.put(key2, "VAL-2-1");
- Region region3 = getCache().getRegion(regionName3);
- region3.put(key3, "VAL-2-2");
- }
- });
-
- // wait for updates to come thru
- ev = new WaitCriterion() {
- public boolean done() {
- if (!"VAL-2-2".equals(region1.get(key1)) ||
- !"VAL-2-2".equals(region3.get(key3)))
- return false;
- return true;
- }
- public String description() {
- return null;
- }
- };
- DistributedTestCase.waitForCriterion(ev, 100 * 1000, 200, true);
- assertEquals("VAL-2-2", region1.get(key1));
- assertEquals("VAL-0", region2.get(key2));
- assertEquals("VAL-2-2", region3.get(key3));
-
- // assert again that there is no actively registered interest on region2
- assertTrue(region2.getInterestList().isEmpty());
-
- // register interest again on region2 and make
- region2.registerInterest(key2);
- assertEquals("VAL-2-1", region2.get(key2));
-
- secondServerVM.invoke(new CacheSerializableRunnable("Put from second bridge server") {
- public void run2() throws CacheException {
- Region region1 = getCache().getRegion(regionName1);
- region1.put(key1, "VAL-2-3");
- Region region2 = getCache().getRegion(regionName2);
- region2.put(key2, "VAL-2-2");
- Region region3 = getCache().getRegion(regionName3);
- region3.put(key3, "VAL-2-3");
- }
- });
-
- // wait for updates to come thru
- ev = new WaitCriterion() {
- public boolean done() {
- if (!"VAL-2-3".equals(region1.get(key1)) ||
- !"VAL-2-2".equals(region2.get(key2)) ||
- !"VAL-2-3".equals(region3.get(key3)))
- return false;
- return true;
- }
- public String description() {
- return null;
- }
- };
- DistributedTestCase.waitForCriterion(ev, 100 * 1000, 200, true);
- assertEquals("VAL-2-3", region1.get(key1));
- assertEquals("VAL-2-2", region2.get(key2));
- assertEquals("VAL-2-3", region3.get(key3));
-
- // assert public methods report actively registered interest on region2
- assertTrue(region2.getInterestList().contains(key2));
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2eb4e175/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/BridgeWriterSelectorDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/BridgeWriterSelectorDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/BridgeWriterSelectorDUnitTest.java
deleted file mode 100644
index 147af46..0000000
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/BridgeWriterSelectorDUnitTest.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.gemstone.gemfire.cache30;
-
-/**
- * Same as BridgeWriterDUnitTest but uses selector in server
- *
- * @author darrel
- * @since 5.1
- */
-public class BridgeWriterSelectorDUnitTest extends BridgeWriterDUnitTest {
- public BridgeWriterSelectorDUnitTest(String name) {
- super(name);
- }
- protected int getMaxThreads() {
- return 2;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2eb4e175/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/Bug38741DUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/Bug38741DUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/Bug38741DUnitTest.java
index 487434b..cfeb0e1 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/Bug38741DUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/Bug38741DUnitTest.java
@@ -27,7 +27,7 @@ import com.gemstone.gemfire.cache.RegionAttributes;
import com.gemstone.gemfire.cache.Scope;
import com.gemstone.gemfire.distributed.internal.DistributionConfig;
import com.gemstone.gemfire.internal.NanoTimer;
-import com.gemstone.gemfire.internal.cache.BridgeServerImpl;
+import com.gemstone.gemfire.internal.cache.CacheServerImpl;
import com.gemstone.gemfire.internal.cache.BucketRegion;
import com.gemstone.gemfire.internal.cache.BucketRegion.RawValue;
import com.gemstone.gemfire.internal.cache.CachedDeserializable;
@@ -51,7 +51,7 @@ import dunit.VM;
* @author Mitch Thomas
* @since bugfix5.7
*/
-public class Bug38741DUnitTest extends BridgeTestCase {
+public class Bug38741DUnitTest extends ClientServerTestCase {
private static final long serialVersionUID = 1L;
protected RegionAttributes getRegionAttributes() {
@@ -151,7 +151,7 @@ public class Bug38741DUnitTest extends BridgeTestCase {
getCache();
AttributesFactory factory = new AttributesFactory();
- BridgeTestCase.configureConnectionPool(factory, serverHostName, ports, true,-1,1,null);
+ ClientServerTestCase.configureConnectionPool(factory, serverHostName, ports, true,-1,1,null);
factory.setScope(Scope.LOCAL);
Region r = createRootRegion(rName, factory.create());
SerializationCountingKey ks1 = new SerializationCountingKey(k1);
@@ -177,8 +177,8 @@ public class Bug38741DUnitTest extends BridgeTestCase {
server.invoke(new CacheSerializableRunnable("Assert copy behavior after client is setup") {
public void run2() throws CacheException {
Region r = getRootRegion(rName);
- BridgeServerImpl bsi = (BridgeServerImpl)
- getCache().getBridgeServers().iterator().next();
+ CacheServerImpl bsi = (CacheServerImpl)
+ getCache().getCacheServers().iterator().next();
Collection cp = bsi.getAcceptor().getCacheClientNotifier().getClientProxies();
// Should only be one because only one client is connected
assertEquals(1, cp.size());
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2eb4e175/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml30DUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml30DUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml30DUnitTest.java
index 95cc02a..e06cd13 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml30DUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml30DUnitTest.java
@@ -39,7 +39,6 @@ import com.gemstone.gemfire.cache.MirrorType;
import com.gemstone.gemfire.cache.Region;
import com.gemstone.gemfire.cache.Scope;
import com.gemstone.gemfire.cache.client.PoolManager;
-import com.gemstone.gemfire.cache.util.BridgeClient;
import com.gemstone.gemfire.cache.util.ObjectSizer;
import com.gemstone.gemfire.distributed.internal.DistributionConfig;
import com.gemstone.gemfire.internal.AvailablePortHelper;
@@ -223,132 +222,6 @@ public class CacheXml30DUnitTest extends CacheXmlTestCase {
testXml(cache);
}
- public static class TestBridgeClient extends BridgeClient {
- public boolean equals(Object obj)
- {
- return obj instanceof BridgeClient; // needed for sameAs comparison
- }
- }
- /**
- * 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);
-
- addExpectedException("Connection refused: connect");
- 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());
- }
-
- /**
- * 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);
-
- addExpectedException("Connection refused: connect");
- 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());
- }
-
-
- /**
- * 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);
-
- addExpectedException("Connection refused: connect");
- 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 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);
-
- addExpectedException("Connection refused: connect");
- 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 cache writer with no parameters
*/
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2eb4e175/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml40DUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml40DUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml40DUnitTest.java
index 686a0ab..acaf91a 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml40DUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml40DUnitTest.java
@@ -8,7 +8,7 @@
package com.gemstone.gemfire.cache30;
import com.gemstone.gemfire.cache.*;
-import com.gemstone.gemfire.cache.util.BridgeServer;
+import com.gemstone.gemfire.cache.server.CacheServer;
import com.gemstone.gemfire.internal.AvailablePortHelper;
import com.gemstone.gemfire.internal.cache.xmlcache.*;
@@ -56,9 +56,9 @@ public class CacheXml40DUnitTest extends CacheXml30DUnitTest {
public void testBridgeServers() {
CacheCreation cache = new CacheCreation();
- BridgeServer bridge1 = cache.addBridgeServer();
+ CacheServer bridge1 = cache.addCacheServer();
setBridgeAttributes(bridge1);
- BridgeServer bridge2 = cache.addBridgeServer();
+ CacheServer bridge2 = cache.addCacheServer();
bridge2.setPort(AvailablePortHelper.getRandomAvailableTCPPort());
testXml(cache);
@@ -68,7 +68,7 @@ public class CacheXml40DUnitTest extends CacheXml30DUnitTest {
* Used by testBridgeServers to set version specific attributes
* @param bridge1 the bridge server to set attributes upon
*/
- public void setBridgeAttributes(BridgeServer bridge1)
+ public void setBridgeAttributes(CacheServer bridge1)
{
bridge1.setPort(AvailablePortHelper.getRandomAvailableTCPPort());
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2eb4e175/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml41DUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml41DUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml41DUnitTest.java
index f7aabf4..cd16cac 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml41DUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml41DUnitTest.java
@@ -8,8 +8,9 @@
package com.gemstone.gemfire.cache30;
import com.gemstone.gemfire.cache.*;
-import com.gemstone.gemfire.cache.util.BridgeServer;
+import com.gemstone.gemfire.cache.server.CacheServer;
import com.gemstone.gemfire.internal.cache.xmlcache.*;
+
import java.io.*;
import org.xml.sax.SAXException;
@@ -40,7 +41,7 @@ public class CacheXml41DUnitTest extends CacheXml40DUnitTest
// ////// Test methods
- public void setBridgeAttributes(BridgeServer bridge1)
+ public void setBridgeAttributes(CacheServer bridge1)
{
super.setBridgeAttributes(bridge1);
bridge1.setMaximumTimeBetweenPings(12345);
@@ -548,7 +549,6 @@ public class CacheXml41DUnitTest extends CacheXml40DUnitTest
assertEquals(true, DynamicRegionFactory.get().getConfig().getPersistBackup());
assertEquals(true, DynamicRegionFactory.get().isOpen());
assertEquals(null, DynamicRegionFactory.get().getConfig().getDiskDir());
- assertEquals(null, DynamicRegionFactory.get().getConfig().getBridgeWriter());
Region dr = getCache().getRegion("__DynamicRegions");
if(dr != null) {
dr.localDestroyRegion();
@@ -557,7 +557,7 @@ public class CacheXml41DUnitTest extends CacheXml40DUnitTest
}
public void testDynamicRegionFactoryNonDefault() throws CacheException {
CacheCreation cache = new CacheCreation();
- cache.setDynamicRegionFactoryConfig(new DynamicRegionFactory.Config((File)null, (com.gemstone.gemfire.cache.util.BridgeWriter)null, false, false));
+ cache.setDynamicRegionFactoryConfig(new DynamicRegionFactory.Config((File)null, null, false, false));
RegionAttributesCreation attrs = new RegionAttributesCreation(cache);
cache.createRegion("root", attrs);
// note that testXml can't check if they are same because enabling
@@ -567,7 +567,6 @@ public class CacheXml41DUnitTest extends CacheXml40DUnitTest
assertEquals(false, DynamicRegionFactory.get().getConfig().getPersistBackup());
assertEquals(true, DynamicRegionFactory.get().isOpen());
assertEquals(null, DynamicRegionFactory.get().getConfig().getDiskDir());
- assertEquals(null, DynamicRegionFactory.get().getConfig().getBridgeWriter());
Region dr = getCache().getRegion("__DynamicRegions");
if(dr != null) {
dr.localDestroyRegion();
@@ -582,7 +581,7 @@ public class CacheXml41DUnitTest extends CacheXml40DUnitTest
CacheCreation cache = new CacheCreation();
File f = new File("diskDir");
f.mkdirs();
- cache.setDynamicRegionFactoryConfig(new DynamicRegionFactory.Config(f, null));
+ cache.setDynamicRegionFactoryConfig(new DynamicRegionFactory.Config(f, null, true, true));
RegionAttributesCreation attrs = new RegionAttributesCreation(cache);
cache.createRegion("root", attrs);
// note that testXml can't check if they are same because enabling
@@ -590,28 +589,11 @@ public class CacheXml41DUnitTest extends CacheXml40DUnitTest
testXml(cache, false);
assertEquals(true, DynamicRegionFactory.get().isOpen());
assertEquals(f.getAbsoluteFile(), DynamicRegionFactory.get().getConfig().getDiskDir());
- assertEquals(null, DynamicRegionFactory.get().getConfig().getBridgeWriter());
Region dr =getCache().getRegion("__DynamicRegions");
if(dr != null) {
dr.localDestroyRegion();
}
}
- /**
- * disabled test because it can only be done from a bridge client cache.
- */
- public void _testDynamicRegionFactoryCacheWriter() throws CacheException {
- CacheCreation cache = new CacheCreation();
- CacheWriter writer = new MyTestCacheWriter();
- cache.setDynamicRegionFactoryConfig(new DynamicRegionFactory.Config(null, (com.gemstone.gemfire.cache.util.BridgeWriter)writer));
- RegionAttributesCreation attrs = new RegionAttributesCreation(cache);
- cache.createRegion("root", attrs);
- // note that testXml can't check if they are same because enabling
- // dynamic regions causes a meta region to be produced.
- testXml(cache, false);
- assertEquals(true, DynamicRegionFactory.get().isOpen());
- assertEquals(null, DynamicRegionFactory.get().getConfig().getDiskDir());
- assertEquals(writer, DynamicRegionFactory.get().getConfig().getBridgeWriter());
- }
/**
* Remove this override when bug #52052 is fixed.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2eb4e175/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml45DUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml45DUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml45DUnitTest.java
index bc41df8..9891e59 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml45DUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml45DUnitTest.java
@@ -9,7 +9,7 @@ package com.gemstone.gemfire.cache30;
import com.company.app.DBLoader;
import com.gemstone.gemfire.cache.*;
-import com.gemstone.gemfire.cache.util.BridgeServer;
+import com.gemstone.gemfire.cache.server.CacheServer;
import com.gemstone.gemfire.internal.AvailablePort;
import com.gemstone.gemfire.internal.cache.DistributedRegion;
import com.gemstone.gemfire.internal.cache.xmlcache.*;
@@ -46,7 +46,7 @@ public class CacheXml45DUnitTest extends CacheXml41DUnitTest {
- public void setBridgeAttributes(BridgeServer bridge1)
+ public void setBridgeAttributes(CacheServer bridge1)
{
super.setBridgeAttributes(bridge1);
bridge1.setMaxConnections(100);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2eb4e175/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml51DUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml51DUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml51DUnitTest.java
index 779b44d..59e024d 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml51DUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml51DUnitTest.java
@@ -8,12 +8,12 @@
package com.gemstone.gemfire.cache30;
import com.gemstone.gemfire.cache.*;
+import com.gemstone.gemfire.cache.server.CacheServer;
import com.gemstone.gemfire.internal.AvailablePortHelper;
import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
import com.gemstone.gemfire.internal.cache.PartitionedRegion;
import com.gemstone.gemfire.internal.cache.DiskWriteAttributesImpl;
import com.gemstone.gemfire.internal.cache.xmlcache.*;
-import com.gemstone.gemfire.cache.util.BridgeServer;
import dunit.Host;
import dunit.VM;
@@ -148,7 +148,7 @@ public void testMessageSyncInterval() throws CacheException {
public void testBridgeAttributesRelatedToClientQueuesHA() throws CacheException {
CacheCreation cache = new CacheCreation();
cache.setMessageSyncInterval(3445);
- BridgeServer bs = cache.addBridgeServer();
+ CacheServer bs = cache.addCacheServer();
bs.setMaximumMessageCount(12345);
bs.setMessageTimeToLive(56789);
bs.setPort(AvailablePortHelper.getRandomAvailableTCPPort());
@@ -158,7 +158,7 @@ public void testBridgeAttributesRelatedToClientQueuesHA() throws CacheException
testXml(cache);
Cache c = getCache();
assertNotNull(c);
- BridgeServer server = (BridgeServer)cache.getBridgeServers().iterator().next();
+ CacheServer server = (CacheServer)cache.getCacheServers().iterator().next();
assertNotNull(server);
assertEquals(12345,server.getMaximumMessageCount());
assertEquals(56789,server.getMessageTimeToLive());
@@ -199,7 +199,7 @@ public void testBridgeAttributesRelatedToClientQueuesHA() throws CacheException
{
CacheCreation cache = new CacheCreation();
- BridgeServer bs = cache.addBridgeServer();
+ CacheServer bs = cache.addCacheServer();
bs.setMaxThreads(37);
bs.setMaxConnections(999);
bs.setPort(AvailablePortHelper.getRandomAvailableTCPPort());
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2eb4e175/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml57DUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml57DUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml57DUnitTest.java
index 37cf277..85fcf2f 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml57DUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml57DUnitTest.java
@@ -376,7 +376,6 @@ public class CacheXml57DUnitTest extends CacheXml55DUnitTest
assertEquals(false, DynamicRegionFactory.get().getConfig().getPersistBackup());
assertEquals(true, DynamicRegionFactory.get().isOpen());
assertEquals(null, DynamicRegionFactory.get().getConfig().getDiskDir());
- assertEquals(null, DynamicRegionFactory.get().getConfig().getBridgeWriter());
assertEquals("connectionPool", DynamicRegionFactory.get().getConfig().getPoolName());
Region dr = getCache().getRegion("__DynamicRegions");
if(dr != null) {