You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ji...@apache.org on 2016/04/12 23:16:38 UTC

[13/18] incubator-geode git commit: GEODE-17: ensure gfsh-over-http tests are enabled

GEODE-17: ensure gfsh-over-http tests are enabled


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

Branch: refs/heads/feature/GEODE-17-2
Commit: dca07b1d3a9bdd43e8e8438bd2b6e9d92675c025
Parents: c41cd45
Author: Jinmei Liao <ji...@pivotal.io>
Authored: Wed Apr 6 12:40:05 2016 -0700
Committer: Jinmei Liao <ji...@pivotal.io>
Committed: Wed Apr 6 12:40:05 2016 -0700

----------------------------------------------------------------------
 .../cli/commands/CliCommandTestBase.java        | 53 ++++++++----------
 .../cli/commands/CommandOverHttpTests.java      | 56 ++++++++++++++++++++
 2 files changed, 79 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/dca07b1d/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CliCommandTestBase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CliCommandTestBase.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CliCommandTestBase.java
index 55f5556..d8f3587 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CliCommandTestBase.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CliCommandTestBase.java
@@ -16,21 +16,6 @@
  */
 package com.gemstone.gemfire.management.internal.cli.commands;
 
-import static com.gemstone.gemfire.test.dunit.Assert.*;
-import static com.gemstone.gemfire.test.dunit.LogWriterUtils.*;
-
-import java.io.IOException;
-import java.io.PrintStream;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
 import com.gemstone.gemfire.cache.Cache;
 import com.gemstone.gemfire.distributed.internal.DistributionConfig;
 import com.gemstone.gemfire.internal.AvailablePortHelper;
@@ -43,10 +28,24 @@ import com.gemstone.gemfire.management.internal.cli.result.CommandResult;
 import com.gemstone.gemfire.management.internal.cli.shell.Gfsh;
 import com.gemstone.gemfire.management.internal.cli.util.CommandStringBuilder;
 import com.gemstone.gemfire.test.dunit.Host;
-import com.gemstone.gemfire.test.dunit.SerializableCallable;
 import com.gemstone.gemfire.test.dunit.SerializableRunnable;
 import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
 
+import java.io.IOException;
+import java.io.PrintStream;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import static com.gemstone.gemfire.test.dunit.Assert.*;
+import static com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter;
+
 /**
  * Base class for all the CLI/gfsh command dunit tests.
  */
@@ -54,13 +53,13 @@ public class CliCommandTestBase extends JUnit4CacheTestCase {
 
   private static final long serialVersionUID = 1L;
 
-  protected static final String USE_HTTP_SYSTEM_PROPERTY = "useHTTP";
+  public static final String USE_HTTP_SYSTEM_PROPERTY = "useHTTP";
 
   private ManagementService managementService;
 
   private transient HeadlessGfsh shell;
 
-  private boolean useHttpOnConnect = Boolean.getBoolean("useHTTP");
+  private boolean useHttpOnConnect = Boolean.getBoolean(USE_HTTP_SYSTEM_PROPERTY);
 
   private int httpPort;
   private int jmxPort;
@@ -89,9 +88,8 @@ public class CliCommandTestBase extends JUnit4CacheTestCase {
    */
   @SuppressWarnings("serial")
   protected final HeadlessGfsh createDefaultSetup(final Properties props) {
-    Object[] result = (Object[]) Host.getHost(0).getVM(0).invoke(new SerializableCallable() {
-      public Object call() {
-        final Object[] result = new Object[3];
+    Object[] result = (Object[]) Host.getHost(0).getVM(0).invoke( "createDefaultSetup", () -> {
+        final Object[] results = new Object[3];
         final Properties localProps = (props != null ? props : new Properties());
 
         try {
@@ -118,12 +116,11 @@ public class CliCommandTestBase extends JUnit4CacheTestCase {
         getSystem(localProps);
         verifyManagementServiceStarted(getCache());
 
-        result[0] = jmxHost;
-        result[1] = jmxPort;
-        result[2] = httpPort;
+        results[0] = jmxHost;
+        results[1] = jmxPort;
+        results[2] = httpPort;
 
-        return result;
-      }
+        return results;
     });
 
     this.jmxHost = (String) result[0];
@@ -133,10 +130,6 @@ public class CliCommandTestBase extends JUnit4CacheTestCase {
     return defaultShellConnect();
   }
 
-  protected boolean useHTTPByTest() {
-    return false;
-  }
-
   /**
    * Destroy all of the components created for the default setup.
    */

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/dca07b1d/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CommandOverHttpTests.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CommandOverHttpTests.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CommandOverHttpTests.java
new file mode 100644
index 0000000..9b3e2f8
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CommandOverHttpTests.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.management.internal.cli.commands;
+
+import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
+import org.junit.ClassRule;
+import org.junit.contrib.java.lang.system.ProvideSystemProperty;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+@Category(IntegrationTest.class)
+
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+    ConfigCommandsDUnitTest.class,
+    DeployCommandsDUnitTest.class,
+    DiskStoreCommandsDUnitTest.class,
+    FunctionCommandsDUnitTest.class,
+    GemfireDataCommandsDUnitTest.class,
+    GetCommandOnRegionWithCacheLoaderDuringCacheMissDUnitTest.class,
+    IndexCommandsDUnitTest.class,
+    ListAndDescribeDiskStoreCommandsDUnitTest.class,
+    ListIndexCommandDUnitTest.class,
+    MemberCommandsDUnitTest.class,
+    MiscellaneousCommandsDUnitTest.class,
+    MiscellaneousCommandsExportLogsPart1DUnitTest.class,
+    MiscellaneousCommandsExportLogsPart2DUnitTest.class,
+    MiscellaneousCommandsExportLogsPart3DUnitTest.class,
+    MiscellaneousCommandsExportLogsPart4DUnitTest.class,
+    QueueCommandsDUnitTest.class,
+    SharedConfigurationCommandsDUnitTest.class,
+    ShellCommandsDUnitTest.class,
+    ShowDeadlockDUnitTest.class,
+    ShowMetricsDUnitTest.class,
+    ShowStackTraceDUnitTest.class,
+    UserCommandsDUnitTest.class
+})
+public class CommandOverHttpTests {
+  @ClassRule
+  public static ProvideSystemProperty provideSystemProperty = new ProvideSystemProperty(CliCommandTestBase.USE_HTTP_SYSTEM_PROPERTY, "true");
+}