You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by kl...@apache.org on 2016/02/01 19:08:04 UTC

[1/6] incubator-geode git commit: GEODE-859: Modularize build script

Repository: incubator-geode
Updated Branches:
  refs/heads/feature/GEODE-805 4f0d877b8 -> 122e10f0a


GEODE-859: Modularize build script

The root build.gradle script was getting unwieldy.  This change
breaks the script into the following sections:

- code-analysis.gradle
- ide.gradle
- java.gradle
- publish.gradle
- rat.gradle
- test.gradle

Each section should be relatively independent.  For example, the
test script contains all the test dependencies.


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

Branch: refs/heads/feature/GEODE-805
Commit: 4903d907d702143836a8df0335f98f88a9f47c9f
Parents: 80bd7d8
Author: Anthony Baker <ab...@apache.org>
Authored: Tue Jan 26 09:00:12 2016 -0800
Committer: Anthony Baker <ab...@apache.org>
Committed: Sat Jan 30 09:02:43 2016 -0800

----------------------------------------------------------------------
 build.gradle                  | 527 +------------------------------------
 gemfire-assembly/build.gradle |   8 +-
 gradle/code-analysis.gradle   | 113 ++++++++
 gradle/ide.gradle             |  53 ++++
 gradle/java.gradle            | 106 ++++++++
 gradle/publish.gradle         |  83 ++++++
 gradle/rat.gradle             |   4 +
 gradle/test.gradle            | 243 +++++++++++++++++
 8 files changed, 619 insertions(+), 518 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4903d907/build.gradle
----------------------------------------------------------------------
diff --git a/build.gradle b/build.gradle
index 28519dd..059cf31 100755
--- a/build.gradle
+++ b/build.gradle
@@ -27,7 +27,6 @@ buildscript {
   }
 }
 
-apply from: 'gradle/rat.gradle'
 apply plugin: 'wrapper'
 
 // Load all properties in dependency-version.properties as project properties, so all projects can read them
@@ -56,538 +55,32 @@ allprojects {
 
   group = "org.apache.geode"
 
-  apply plugin: 'idea'
-  apply plugin: 'eclipse'
-  
   buildRoot = buildRoot.trim()
   if (!buildRoot.isEmpty()) {
     buildDir = buildRoot + project.path.replace(":", "/") + "/build"
   }
-
-  gradle.taskGraph.whenReady( { graph ->
-    tasks.withType(Tar).each { tar ->
-      tar.compression = Compression.GZIP
-      tar.extension = 'tar.gz'
-    }
-  })
 }
 
