geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstew...@apache.org
Subject [7/7] geode git commit: DeployJarTestSuite is failing
Date Tue, 28 Feb 2017 23:37:50 GMT
DeployJarTestSuite is failing


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

Branch: refs/heads/GEODE-2290
Commit: 02fac310052fe6fcfd65913161807e570b7be8b2
Parents: e01e20d
Author: Jared Stewart <jstewart@pivotal.io>
Authored: Tue Feb 28 15:36:38 2017 -0800
Committer: Jared Stewart <jstewart@pivotal.io>
Committed: Tue Feb 28 15:36:38 2017 -0800

----------------------------------------------------------------------
 .../geode/internal/DeployedJarJUnitTest.java    | 40 +++++++++-----------
 .../geode/management/DeployJarTestSuite.java    |  3 +-
 .../dunit/rules/GfshShellConnectionRule.java    |  2 +-
 3 files changed, 20 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/02fac310/geode-core/src/test/java/org/apache/geode/internal/DeployedJarJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/DeployedJarJUnitTest.java
b/geode-core/src/test/java/org/apache/geode/internal/DeployedJarJUnitTest.java
index 3e3e68b..50f7c68 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/DeployedJarJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/DeployedJarJUnitTest.java
@@ -15,6 +15,7 @@
 package org.apache.geode.internal;
 
 import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
+import static org.apache.geode.distributed.ConfigurationProperties.NAME;
 import static org.apache.geode.internal.JarDeployer.JAR_PREFIX;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
@@ -28,8 +29,10 @@ import org.apache.geode.cache.execute.Function;
 import org.apache.geode.cache.execute.FunctionContext;
 import org.apache.geode.cache.execute.FunctionService;
 import org.apache.geode.cache.execute.ResultSender;
+import org.apache.geode.internal.cache.GemFireCacheImpl;
 import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.cache.execute.FunctionContextImpl;
+import org.apache.geode.test.dunit.rules.ServerStarterRule;
 import org.apache.geode.test.junit.categories.IntegrationTest;
 import org.junit.After;
 import org.junit.Before;
