geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dschnei...@apache.org
Subject [02/27] incubator-geode git commit: Unit tests no longer use BridgeClient
Date Mon, 31 Aug 2015 23:13:58 GMT
Unit tests no longer use BridgeClient


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/ccb49bb1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/ccb49bb1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/ccb49bb1

Branch: refs/heads/feature/GEODE-243
Commit: ccb49bb1d337cc5711cabe6c7e5526845894ef12
Parents: 3315cdf
Author: Darrel Schneider <dschneider@pivotal.io>
Authored: Thu Aug 27 11:38:01 2015 -0700
Committer: Darrel Schneider <dschneider@pivotal.io>
Committed: Thu Aug 27 11:38:01 2015 -0700

----------------------------------------------------------------------
 .../cache/query/dunit/RemoteQueryDUnitTest.java |  68 +++--------
 .../gemfire/cache30/CacheXml30DUnitTest.java    | 122 -------------------
 2 files changed, 17 insertions(+), 173 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ccb49bb1/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/RemoteQueryDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/RemoteQueryDUnitTest.java
b/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/RemoteQueryDUnitTest.java
index 0028540..f2681d2 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/RemoteQueryDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/RemoteQueryDUnitTest.java
@@ -10,6 +10,7 @@ package com.gemstone.gemfire.cache.query.dunit;
 import com.gemstone.gemfire.DataSerializable;
 import com.gemstone.gemfire.DataSerializer;
 import com.gemstone.gemfire.cache.*;
+import com.gemstone.gemfire.cache.client.PoolManager;
 import com.gemstone.gemfire.cache.query.*;
 import com.gemstone.gemfire.cache.query.internal.*;
 import com.gemstone.gemfire.cache.util.*;
@@ -43,9 +44,6 @@ public class RemoteQueryDUnitTest extends CacheTestCase {
   /** The port on which the bridge server was started in this VM */
   private static int bridgeServerPort;
 
-  /**
-   * Creates a new <code>GemFireMemberStatusDUnitTest</code>
-   */
   public RemoteQueryDUnitTest(String name) {
     super(name);
   }
@@ -952,7 +950,6 @@ public class RemoteQueryDUnitTest extends CacheTestCase {
           AttributesFactory factory = new AttributesFactory();
           factory.setScope(Scope.LOCAL);
           createRegion(name, factory.create());
-          pause(1000);
           try {
             startBridgeServer(0, false);
           } catch (Exception ex) {
@@ -980,16 +977,11 @@ public class RemoteQueryDUnitTest extends CacheTestCase {
           Properties config = new Properties();
           config.setProperty("mcast-port", "0");
           system = (InternalDistributedSystem) DistributedSystem.connect(config);
+          PoolManager.createFactory().addServer(host0, port).setSubscriptionEnabled(true).create("clientPool");
           getCache();
           AttributesFactory factory = new AttributesFactory();
           factory.setScope(Scope.LOCAL);
-          BridgeClient writer = new BridgeClient();
-          Properties props = new Properties();
-          props.setProperty("endpoints", "server=" + host0 + ":" +
-                            port);
-          props.setProperty("establishCallbackConnection", "true");
-          writer.init(props);
-          factory.setCacheWriter(writer);
+          factory.setPoolName("clientPool");
           createRegion(name, factory.create());
         }
       });
@@ -1000,16 +992,11 @@ public class RemoteQueryDUnitTest extends CacheTestCase {
           Properties config = new Properties();
           config.setProperty("mcast-port", "0");
           system = (InternalDistributedSystem) DistributedSystem.connect(config);
+          PoolManager.createFactory().addServer(host0, port).setSubscriptionEnabled(true).create("clientPool");
           getCache();
           AttributesFactory factory = new AttributesFactory();
           factory.setScope(Scope.LOCAL);
-          BridgeClient loader = new BridgeClient();
-          Properties props = new Properties();
-          props.setProperty("endpoints", "server=" + host0 + ":" +
-                            port);
-          props.setProperty("establishCallbackConnection", "true");
-          loader.init(props);
-          factory.setCacheLoader(loader);
+          factory.setPoolName("clientPool");
           createRegion(name, factory.create());
         }
       });