-task clean (type: Delete) {
+task clean(type: Delete) {
   delete rootProject.buildDir
   if (!buildRoot.isEmpty()) {
     delete buildRoot
   }  
 }
 
-def testResultsDir(def parent, def name) {
-  new File(parent, name)
-}
-
-def writeTestProperties(def parent, def name) {
-  def availablePortFinder = AvailablePortFinder.createPrivate()
-  
-  def props = new Properties()
-  props.setProperty('mcast-port', Integer.toString(availablePortFinder.nextAvailable))
-  props.setProperty('log-level', 'config')
-  def propsFile = new File(testResultsDir(parent, name), 'gemfire.properties')
-  def writer = propsFile.newWriter()
-  props.store(writer, 'Autogenerated Gemfire properties')
-
+// allow external projects to override include location
+if (name == 'gemfire') {
+  ext.scriptDir = 'gradle'
 }
 
-task combineReports(type: TestReport) {
-  description 'Combines the test reports.'
-  destinationDir = file "${rootProject.buildDir}/reports/combined"
-
-  doLast {
-    println "All test reports at ${rootProject.buildDir}/reports/combined"
-  }
-}
-
-gradle.taskGraph.whenReady({ graph ->
-  tasks.getByName('combineReports').reportOn rootProject.subprojects.collect{ it.tasks.withType(Test) }.flatten()
-})
+apply from: "${scriptDir}/java.gradle"
+apply from: "${scriptDir}/test.gradle"
+apply from: "${scriptDir}/publish.gradle"
+apply from: "${scriptDir}/code-analysis.gradle"
+apply from: "${scriptDir}/ide.gradle"
+apply from: "${scriptDir}/rat.gradle"
 
 subprojects {
-  apply plugin: 'java'
-
-  // apply compiler options
-  gradle.taskGraph.whenReady( { graph ->
-    tasks.withType(JavaCompile).each { javac ->
-      javac.configure {
-        sourceCompatibility '1.8'
-        targetCompatibility '1.8'
-        options.encoding = 'UTF-8'
-      }
-    }
-  })
-  
-  // apply default manifest
-  gradle.taskGraph.whenReady( { graph ->
-    tasks.withType(Jar).each { jar ->
-      jar.doFirst {
-        manifest {
-          attributes(
-            "Manifest-Version"  : "1.0",
-            "Created-By"        : System.getProperty("user.name"),
-            "Title"             : rootProject.name,
-            "Version"           : version,
-            "Organization"      : "Apache Software Foundation (ASF)"
-          )
-        }
-      }
-    }
-  })
-
-  configurations {
-    provided {
-      description 'a dependency that is provided externally at runtime'
-      visible true
-    }
-    
-    testOutput {
-      extendsFrom testCompile
-      description  'a dependency that exposes test artifacts'
-    }
-  }
-
-  // Here we want to disable all transitive dependencies on external artifacts.  This
-  // allows us to lock down library versions.  However, we want project dependencies to
-  // be transitive such that the libraries of a dependent project are automatically included.
-  configurations.all {
-    dependencies.all { dep ->
-      if (dep instanceof ModuleDependency && !(dep instanceof ProjectDependency)) {
-        dep.transitive = false
-      }
-    }
-  }
- 
-  // Configuration for Checkstyle, FindBugs
-  if (project.hasProperty("staticAnalysis")) {
-    apply plugin: 'checkstyle'
-
-    //Checkstyle configuration
-    configurations.checkstyle {
-      dependencies.all { dep ->
-        dep.transitive = true
-      }
-    }
-    
-    //Findbugs configuration
-    apply plugin: 'findbugs'
- 
-    configurations.findbugs {
-      dependencies.all { dep ->
-        dep.transitive = true
-      }
-    }
-
-    // Switch default Findbugs report to HTML for developers
-    def findbugsXmlEnabled = false
-    def findbugsHtmlEnabled = true
-
-    // Provide ability to change report type to XML for ingesting into other ap
-    if ( project.hasProperty("findbugsXmlReport") ) {
-      findbugsXmlEnabled = true
-      findbugsHtmlEnabled = false
-    }
-
-    configurations.findbugs {
-      dependencies.all { dep ->
-        dep.transitive = true
-      }
-      findbugs.effort = 'max'
-      findbugs.reportLevel = 'low'
-    }
- 
-    tasks.withType(FindBugs) {
-      reports {
-        xml.enabled = findbugsXmlEnabled
-        html.enabled = findbugsHtmlEnabled
-      }
-    }
-  }
-
-  // JaCoCo configuration
-  if (project.hasProperty("codeCoverage")) {
-    apply plugin: 'jacoco'
-    
-    configurations.jacocoAnt {
-      dependencies.all { dep ->
-          dep.transitive = true
-      }
-    }
-
-    task mergeIntegrationTestCoverage (type: JacocoMerge) {
-      description 'Merges Distributed and Integration test coverage results'
-
-      destinationFile = file("${buildDir}/jacoco/mergedIntegrationTestCoverage.exec")
-      executionData = fileTree(dir: 'build/jacoco', include: ['**/distributedTest.exec','**/integrationTest.exec'])
-
-    }
-
-    jacocoTestReport {
-      reports { 
-        csv.enabled false
-        sourceSets project.sourceSets.main
-        html.destination "${buildDir}/jacocoTestHtml"
-      }
-    }
-    
-    task jacocoIntegrationTestReport (type: JacocoReport) {
-      reports { 
-        csv.enabled false
-        sourceSets project.sourceSets.main
-        html.destination "${buildDir}/jacocoIntegrationTestHtml"
-        executionData = fileTree(dir: 'build/jacoco', include: '**/integrationTest.exec')
-      }
-    }
-    
-    task jacocoDistributedTestReport (type: JacocoReport) {
-      reports { 
-        csv.enabled false
-        sourceSets project.sourceSets.main
-        html.destination "${buildDir}/jacocoDistributedTestHtml"
-        executionData = fileTree(dir: 'build/jacoco', include: '**/distributedTest.exec')
-      }
-    }
-    
-    task jacocoOverallTestReport (type: JacocoReport) {
-      reports { 
-        csv.enabled false
-        sourceSets project.sourceSets.main
-        html.destination "${buildDir}/jacocoOverallTestHtml"
-        executionData = fileTree(dir: 'build/jacoco', include: '**/*.exec')
-      }
-    }
-  }
- 
-  eclipse {
-    classpath {
-      defaultOutputDir = file('build-eclipse')
-      downloadSources = true
-      plusConfigurations += [ configurations.provided ]     
-    }
-    // Several files have UTF-8 encoding and Eclipse running on Windows
-    // will have trouble unless we tell it to use UTF-8 encoding.
-    // This setting needs to go into the core.resources.prefs file,
-    // which the JDT script isn't set up to configure
-    eclipseJdt << {
-      File f = file('.settings/org.eclipse.core.resources.prefs')
-      f.write('eclipse.preferences.version=1\n')
-      f.append('encoding/<project>=utf-8')
-    }
-  }
-  
-  cleanEclipse << {
-    delete '.settings/org.eclipse.core.resources.prefs'
-  }
-
-  tasks.eclipse.dependsOn(cleanEclipse)
-
-  idea {
-    module {
-      downloadSources = true
-      scopes.PROVIDED.plus += [ configurations.provided ]
-    }
-  }
-    
-  task jarTest (type: Jar, dependsOn: testClasses) {
-    description 'Assembles a jar archive of test classes.'
-    from sourceSets.test.output
-    classifier 'test'
-  }
-
-  artifacts {
-    testOutput jarTest
-  }
-
-  sourceSets {
-    main.compileClasspath += configurations.provided
-    main.runtimeClasspath -= configurations.provided
-    test.compileClasspath += configurations.provided
-    test.runtimeClasspath += configurations.provided
-  }
-
-  javadoc.classpath += configurations.provided
-
-  javadoc {
-    options.addStringOption('Xdoclint:none', '-quiet')
-    options.encoding='UTF-8'
-  }
-
-  dependencies {
-    compile 'org.springframework:spring-aop:' + project.'springframework.version'
-    compile 'org.springframework:spring-beans:' + project.'springframework.version'
-    compile 'org.springframework:spring-context:' + project.'springframework.version'
-    compile 'org.springframework:spring-context-support:' + project.'springframework.version'
-    compile 'org.springframework:spring-core:' + project.'springframework.version'
-    compile 'org.springframework:spring-expression:' + project.'springframework.version'
-    compile 'org.springframework:spring-web:' + project.'springframework.version'
-    compile 'org.springframework:spring-webmvc:' + project.'springframework.version'
-    compile 'com.github.stephenc.findbugs:findbugs-annotations:' + project.'stephenc-findbugs.version'
-
-    testCompile 'com.github.stefanbirkner:system-rules:' + project.'system-rules.version'
-    testCompile 'com.google.code.tempus-fugit:tempus-fugit:' + project.'tempus-fugit.version'
-    testCompile 'com.jayway.awaitility:awaitility:' + project.'awaitility.version'
-    testCompile 'edu.umd.cs.mtc:multithreadedtc:' + project.'multithreadedtc.version'
-    testCompile 'eu.codearte.catch-exception:catch-exception:' + project.'catch-exception.version'
-    testCompile 'eu.codearte.catch-exception:catch-throwable:' + project.'catch-throwable.version'
-    testCompile 'junit:junit:' + project.'junit.version'
-    testCompile 'org.assertj:assertj-core:' + project.'assertj-core.version'
-    testCompile 'org.mockito:mockito-core:' + project.'mockito-core.version'
-    testCompile 'org.hamcrest:hamcrest-all:' + project.'hamcrest-all.version'
-    testCompile 'org.jmock:jmock:' + project.'jmock.version'
-    testCompile 'org.jmock:jmock-junit4:' + project.'jmock.version'
-    testCompile 'org.jmock:jmock-legacy:' + project.'jmock.version'
-    testCompile 'pl.pragmatists:JUnitParams:' + project.'JUnitParams.version'
-    
-    testRuntime 'cglib:cglib:' + project.'cglib.version'
-    testRuntime 'org.objenesis:objenesis:' + project.'objenesis.version'
-    testRuntime 'org.ow2.asm:asm:' + project.'asm.version'
-  }
-
-  //This target does not run any tests. Rather, it validates that there are no
-  //tests that are missing a category annotation
-  task checkMissedTests(type: Test) {
-    include '**/*Test.class'
-    useJUnit {
-      excludeCategories 'com.gemstone.gemfire.test.junit.categories.UnitTest'
-      excludeCategories 'com.gemstone.gemfire.test.junit.categories.IntegrationTest'
-      excludeCategories 'com.gemstone.gemfire.test.junit.categories.DistributedTest'
-      excludeCategories 'com.gemstone.gemfire.test.junit.categories.PerformanceTest'
-      excludeCategories 'com.gemstone.gemfire.test.junit.categories.HydraTest'
-      excludeCategories 'com.gemstone.gemfire.test.junit.categories.ContainerTest'
-      excludeCategories 'com.gemstone.gemfire.test.junit.categories.UITest'
-    }
-
-    beforeTest { descriptor ->
-      throw new GradleException("The test " + descriptor.getClassName() + "." + descriptor.getName() + " does not include a junit category.");
-    }
-  }
-
-
-  test {
-    include '**/*Test.class'
-    useJUnit {
-      includeCategories 'com.gemstone.gemfire.test.junit.categories.UnitTest'
-      excludeCategories 'com.gemstone.gemfire.test.junit.categories.IntegrationTest'
-      excludeCategories 'com.gemstone.gemfire.test.junit.categories.DistributedTest'
-      excludeCategories 'com.gemstone.gemfire.test.junit.categories.PerformanceTest'
-      excludeCategories 'com.gemstone.gemfire.test.junit.categories.HydraTest'
-      excludeCategories 'com.gemstone.gemfire.test.junit.categories.ContainerTest'
-      excludeCategories 'com.gemstone.gemfire.test.junit.categories.UITest'
-    }    
-    
-    // run each test in its own vm to avoid interference issues if a test doesn't clean up
-    // state
-    //forkEvery 1
-    
-    doFirst {
-      writeTestProperties(buildDir, name)
-    }
-  }
-
-  task integrationTest(type:Test) {
-    include '**/*Test.class'
-    exclude '**/*DUnitTest.class'
-    useJUnit {
-      excludeCategories 'com.gemstone.gemfire.test.junit.categories.UnitTest'
-      includeCategories 'com.gemstone.gemfire.test.junit.categories.IntegrationTest'
-      excludeCategories 'com.gemstone.gemfire.test.junit.categories.DistributedTest'
-      excludeCategories 'com.gemstone.gemfire.test.junit.categories.PerformanceTest'
-      excludeCategories 'com.gemstone.gemfire.test.junit.categories.HydraTest'
-      excludeCategories 'com.gemstone.gemfire.test.junit.categories.ContainerTest'
-      excludeCategories 'com.gemstone.gemfire.test.junit.categories.UITest'
-    }    
-
-    forkEvery 1
-
-    doFirst {
-      writeTestProperties(buildDir, name)
-    }
-  }
-
-  task uiTest(type:Test) {
-    include '**/*Test.class'
-    useJUnit {
-      excludeCategories 'com.gemstone.gemfire.test.junit.categories.UnitTest'
-      excludeCategories 'com.gemstone.gemfire.test.junit.categories.IntegrationTest'
-      excludeCategories 'com.gemstone.gemfire.test.junit.categories.DistributedTest'
-      excludeCategories 'com.gemstone.gemfire.test.junit.categories.PerformanceTest'
-      excludeCategories 'com.gemstone.gemfire.test.junit.categories.HydraTest'
-      excludeCategories 'com.gemstone.gemfire.test.junit.categories.ContainerTest'
-      includeCategories 'com.gemstone.gemfire.test.junit.categories.UITest'
-    }
-
-    doFirst {
-      writeTestProperties(buildDir, name)
-    }
-  }
-  
-  task distributedTest(type:Test) {
-    include '**/*Test.class'
-    
-    // maxParallelForks = 2
-    // maxParallelForks = Runtime.runtime.availableProcessors()
-    
-    useJUnit {
-      excludeCategories 'com.gemstone.gemfire.test.junit.categories.UnitTest'
-      excludeCategories 'com.gemstone.gemfire.test.junit.categories.IntegrationTest'
-      includeCategories 'com.gemstone.gemfire.test.junit.categories.DistributedTest'
-      excludeCategories 'com.gemstone.gemfire.test.junit.categories.PerformanceTest'
-      excludeCategories 'com.gemstone.gemfire.test.junit.categories.HydraTest'
-      excludeCategories 'com.gemstone.gemfire.test.junit.categories.ContainerTest'
-      excludeCategories 'com.gemstone.gemfire.test.junit.categories.UITest'
-    }    
-    
-    //I'm hoping this might deal with SOME OOMEs I've seen
-    forkEvery 30
-
-  }
-
-  // By proving a file with an arbitrary list of test classes, we can select only those
-  // tests to run. Activated using -Dcustom.tests=<file> customTest
-  def customTestList = []
-  def customTestFile = System.getProperty('custom.tests')
-  if (customTestFile != null) {
-    new File(customTestFile).eachLine { customTestList << it }
-  }
-
-  task customTest(type:Test) {
-    include { x ->
-      (x.isDirectory() || customTestList.any { y -> x.getName().contains(y) } ) ? true : false
-    }
-
-    forkEvery 30
-  }
-
-  // apply common test configuration
-  gradle.taskGraph.whenReady( { graph ->
-    tasks.withType(Test).each { test ->
-      check.dependsOn test
-      test.configure {
-        onlyIf { ! Boolean.getBoolean('skip.tests') }
-
-        //force tests to be run every time by
-        //saying the results are never up to date
-        outputs.upToDateWhen { false }
-    
-        def resultsDir = testResultsDir(buildDir, test.name)
-        workingDir resultsDir.absolutePath
-        
-        reports.html.destination = file "$buildDir/reports/$name"
-        testLogging {
-          exceptionFormat = 'full'
-        }
-        
-        maxHeapSize '768m'
-        jvmArgs = ['-XX:+HeapDumpOnOutOfMemoryError', '-ea']
-
-        systemProperty 'gemfire.DEFAULT_MAX_OPLOG_SIZE', '10'
-        systemProperty 'gemfire.disallowMcastDefaults', 'true'
-        systemProperty 'jline.terminal', 'jline.UnsupportedTerminal'
-
-        def eol = System.getProperty('line.separator')
-        def progress = new File(resultsDir, "$test.name-progress.txt")
-        beforeTest { desc ->
-          def now = new Date().format('yyyy-MM-dd HH:mm:ss.SSS Z')
-          progress << "$now Starting test $desc.className $desc.name$eol"
-        }
-        afterTest { desc, result ->
-          def now = new Date().format('yyyy-MM-dd HH:mm:ss.SSS Z')
-          progress << "$now Completed test $desc.className $desc.name with result: ${result.resultType}$eol"
-        }
-        
-        doFirst {
-          resultsDir.deleteDir()
-          resultsDir.mkdirs()
-        }
-      }
-    }
-  })
-
-  // publishing configuration
-  apply plugin: 'com.bmuschko.nexus'
-  
-  extraArchive {
-    sources = true
-    javadoc = true
-    tests = false
-  }
-
-  nexus {
-    sign = true
-    repositoryUrl = 'https://repository.apache.org/service/local/staging/deploy/maven2'
-    snapshotRepositoryUrl = 'https://repository.apache.org/content/repositories/snapshots'
-  }
-  
-  modifyPom {
-    project {
-      name 'Apache Geode (incubating)'
-      description 'Apache Geode (incubating) provides a database-like consistency model, reliable transaction processing and a shared-nothing architecture to maintain very low latency performance with high concurrency processing'
-      url 'http://geode.incubator.apache.org'
-
-      scm {
-        url 'https://git-wip-us.apache.org/repos/asf?p=incubator-geode.git;a=tree'
-        connection 'scm:https://git-wip-us.apache.org/repos/asf/incubator-geode.git'
-        developerConnection 'scm:https://git-wip-us.apache.org/repos/asf/incubator-geode.git'
-      }
-
-      licenses {
-        license {
-          name 'The Apache Software License, Version 2.0'
-          url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
-        }
-      }
-
-      repositories {
-        repository {
-          id 'libs-release'
-          name 'Spring Maven libs-release Repository'
-          url 'http://repo.spring.io/libs-release'
-        }
-      }
-    }
-  }
-
-  // The nexus plugin reads authentication from ~/.gradle/gradle.properties but the
-  // jenkins server stores publishing credentials in ~/.m2/settings.xml (maven).
-  // We match on the expected snapshot repository id.
-  afterEvaluate {
-    if (!isReleaseVersion && System.env.USER == 'jenkins') {
-      def settingsXml = new File(System.getProperty('user.home'), '.m2/settings.xml')
-      if (settingsXml.exists()) {
-        def snapshotCreds = new XmlSlurper().parse(settingsXml).servers.server.find { server ->
-          server.id.text() == 'apache.snapshots.https'
-        }
-  
-        if (snapshotCreds != null) {
-          tasks.uploadArchives.doFirst {
-            repositories().withType(MavenDeployer).each { repo ->
-              repo.snapshotRepository.authentication.userName = snapshotCreds.username.text()
-              repo.snapshotRepository.authentication.password = snapshotCreds.password.text()
-            }
-          }
-        }
-      }
-    }
-  }
-
-  // Make precheckin task run all validation tests for checking in code.
-  task precheckin (dependsOn: [ build, integrationTest, distributedTest ]) {
-    description 'Run this task before checking in code to validate changes. This task combines the following tasks: build, integrationTest, and distributedTest'
-  }
-
-  check.dependsOn checkMissedTests, rat
-  combineReports.mustRunAfter check, test, integrationTest, distributedTest, checkMissedTests
-  build.finalizedBy combineReports
-  check.finalizedBy combineReports
-  test.finalizedBy combineReports
-  integrationTest.finalizedBy combineReports
-  distributedTest.finalizedBy combineReports
-  checkMissedTests.finalizedBy combineReports
-
   // Make sure clean task for rootProject runs last
   clean.finalizedBy rootProject.clean
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4903d907/gemfire-assembly/build.gradle
----------------------------------------------------------------------
diff --git a/gemfire-assembly/build.gradle b/gemfire-assembly/build.gradle
index 834413e..3b2594c 100755
--- a/gemfire-assembly/build.gradle
+++ b/gemfire-assembly/build.gradle
@@ -16,9 +16,9 @@
  */
 import org.gradle.api.internal.artifacts.publish.ArchivePublishArtifact;
 
-
 apply plugin: 'distribution'
 
+// disable artifact generation for this project
 jar.enabled = false
 extraArchive {
   sources = false
@@ -41,6 +41,12 @@ configurations.all {
   artifacts.removeAll artifacts.findAll { it instanceof ArchivePublishArtifact && !it.archiveTask.enabled }
 }
 
+gradle.taskGraph.whenReady( { graph ->
+  tasks.withType(Tar).each { tar ->
+    tar.compression = Compression.GZIP
+    tar.extension = 'tar.gz'
+  }
+})
 
 dependencies {
   provided project(':gemfire-core')

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4903d907/gradle/code-analysis.gradle
----------------------------------------------------------------------
diff --git a/gradle/code-analysis.gradle b/gradle/code-analysis.gradle
new file mode 100644
index 0000000..7ce31e8
--- /dev/null
+++ b/gradle/code-analysis.gradle
@@ -0,0 +1,113 @@
+/*
+ * 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.
+ */
+subprojects {
+  if (project.hasProperty("staticAnalysis")) {
+    apply plugin: 'checkstyle'
+  
+    //Checkstyle configuration
+    configurations.checkstyle {
+      dependencies.all { dep ->
+        dep.transitive = true
+      }
+    }
+  
+    //Findbugs configuration
+    apply plugin: 'findbugs'
+  
+    // Switch default Findbugs report to HTML for developers
+    def findbugsXmlEnabled = false
+    def findbugsHtmlEnabled = true
+  
+    // Provide ability to change report type to XML for ingesting into other ap
+    if ( project.hasProperty("findbugsXmlReport") ) {
+      findbugsXmlEnabled = true
+      findbugsHtmlEnabled = false
+    }
+  
+    configurations.findbugs {
+      dependencies.all { dep ->
+        dep.transitive = true
+      }
+      findbugs.effort = 'max'
+      findbugs.reportLevel = 'low'
+    }
+  
+    tasks.withType(FindBugs) {
+      reports {
+        xml.enabled = findbugsXmlEnabled
+        html.enabled = findbugsHtmlEnabled
+      }
+    }
+  }
+  
+  // JaCoCo configuration
+  if (project.hasProperty("codeCoverage")) {
+    apply plugin: 'jacoco'
+  
+    configurations.jacocoAnt {
+      dependencies.all { dep ->
+        dep.transitive = true
+      }
+    }
+  
+    task mergeIntegrationTestCoverage (type: JacocoMerge) {
+      description 'Merges Distributed and Integration test coverage results'
+  
+      destinationFile = file("${buildDir}/jacoco/mergedIntegrationTestCoverage.exec")
+      executionData = fileTree(dir: 'build/jacoco', include: [
+        '**/distributedTest.exec',
+        '**/integrationTest.exec'
+      ])
+  
+    }
+  
+    jacocoTestReport {
+      reports {
+        csv.enabled false
+        sourceSets project.sourceSets.main
+        html.destination "${buildDir}/jacocoTestHtml"
+      }
+    }
+  
+    task jacocoIntegrationTestReport (type: JacocoReport) {
+      reports {
+        csv.enabled false
+        sourceSets project.sourceSets.main
+        html.destination "${buildDir}/jacocoIntegrationTestHtml"
+        executionData = fileTree(dir: 'build/jacoco', include: '**/integrationTest.exec')
+      }
+    }
+  
+    task jacocoDistributedTestReport (type: JacocoReport) {
+      reports {
+        csv.enabled false
+        sourceSets project.sourceSets.main
+        html.destination "${buildDir}/jacocoDistributedTestHtml"
+        executionData = fileTree(dir: 'build/jacoco', include: '**/distributedTest.exec')
+      }
+    }
+  
+    task jacocoOverallTestReport (type: JacocoReport) {
+      reports {
+        csv.enabled false
+        sourceSets project.sourceSets.main
+        html.destination "${buildDir}/jacocoOverallTestHtml"
+        executionData = fileTree(dir: 'build/jacoco', include: '**/*.exec')
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4903d907/gradle/ide.gradle
----------------------------------------------------------------------
diff --git a/gradle/ide.gradle b/gradle/ide.gradle
new file mode 100644
index 0000000..e4c7df5
--- /dev/null
+++ b/gradle/ide.gradle
@@ -0,0 +1,53 @@
+/*
+ * 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.
+ */
+allprojects {
+  apply plugin: 'idea'
+  apply plugin: 'eclipse'
+}
+
+subprojects {
+  eclipse {
+    classpath {
+      defaultOutputDir = file('build-eclipse')
+      downloadSources = true
+      plusConfigurations += [ configurations.provided ]
+    }
+    // Several files have UTF-8 encoding and Eclipse running on Windows
+    // will have trouble unless we tell it to use UTF-8 encoding.
+    // This setting needs to go into the core.resources.prefs file,
+    // which the JDT script isn't set up to configure
+    eclipseJdt << {
+      File f = file('.settings/org.eclipse.core.resources.prefs')
+      f.write('eclipse.preferences.version=1\n')
+      f.append('encoding/<project>=utf-8')
+    }
+  }
+  
+  cleanEclipse << {
+    delete '.settings/org.eclipse.core.resources.prefs'
+  }
+  
+  tasks.eclipse.dependsOn(cleanEclipse)
+  
+  idea {
+    module {
+      downloadSources = true
+      scopes.PROVIDED.plus += [ configurations.provided ]
+    }
+  }
+}
+  

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4903d907/gradle/java.gradle
----------------------------------------------------------------------
diff --git a/gradle/java.gradle b/gradle/java.gradle
new file mode 100644
index 0000000..3ec105d
--- /dev/null
+++ b/gradle/java.gradle
@@ -0,0 +1,106 @@
+/*
+ * 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.
+ */
+subprojects {
+  apply plugin: 'java'
+  
+  // apply compiler options
+  gradle.taskGraph.whenReady( { graph ->
+    tasks.withType(JavaCompile).each { javac ->
+      javac.configure {
+        sourceCompatibility '1.8'
+        targetCompatibility '1.8'
+        options.encoding = 'UTF-8'
+      }
+    }
+  })
+  
+  // apply default manifest
+  gradle.taskGraph.whenReady( { graph ->
+    tasks.withType(Jar).each { jar ->
+      jar.doFirst {
+        manifest {
+          attributes(
+            "Manifest-Version"  : "1.0",
+            "Created-By"        : System.getProperty("user.name"),
+            "Title"             : rootProject.name,
+            "Version"           : version,
+            "Organization"      : "Apache Software Foundation (ASF)"
+          )
+        }
+      }
+    }
+  })
+
+  configurations {
+    provided {
+      description 'a dependency that is provided externally at runtime'
+      visible true
+    }
+    
+    testOutput {
+      extendsFrom testCompile
+      description  'a dependency that exposes test artifacts'
+    }
+  }
+
+  // Here we want to disable all transitive dependencies on external artifacts.  This
+  // allows us to lock down library versions.  However, we want project dependencies to
+  // be transitive such that the libraries of a dependent project are automatically included.
+  configurations.all {
+    dependencies.all { dep ->
+      if (dep instanceof ModuleDependency && !(dep instanceof ProjectDependency)) {
+        dep.transitive = false
+      }
+    }
+  }
+ 
+  task jarTest (type: Jar, dependsOn: testClasses) {
+    description 'Assembles a jar archive of test classes.'
+    from sourceSets.test.output
+    classifier 'test'
+  }
+
+  artifacts {
+    testOutput jarTest
+  }
+
+  sourceSets {
+    main.compileClasspath += configurations.provided
+    main.runtimeClasspath -= configurations.provided
+    test.compileClasspath += configurations.provided
+    test.runtimeClasspath += configurations.provided
+  }
+
+  javadoc.classpath += configurations.provided
+
+  javadoc {
+    options.addStringOption('Xdoclint:none', '-quiet')
+    options.encoding='UTF-8'
+  }
+
+  dependencies {
+    compile 'org.springframework:spring-aop:' + project.'springframework.version'
+    compile 'org.springframework:spring-beans:' + project.'springframework.version'
+    compile 'org.springframework:spring-context:' + project.'springframework.version'
+    compile 'org.springframework:spring-context-support:' + project.'springframework.version'
+    compile 'org.springframework:spring-core:' + project.'springframework.version'
+    compile 'org.springframework:spring-expression:' + project.'springframework.version'
+    compile 'org.springframework:spring-web:' + project.'springframework.version'
+    compile 'org.springframework:spring-webmvc:' + project.'springframework.version'
+    compile 'com.github.stephenc.findbugs:findbugs-annotations:' + project.'stephenc-findbugs.version'
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4903d907/gradle/publish.gradle
----------------------------------------------------------------------
diff --git a/gradle/publish.gradle b/gradle/publish.gradle
new file mode 100644
index 0000000..4eb6a75
--- /dev/null
+++ b/gradle/publish.gradle
@@ -0,0 +1,83 @@
+/*
+ * 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.
+ */
+subprojects {
+  apply plugin: 'com.bmuschko.nexus'
+  
+  extraArchive {
+    sources = true
+    javadoc = true
+    tests = false
+  }
+  
+  nexus {
+    sign = true
+    repositoryUrl = 'https://repository.apache.org/service/local/staging/deploy/maven2'
+    snapshotRepositoryUrl = 'https://repository.apache.org/content/repositories/snapshots'
+  }
+  
+  modifyPom {
+    project {
+      name 'Apache Geode (incubating)'
+      description 'Apache Geode (incubating) provides a database-like consistency model, reliable transaction processing and a shared-nothing architecture to maintain very low latency performance with high concurrency processing'
+      url 'http://geode.incubator.apache.org'
+  
+      scm {
+        url 'https://git-wip-us.apache.org/repos/asf?p=incubator-geode.git;a=tree'
+        connection 'scm:https://git-wip-us.apache.org/repos/asf/incubator-geode.git'
+        developerConnection 'scm:https://git-wip-us.apache.org/repos/asf/incubator-geode.git'
+      }
+  
+      licenses {
+        license {
+          name 'The Apache Software License, Version 2.0'
+          url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
+        }
+      }
+  
+      repositories {
+        repository {
+          id 'libs-release'
+          name 'Spring Maven libs-release Repository'
+          url 'http://repo.spring.io/libs-release'
+        }
+      }
+    }
+  }
+  
+  // The nexus plugin reads authentication from ~/.gradle/gradle.properties but the
+  // jenkins server stores publishing credentials in ~/.m2/settings.xml (maven).
+  // We match on the expected snapshot repository id.
+  afterEvaluate {
+    if (!isReleaseVersion && System.env.USER == 'jenkins') {
+      def settingsXml = new File(System.getProperty('user.home'), '.m2/settings.xml')
+      if (settingsXml.exists()) {
+        def snapshotCreds = new XmlSlurper().parse(settingsXml).servers.server.find { server ->
+          server.id.text() == 'apache.snapshots.https'
+        }
+  
+        if (snapshotCreds != null) {
+          tasks.uploadArchives.doFirst {
+            repositories().withType(MavenDeployer).each { repo ->
+              repo.snapshotRepository.authentication.userName = snapshotCreds.username.text()
+              repo.snapshotRepository.authentication.password = snapshotCreds.password.text()
+            }
+          }
+        }
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4903d907/gradle/rat.gradle
----------------------------------------------------------------------
diff --git a/gradle/rat.gradle b/gradle/rat.gradle
index b81cffd..d66f9bb 100644
--- a/gradle/rat.gradle
+++ b/gradle/rat.gradle
@@ -198,3 +198,7 @@ rat {
     'gemfire-pulse/src/main/webapp/scripts/multiselect/prettify.js'
   ]
 }
+
+subprojects {
+  check.dependsOn rat
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4903d907/gradle/test.gradle
----------------------------------------------------------------------
diff --git a/gradle/test.gradle b/gradle/test.gradle
new file mode 100644
index 0000000..b076f26
--- /dev/null
+++ b/gradle/test.gradle
@@ -0,0 +1,243 @@
+/*
+ * 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.
+ */
+def testResultsDir(def parent, def name) {
+  new File(parent, name)
+}
+
+def writeTestProperties(def parent, def name) {
+  def availablePortFinder = AvailablePortFinder.createPrivate()
+  
+  def props = new Properties()
+  props.setProperty('mcast-port', Integer.toString(availablePortFinder.nextAvailable))
+  props.setProperty('log-level', 'config')
+  def propsFile = new File(testResultsDir(parent, name), 'gemfire.properties')
+  def writer = propsFile.newWriter()
+  props.store(writer, 'Autogenerated Gemfire properties')
+
+}
+
+task combineReports(type: TestReport) {
+  description 'Combines the test reports.'
+  destinationDir = file "${rootProject.buildDir}/reports/combined"
+
+  doLast {
+    println "All test reports at ${rootProject.buildDir}/reports/combined"
+  }
+}
+
+gradle.taskGraph.whenReady({ graph ->
+  tasks.getByName('combineReports').reportOn rootProject.subprojects.collect{ it.tasks.withType(Test) }.flatten()
+})
+
+
+subprojects {
+  dependencies {
+    testCompile 'com.github.stefanbirkner:system-rules:' + project.'system-rules.version'
+    testCompile 'com.google.code.tempus-fugit:tempus-fugit:' + project.'tempus-fugit.version'
+    testCompile 'com.jayway.awaitility:awaitility:' + project.'awaitility.version'
+    testCompile 'edu.umd.cs.mtc:multithreadedtc:' + project.'multithreadedtc.version'
+    testCompile 'eu.codearte.catch-exception:catch-exception:' + project.'catch-exception.version'
+    testCompile 'eu.codearte.catch-exception:catch-throwable:' + project.'catch-throwable.version'
+    testCompile 'junit:junit:' + project.'junit.version'
+    testCompile 'org.assertj:assertj-core:' + project.'assertj-core.version'
+    testCompile 'org.mockito:mockito-core:' + project.'mockito-core.version'
+    testCompile 'org.hamcrest:hamcrest-all:' + project.'hamcrest-all.version'
+    testCompile 'org.jmock:jmock:' + project.'jmock.version'
+    testCompile 'org.jmock:jmock-junit4:' + project.'jmock.version'
+    testCompile 'org.jmock:jmock-legacy:' + project.'jmock.version'
+    testCompile 'pl.pragmatists:JUnitParams:' + project.'JUnitParams.version'
+    
+    testRuntime 'cglib:cglib:' + project.'cglib.version'
+    testRuntime 'org.objenesis:objenesis:' + project.'objenesis.version'
+    testRuntime 'org.ow2.asm:asm:' + project.'asm.version'
+  }
+  
+  //This target does not run any tests. Rather, it validates that there are no
+  //tests that are missing a category annotation
+  task checkMissedTests(type: Test) {
+    include '**/*Test.class'
+    useJUnit {
+      excludeCategories 'com.gemstone.gemfire.test.junit.categories.UnitTest'
+      excludeCategories 'com.gemstone.gemfire.test.junit.categories.IntegrationTest'
+      excludeCategories 'com.gemstone.gemfire.test.junit.categories.DistributedTest'
+      excludeCategories 'com.gemstone.gemfire.test.junit.categories.PerformanceTest'
+      excludeCategories 'com.gemstone.gemfire.test.junit.categories.HydraTest'
+      excludeCategories 'com.gemstone.gemfire.test.junit.categories.ContainerTest'
+      excludeCategories 'com.gemstone.gemfire.test.junit.categories.UITest'
+    }
+
+    beforeTest { descriptor ->
+      throw new GradleException("The test " + descriptor.getClassName() + "." + descriptor.getName() + " does not include a junit category.");
+    }
+  }
+
+
+  test {
+    include '**/*Test.class'
+    useJUnit {
+      includeCategories 'com.gemstone.gemfire.test.junit.categories.UnitTest'
+      excludeCategories 'com.gemstone.gemfire.test.junit.categories.IntegrationTest'
+      excludeCategories 'com.gemstone.gemfire.test.junit.categories.DistributedTest'
+      excludeCategories 'com.gemstone.gemfire.test.junit.categories.PerformanceTest'
+      excludeCategories 'com.gemstone.gemfire.test.junit.categories.HydraTest'
+      excludeCategories 'com.gemstone.gemfire.test.junit.categories.ContainerTest'
+      excludeCategories 'com.gemstone.gemfire.test.junit.categories.UITest'
+    }
+    
+    // run each test in its own vm to avoid interference issues if a test doesn't clean up
+    // state
+    //forkEvery 1
+    
+    doFirst {
+      writeTestProperties(buildDir, name)
+    }
+  }
+
+  task integrationTest(type:Test) {
+    include '**/*Test.class'
+    exclude '**/*DUnitTest.class'
+    useJUnit {
+      excludeCategories 'com.gemstone.gemfire.test.junit.categories.UnitTest'
+      includeCategories 'com.gemstone.gemfire.test.junit.categories.IntegrationTest'
+      excludeCategories 'com.gemstone.gemfire.test.junit.categories.DistributedTest'
+      excludeCategories 'com.gemstone.gemfire.test.junit.categories.PerformanceTest'
+      excludeCategories 'com.gemstone.gemfire.test.junit.categories.HydraTest'
+      excludeCategories 'com.gemstone.gemfire.test.junit.categories.ContainerTest'
+      excludeCategories 'com.gemstone.gemfire.test.junit.categories.UITest'
+    }
+
+    forkEvery 1
+
+    doFirst {
+      writeTestProperties(buildDir, name)
+    }
+  }
+
+  task uiTest(type:Test) {
+    include '**/*Test.class'
+    useJUnit {
+      excludeCategories 'com.gemstone.gemfire.test.junit.categories.UnitTest'
+      excludeCategories 'com.gemstone.gemfire.test.junit.categories.IntegrationTest'
+      excludeCategories 'com.gemstone.gemfire.test.junit.categories.DistributedTest'
+      excludeCategories 'com.gemstone.gemfire.test.junit.categories.PerformanceTest'
+      excludeCategories 'com.gemstone.gemfire.test.junit.categories.HydraTest'
+      excludeCategories 'com.gemstone.gemfire.test.junit.categories.ContainerTest'
+      includeCategories 'com.gemstone.gemfire.test.junit.categories.UITest'
+    }
+
+    doFirst {
+      writeTestProperties(buildDir, name)
+    }
+  }
+  
+  task distributedTest(type:Test) {
+    include '**/*Test.class'
+    
+    // maxParallelForks = 2
+    // maxParallelForks = Runtime.runtime.availableProcessors()
+    
+    useJUnit {
+      excludeCategories 'com.gemstone.gemfire.test.junit.categories.UnitTest'
+      excludeCategories 'com.gemstone.gemfire.test.junit.categories.IntegrationTest'
+      includeCategories 'com.gemstone.gemfire.test.junit.categories.DistributedTest'
+      excludeCategories 'com.gemstone.gemfire.test.junit.categories.PerformanceTest'
+      excludeCategories 'com.gemstone.gemfire.test.junit.categories.HydraTest'
+      excludeCategories 'com.gemstone.gemfire.test.junit.categories.ContainerTest'
+      excludeCategories 'com.gemstone.gemfire.test.junit.categories.UITest'
+    }
+    
+    //I'm hoping this might deal with SOME OOMEs I've seen
+    forkEvery 30
+
+  }
+
+  // By proving a file with an arbitrary list of test classes, we can select only those
+  // tests to run. Activated using -Dcustom.tests=<file> customTest
+  def customTestList = []
+  def customTestFile = System.getProperty('custom.tests')
+  if (customTestFile != null) {
+    new File(customTestFile).eachLine { customTestList << it }
+  }
+
+  task customTest(type:Test) {
+    include { x ->
+      (x.isDirectory() || customTestList.any { y -> x.getName().contains(y) } ) ? true : false
+    }
+
+    forkEvery 30
+  }
+
+  // apply common test configuration
+  gradle.taskGraph.whenReady( { graph ->
+    tasks.withType(Test).each { test ->
+      check.dependsOn test
+      test.configure {
+        onlyIf { ! Boolean.getBoolean('skip.tests') }
+
+        //force tests to be run every time by
+        //saying the results are never up to date
+        outputs.upToDateWhen { false }
+    
+        def resultsDir = testResultsDir(buildDir, test.name)
+        workingDir resultsDir.absolutePath
+        
+        reports.html.destination = file "$buildDir/reports/$name"
+        testLogging {
+          exceptionFormat = 'full'
+        }
+        
+        maxHeapSize '768m'
+        jvmArgs = ['-XX:+HeapDumpOnOutOfMemoryError', '-ea']
+
+        systemProperty 'gemfire.DEFAULT_MAX_OPLOG_SIZE', '10'
+        systemProperty 'gemfire.disallowMcastDefaults', 'true'
+        systemProperty 'jline.terminal', 'jline.UnsupportedTerminal'
+
+        def eol = System.getProperty('line.separator')
+        def progress = new File(resultsDir, "$test.name-progress.txt")
+        beforeTest { desc ->
+          def now = new Date().format('yyyy-MM-dd HH:mm:ss.SSS Z')
+          progress << "$now Starting test $desc.className $desc.name$eol"
+        }
+        afterTest { desc, result ->
+          def now = new Date().format('yyyy-MM-dd HH:mm:ss.SSS Z')
+          progress << "$now Completed test $desc.className $desc.name with result: ${result.resultType}$eol"
+        }
+        
+        doFirst {
+          resultsDir.deleteDir()
+          resultsDir.mkdirs()
+        }
+      }
+    }
+  })
+
+  // Make precheckin task run all validation tests for checking in code.
+  task precheckin (dependsOn: [ build, integrationTest, distributedTest ]) {
+    description 'Run this task before checking in code to validate changes. This task combines the following tasks: build, integrationTest, and distributedTest'
+  }
+
+  check.dependsOn checkMissedTests
+  
+  combineReports.mustRunAfter check, test, integrationTest, distributedTest, checkMissedTests
+  build.finalizedBy combineReports
+  check.finalizedBy combineReports
+  test.finalizedBy combineReports
+  integrationTest.finalizedBy combineReports
+  distributedTest.finalizedBy combineReports
+  checkMissedTests.finalizedBy combineReports
+}



[6/6] incubator-geode git commit: Merge remote-tracking branch 'origin/develop' into feature/GEODE-805

Posted by kl...@apache.org.
Merge remote-tracking branch 'origin/develop' into feature/GEODE-805


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

Branch: refs/heads/feature/GEODE-805
Commit: 122e10f0a47510dec530859d282afd149a6af4b9
Parents: 4f0d877 d22176b
Author: Kirk Lund <kl...@pivotal.io>
Authored: Mon Feb 1 09:34:06 2016 -0800
Committer: Kirk Lund <kl...@pivotal.io>
Committed: Mon Feb 1 09:34:06 2016 -0800

----------------------------------------------------------------------
 build.gradle                                    | 529 +------------------
 gemfire-assembly/build.gradle                   |   8 +-
 .../membership/gms/fd/GMSHealthMonitor.java     |   3 +-
 .../internal/tcpserver/TcpClient.java           |  15 +-
 .../internal/tcpserver/TcpServer.java           |  17 +-
 .../internal/cache/AbstractRegionMap.java       | 133 +----
 .../region/entry/RegionEntryFactoryBuilder.java | 103 ++++
 .../RegionEntryFactoryBuilderJUnitTest.java     |  85 +++
 gemfire-site/website/layouts/footer.html        |   2 +-
 gradle/code-analysis.gradle                     | 113 ++++
 gradle/ide.gradle                               |  53 ++
 gradle/java.gradle                              | 108 ++++
 gradle/publish.gradle                           |  83 +++
 gradle/rat.gradle                               |   4 +
 gradle/test.gradle                              | 243 +++++++++
 15 files changed, 825 insertions(+), 674 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/122e10f0/gradle/java.gradle
----------------------------------------------------------------------
diff --cc gradle/java.gradle
index 0000000,3ec105d..d166fca
mode 000000,100644..100644
--- a/gradle/java.gradle
+++ b/gradle/java.gradle
@@@ -1,0 -1,106 +1,108 @@@
+ /*
+  * 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.
+  */
+ subprojects {
+   apply plugin: 'java'
+   
+   // apply compiler options
+   gradle.taskGraph.whenReady( { graph ->
+     tasks.withType(JavaCompile).each { javac ->
+       javac.configure {
+         sourceCompatibility '1.8'
+         targetCompatibility '1.8'
+         options.encoding = 'UTF-8'
+       }
+     }
+   })
+   
+   // apply default manifest
+   gradle.taskGraph.whenReady( { graph ->
+     tasks.withType(Jar).each { jar ->
+       jar.doFirst {
+         manifest {
+           attributes(
+             "Manifest-Version"  : "1.0",
+             "Created-By"        : System.getProperty("user.name"),
+             "Title"             : rootProject.name,
+             "Version"           : version,
+             "Organization"      : "Apache Software Foundation (ASF)"
+           )
+         }
+       }
+     }
+   })
+ 
+   configurations {
+     provided {
+       description 'a dependency that is provided externally at runtime'
+       visible true
+     }
+     
+     testOutput {
+       extendsFrom testCompile
+       description  'a dependency that exposes test artifacts'
+     }
+   }
+ 
+   // Here we want to disable all transitive dependencies on external artifacts.  This
+   // allows us to lock down library versions.  However, we want project dependencies to
+   // be transitive such that the libraries of a dependent project are automatically included.
+   configurations.all {
+     dependencies.all { dep ->
+       if (dep instanceof ModuleDependency && !(dep instanceof ProjectDependency)) {
+         dep.transitive = false
+       }
+     }
+   }
+  
+   task jarTest (type: Jar, dependsOn: testClasses) {
+     description 'Assembles a jar archive of test classes.'
+     from sourceSets.test.output
+     classifier 'test'
+   }
+ 
+   artifacts {
+     testOutput jarTest
+   }
+ 
+   sourceSets {
+     main.compileClasspath += configurations.provided
+     main.runtimeClasspath -= configurations.provided
+     test.compileClasspath += configurations.provided
+     test.runtimeClasspath += configurations.provided
+   }
+ 
+   javadoc.classpath += configurations.provided
+ 
+   javadoc {
+     options.addStringOption('Xdoclint:none', '-quiet')
+     options.encoding='UTF-8'
+   }
+ 
+   dependencies {
+     compile 'org.springframework:spring-aop:' + project.'springframework.version'
+     compile 'org.springframework:spring-beans:' + project.'springframework.version'
+     compile 'org.springframework:spring-context:' + project.'springframework.version'
+     compile 'org.springframework:spring-context-support:' + project.'springframework.version'
+     compile 'org.springframework:spring-core:' + project.'springframework.version'
+     compile 'org.springframework:spring-expression:' + project.'springframework.version'
+     compile 'org.springframework:spring-web:' + project.'springframework.version'
+     compile 'org.springframework:spring-webmvc:' + project.'springframework.version'
+     compile 'com.github.stephenc.findbugs:findbugs-annotations:' + project.'stephenc-findbugs.version'
++    compile 'com.google.code.findbugs:jsr305:' + project.'jsr305.version'
++    compile 'javax.enterprise:cdi-api:' + project.'cdi-api.version'
+   }
+ }


[2/6] incubator-geode git commit: Fix footer GitHub link

Posted by kl...@apache.org.
Fix footer GitHub link

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

Branch: refs/heads/feature/GEODE-805
Commit: 41e55534d135d6c6030e29351cdcfac91836f758
Parents: 4903d90
Author: John C Bledsoe <jc...@users.noreply.github.com>
Authored: Sun Jan 31 03:49:49 2016 -0600
Committer: John C Bledsoe <jc...@users.noreply.github.com>
Committed: Sun Jan 31 03:49:49 2016 -0600

----------------------------------------------------------------------
 gemfire-site/website/layouts/footer.html | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/41e55534/gemfire-site/website/layouts/footer.html
----------------------------------------------------------------------
diff --git a/gemfire-site/website/layouts/footer.html b/gemfire-site/website/layouts/footer.html
index c024af6..d757cc1 100644
--- a/gemfire-site/website/layouts/footer.html
+++ b/gemfire-site/website/layouts/footer.html
@@ -23,7 +23,7 @@
             <div class="col-md-2">
                 <ul class="nav nav-list">
                     <li class="nav-header">Resources</li>
-                    <li><a href="http://github.com/apache/geode-incubator" target="_blank">GitHub Code</a></li>
+                    <li><a href="http://github.com/apache/incubator-geode" target="_blank">GitHub Code</a></li>
                     <li><a href="http://geode.docs.pivotal.io" target="_blank">Docs</a></li>
                     <li><a href="https://issues.apache.org/jira/browse/GEODE" target="_blank">JIRA Bug Tracker</a></li>
                     <li><a href="http://stackoverflow.com/search?q=Apache%20Geode" target="_blank">StackOverflow</a></li>


[3/6] incubator-geode git commit: Closes #84

Posted by kl...@apache.org.
Closes #84


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

Branch: refs/heads/feature/GEODE-805
Commit: 554ecaee5963b460a5c9c303564811ffdf55bbc8
Parents: 41e5553
Author: William Markito <wm...@pivotal.io>
Authored: Sun Jan 31 11:17:13 2016 +0100
Committer: William Markito <wm...@pivotal.io>
Committed: Sun Jan 31 11:17:13 2016 +0100

----------------------------------------------------------------------

----------------------------------------------------------------------



[5/6] incubator-geode git commit: GEODE-871: Frequient use of executeOnAllServers causes build-up of TIME_WAIT sockets

Posted by kl...@apache.org.
GEODE-871: Frequient use of executeOnAllServers causes build-up of TIME_WAIT sockets

Modified the fix to not abort the connection if a response wasn't read.
I also propagated this pattern to GMSHealthMonitor so that the "final
check" sockets are quickly released.


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

Branch: refs/heads/feature/GEODE-805
Commit: d22176bb1632dc5593a1755a1355aacd0360c5e8
Parents: 02c67e2
Author: Bruce Schuchardt <bs...@pivotal.io>
Authored: Mon Feb 1 08:35:00 2016 -0800
Committer: Bruce Schuchardt <bs...@pivotal.io>
Committed: Mon Feb 1 08:37:05 2016 -0800

----------------------------------------------------------------------
 .../membership/gms/fd/GMSHealthMonitor.java        |  3 +--
 .../distributed/internal/tcpserver/TcpClient.java  | 15 +++++++++++----
 .../distributed/internal/tcpserver/TcpServer.java  | 17 +----------------
 3 files changed, 13 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d22176bb/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/fd/GMSHealthMonitor.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/fd/GMSHealthMonitor.java b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/fd/GMSHealthMonitor.java
index b6f6c12..dc549bf 100755
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/fd/GMSHealthMonitor.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/fd/GMSHealthMonitor.java
@@ -312,7 +312,6 @@ public class GMSHealthMonitor implements HealthMonitor, MessageHandler {
             && uuidLSBs == myUUID.getLeastSignificantBits()
             && uuidMSBs == myUUID.getMostSignificantBits()
             && vmViewId == myVmViewId) {
-          socket.setSoLinger(true, (int)memberTimeout);
           out.write(OK);
           out.flush();
           socket.shutdownOutput();
@@ -323,7 +322,6 @@ public class GMSHealthMonitor implements HealthMonitor, MessageHandler {
           }
         }
         else {
-          socket.setSoLinger(true, (int)memberTimeout);
           out.write(ERROR);
           out.flush();
           socket.shutdownOutput();
@@ -494,6 +492,7 @@ public class GMSHealthMonitor implements HealthMonitor, MessageHandler {
     finally {
       try {
         if (clientSocket != null) {
+          clientSocket.setSoLinger(true, 0); // abort the connection
           clientSocket.close();
         }
       } catch (IOException e) {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d22176bb/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/tcpserver/TcpClient.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/tcpserver/TcpClient.java b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/tcpserver/TcpClient.java
index 47f50b3..dfcb78c 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/tcpserver/TcpClient.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/tcpserver/TcpClient.java
@@ -167,14 +167,21 @@ public class TcpClient {
       }
       return null;
     } finally {
-      if (out != null) {
-        out.close();
-      }
       try {
+        if (replyExpected) {
+          // Since we've read a response we know that the Locator is finished
+          // with the socket and is closing it.  Aborting the connection by
+          // setting SO_LINGER to zero will clean up the TIME_WAIT socket on
+          // the locator's machine.
+          sock.setSoLinger(true, 0);
+        }
         sock.close();
       } catch(Exception e) {
         logger.error("Error closing socket ", e);
       }
+      if (out != null) {
+        out.close();
+      }
     }
   }
 
@@ -184,7 +191,6 @@ public class TcpClient {
     Short serverVersion = null;
 
     // Get GemFire version of TcpServer first, before sending any other request.
-    VersionResponse verRes = null;
     synchronized(serverVersions) {
       serverVersion = serverVersions.get(ipAddr);
     }
@@ -223,6 +229,7 @@ public class TcpClient {
       }
     } finally {
       try {
+        sock.setSoLinger(true, 0); // initiate an abort on close to shut down the server's socket
         sock.close();
       } catch(Exception e) {
         logger.error("Error closing socket ", e);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d22176bb/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/tcpserver/TcpServer.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/tcpserver/TcpServer.java b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/tcpserver/TcpServer.java
index f52b9ab..e5ad416 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/tcpserver/TcpServer.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/tcpserver/TcpServer.java
@@ -398,7 +398,6 @@ public class TcpServer {
             DataSerializer.writeObject(response, output);
 
             output.flush();
-            output.close();
           }
 
           handler.endResponse(request,startTime);
@@ -467,24 +466,10 @@ public class TcpServer {
             t.printStackTrace();
           }
         } finally {
-          // Normal path closes input first, so let's do that here...
-          if (input != null) {
-            try {
-              input.close();
-            } catch (IOException e) {
-              log.warn(
-                "Exception closing input stream", e);
-            }
-          }
-
-          // Closing the ObjectInputStream is supposed to close
-          // the underlying InputStream, but we do it here just for
-          // good measure. Closing a closed socket is a no-op.
           try {
             sock.close();
           } catch (IOException e) {
-            log.warn(
-                "Exception closing socket", e);
+            // ignore
           }
         }
       }


[4/6] incubator-geode git commit: GEODE-795: Changed RegionEntryFactory code from complex nested if-else block to more maintainable bit masking.

Posted by kl...@apache.org.
GEODE-795: Changed RegionEntryFactory code from complex nested if-else block to more maintainable bit masking.


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

Branch: refs/heads/feature/GEODE-805
Commit: 02c67e2578b31c8e3babb654e55fb97f688ef0b4
Parents: 554ecae
Author: Udo Kohlmeyer <uk...@pivotal.io>
Authored: Thu Jan 28 08:54:29 2016 +1100
Committer: Udo Kohlmeyer <uk...@pivotal.io>
Committed: Mon Feb 1 14:14:40 2016 +1100

----------------------------------------------------------------------
 .../internal/cache/AbstractRegionMap.java       | 133 +------------------
 .../region/entry/RegionEntryFactoryBuilder.java | 103 ++++++++++++++
 .../RegionEntryFactoryBuilderJUnitTest.java     |  85 ++++++++++++
 3 files changed, 190 insertions(+), 131 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/02c67e25/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/AbstractRegionMap.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/AbstractRegionMap.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/AbstractRegionMap.java
index 096bd0a..3679519 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/AbstractRegionMap.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/AbstractRegionMap.java
@@ -28,6 +28,7 @@ import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.atomic.AtomicInteger;
 
+import com.gemstone.gemfire.internal.cache.region.entry.RegionEntryFactoryBuilder;
 import org.apache.logging.log4j.Logger;
 
 import com.gemstone.gemfire.GemFireIOException;
@@ -193,137 +194,7 @@ abstract class AbstractRegionMap implements RegionMap {
       }
     }
     else {
-      final RegionEntryFactory factory;
-      if (attr.statisticsEnabled) {
-        if (isLRU) {
-          if (isDisk) {
-            if (withVersioning) {
-              if (offHeap) {
-                factory = VersionedStatsDiskLRURegionEntryOffHeap.getEntryFactory();
-              } else {
-                factory = VersionedStatsDiskLRURegionEntryHeap.getEntryFactory();
-              }
-            } else {
-              if (offHeap) {
-                factory = VMStatsDiskLRURegionEntryOffHeap.getEntryFactory();
-              } else {
-                factory = VMStatsDiskLRURegionEntryHeap.getEntryFactory();
-              }
-            }
-          } else {
-            if (withVersioning) {
-              if (offHeap) {
-                factory = VersionedStatsLRURegionEntryOffHeap.getEntryFactory();
-              } else {
-                factory = VersionedStatsLRURegionEntryHeap.getEntryFactory();
-              }
-            } else {
-              if (offHeap) {
-                factory = VMStatsLRURegionEntryOffHeap.getEntryFactory();
-              } else {
-                factory = VMStatsLRURegionEntryHeap.getEntryFactory();
-              }
-            }
-          }
-        } else { // !isLRU
-          if (isDisk) {
-            if (withVersioning) {
-              if (offHeap) {
-                factory = VersionedStatsDiskRegionEntryOffHeap.getEntryFactory();
-              } else {
-                factory = VersionedStatsDiskRegionEntryHeap.getEntryFactory();
-              }
-            } else {
-              if (offHeap) {
-                factory = VMStatsDiskRegionEntryOffHeap.getEntryFactory();
-              } else {
-                factory = VMStatsDiskRegionEntryHeap.getEntryFactory();
-              }
-            }
-          } else {
-            if (withVersioning) {
-              if (offHeap) {
-                factory = VersionedStatsRegionEntryOffHeap.getEntryFactory();
-              } else {
-                factory = VersionedStatsRegionEntryHeap.getEntryFactory();
-              }
-            } else {
-              if (offHeap) {
-                factory = VMStatsRegionEntryOffHeap.getEntryFactory();
-              } else {
-                factory = VMStatsRegionEntryHeap.getEntryFactory();
-              }
-            }
-          }
-        }
-      }
-      else { // !statistics enabled
-        if (isLRU) {
-          if (isDisk) {
-            if (withVersioning) {
-              if (offHeap) {
-                factory = VersionedThinDiskLRURegionEntryOffHeap.getEntryFactory();
-              } else {
-                factory = VersionedThinDiskLRURegionEntryHeap.getEntryFactory();
-              }
-            } else {
-              if (offHeap) {
-                factory = VMThinDiskLRURegionEntryOffHeap.getEntryFactory();
-              } else {
-                factory = VMThinDiskLRURegionEntryHeap.getEntryFactory();
-              }
-            }
-          }
-          else {
-            if (withVersioning) {
-              if (offHeap) {
-                factory = VersionedThinLRURegionEntryOffHeap.getEntryFactory();
-              } else {
-                factory = VersionedThinLRURegionEntryHeap.getEntryFactory();
-              }
-            } else {
-              if (offHeap) {
-                factory = VMThinLRURegionEntryOffHeap.getEntryFactory();
-              } else {
-                factory = VMThinLRURegionEntryHeap.getEntryFactory();
-              }
-            }
-          }
-        }
-        else { // !isLRU
-          if (isDisk) {
-            if (withVersioning) {
-              if (offHeap) {
-                factory = VersionedThinDiskRegionEntryOffHeap.getEntryFactory();
-              } else {
-                factory = VersionedThinDiskRegionEntryHeap.getEntryFactory();
-              }
-            } else {
-              if (offHeap) {
-                factory = VMThinDiskRegionEntryOffHeap.getEntryFactory();
-              } else {
-                factory = VMThinDiskRegionEntryHeap.getEntryFactory();
-              }
-            }
-          }
-          else {
-            if (withVersioning) {
-              if (offHeap) {
-                factory = VersionedThinRegionEntryOffHeap.getEntryFactory();
-              } else {
-                factory = VersionedThinRegionEntryHeap.getEntryFactory();
-              }
-            } else {
-              if (offHeap) {
-                factory = VMThinRegionEntryOffHeap.getEntryFactory();
-              } else {
-                factory = VMThinRegionEntryHeap.getEntryFactory();
-              }
-            }
-          }
-        }
-      }
-      setEntryFactory(factory);
+      setEntryFactory(new RegionEntryFactoryBuilder().getRegionEntryFactoryOrNull(attr.statisticsEnabled,isLRU,isDisk,withVersioning,offHeap));
     }
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/02c67e25/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/region/entry/RegionEntryFactoryBuilder.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/region/entry/RegionEntryFactoryBuilder.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/region/entry/RegionEntryFactoryBuilder.java
new file mode 100644
index 0000000..f4e55ed
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/region/entry/RegionEntryFactoryBuilder.java
@@ -0,0 +1,103 @@
+/*
+ * 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.cache.region.entry;
+
+import com.gemstone.gemfire.internal.cache.*;
+
+public class RegionEntryFactoryBuilder {
+  public RegionEntryFactory getRegionEntryFactoryOrNull(boolean statsEnabled, boolean isLRU, boolean isDisk, boolean withVersioning, boolean offHeap) {
+    int bitRepresentation = 0;
+    bitRepresentation |= statsEnabled ? 1 : 0;
+    bitRepresentation |= isLRU ? 2 : 0;
+    bitRepresentation |= isDisk ? 4 : 0;
+    bitRepresentation |= withVersioning ? 8 : 0;
+    bitRepresentation |= offHeap ? 16 : 0;
+
+    /**
+     * The bits represent all options
+     * |offHeap|versioning|disk|lru|stats|
+     */
+    switch (bitRepresentation) {
+    case (0):
+      return VMThinRegionEntryHeap.getEntryFactory(); // Bits: 00000
+    case (1):
+      return VMStatsRegionEntryHeap.getEntryFactory(); // Bits: 00001
+    case (2):
+      return VMThinLRURegionEntryHeap.getEntryFactory(); // Bits: 00010
+    case (3):
+      return VMStatsLRURegionEntryHeap.getEntryFactory(); // Bits: 00011
+    case (4):
+      return VMThinDiskRegionEntryHeap.getEntryFactory(); // Bits: 00100
+    case (5):
+      return VMStatsDiskRegionEntryHeap.getEntryFactory(); // Bits: 00101
+    case (6):
+      return VMThinDiskLRURegionEntryHeap.getEntryFactory(); // Bits: 00110
+    case (7):
+      return VMStatsDiskLRURegionEntryHeap.getEntryFactory(); // Bits: 00111
+    case (8):
+      return VersionedThinRegionEntryHeap.getEntryFactory(); // Bits: 01000
+    case (9):
+      return VersionedStatsRegionEntryHeap.getEntryFactory(); // Bits: 01001
+    case (10):
+      return VersionedThinLRURegionEntryHeap.getEntryFactory(); // Bits: 01010
+    case (11):
+      return VersionedStatsLRURegionEntryHeap.getEntryFactory(); // Bits: 01011
+    case (12):
+      return VersionedThinDiskRegionEntryHeap.getEntryFactory(); // Bits: 01100
+    case (13):
+      return VersionedStatsDiskRegionEntryHeap.getEntryFactory(); // Bits: 01101
+    case (14):
+      return VersionedThinDiskLRURegionEntryHeap.getEntryFactory(); // Bits: 01110
+    case (15):
+      return VersionedStatsDiskLRURegionEntryHeap.getEntryFactory(); // Bits: 01111
+    case (16):
+      return VMThinRegionEntryOffHeap.getEntryFactory(); // Bits: 10000
+    case (17):
+      return VMStatsRegionEntryOffHeap.getEntryFactory(); // Bits: 10001
+    case (18):
+      return VMThinLRURegionEntryOffHeap.getEntryFactory(); // Bits: 10010
+    case (19):
+      return VMStatsLRURegionEntryOffHeap.getEntryFactory(); // Bits: 10011
+    case (20):
+      return VMThinDiskRegionEntryOffHeap.getEntryFactory(); // Bits: 10100
+    case (21):
+      return VMStatsDiskRegionEntryOffHeap.getEntryFactory(); // Bits: 10101
+    case (22):
+      return VMThinDiskLRURegionEntryOffHeap.getEntryFactory(); // Bits: 10110
+    case (23):
+      return VMStatsDiskLRURegionEntryOffHeap.getEntryFactory(); // Bits: 10111
+    case (24):
+      return VersionedThinRegionEntryOffHeap.getEntryFactory(); // Bits: 11000
+    case (25):
+      return VersionedStatsRegionEntryOffHeap.getEntryFactory(); // Bits: 11001
+    case (26):
+      return VersionedThinLRURegionEntryOffHeap.getEntryFactory(); // Bits: 11010
+    case (27):
+      return VersionedStatsLRURegionEntryOffHeap.getEntryFactory(); // Bits: 11011
+    case (28):
+      return VersionedThinDiskRegionEntryOffHeap.getEntryFactory(); // Bits: 11100
+    case (29):
+      return VersionedStatsDiskRegionEntryOffHeap.getEntryFactory(); // Bits: 11101
+    case (30):
+      return VersionedThinDiskLRURegionEntryOffHeap.getEntryFactory(); // Bits: 11110
+    case (31):
+      return VersionedStatsDiskLRURegionEntryOffHeap.getEntryFactory(); // Bits: 11111
+    default:
+      return null;
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/02c67e25/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/region/entry/RegionEntryFactoryBuilderJUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/region/entry/RegionEntryFactoryBuilderJUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/region/entry/RegionEntryFactoryBuilderJUnitTest.java
new file mode 100644
index 0000000..09fde8a
--- /dev/null
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/region/entry/RegionEntryFactoryBuilderJUnitTest.java
@@ -0,0 +1,85 @@
+/*
+ * 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.cache.region.entry;
+
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
+import junitparams.JUnitParamsRunner;
+import junitparams.Parameters;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+
+import static org.junit.Assert.assertEquals;
+
+@Category(UnitTest.class)
+@RunWith(JUnitParamsRunner.class)
+public class RegionEntryFactoryBuilderJUnitTest {
+
+  private RegionEntryFactoryBuilder regionEntryFactoryBuilder;
+
+  @Before
+  public void setup() {
+    regionEntryFactoryBuilder = new RegionEntryFactoryBuilder();
+  }
+
+  /**
+   * This method will test that the correct RegionEntryFactory is created
+   * dependent on the 5 conditionals:
+   * enableStats, enableLRU, enableDisk, enableVersion, enableOffHeap
+   */
+  @Test
+  @Parameters({
+      "VMThinRegionEntryHeapFactory,false,false,false,false,false",
+      "VMThinRegionEntryOffHeapFactory,false,false,false,false,true",
+      "VersionedThinRegionEntryHeapFactory,false,false,false,true,false",
+      "VersionedThinRegionEntryOffHeapFactory,false,false,false,true,true",
+      "VMThinDiskRegionEntryHeapFactory,false,false,true,false,false",
+      "VMThinDiskRegionEntryOffHeapFactory,false,false,true,false,true",
+      "VersionedThinDiskRegionEntryHeapFactory,false,false,true,true,false",
+      "VersionedThinDiskRegionEntryOffHeapFactory,false,false,true,true,true",
+      "VMThinLRURegionEntryHeapFactory,false,true,false,false,false",
+      "VMThinLRURegionEntryOffHeapFactory,false,true,false,false,true",
+      "VersionedThinLRURegionEntryHeapFactory,false,true,false,true,false",
+      "VersionedThinLRURegionEntryOffHeapFactory,false,true,false,true,true",
+      "VMThinDiskLRURegionEntryHeapFactory,false,true,true,false,false",
+      "VMThinDiskLRURegionEntryOffHeapFactory,false,true,true,false,true",
+      "VersionedThinDiskLRURegionEntryHeapFactory,false,true,true,true,false",
+      "VersionedThinDiskLRURegionEntryOffHeapFactory,false,true,true,true,true",
+      "VMStatsRegionEntryHeapFactory,true,false,false,false,false",
+      "VMStatsRegionEntryOffHeapFactory,true,false,false,false,true",
+      "VersionedStatsRegionEntryHeapFactory,true,false,false,true,false",
+      "VersionedStatsRegionEntryOffHeapFactory,true,false,false,true,true",
+      "VMStatsDiskRegionEntryHeapFactory,true,false,true,false,false",
+      "VMStatsDiskRegionEntryOffHeapFactory,true,false,true,false,true",
+      "VersionedStatsDiskRegionEntryHeapFactory,true,false,true,true,false",
+      "VersionedStatsDiskRegionEntryOffHeapFactory,true,false,true,true,true",
+      "VMStatsLRURegionEntryHeapFactory,true,true,false,false,false",
+      "VMStatsLRURegionEntryOffHeapFactory,true,true,false,false,true",
+      "VersionedStatsLRURegionEntryHeapFactory,true,true,false,true,false",
+      "VersionedStatsLRURegionEntryOffHeapFactory,true,true,false,true,true",
+      "VMStatsDiskLRURegionEntryHeapFactory,true,true,true,false,false",
+      "VMStatsDiskLRURegionEntryOffHeapFactory,true,true,true,false,true",
+      "VersionedStatsDiskLRURegionEntryHeapFactory,true,true,true,true,false",
+      "VersionedStatsDiskLRURegionEntryOffHeapFactory,true,true,true,true,true"
+  })
+  public void testRegionEntryFactoryUnitTest(String factoryName, boolean enableStats, boolean enableLRU, boolean enableDisk,
+      boolean enableVersioning, boolean enableOffHeap) {
+    assertEquals(factoryName,
+        regionEntryFactoryBuilder.getRegionEntryFactoryOrNull(enableStats, enableLRU, enableDisk, enableVersioning, enableOffHeap).getClass().getSimpleName());
+  }
+}
\ No newline at end of file