You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ud...@apache.org on 2018/08/30 16:33:26 UTC

[geode] branch feature/GEODE-5660 updated (b24c94f -> 2633be4)

This is an automated email from the ASF dual-hosted git repository.

udo pushed a change to branch feature/GEODE-5660
in repository https://gitbox.apache.org/repos/asf/geode.git.


    omit b24c94f  GEODE-5660: Added method to lookup war file from classpath within AgentUtil.java. This is to address problem where http server is started from Java API (Spring Data Geode specifically) Now, the application can reference the `geode-web-api` war from repo and not have to specifically set `GEODE-HOME` property
     add b3cf86b  GEODE-5604 Update gradle syntax to comply with 5.0 (#2350)
     add ebe44c2  GEODE-5641: add no-arg constructor to DiskDirRule
     add f550cc4  GEODE-5639: use AssertJ instead of CatchException
     add 281492a  GEODE-5639: remove CatchException dependencies from Gradle
     add 34ec001  GEODE-5637: disable SingleHopClientExecutorWithLoggingIntegrationTest
     add 1c349b5  Markdown format improvements.
     add 238706c  GEODE-5636: DescribeClientCommandDUnitTest fails on Windows (#2382)
     add be5430d  GEODE-5656: Upgrades Gradle to 4.10 (#2397)
     add ad37e34  GEODE-5601: Serialize running of acceptance tests in lieu of containerizing them (#2389)
     add 8ae1bdb  GEODE-5530: Moves more shared test code into the DUnit framework.
     add 30c1eff  Improve readability and failure reporting in new ThreadMonitorIntegrationTest.
     add 81cfad6  Move failing integration test to integrationTests.
     add e396d91  Bump for precheckin rerun
     add 7c57aef  Merge pull request #2396 from PurelyApplied/geode-5654
     add 7aee737  GEODE-5661: Pulse does not work when legacy SSL options are used (#2401)
     add 64845ab  GEODE-5594: Rename SSL hostname validation property name (#2398)
     add 574530c  GEODE-5536: Force unitTest compilation to be dependency of source classes (#2337)
     new 0b13c82  GEODE-5660: Added method to lookup war file from classpath within AgentUtil.java. This is to address problem where http server is started from Java API (Spring Data Geode specifically) Now, the application can reference the `geode-web-api` war from repo and not have to specifically set `GEODE-HOME` property
     new 2633be4  GEODE-5660: Addressing review commentary

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (b24c94f)
            \
             N -- N -- N   refs/heads/feature/GEODE-5660 (2633be4)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 BUILDING.md                                        |  16 ++-
 README.md                                          |  99 +++++++-------
 build.gradle                                       |   4 +-
 buildSrc/build.gradle                              |  10 +-
 ci/pipelines/geode-build/jinja.template.yml        |   1 +
 ci/pipelines/pull-request/jinja.template.yml       |   1 +
 ci/pipelines/shared/jinja.variables.yml            |   7 +-
 ci/scripts/execute_tests.sh                        |   7 +-
 extensions/geode-modules-assembly/build.gradle     |  40 +++---
 .../geode-modules-session-internal/build.gradle    |   2 +-
 extensions/geode-modules-session/build.gradle      |   2 +-
 extensions/geode-modules-test/build.gradle         |   2 +-
 extensions/geode-modules-tomcat7/build.gradle      |   4 +-
 extensions/geode-modules-tomcat8/build.gradle      |   4 +-
 extensions/geode-modules/build.gradle              |   2 +-
 geode-assembly/build.gradle                        |  29 ++--
 geode-assembly/geode-assembly-test/build.gradle    |   2 +-
 .../test/junit/rules/GeodeHttpClientRule.java      |  36 +++--
 .../tools/pulse/PulseSecurityWithSSLTest.java      |  80 +++++++++--
 geode-connectors/build.gradle                      |   2 +-
 .../connectors/jdbc/JdbcWriterIntegrationTest.java |   9 +-
 geode-core/build.gradle                            |   7 +-
 ...okenSerializationConsistencyRegressionTest.java |  12 +-
 ...ExceptionsIncludeLocalMemberRegressionTest.java |  54 +++++---
 .../cache/execute/PRTransactionDUnitTest.java      | 152 ++++++++++++---------
 .../geode/pdx/PdxAttributesDistributedTest.java}   |  88 +++++-------
 .../test/dunit/tests/BasicDistributedTest.java     |  73 +++++-----
 ...opClientExecutorWithLoggingIntegrationTest.java |   6 +
 .../LocatorLauncherIntegrationTest.java            |  53 +++----
 .../ServerLauncherBuilderIntegrationTest.java      |  30 ++--
 .../distributed/ServerLauncherIntegrationTest.java |  53 +++----
 .../apache/geode/internal/SSLConfigJUnitTest.java  |  19 +++
 .../eviction/TransactionsWithOverflowTest.java     |  43 +++---
 .../ThreadsMonitoringIntegrationTest.java          |  67 +++++----
 .../FileProcessControllerIntegrationTest.java      |   7 +-
 .../pdx/PdxInstanceLoaderIntegrationTest.java      |  30 ++--
 .../geode/distributed/ConfigurationProperties.java |   2 +-
 .../geode/management/internal/AgentUtil.java       |  41 +-----
 .../geode/management/internal/ManagementAgent.java |  40 +++---
 .../apache/geode/distributed/LocatorStateTest.java |  34 ++---
 .../cache/EntryEventSerializationTest.java         |   6 +-
 .../cache/xmlcache/CacheCreationJUnitTest.java     |  15 +-
 .../geode/internal/lang/ThrowableUtilsTest.java    |  64 ++++-----
 .../internal/offheap/FreeListManagerTest.java      |  41 +++---
 .../MemoryAllocatorFillPatternJUnitTest.java       |  25 ++--
 .../security/GemFireSecurityExceptionTest.java     |  91 ++++++------
 .../geode/security/NotAuthorizedExceptionTest.java |  97 ++++++-------
 geode-cq/build.gradle                              |   1 +
 .../commands/DescribeClientCommandDUnitTest.java   |   5 +-
 geode-dunit/build.gradle                           |   3 -
 .../geode/internal/cache/CommitFunction.java       |   0
 .../internal/cache/NestedTransactionFunction.java  |   0
 .../cache/PartitionedRegionGetSomeKeys.java        |   0
 .../geode/internal/cache/RollbackFunction.java     |   0
 .../apache/geode/internal/cache/ha/HAHelper.java   |   0
 .../internal/cache/tier/sockets/HaHelper.java      |   0
 .../test/dunit/rules/DistributedDiskDirRule.java   |  29 ++--
 .../apache/geode/test/junit/rules/DiskDirRule.java |  23 +---
 geode-lucene/build.gradle                          |   8 +-
 geode-old-client-support/build.gradle              |   2 +-
 geode-old-versions/build.gradle                    |   4 +-
 geode-protobuf/build.gradle                        |   7 +-
 geode-pulse/build.gradle                           |   4 +-
 .../ParallelGatewaySenderOperationsDUnitTest.java  |  11 +-
 geode-web-api/build.gradle                         |   1 +
 gradle.properties                                  |   2 +-
 gradle/dependency-versions.properties              |   2 -
 gradle/ide.gradle                                  |  16 +--
 gradle/java.gradle                                 |   8 ++
 gradle/publish.gradle                              |  90 ++++++------
 gradle/sonar.gradle                                |   8 +-
 gradle/test.gradle                                 |  31 +++--
 gradle/wrapper/gradle-wrapper.jar                  | Bin 54413 -> 56172 bytes
 gradle/wrapper/gradle-wrapper.properties           |   2 +-
 settings.gradle                                    |  29 ++--
 75 files changed, 936 insertions(+), 859 deletions(-)
 rename geode-core/src/{integrationTest/java/org/apache/geode/pdx/PdxAttributesJUnitTest.java => distributedTest/java/org/apache/geode/pdx/PdxAttributesDistributedTest.java} (81%)
 rename geode-core/src/{test => integrationTest}/java/org/apache/geode/internal/monitoring/ThreadsMonitoringIntegrationTest.java (57%)
 rename {geode-core/src/distributedTest => geode-dunit/src/main}/java/org/apache/geode/internal/cache/CommitFunction.java (100%)
 rename {geode-core/src/distributedTest => geode-dunit/src/main}/java/org/apache/geode/internal/cache/NestedTransactionFunction.java (100%)
 rename {geode-core/src/distributedTest => geode-dunit/src/main}/java/org/apache/geode/internal/cache/PartitionedRegionGetSomeKeys.java (100%)
 rename {geode-core/src/distributedTest => geode-dunit/src/main}/java/org/apache/geode/internal/cache/RollbackFunction.java (100%)
 rename {geode-core/src/distributedTest => geode-dunit/src/main}/java/org/apache/geode/internal/cache/ha/HAHelper.java (100%)
 rename {geode-core/src/distributedTest => geode-dunit/src/main}/java/org/apache/geode/internal/cache/tier/sockets/HaHelper.java (100%)


[geode] 02/02: GEODE-5660: Addressing review commentary

Posted by ud...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

udo pushed a commit to branch feature/GEODE-5660
in repository https://gitbox.apache.org/repos/asf/geode.git

commit 2633be49df4077cd2a8c6fbd9299d9e9b872cee6
Author: Udo Kohlmeyer <uk...@pivotal.io>
AuthorDate: Thu Aug 30 09:32:45 2018 -0700

    GEODE-5660: Addressing review commentary
---
 .../geode/management/internal/AgentUtil.java       | 41 ++++------------------
 1 file changed, 7 insertions(+), 34 deletions(-)

diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/AgentUtil.java b/geode-core/src/main/java/org/apache/geode/management/internal/AgentUtil.java
index 83ec51e..6b80802 100755
--- a/geode-core/src/main/java/org/apache/geode/management/internal/AgentUtil.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/AgentUtil.java
@@ -16,9 +16,7 @@
 package org.apache.geode.management.internal;
 
 import java.io.File;
-import java.net.URL;
 import java.util.Arrays;
-import java.util.Objects;
 import java.util.stream.Stream;
 
 import org.apache.commons.lang.StringUtils;
@@ -30,13 +28,14 @@ import org.apache.geode.internal.logging.LogService;
 /**
  * Hosts common utility methods needed by the management package
  *
- * @since Geode 1.0.0.0
+ * @since Geode 1.0.0
  */
 public class AgentUtil {
 
   private static final Logger logger = LogService.getLogger();
 
   private final String gemfireVersion;
+  private static final String GEODE_HOME = "GEODE_HOME";
 
   public AgentUtil(String gemfireVersion) {
     this.gemfireVersion = gemfireVersion;
@@ -68,36 +67,10 @@ public class AgentUtil {
       return possiblePath;
     }
 
-    // if $GEODE_HOME is not set or we are not able to find it in all the possible locations under
-    // $GEODE_HOME, try to find in the classpath
-    possiblePath =
-        findPossibleWarLocationFromExtraLocations(versionedWarFileName, unversionedWarFileName);
-    if (possiblePath != null) {
-      return possiblePath;
-    }
-
     logger.warn(warFilePrefix + " war file was not found");
     return null;
   }
 
-  private String findPossibleWarLocationFromExtraLocations(String versionedWarFileName,
-      String unversionedWarFileName) {
-    final URL url = Arrays.stream(new String[] {versionedWarFileName,
-        "tools/Pulse/" + versionedWarFileName,
-        "tools/Extensions/" + versionedWarFileName,
-        "lib/" + versionedWarFileName,
-        unversionedWarFileName})
-        .map(possibleFile -> this.getClass().getClassLoader().getResource(possibleFile))
-        .filter(Objects::nonNull).findFirst().orElse(null);
-
-    if (url != null) {
-      final String path = url.getPath();
-      logger.info("War file found: {}", path);
-      return path;
-    }
-    return null;
-  }
-
   private String findPossibleWarLocationForGeodeHome(String versionedWarFileName,
       String unversionedWarFileName) {
     String[] possibleFiles = {};
@@ -127,11 +100,11 @@ public class AgentUtil {
         .findFirst().orElse(null);
   }
 
-  public boolean isWebApplicationAvailable(final String warFileLocation) {
+  boolean isWebApplicationAvailable(final String warFileLocation) {
     return StringUtils.isNotBlank(warFileLocation);
   }
 
-  public boolean isWebApplicationAvailable(final String... warFileLocations) {
+  boolean isWebApplicationAvailable(final String... warFileLocations) {
     for (String warFileLocation : warFileLocations) {
       if (isWebApplicationAvailable(warFileLocation)) {
         return true;
@@ -141,11 +114,11 @@ public class AgentUtil {
     return false;
   }
 
-  public String getGeodeHome() {
+  private String getGeodeHome() {
 
-    String geodeHome = System.getenv("GEODE_HOME");
+    String geodeHome = System.getenv(GEODE_HOME);
 
-    logger.info("GEODE_HOME:" + geodeHome);
+    logger.info(GEODE_HOME+":" + geodeHome);
     // Check for empty variable. if empty, then log message and exit HTTP server
     // startup
     if (StringUtils.isBlank(geodeHome)) {


[geode] 01/02: GEODE-5660: Added method to lookup war file from classpath within AgentUtil.java. This is to address problem where http server is started from Java API (Spring Data Geode specifically) Now, the application can reference the `geode-web-api` war from repo and not have to specifically set `GEODE-HOME` property

Posted by ud...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

udo pushed a commit to branch feature/GEODE-5660
in repository https://gitbox.apache.org/repos/asf/geode.git

commit 0b13c82591bf7d95a31309c4bfd22f8962deee02
Author: Udo Kohlmeyer <uk...@pivotal.io>
AuthorDate: Tue Aug 28 17:03:47 2018 -0700

    GEODE-5660: Added method to lookup war file from classpath
    within AgentUtil.java. This is to address problem where
    http server is started from Java API (Spring Data Geode specifically)
    Now, the application can reference the `geode-web-api` war from repo
    and not have to specifically set `GEODE-HOME` property
---
 .../management/internal/AgentUtilJUnitTest.java    |  18 ++++
 .../geode/management/internal/AgentUtil.java       | 104 ++++++++++++++-------
 2 files changed, 88 insertions(+), 34 deletions(-)

diff --git a/geode-assembly/src/integrationTest/java/org/apache/geode/management/internal/AgentUtilJUnitTest.java b/geode-assembly/src/integrationTest/java/org/apache/geode/management/internal/AgentUtilJUnitTest.java
index 4d5b718..7307d65 100644
--- a/geode-assembly/src/integrationTest/java/org/apache/geode/management/internal/AgentUtilJUnitTest.java
+++ b/geode-assembly/src/integrationTest/java/org/apache/geode/management/internal/AgentUtilJUnitTest.java
@@ -15,9 +15,12 @@
 package org.apache.geode.management.internal;
 
 import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertThat;
 
 import java.io.IOException;
 
+import org.hamcrest.text.IsEqualIgnoringCase;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
@@ -50,4 +53,19 @@ public class AgentUtilJUnitTest {
     String gemFireWarLocation = agentUtil.findWarLocation("geode-pulse");
     assertNotNull("Pulse WAR File was not found", gemFireWarLocation);
   }
+
+  @Test
+  public void testLookupOfWarFileOnClassPath() {
+    String classpath = System.getProperty("java.class.path");
+    String gemFireWarLocation = agentUtil.findWarLocation("testWarFile");
+    assertNull(gemFireWarLocation);
+
+    classpath =
+        classpath + System.getProperty("path.separator") + "somelocation/testWarFile.war";
+    System.setProperty("java.class.path", classpath);
+    gemFireWarLocation = agentUtil.findWarLocation("testWarFile");
+    assertNotNull(gemFireWarLocation);
+    assertThat(gemFireWarLocation,
+        IsEqualIgnoringCase.equalToIgnoringCase("somelocation/testWarFile.war"));
+  }
 }
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/AgentUtil.java b/geode-core/src/main/java/org/apache/geode/management/internal/AgentUtil.java
index 95e40dc..83ec51e 100755
--- a/geode-core/src/main/java/org/apache/geode/management/internal/AgentUtil.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/AgentUtil.java
@@ -17,6 +17,9 @@ package org.apache.geode.management.internal;
 
 import java.io.File;
 import java.net.URL;
+import java.util.Arrays;
+import java.util.Objects;
+import java.util.stream.Stream;
 
 import org.apache.commons.lang.StringUtils;
 import org.apache.logging.log4j.Logger;
@@ -28,16 +31,12 @@ import org.apache.geode.internal.logging.LogService;
  * Hosts common utility methods needed by the management package
  *
  * @since Geode 1.0.0.0
- *
  */
 public class AgentUtil {
 
   private static final Logger logger = LogService.getLogger();
 
-  public static final String ERROR_VARIABLE_NOT_SET =
-      "The GEODE_HOME environment variable must be set!";
-
-  private String gemfireVersion = null;
+  private final String gemfireVersion;
 
   public AgentUtil(String gemfireVersion) {
     this.gemfireVersion = gemfireVersion;
@@ -53,44 +52,81 @@ public class AgentUtil {
    *        geode-web-api
    */
   public String findWarLocation(String warFilePrefix) {
-    String geodeHome = getGeodeHome();
-    if (StringUtils.isNotBlank(geodeHome)) {
-      String[] possibleFiles =
-          {geodeHome + "/tools/Extensions/" + warFilePrefix + "-" + gemfireVersion + ".war",
-              geodeHome + "/tools/Pulse/" + warFilePrefix + "-" + gemfireVersion + ".war",
-              geodeHome + "/lib/" + warFilePrefix + "-" + gemfireVersion + ".war",
-              geodeHome + "/tools/Extensions/" + warFilePrefix + ".war",
-              geodeHome + "/tools/Pulse/" + warFilePrefix + ".war",
-              geodeHome + "/lib/" + warFilePrefix + ".war"};
-      for (String possibleFile : possibleFiles) {
-        if (new File(possibleFile).isFile()) {
-          logger.info(warFilePrefix + " war found: {}", possibleFile);
-          return possibleFile;
-        }
-      }
+    final String versionedWarFileName = warFilePrefix + "-" + gemfireVersion + ".war";
+    final String unversionedWarFileName = warFilePrefix + ".war";
+
+    // This will attempt to find the war file defined somewhere on the Java classpath,
+    // other than the
+    String possiblePath =
+        lookupWarLocationFromClasspath(versionedWarFileName, unversionedWarFileName);
+    if (possiblePath != null) {
+      return possiblePath;
+    }
+    possiblePath =
+        findPossibleWarLocationForGeodeHome(versionedWarFileName, unversionedWarFileName);
+    if (possiblePath != null) {
+      return possiblePath;
     }
 
     // if $GEODE_HOME is not set or we are not able to find it in all the possible locations under
-    // $GEODE_HOME, try to
-    // find in the classpath
-    String[] possibleFiles = {warFilePrefix + "-" + gemfireVersion + ".war",
-        "tools/Pulse/" + warFilePrefix + "-" + gemfireVersion + ".war",
-        "tools/Extensions/" + warFilePrefix + "-" + gemfireVersion + ".war",
-        "lib/" + warFilePrefix + "-" + gemfireVersion + ".war", warFilePrefix + ".war"};
-    for (String possibleFile : possibleFiles) {
-      URL url = this.getClass().getClassLoader().getResource(possibleFile);
-      if (url != null) {
-        // found the war file
-        logger.info(warFilePrefix + " war found: {}", possibleFile);
-        return url.getPath();
-      }
+    // $GEODE_HOME, try to find in the classpath
+    possiblePath =
+        findPossibleWarLocationFromExtraLocations(versionedWarFileName, unversionedWarFileName);
+    if (possiblePath != null) {
+      return possiblePath;
     }
 
-    // we still couldn't find the war file
     logger.warn(warFilePrefix + " war file was not found");
     return null;
   }
 
+  private String findPossibleWarLocationFromExtraLocations(String versionedWarFileName,
+      String unversionedWarFileName) {
+    final URL url = Arrays.stream(new String[] {versionedWarFileName,
+        "tools/Pulse/" + versionedWarFileName,
+        "tools/Extensions/" + versionedWarFileName,
+        "lib/" + versionedWarFileName,
+        unversionedWarFileName})
+        .map(possibleFile -> this.getClass().getClassLoader().getResource(possibleFile))
+        .filter(Objects::nonNull).findFirst().orElse(null);
+
+    if (url != null) {
+      final String path = url.getPath();
+      logger.info("War file found: {}", path);
+      return path;
+    }
+    return null;
+  }
+
+  private String findPossibleWarLocationForGeodeHome(String versionedWarFileName,
+      String unversionedWarFileName) {
+    String[] possibleFiles = {};
+    String geodeHome = getGeodeHome();
+    if (StringUtils.isNotBlank(geodeHome)) {
+      possibleFiles = new String[] {geodeHome + "/tools/Extensions/" + versionedWarFileName,
+          geodeHome + "/tools/Pulse/" + versionedWarFileName,
+          geodeHome + "/lib/" + versionedWarFileName,
+          geodeHome + "/tools/Extensions/" + unversionedWarFileName,
+          geodeHome + "/tools/Pulse/" + unversionedWarFileName,
+          geodeHome + "/lib/" + unversionedWarFileName};
+    }
+    return findPossibleWarLocationFromStream(Arrays.stream(possibleFiles));
+  }
+
+  private String findPossibleWarLocationFromStream(Stream<String> stream) {
+    return stream.filter(possiblePath -> new File(possiblePath).isFile())
+        .findFirst().orElse(null);
+  }
+
+  private String lookupWarLocationFromClasspath(String versionedWarFileName,
+      String unversionedWarFileName) {
+    return Arrays
+        .stream(System.getProperty("java.class.path").split(File.pathSeparator))
+        .filter(pathString -> pathString.endsWith(versionedWarFileName) || pathString
+            .endsWith(unversionedWarFileName))
+        .findFirst().orElse(null);
+  }
+
   public boolean isWebApplicationAvailable(final String warFileLocation) {
     return StringUtils.isNotBlank(warFileLocation);
   }