@@ -72,26 +75,28 @@ public class DeployedJarJUnitTest {
 
   private final ClassBuilder classBuilder = new ClassBuilder();
 
-  private InternalCache cache;
+  @Rule
+  public ServerStarterRule serverStarterRule = new ServerStarterRule();
 
   @Before
-  public void setup() throws IOException {
+  public void setup() throws Exception {
     System.setProperty("user.dir", temporaryFolder.newFolder().getAbsolutePath());
+      Properties properties = new Properties();
+      properties.setProperty(NAME, "myServer");
+    serverStarterRule.startServer(properties);
+
     ClassPathLoader.setLatestToDefault();
   }
 
   @After
   public void tearDown() throws Exception {
-    ClassPathLoader.setLatestToDefault();
     for (String functionName : FunctionService.getRegisteredFunctions().keySet()) {
       if (functionName.startsWith("JarClassLoaderJUnit")) {
         FunctionService.unregisterFunction(functionName);
       }
     }
 
-    if (this.cache != null) {
-      this.cache.close();
-    }
+    ClassPathLoader.setLatestToDefault();
   }
 
   @Test
@@ -241,7 +246,8 @@ public class DeployedJarJUnitTest {
   }
 
   @Test
-  public void testDeclarableFunctionsWithNoCacheXml() throws IOException, ClassNotFoundException
{
+  public void testDeclarableFunctionsWithNoCacheXml() throws Exception {
+
     final String jarName = "JarClassLoaderJUnitNoXml.jar";
 
     // Add a Declarable Function without parameters for the class to the Classpath
@@ -282,13 +288,6 @@ public class DeployedJarJUnitTest {
 
   @Test
   public void testDeclarableFunctionsWithoutParms() throws IOException, ClassNotFoundException
{
-    final File jarFile1 = new File("JarClassLoaderJUnit.v1.jar");
-    final File jarFile2 = new File("JarClassLoaderJUnit.v2.jar");
-
-    Properties properties = new Properties();
-    properties.setProperty(MCAST_PORT, "0");
-    CacheFactory cacheFactory = new CacheFactory(properties);
-    this.cache = (InternalCache) cacheFactory.create();
 
     // Add a Declarable Function without parameters for the class to the Classpath
     StringBuffer stringBuffer = new StringBuffer();
@@ -309,6 +308,7 @@ public class DeployedJarJUnitTest {
 
     byte[] jarBytes =
         this.classBuilder.createJarFromClassContent("JarClassLoaderJUnitFunction", functionString);
+
     ClassPathLoader.getLatest().getJarDeployer().deploy("JarClassLoaderJUnitFunction.jar",
         jarBytes);
 
@@ -332,7 +332,7 @@ public class DeployedJarJUnitTest {
     stringBuffer.append(" </function-service>");
     stringBuffer.append("</cache>");
     String cacheXmlString = stringBuffer.toString();
-    this.cache.loadCacheXml(new ByteArrayInputStream(cacheXmlString.getBytes()));
+    GemFireCacheImpl.getInstance().loadCacheXml(new ByteArrayInputStream(cacheXmlString.getBytes()));
 
     // Check to see if the function without parameters executes correctly
     Function function = FunctionService.getFunction("JarClassLoaderJUnitFunction");
@@ -358,12 +358,6 @@ public class DeployedJarJUnitTest {
 
   @Test
   public void testDeclarableFunctionsWithParms() throws IOException, ClassNotFoundException
{
-
-    Properties properties = new Properties();
-    properties.setProperty(MCAST_PORT, "0");
-    CacheFactory cacheFactory = new CacheFactory(properties);
-    this.cache = (InternalCache) cacheFactory.create();
-
     // Add a Declarable Function with parameters to the class to the Classpath
     StringBuffer stringBuffer = new StringBuffer();
     stringBuffer.append("import java.util.Properties;");
@@ -417,7 +411,7 @@ public class DeployedJarJUnitTest {
     stringBuffer.append(" </function-service>");
     stringBuffer.append("</cache>");
     String cacheXmlString = stringBuffer.toString();
-    this.cache.loadCacheXml(new ByteArrayInputStream(cacheXmlString.getBytes()));
+    GemFireCacheImpl.getInstance().loadCacheXml(new ByteArrayInputStream(cacheXmlString.getBytes()));
 
     // Check to see if the functions with parameters execute correctly
     Function function = FunctionService.getFunction("JarClassLoaderJUnitFunctionA");
@@ -453,7 +447,7 @@ public class DeployedJarJUnitTest {
     cacheXmlString =
         cacheXmlString.replace("JarClassLoaderJUnitFunctionA", "JarClassLoaderJUnitFunctionC")
             .replace("CAT", "BIRD");
-    this.cache.loadCacheXml(new ByteArrayInputStream(cacheXmlString.getBytes()));
+    GemFireCacheImpl.getInstance().loadCacheXml(new ByteArrayInputStream(cacheXmlString.getBytes()));
 
     // Update the first function (change the value returned from execute)
     functionString = functionString.replace("v2", "v3");

http://git-wip-us.apache.org/repos/asf/geode/blob/02fac310/geode-core/src/test/java/org/apache/geode/management/DeployJarTestSuite.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/DeployJarTestSuite.java
b/geode-core/src/test/java/org/apache/geode/management/DeployJarTestSuite.java
index e60dec7..e77d64b 100644
--- a/geode-core/src/test/java/org/apache/geode/management/DeployJarTestSuite.java
+++ b/geode-core/src/test/java/org/apache/geode/management/DeployJarTestSuite.java
@@ -4,11 +4,12 @@ import org.apache.geode.internal.ClassPathLoaderIntegrationTest;
 import org.apache.geode.internal.ClassPathLoaderTest;
 import org.apache.geode.internal.DeployedJarJUnitTest;
 import org.apache.geode.internal.JarDeployerIntegrationTest;
+import org.apache.geode.management.internal.cli.commands.DeployCommandsDUnitTest;
 import org.junit.runner.RunWith;
 import org.junit.runners.Suite;
 
 @RunWith(Suite.class)
-@Suite.SuiteClasses({DeployedJarJUnitTest.class, JarDeployerIntegrationTest.class,
+@Suite.SuiteClasses({ DeployedJarJUnitTest.class, DeployCommandsDUnitTest.class, JarDeployerIntegrationTest.class,
     ClassPathLoaderIntegrationTest.class, ClassPathLoaderTest.class})
 public class DeployJarTestSuite {
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/02fac310/geode-core/src/test/java/org/apache/geode/test/dunit/rules/GfshShellConnectionRule.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/GfshShellConnectionRule.java
b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/GfshShellConnectionRule.java
index 4729be3..984d88e 100644
--- a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/GfshShellConnectionRule.java
+++ b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/GfshShellConnectionRule.java
@@ -119,7 +119,7 @@ public class GfshShellConnectionRule extends DescribedExternalResource
{
     // can not use Awaitility here because it starts another thead, but the Gfsh instance
is in a
     // threadLocal variable, See Gfsh.getExistingInstance()
     CommandResult result = null;
-    for (int i = 0; i < 50; i++) {
+    for (int i = 0; i < 100; i++) {
       result = executeCommand(connectCommand.toString());
       if (!gfsh.outputString.contains("no such object in table")) {
         break;


Mime
View raw message