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

[1/3] incubator-geode git commit: GEODE-1025: Removing bundled SDG and special handling of spring jars

Repository: incubator-geode
Updated Branches:
  refs/heads/develop f2eeebbb0 -> e0c20de16


GEODE-1025: Removing bundled SDG and special handling of spring jars

Spring Data Gemfire will no longer be bundled with geode, instead users
will be expected to manually add it to the classpath if they want to
start with spring.

Removing the spring jars from the lib directory, and the special code
that automatically adds the spring jars to the classpath when starting
with --spring-xml-location.


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

Branch: refs/heads/develop
Commit: 4c2d3091f86e0fb2fe3c07f459f71bb3bccb48d1
Parents: 22906e0
Author: Dan Smith <up...@apache.org>
Authored: Mon Apr 4 11:06:53 2016 -0700
Committer: Dan Smith <up...@apache.org>
Committed: Thu Apr 7 14:34:19 2016 -0700

----------------------------------------------------------------------
 build.gradle                                    |  2 -
 geode-assembly/build.gradle                     | 26 +++------
 .../LauncherLifecycleCommandsDUnitTest.java     | 60 --------------------
 .../LauncherLifecycleCommandsJUnitTest.java     | 46 +--------------
 .../src/test/resources/expected_jars.txt        |  3 -
 .../resources/spring/spring-gemfire-context.xml | 43 --------------
 geode-core/build.gradle                         |  7 +--
 .../cli/commands/LauncherLifecycleCommands.java | 60 +-------------------
 geode-rebalancer/build.gradle                   |  1 +
 geode-web/build.gradle                          |  7 ++-
 gradle/dependency-versions.properties           |  2 -
 11 files changed, 21 insertions(+), 236 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4c2d3091/build.gradle
