geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sbawas...@apache.org
Subject [2/2] incubator-geode git commit: fixing tests to not use the deprecated CacheFactory.creads(ds) method
Date Tue, 19 Jan 2016 19:15:32 GMT
fixing tests to not use the deprecated CacheFactory.creads(ds) method


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

Branch: refs/heads/feature/GEODE-259
Commit: aa9d21cdaafad54583168e29e0164143d2f2adff
Parents: 22f31f8
Author: Swapnil Bawaskar <sbawaskar@pivotal.io>
Authored: Tue Jan 19 11:14:25 2016 -0800
Committer: Swapnil Bawaskar <sbawaskar@pivotal.io>
Committed: Tue Jan 19 11:14:25 2016 -0800

----------------------------------------------------------------------
 .../gemstone/gemfire/cache/CacheFactoryTest.java  | 11 +++++++++++
 .../gemfire/cache/PoolManagerJUnitTest.java       | 18 +++++++++++-------
 .../cache/client/internal/LocatorTestBase.java    |  6 ++----
 .../cache/ClientServerTransactionDUnitTest.java   |  3 +--
 .../internal/cache/GemFireCacheImplTest.java      |  9 +++++++++
 ...stributedRegionFunctionExecutionDUnitTest.java |  2 +-
 .../execute/FunctionServiceStatsDUnitTest.java    |  9 ++-------
 .../execute/PRFunctionExecutionDUnitTest.java     |  2 +-
 .../internal/cache/ha/StatsBugDUnitTest.java      |  6 +-----
 9 files changed, 39 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/aa9d21cd/gemfire-core/src/test/java/com/gemstone/gemfire/cache/CacheFactoryTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache/CacheFactoryTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache/CacheFactoryTest.java
index 7ca2b40..6936673 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache/CacheFactoryTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache/CacheFactoryTest.java
@@ -1,7 +1,18 @@
 package com.gemstone.gemfire.cache;
 