@@ -1076,10 +1063,8 @@ public class RemoteQueryDUnitTest extends CacheTestCase {
       vm1.invoke(new CacheSerializableRunnable("Close client") {
         public void run2() throws CacheException {
           Region region = getRootRegion().getSubregion(name);
-          BridgeClient writer = (BridgeClient)
-            region.getAttributes().getCacheWriter();
-          writer.close();
-          region.getAttributesMutator().setCacheWriter(null);
+          region.close();
+          PoolManager.find("clientPool").destroy();
         }
       });
 
@@ -1087,10 +1072,8 @@ public class RemoteQueryDUnitTest extends CacheTestCase {
       vm2.invoke(new CacheSerializableRunnable("Close client") {
         public void run2() throws CacheException {
           Region region = getRootRegion().getSubregion(name);
-          BridgeClient loader = (BridgeClient)
-            region.getAttributes().getCacheLoader();
-          loader.close();
-          region.getAttributesMutator().setCacheLoader(null);
+          region.close();
+          PoolManager.find("clientPool").destroy();
         }
       });
 
@@ -1127,7 +1110,6 @@ public class RemoteQueryDUnitTest extends CacheTestCase {
            AttributesFactory factory = new AttributesFactory();
            factory.setScope(Scope.LOCAL);
            createRegion(name, factory.createRegionAttributes());
-           pause(1000);
            try {
              startBridgeServer(0, false);
            } catch (Exception ex) {
@@ -1155,16 +1137,11 @@ public class RemoteQueryDUnitTest extends CacheTestCase {
            Properties config = new Properties();
            config.setProperty("mcast-port", "0");
            system = (InternalDistributedSystem) DistributedSystem.connect(config);
+           PoolManager.createFactory().addServer(host0, port).setSubscriptionEnabled(true).create("clientPool");
            getCache();
            AttributesFactory factory = new AttributesFactory();
            factory.setScope(Scope.LOCAL);
-           BridgeClient writer = new BridgeClient();
-           Properties props = new Properties();
-           props.setProperty("endpoints", "server=" + host0 + ":" +
-                             port);
-           props.setProperty("establishCallbackConnection", "true");
-           writer.init(props);
-           factory.setCacheWriter(writer);
+           factory.setPoolName("clientPool");
            createRegion(name, factory.createRegionAttributes());
          }
        });
@@ -1197,10 +1174,8 @@ public class RemoteQueryDUnitTest extends CacheTestCase {
        vm1.invoke(new CacheSerializableRunnable("Close client") {
          public void run2() throws CacheException {
            Region region = getRootRegion().getSubregion(name);
-           BridgeClient writer = (BridgeClient)
-             region.getAttributes().getCacheWriter();
-           writer.close();
-           region.getAttributesMutator().setCacheWriter(null);
+           region.close();
+           PoolManager.find("clientPool").destroy();
          }
        });
 
@@ -1247,7 +1222,6 @@ public class RemoteQueryDUnitTest extends CacheTestCase {
               }
 
             });
-            pause(1000);
             try {
               startBridgeServer(0, false);
             } catch (Exception ex) {
@@ -1275,16 +1249,11 @@ public class RemoteQueryDUnitTest extends CacheTestCase {
             Properties config = new Properties();
             config.setProperty("mcast-port", "0");
             system = (InternalDistributedSystem) DistributedSystem.connect(config);
+            PoolManager.createFactory().addServer(host0, port).setSubscriptionEnabled(true).create("clientPool");
             getCache();
             AttributesFactory factory = new AttributesFactory();
             factory.setScope(Scope.LOCAL);
-            BridgeClient writer = new BridgeClient();
-            Properties props = new Properties();
-            props.setProperty("endpoints", "server=" + host0 + ":" +
-                              port);
-            props.setProperty("establishCallbackConnection", "true");
-            writer.init(props);
-            factory.setCacheWriter(writer);
+            factory.setPoolName("clientPool");
             createRegion(name, factory.createRegionAttributes());
           }
         });
@@ -1321,7 +1290,6 @@ public class RemoteQueryDUnitTest extends CacheTestCase {
               }
 
             });
-            pause(1000);
             for (int i=0; i<numberOfEntries; i++) {
               region1.put("key-"+i, new TestObject(i, "ibm"));
               region2.put("key-"+i, new TestObject(i, "ibm"));
@@ -1351,10 +1319,8 @@ public class RemoteQueryDUnitTest extends CacheTestCase {
         vm1.invoke(new CacheSerializableRunnable("Close client") {
           public void run2() throws CacheException {
             Region region = getRootRegion().getSubregion(name);
-            BridgeClient writer = (BridgeClient)
-              region.getAttributes().getCacheWriter();
-            writer.close();
-            region.getAttributesMutator().setCacheWriter(null);
+            region.close();
+            PoolManager.find("clientPool").destroy();
           }
         });
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ccb49bb1/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 5f9de44..f983e46 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
@@ -223,128 +223,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);
-    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);
-    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);
-    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);
-    assertEquals("pools="+PoolManager.getAll(), 1, PoolManager.getAll().size());
-  }
-
   /**
    * Tests a cache writer with no parameters
    */


Mime
View raw message