----------------------------------------------------------------------
diff --git a/build.gradle b/build.gradle
index 890bce3..4f79eae 100755
--- a/build.gradle
+++ b/build.gradle
@@ -45,8 +45,6 @@ allprojects {
   repositories {
     mavenCentral()
     maven { url "http://repo.spring.io/release" }
-    maven { url "http://repo.spring.io/milestone" }
-    maven { url "http://repo.spring.io/snapshot" }
   }
 
   group = "org.apache.geode"

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4c2d3091/geode-assembly/build.gradle
----------------------------------------------------------------------
diff --git a/geode-assembly/build.gradle b/geode-assembly/build.gradle
index 7e61d1d..207db73 100755
--- a/geode-assembly/build.gradle
+++ b/geode-assembly/build.gradle
@@ -49,19 +49,7 @@ configurations {
 
 dependencies {
   provided project(':geode-core')
-  bundled ('org.springframework.data:spring-data-commons:' + project.'spring-data-commons.version') {
-    transitive=false
-  }
-  bundled ('org.springframework.data:spring-data-gemfire:' + project.'spring-data-gemfire.version') {
-    transitive=false
-  }
-  bundled ('org.springframework:spring-expression:' + project.'springframework.version') {
-    transitive=false
-  }
-  bundled ('org.springframework:spring-tx:' + project.'springframework.version') {
-    transitive=false
-  }
-  
+
   archives project(':geode-common')  
   archives project(':geode-json')  
   archives project(':geode-joptsimple')  
@@ -75,6 +63,10 @@ dependencies {
 
   testCompile project(':geode-junit')
   testCompile project(path: ':geode-core', configuration: 'testOutput')
+  testCompile ('org.springframework:spring-web:' + project.'springframework.version') {
+    exclude module: 'aopalliance'
+    exclude module: 'spring-aop'
+  }
 
   testCompile 'org.apache.httpcomponents:httpclient:' + project.'httpclient.version'
   testCompile 'org.apache.httpcomponents:httpcore:' + project.'httpcore.version'
@@ -314,18 +306,18 @@ distributions {
         from project(":geode-cq").configurations.archives.allArtifacts.files
 
         from project(":geode-core").configurations.runtime
+        from project(":geode-core").configurations.archives.allArtifacts.files
+
+        from project(":geode-lucene").configurations.runtime
+        from project(":geode-lucene").configurations.archives.allArtifacts.files
 
         from configurations.bundled
 
-        from project(":geode-core").configurations.archives.allArtifacts.files
         //These tasks are included as closures (wrapped in {}) because gradle may evaluate
         //this CopySpec before it evaluates the geode-core build file.
         from { project(":geode-core").webJar }
         from { project(":geode-core").raJar }
         from { project(":geode-core").jcaJar }
-        
-        from project(":geode-lucene").configurations.runtime
-        from project(":geode-lucene").configurations.archives.allArtifacts.files
 
         // include this jar        
         from project(":geode-web-api").jar

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4c2d3091/geode-assembly/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/LauncherLifecycleCommandsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/LauncherLifecycleCommandsDUnitTest.java b/geode-assembly/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/LauncherLifecycleCommandsDUnitTest.java
index 1171207..e41e118 100644
--- a/geode-assembly/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/LauncherLifecycleCommandsDUnitTest.java
+++ b/geode-assembly/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/LauncherLifecycleCommandsDUnitTest.java
@@ -799,66 +799,6 @@ public class LauncherLifecycleCommandsDUnitTest extends CliCommandTestBase {
     assertEquals(Status.NOT_RESPONDING, locatorState.getStatus());
   }
 
-  public void test013StartServerWithSpring() {
-    String pathname = (getClass().getSimpleName() + "_" + getTestMethodName());
-    File workingDirectory = new File(pathname);
-
-    assertTrue(workingDirectory.isDirectory() || workingDirectory.mkdir());
-
-    CommandStringBuilder command = new CommandStringBuilder(CliStrings.START_SERVER);
-
-    command.addOption(CliStrings.START_SERVER__NAME, getClass().getSimpleName().concat("_").concat(getTestMethodName()));
-    command.addOption(CliStrings.START_SERVER__USE_CLUSTER_CONFIGURATION, Boolean.FALSE.toString());
-    command.addOption(CliStrings.START_SERVER__LOG_LEVEL, "config");
-    command.addOption(CliStrings.START_SERVER__INCLUDE_SYSTEM_CLASSPATH);
-    command.addOption(CliStrings.START_SERVER__DISABLE_DEFAULT_SERVER);
-    command.addOption(CliStrings.START_SERVER__DIR, pathname);
-    command.addOption(CliStrings.START_SERVER__SPRING_XML_LOCATION, "spring/spring-gemfire-context.xml");
-
-    CommandResult result = executeCommand(command.toString());
-
-    assertNotNull(result);
-    assertEquals(Result.Status.OK, result.getStatus());
-
-    final ServerLauncher springGemFireServer = new ServerLauncher.Builder().setCommand(
-        ServerLauncher.Command.STATUS).setWorkingDirectory(
-        IOUtils.tryGetCanonicalPathElseGetAbsolutePath(workingDirectory)).build();
-
-    assertNotNull(springGemFireServer);
-
-    ServerState serverState = springGemFireServer.status();
-    
-    assertNotNull(serverState);
-    assertEquals(Status.ONLINE, serverState.getStatus());
-    
-    //Ensure the member name is what is set through spring
-    String logFile = serverState.getLogFile();
-    assertTrue("Log file name was not configured from spring context: " + logFile, logFile.contains("spring_server.log"));
-
-    // Now that the GemFire Server bootstrapped with Spring started up OK, stop it!
-    stopServer(springGemFireServer.getWorkingDirectory());
-
-    WaitCriterion waitCriteria = new WaitCriterion() {
-      @Override
-      public boolean done() {
-        ServerState serverState = springGemFireServer.status();
-        return (serverState != null && Status.NOT_RESPONDING.equals(serverState.getStatus()));
-      }
-
-      @Override
-      public String description() {
-        return "wait for the Locator to stop; the Locator will no longer respond after it stops";
-      }
-    };
-
-    waitForCriterion(waitCriteria, TimeUnit.SECONDS.toMillis(15), TimeUnit.SECONDS.toMillis(5), true);
-
-    serverState = springGemFireServer.status();
-
-    assertNotNull(serverState);
-    assertEquals(Status.NOT_RESPONDING, serverState.getStatus());
-  }
-
   public void test014GemFireServerJvmProcessTerminatesOnOutOfMemoryError() throws Exception {
     int ports[] = AvailablePortHelper.getRandomAvailableTCPPorts(2);
     final int serverPort = ports[0];

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4c2d3091/geode-assembly/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/LauncherLifecycleCommandsJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/LauncherLifecycleCommandsJUnitTest.java b/geode-assembly/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/LauncherLifecycleCommandsJUnitTest.java
index c999cfa..dc89f03 100755
--- a/geode-assembly/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/LauncherLifecycleCommandsJUnitTest.java
+++ b/geode-assembly/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/LauncherLifecycleCommandsJUnitTest.java
@@ -312,47 +312,6 @@ public class LauncherLifecycleCommandsJUnitTest {
   }
 
   @Test
-  public void testGetSpringJars() {
-    List<String> actualSpringJarPathnames = new LauncherLifecycleCommands().getSpringJars();
-
-    assertNotNull(actualSpringJarPathnames);
-    assertEquals(LauncherLifecycleCommands.SPRING_JAR_NAME_PREFIXES.size(), actualSpringJarPathnames.size());
-
-    int springCoreVersion = -1;
-    int springDataCommonsVersion = -1;
-    int springDataGemFireVersion = -1;
-
-    Set<String> expectedSpringJarNames = new HashSet<>(LauncherLifecycleCommands.SPRING_JAR_NAME_PREFIXES);
-
-    assertFalse(expectedSpringJarNames.isEmpty());
-
-    for (String springJarPathname : actualSpringJarPathnames) {
-      String springJarName = springJarPathname.substring(springJarPathname.lastIndexOf(File.separator) + 1);
-      String springJarNamePrefix = springJarName.substring(0, springJarName.lastIndexOf("-"));
-
-      switch (springJarNamePrefix) {
-        case LauncherLifecycleCommands.SPRING_BEANS_JAR_NAME_PREFIX:
-          springCoreVersion = Integer.parseInt(StringUtils.getDigitsOnly(springJarName));
-          break;
-        case LauncherLifecycleCommands.SPRING_DATA_COMMONS_JAR_NAME_PREFIX:
-          springDataCommonsVersion = Integer.parseInt(StringUtils.getDigitsOnly(springJarName));
-          break;
-        case LauncherLifecycleCommands.SPRING_DATA_GEMFIRE_JAR_NAME_PREFIX:
-          springDataGemFireVersion = Integer.parseInt(StringUtils.getDigitsOnly(springJarName));
-          break;
-      }
-
-      expectedSpringJarNames.remove(springJarNamePrefix);
-    }
-
-    assertTrue(String.format("Expected empty; but was (%1$s)", expectedSpringJarNames),
-        expectedSpringJarNames.isEmpty());
-    assertEquals(424, springCoreVersion);
-    assertEquals(191, springDataCommonsVersion);
-    assertEquals(172, springDataGemFireVersion);
-  }
-
-  @Test
   public void testGetSystemClasspath() {
     assertEquals(System.getProperty("java.class.path"), getLauncherLifecycleCommands().getSystemClasspath());
   }
@@ -376,10 +335,9 @@ public class LauncherLifecycleCommandsJUnitTest {
 
     String expectedClasspath = launcherCommands.getGemFireJarPath().concat(File.pathSeparator).concat(
         userClasspath).concat(File.pathSeparator).concat(
-        LauncherLifecycleCommands.CORE_DEPENDENCIES_JAR_PATHNAME).concat(File.pathSeparator).concat(
-        toPath(launcherCommands.getSpringJars().toArray()));
+        LauncherLifecycleCommands.CORE_DEPENDENCIES_JAR_PATHNAME);
 
-    String actualClasspath = launcherCommands.getServerClasspath(false, true, userClasspath);
+    String actualClasspath = launcherCommands.getServerClasspath(false, userClasspath);
 
     assertEquals(expectedClasspath, actualClasspath);
   }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4c2d3091/geode-assembly/src/test/resources/expected_jars.txt
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/resources/expected_jars.txt b/geode-assembly/src/test/resources/expected_jars.txt
index a566c4d..159d1e6 100644
--- a/geode-assembly/src/test/resources/expected_jars.txt
+++ b/geode-assembly/src/test/resources/expected_jars.txt
@@ -61,10 +61,7 @@ spring-aop
 spring-aspects
 spring-beans
 spring-context
-spring-context-support
 spring-core
-spring-data-commons
-spring-data-gemfire
 spring-expression
 spring-hateoas
 spring-ldap-core

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4c2d3091/geode-assembly/src/test/resources/spring/spring-gemfire-context.xml
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/resources/spring/spring-gemfire-context.xml b/geode-assembly/src/test/resources/spring/spring-gemfire-context.xml
deleted file mode 100644
index d6f6df3..0000000
--- a/geode-assembly/src/test/resources/spring/spring-gemfire-context.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-  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.
--->
-
-<beans xmlns="http://www.springframework.org/schema/beans"
-       xmlns:gfe="http://www.springframework.org/schema/gemfire"
-       xmlns:util="http://www.springframework.org/schema/util"
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-       xsi:schemaLocation="
-        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
-        http://www.springframework.org/schema/gemfire http://www.springframework.org/schema/gemfire/spring-gemfire.xsd
-        http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
-  ">
-
-  <util:properties id="gemfireProperties">
-    <prop key="name">SpringGemFireServerBootstrap</prop>
-    <prop key="mcast-port">0</prop>
-    <prop key="log-level">config</prop>
-    <prop key="log-file">spring_server.log</prop>
-    <prop key="http-service-port">0</prop>
-  </util:properties>
-
-  <gfe:cache properties-ref="gemfireProperties" copy-on-read="true"
-             critical-heap-percentage="0.95" eviction-heap-percentage="0.85"
-             pdx-ignore-unread-fields="false" pdx-persistent="true" pdx-read-serialized="true"/>
-
-  <gfe:partitioned-region id="Example" persistent="false"/>
-
-</beans>

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4c2d3091/geode-core/build.gradle
----------------------------------------------------------------------
diff --git a/geode-core/build.gradle b/geode-core/build.gradle
index 1d12be3..e91a2d3 100755
--- a/geode-core/build.gradle
+++ b/geode-core/build.gradle
@@ -101,11 +101,7 @@ dependencies {
   compile ('org.eclipse.jetty:jetty-webapp:' + project.'jetty.version') {
     ext.optional = true
   }
-  runtime ('org.springframework:spring-aop:' + project.'springframework.version') {
-    exclude module: 'aopalliance'
-    ext.optional = true
-  }
-  compile ('org.springframework:spring-webmvc:' + project.'springframework.version') {
+  provided ('org.springframework:spring-webmvc:' + project.'springframework.version') {
     exclude module: 'aopalliance'
     exclude module: 'spring-aop'
     ext.optional = true
@@ -116,6 +112,7 @@ dependencies {
     exclude module: 'cglib'
     exclude module: 'guava'
     exclude module: 'spring-aop'
+    exclude module: 'spring-context-support'
     ext.optional = true
   }
   compile ('org.xerial.snappy:snappy-java:' + project.'snappy-java.version') {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4c2d3091/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/commands/LauncherLifecycleCommands.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/commands/LauncherLifecycleCommands.java b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/commands/LauncherLifecycleCommands.java
index d9928c5..d73c865 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/commands/LauncherLifecycleCommands.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/commands/LauncherLifecycleCommands.java
@@ -157,32 +157,6 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
   protected static final String CORE_DEPENDENCIES_JAR_PATHNAME =
     IOUtils.appendToPath(GEMFIRE_HOME, "lib", "geode-dependencies.jar");
 
-  protected static final String SPRING_AOP_JAR_NAME_PREFIX = "spring-aop";
-  protected static final String SPRING_BEANS_JAR_NAME_PREFIX = "spring-beans";
-  protected static final String SPRING_CONTEXT_JAR_NAME_PREFIX = "spring-context";
-  protected static final String SPRING_CONTEXT_SUPPORT_JAR_NAME_PREFIX = "spring-context-support";
-  protected static final String SPRING_DATA_COMMONS_JAR_NAME_PREFIX = "spring-data-commons";
-  protected static final String SPRING_DATA_GEMFIRE_JAR_NAME_PREFIX = "spring-data-gemfire";
-  protected static final String SPRING_EXPRESSION_JAR_NAME_PREFIX = "spring-expression";
-  protected static final String SPRING_TX_JAR_NAME_PREFIX = "spring-tx";
-
-  protected static final Set<String> SPRING_JAR_NAME_PREFIXES;
-
-  static {
-    Set<String> springJarNamePrefixes = new HashSet<>(8);
-
-    springJarNamePrefixes.add(SPRING_AOP_JAR_NAME_PREFIX);
-    springJarNamePrefixes.add(SPRING_BEANS_JAR_NAME_PREFIX);
-    springJarNamePrefixes.add(SPRING_CONTEXT_JAR_NAME_PREFIX);
-    springJarNamePrefixes.add(SPRING_CONTEXT_SUPPORT_JAR_NAME_PREFIX);
-    springJarNamePrefixes.add(SPRING_DATA_COMMONS_JAR_NAME_PREFIX);
-    springJarNamePrefixes.add(SPRING_DATA_GEMFIRE_JAR_NAME_PREFIX);
-    springJarNamePrefixes.add(SPRING_EXPRESSION_JAR_NAME_PREFIX);
-    springJarNamePrefixes.add(SPRING_TX_JAR_NAME_PREFIX);
-
-    SPRING_JAR_NAME_PREFIXES = Collections.unmodifiableSet(springJarNamePrefixes);
-  }
-
   protected static boolean isAttachApiAvailable() {
     if (ATTACH_API_AVAILABLE.get() == null) {
       try {
@@ -1143,48 +1117,16 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
   }
 
   protected String getServerClasspath(final boolean includeSystemClasspath,
-                                      final boolean includeSpringDependencies,
                                       final String userClasspath)
   {
     List<String> jarFilePathnames = new ArrayList<>();
 
     jarFilePathnames.add(CORE_DEPENDENCIES_JAR_PATHNAME);
 
-    if (includeSpringDependencies) {
-      jarFilePathnames.addAll(getSpringJars());
-    }
-
     return toClasspath(includeSystemClasspath, jarFilePathnames.toArray(new String[jarFilePathnames.size()]),
       userClasspath);
   }
 
-  protected List<String> getSpringJars() {
-    File gemfireHomeDirectory= new File(GEMFIRE_HOME);
-
-    assertArgument(gemfireHomeDirectory.isDirectory(),
-      "Please set the GEMFIRE environment variable to the product installation directory.");
-
-    List<String> springJarFilePathnames = new ArrayList<>(SPRING_JAR_NAME_PREFIXES.size());
-
-    for (File jarFile : new File(gemfireHomeDirectory, "lib").listFiles(new FileFilter() {
-      @Override public boolean accept(final File pathname) {
-        return (pathname.getName().startsWith("spring-") && pathname.getAbsolutePath().endsWith(".jar"));
-      }
-    })) {
-      String jarFileName = jarFile.getName();
-
-      if (SPRING_JAR_NAME_PREFIXES.stream().anyMatch(prefix -> jarFileName.startsWith(prefix))) {
-        springJarFilePathnames.add(jarFile.getAbsolutePath());
-      }
-    }
-
-    assertState(springJarFilePathnames.size() == SPRING_JAR_NAME_PREFIXES.size(),
-      "Unable to find all the necessary Spring JAR files in $GEMFIRE/lib (%1$s): expected (%2$s); but was (%3$s)",
-        gemfireHomeDirectory, SPRING_JAR_NAME_PREFIXES, springJarFilePathnames);
-
-    return springJarFilePathnames;
-  }
-
   protected String getSystemClasspath() {
     return System.getProperty("java.class.path");
   }
@@ -1808,7 +1750,7 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
     commandLine.add("-server");
     commandLine.add("-classpath");
     commandLine.add(getServerClasspath(Boolean.TRUE.equals(includeSystemClasspath),
-      launcher.isSpringXmlLocationSpecified(), userClasspath));
+      userClasspath));
 
     addCurrentLocators(commandLine, gemfireProperties);
     addGemFirePropertyFile(commandLine, gemfirePropertiesPathname);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4c2d3091/geode-rebalancer/build.gradle
----------------------------------------------------------------------
diff --git a/geode-rebalancer/build.gradle b/geode-rebalancer/build.gradle
index c21dbf1..b821590 100644
--- a/geode-rebalancer/build.gradle
+++ b/geode-rebalancer/build.gradle
@@ -23,6 +23,7 @@ dependencies {
     exclude module: 'c3p0'
     exclude module: 'slf4j-api'
   }
+  compile ('org.springframework:spring-context:' + project.'springframework.version')
   testCompile project(':geode-junit')
 
   // the following test dependencies are needed for mocking cache instance

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4c2d3091/geode-web/build.gradle
----------------------------------------------------------------------
diff --git a/geode-web/build.gradle b/geode-web/build.gradle
index a2a3dd1..5bd1d89 100755
--- a/geode-web/build.gradle
+++ b/geode-web/build.gradle
@@ -38,7 +38,12 @@ dependencies {
   }
 
   testCompile 'org.springframework:spring-test:' + project.'springframework.version'
-  
+
+  testCompile ('org.springframework:spring-webmvc:' + project.'springframework.version') {
+    exclude module: 'aopalliance'
+    exclude module: 'spring-aop'
+  }
+
   provided 'javax.servlet:javax.servlet-api:' + project.'javax.servlet-api.version'
    
   // have to use output since we exclude the dependent classes from jar :(

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4c2d3091/gradle/dependency-versions.properties
----------------------------------------------------------------------
diff --git a/gradle/dependency-versions.properties b/gradle/dependency-versions.properties
index beb2d26..18e327e 100644
--- a/gradle/dependency-versions.properties
+++ b/gradle/dependency-versions.properties
@@ -85,8 +85,6 @@ quartz.version = 2.2.1
 scala.version = 2.10.0
 slf4j-api.version = 1.7.7
 snappy-java.version = 1.1.1.6
-spring-data-commons.version = 1.9.1.RELEASE
-spring-data-gemfire.version = 1.7.0.APACHE-GEODE-EA-SNAPSHOT
 spring-hateos.version = 0.16.0.RELEASE
 spring-shell.version = 1.1.0.RELEASE
 spring-ldap-core.version = 1.3.2.RELEASE


[2/3] incubator-geode git commit: GEODE-1025: Switching the latest SDG version and reanabling SDG test

Posted by up...@apache.org.
GEODE-1025: Switching the latest SDG version and reanabling SDG test

Spring Data Gemfire (SDG) now implements a service provider required
to start the cache server with spring. Switching to point at the latest
SDG snapshot and renabling the test for starting with SDG.


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

Branch: refs/heads/develop
Commit: 22906e0b3d0926c09bb260bcd312863282b7a3bd
Parents: f2eeebb
Author: Dan Smith <up...@apache.org>
Authored: Wed Mar 30 15:50:08 2016 -0700
Committer: Dan Smith <up...@apache.org>
Committed: Thu Apr 7 14:34:19 2016 -0700

----------------------------------------------------------------------
 build.gradle                                    |  2 -
 .../LauncherLifecycleCommandsDUnitTest.java     |  3 +-
 .../resources/spring/spring-gemfire-context.xml | 43 ++++++++++++++++++++
 .../cli/commands/LauncherLifecycleCommands.java |  3 +-
 gradle/dependency-versions.properties           |  2 +-
 5 files changed, 46 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/22906e0b/build.gradle
----------------------------------------------------------------------
diff --git a/build.gradle b/build.gradle
index 150038e..890bce3 100755
--- a/build.gradle
+++ b/build.gradle
@@ -47,8 +47,6 @@ allprojects {
     maven { url "http://repo.spring.io/release" }
     maven { url "http://repo.spring.io/milestone" }
     maven { url "http://repo.spring.io/snapshot" }
-    maven { url "http://repo.spring.io/libs-release" }
-    maven { url "http://repo.spring.io/ext-release-local" }
   }
 
   group = "org.apache.geode"

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/22906e0b/geode-assembly/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/LauncherLifecycleCommandsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/LauncherLifecycleCommandsDUnitTest.java b/geode-assembly/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/LauncherLifecycleCommandsDUnitTest.java
index 2344155..1171207 100644
--- a/geode-assembly/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/LauncherLifecycleCommandsDUnitTest.java
+++ b/geode-assembly/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/LauncherLifecycleCommandsDUnitTest.java
@@ -799,8 +799,7 @@ public class LauncherLifecycleCommandsDUnitTest extends CliCommandTestBase {
     assertEquals(Status.NOT_RESPONDING, locatorState.getStatus());
   }
 
-  @Ignore("Disabled until GEODE-1025, SGF-476 are resolved")
-  public void IGNORE_test013StartServerWithSpring() {
+  public void test013StartServerWithSpring() {
     String pathname = (getClass().getSimpleName() + "_" + getTestMethodName());
     File workingDirectory = new File(pathname);
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/22906e0b/geode-assembly/src/test/resources/spring/spring-gemfire-context.xml
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/resources/spring/spring-gemfire-context.xml b/geode-assembly/src/test/resources/spring/spring-gemfire-context.xml
new file mode 100644
index 0000000..d6f6df3
--- /dev/null
+++ b/geode-assembly/src/test/resources/spring/spring-gemfire-context.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  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.
+-->
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:gfe="http://www.springframework.org/schema/gemfire"
+       xmlns:util="http://www.springframework.org/schema/util"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="
+        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+        http://www.springframework.org/schema/gemfire http://www.springframework.org/schema/gemfire/spring-gemfire.xsd
+        http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
+  ">
+
+  <util:properties id="gemfireProperties">
+    <prop key="name">SpringGemFireServerBootstrap</prop>
+    <prop key="mcast-port">0</prop>
+    <prop key="log-level">config</prop>
+    <prop key="log-file">spring_server.log</prop>
+    <prop key="http-service-port">0</prop>
+  </util:properties>
+
+  <gfe:cache properties-ref="gemfireProperties" copy-on-read="true"
+             critical-heap-percentage="0.95" eviction-heap-percentage="0.85"
+             pdx-ignore-unread-fields="false" pdx-persistent="true" pdx-read-serialized="true"/>
+
+  <gfe:partitioned-region id="Example" persistent="false"/>
+
+</beans>

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/22906e0b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/commands/LauncherLifecycleCommands.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/commands/LauncherLifecycleCommands.java b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/commands/LauncherLifecycleCommands.java
index 40aa320..d9928c5 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/commands/LauncherLifecycleCommands.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/commands/LauncherLifecycleCommands.java
@@ -1172,9 +1172,8 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
       }
     })) {
       String jarFileName = jarFile.getName();
-      String jarFileNamePrefix = jarFileName.substring(0, jarFileName.lastIndexOf("-"));
 
-      if (SPRING_JAR_NAME_PREFIXES.contains(jarFileNamePrefix.toLowerCase().trim())) {
+      if (SPRING_JAR_NAME_PREFIXES.stream().anyMatch(prefix -> jarFileName.startsWith(prefix))) {
         springJarFilePathnames.add(jarFile.getAbsolutePath());
       }
     }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/22906e0b/gradle/dependency-versions.properties
----------------------------------------------------------------------
diff --git a/gradle/dependency-versions.properties b/gradle/dependency-versions.properties
index 7a5054b..beb2d26 100644
--- a/gradle/dependency-versions.properties
+++ b/gradle/dependency-versions.properties
@@ -86,7 +86,7 @@ scala.version = 2.10.0
 slf4j-api.version = 1.7.7
 snappy-java.version = 1.1.1.6
 spring-data-commons.version = 1.9.1.RELEASE
-spring-data-gemfire.version = 1.7.2.RELEASE
+spring-data-gemfire.version = 1.7.0.APACHE-GEODE-EA-SNAPSHOT
 spring-hateos.version = 0.16.0.RELEASE
 spring-shell.version = 1.1.0.RELEASE
 spring-ldap-core.version = 1.3.2.RELEASE


[3/3] incubator-geode git commit: GEODE-1177: Adding a few more classes to exclude from object sizing

Posted by up...@apache.org.
GEODE-1177: Adding a few more classes to exclude from object sizing

This is not a complete fix for the http session management problem, but
this is a safety catch we should probably have in the product to avoid
following references into InternalDistributedSystem, Classloaders, or
Loggers when computing the size of a user's object.


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

Branch: refs/heads/develop
Commit: e0c20de1645d65bd67eb61350c2ad474b341998c
Parents: 4c2d309
Author: Dan Smith <up...@apache.org>
Authored: Tue Apr 5 13:30:44 2016 -0700
Committer: Dan Smith <up...@apache.org>
Committed: Thu Apr 7 14:34:20 2016 -0700

----------------------------------------------------------------------
 .../internal/size/ReflectionObjectSizer.java    |  9 ++-
 .../size/ReflectionObjectSizerJUnitTest.java    | 71 ++++++++++++++++++++
 2 files changed, 79 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/e0c20de1/geode-core/src/main/java/com/gemstone/gemfire/internal/size/ReflectionObjectSizer.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/size/ReflectionObjectSizer.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/size/ReflectionObjectSizer.java
index 04961b6..36443da 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/size/ReflectionObjectSizer.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/size/ReflectionObjectSizer.java
@@ -24,9 +24,12 @@ import com.gemstone.gemfire.InternalGemFireError;
 import com.gemstone.gemfire.cache.Cache;
 import com.gemstone.gemfire.cache.Region;
 import com.gemstone.gemfire.cache.util.ObjectSizer;
+import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
 import com.gemstone.gemfire.internal.cache.PlaceHolderDiskRegion;
 import com.gemstone.gemfire.internal.size.ObjectGraphSizer.ObjectFilter;
 
+import org.apache.logging.log4j.Logger;
+
 /**
  * An implementation of {@link ObjectSizer} that calculates an accurate, in
  * memory size of for each object that it sizes. This is the slowest method of
@@ -52,9 +55,13 @@ public class ReflectionObjectSizer implements ObjectSizer, Serializable {
       //Protect the user from a couple of pitfalls. If their object
       //has a link to a region or cache, we don't want to size the whole thing.
       if (object instanceof Region || object instanceof Cache
-          || object instanceof PlaceHolderDiskRegion) {
+          || object instanceof PlaceHolderDiskRegion
+          || object instanceof InternalDistributedSystem
+          || object instanceof ClassLoader
+          || object instanceof Logger) {
         return false;
       }
+
       return true;
     }
     

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/e0c20de1/geode-core/src/test/java/com/gemstone/gemfire/internal/size/ReflectionObjectSizerJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/size/ReflectionObjectSizerJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/size/ReflectionObjectSizerJUnitTest.java
new file mode 100644
index 0000000..4489433
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/size/ReflectionObjectSizerJUnitTest.java
@@ -0,0 +1,71 @@
+/*
+ * 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.internal.size;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
+import com.gemstone.gemfire.internal.logging.LogService;
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import io.codearte.catchexception.shade.mockito.Mockito;
+
+@Category(UnitTest.class)
+public class ReflectionObjectSizerJUnitTest {
+
+  @Test
+  public void skipsSizingDistributedSystem() {
+
+    Object referenceObject = Mockito.mock(InternalDistributedSystem.class);
+    checkSizeDoesNotChange(referenceObject);
+  }
+
+  @Test
+  public void skipsSizingClassLoader() {
+
+    checkSizeDoesNotChange(Thread.currentThread().getContextClassLoader());
+  }
+
+  @Test
+  public void skipsSizingLogger() {
+    checkSizeDoesNotChange(LogService.getLogger());
+  }
+
+  private void checkSizeDoesNotChange(final Object referenceObject) {
+    final ReflectionObjectSizer sizer = ReflectionObjectSizer.getInstance();
+    final TestObject nullReference = new TestObject(null);
+    int sizeWithoutReference = sizer.sizeof(nullReference);
+    final TestObject distributedSystemReference = new TestObject(referenceObject);
+    final TestObject stringReference = new TestObject("hello");
+
+    assertEquals(sizeWithoutReference, sizer.sizeof(distributedSystemReference));
+    assertNotEquals(sizeWithoutReference, sizer.sizeof(stringReference));
+  }
+
+  public class TestObject {
+
+    public TestObject(final Object reference) {
+      this.reference = reference;
+    }
+
+    Object reference = null;
+  }
+
+}