+import com.gemstone.gemfire.distributed.DistributedSystem;
+import org.junit.Test;
+
+import static org.mockito.Mockito.mock;
+
 /**
  * Created by sbawaskar on 1/18/16.
  */
 public class CacheFactoryTest {
+  @Test
+  public void x() {
+    DistributedSystem mockDS = mock(DistributedSystem.class);
+    CacheFactory cf = new CacheFactory();
+
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/aa9d21cd/gemfire-core/src/test/java/com/gemstone/gemfire/cache/PoolManagerJUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache/PoolManagerJUnitTest.java
b/gemfire-core/src/test/java/com/gemstone/gemfire/cache/PoolManagerJUnitTest.java
index 47017bc..b6aa248 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache/PoolManagerJUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache/PoolManagerJUnitTest.java
@@ -20,6 +20,8 @@ import static org.junit.Assert.*;
 
 import java.util.Properties;
 
+import com.gemstone.gemfire.cache.client.ClientCacheFactory;
+import com.gemstone.gemfire.internal.cache.xmlcache.ClientCacheCreation;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -39,22 +41,23 @@ import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
  */
 @Category(IntegrationTest.class)
 public class PoolManagerJUnitTest {
-  
-  private DistributedSystem ds;
-  
+
+  private Properties props;
+  private Cache cache;
+
   @Before
   public void setUp() {
-    Properties props = new Properties();
+    props = new Properties();
     props.setProperty("mcast-port", "0");
     props.setProperty("locators", "");
-    ds = DistributedSystem.connect(props);
     assertEquals(0, PoolManager.getAll().size());
+    cache = new CacheFactory(props).create();
   }
   
   @After
   public void tearDown() {
     PoolManager.close();
-    ds.disconnect();
+    cache.close();
   }
   
   @Test
@@ -101,11 +104,12 @@ public class PoolManagerJUnitTest {
     PoolFactory cpf = PoolManager.createFactory();
     ((PoolFactoryImpl)cpf).setStartDisabled(true);
     Pool pool = cpf.addLocator("localhost", 12345).create("mypool");
-    Cache cache = CacheFactory.create(ds);
+
     AttributesFactory fact = new AttributesFactory();
     fact.setPoolName(pool.getName());
     Region region = cache.createRegion("myRegion", fact.create());
     assertEquals(pool, PoolManager.find(region));
+
   }
 
   @Test

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/aa9d21cd/gemfire-core/src/test/java/com/gemstone/gemfire/cache/client/internal/LocatorTestBase.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache/client/internal/LocatorTestBase.java
b/gemfire-core/src/test/java/com/gemstone/gemfire/cache/client/internal/LocatorTestBase.java
index 530b61a..7a3f0c9 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache/client/internal/LocatorTestBase.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache/client/internal/LocatorTestBase.java
@@ -173,8 +173,7 @@ public abstract class LocatorTestBase  extends DistributedTestCase {
             Properties props = new Properties();
             props.setProperty(DistributionConfig.MCAST_PORT_NAME, String.valueOf(0));
             props.setProperty(DistributionConfig.LOCATORS_NAME, locators);
-            DistributedSystem ds = getSystem(props);
-            Cache cache = CacheFactory.create(ds);
+            Cache cache = new CacheFactory(props).create();
             AttributesFactory factory = new AttributesFactory();
             factory.setScope(Scope.DISTRIBUTED_ACK);
             factory.setEnableBridgeConflation(true);
@@ -207,8 +206,7 @@ public abstract class LocatorTestBase  extends DistributedTestCase {
             props.setProperty(DistributionConfig.MCAST_PORT_NAME, String.valueOf(0));
             props.setProperty(DistributionConfig.START_LOCATOR_NAME, locators);
             props.setProperty(DistributionConfig.LOCATORS_NAME, locators);
-            DistributedSystem ds = getSystem(props);
-            Cache cache = CacheFactory.create(ds);
+            Cache cache = new CacheFactory(props).create();
             AttributesFactory factory = new AttributesFactory();
             factory.setScope(Scope.DISTRIBUTED_ACK);
             factory.setEnableBridgeConflation(true);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/aa9d21cd/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/ClientServerTransactionDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/ClientServerTransactionDUnitTest.java
b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/ClientServerTransactionDUnitTest.java
index ff894f4..cb16e32 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/ClientServerTransactionDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/ClientServerTransactionDUnitTest.java
@@ -128,8 +128,7 @@ public class ClientServerTransactionDUnitTest extends RemoteTransactionDUnitTest
         Properties props = getDistributedSystemProperties();
         props.put("mcast-port", "0");
         props.remove("locators");
-        system = (InternalDistributedSystem)DistributedSystem.connect(props);
-        Cache cache = CacheFactory.create(system);
+        Cache cache = new CacheFactory(props).create();
         cache.createRegion(OTHER_REGION,af.create());
         if (startServer) {
           int port = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/aa9d21cd/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/GemFireCacheImplTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/GemFireCacheImplTest.java
b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/GemFireCacheImplTest.java
index 9d62cfc..b4c2681 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/GemFireCacheImplTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/GemFireCacheImplTest.java
@@ -1,7 +1,16 @@
 package com.gemstone.gemfire.internal.cache;
 
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
 /**
  * Created by sbawaskar on 1/18/16.
  */
+@Category(UnitTest.class)
 public class GemFireCacheImplTest {
+  @Test
+  public void x() {
+    //GemFireCacheImpl.
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/aa9d21cd/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/DistributedRegionFunctionExecutionDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/DistributedRegionFunctionExecutionDUnitTest.java
b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/DistributedRegionFunctionExecutionDUnitTest.java
index 7b837a7..612e8f8 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/DistributedRegionFunctionExecutionDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/DistributedRegionFunctionExecutionDUnitTest.java
@@ -1122,7 +1122,7 @@ public class DistributedRegionFunctionExecutionDUnitTest extends
     DM dm = ds.getDistributionManager();
     assertEquals("Distributed System is not loner", true, dm instanceof LonerDistributionManager);
     
-    Cache cache = CacheFactory.create(ds);
+    Cache cache = new CacheFactory(props).create();
     AttributesFactory factory = new AttributesFactory();
     factory.setScope(Scope.LOCAL);
     factory.setDataPolicy(DataPolicy.REPLICATE);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/aa9d21cd/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/FunctionServiceStatsDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/FunctionServiceStatsDUnitTest.java
b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/FunctionServiceStatsDUnitTest.java
index bc28b7b..4703fe7 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/FunctionServiceStatsDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/FunctionServiceStatsDUnitTest.java
@@ -377,8 +377,7 @@ public class FunctionServiceStatsDUnitTest extends PRClientServerTestBase{
           DistributedSystem ds = getSystem(props);
           assertNotNull(ds);
           ds.disconnect();
-          ds = getSystem(props);
-          cache = CacheFactory.create(ds);
+          cache = new CacheFactory(props).create();
           getLogWriter().info("Created Cache on Server");
           assertNotNull(cache);
           AttributesFactory factory = new AttributesFactory();
@@ -423,11 +422,7 @@ public class FunctionServiceStatsDUnitTest extends PRClientServerTestBase{
           Properties props = new Properties();
           props.put("mcast-port", "0");
           props.put("locators", "");
-          DistributedSystem ds = getSystem(props);
-          assertNotNull(ds);
-          ds.disconnect();
-          ds = getSystem(props);
-          cache = CacheFactory.create(ds);
+          cache = new CacheFactory(props).create();
           getLogWriter().info("Created Cache on Client");
           assertNotNull(cache);
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/aa9d21cd/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRFunctionExecutionDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRFunctionExecutionDUnitTest.java
b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRFunctionExecutionDUnitTest.java
index c12b556..b682eb9 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRFunctionExecutionDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRFunctionExecutionDUnitTest.java
@@ -3009,7 +3009,7 @@ public class PRFunctionExecutionDUnitTest extends
     DM dm = ds.getDistributionManager();
     assertEquals("Distributed System is not loner", true, dm instanceof LonerDistributionManager);
     
-    Cache cache = CacheFactory.create(ds);
+    Cache cache = new CacheFactory(props).create();
     AttributesFactory factory = new AttributesFactory();
     factory.setDataPolicy(DataPolicy.PARTITION);
     assertNotNull(cache);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/aa9d21cd/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/ha/StatsBugDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/ha/StatsBugDUnitTest.java
b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/ha/StatsBugDUnitTest.java
index 3d09f80..46a3093 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/ha/StatsBugDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/ha/StatsBugDUnitTest.java
@@ -134,11 +134,7 @@ public class StatsBugDUnitTest extends DistributedTestCase
    */
   private Cache createCache(Properties props) throws Exception
   {
-    DistributedSystem ds = getSystem(props);
-    ds.disconnect();
-    ds = getSystem(props);
-    Cache cache = null;
-    cache = CacheFactory.create(ds);
+    Cache cache =  new CacheFactory(props).create();
     if (cache == null) {
       throw new Exception("CacheFactory.create() returned null ");
     }


Mime
View raw message