geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aba...@apache.org
Subject [19/24] geode-examples git commit: GEODE-2831: Improve geode examples
Date Sat, 15 Jul 2017 15:42:15 GMT
GEODE-2831: Improve geode examples

Pare down the approach for constructing an example
to require the just the following:
- A README.md file
- A scripts/start.gfsh file to start the cluster
- A scripts.stop.gfsh file to stop the cluster
- An Example.java application along with supporting
  classes and tests

The build script contains tasks to start / run / stop
each example.  The README.md file in the root project
provides further details on building and running.


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

Branch: refs/heads/master
Commit: c21e76b2b0b9eeab1e18416272b747ceb0595325
Parents: 4700817
Author: Anthony Baker <abaker@apache.org>
Authored: Mon Apr 24 12:24:47 2017 -0700
Committer: Anthony Baker <abaker@apache.org>
Committed: Wed Apr 26 16:46:11 2017 -0700

----------------------------------------------------------------------
 .travis.yml                                     |   2 +
 BUILDING.md                                     |  51 -----
 README.md                                       |  61 ++++--
 build.gradle                                    |  84 ++++----
 gradle.properties                               |   6 +-
 gradle/ide.gradle                               |  30 +++
 gradle/spotless.gradle                          |  26 +++
 partitioned/README.md                           | 194 ++++++++-----------
 partitioned/build.gradle                        |  20 --
 partitioned/scripts/.gitignore                  |   2 -
 partitioned/scripts/pidkiller.sh                |  35 ----
 partitioned/scripts/setEnv.sh                   |  32 ---
 partitioned/scripts/start.gfsh                  |  25 +++
 partitioned/scripts/startAll.sh                 |  42 ----
 partitioned/scripts/stop.gfsh                   |  18 ++
 partitioned/scripts/stopAll.sh                  |  28 ---
 .../geode/examples/partitioned/Consumer.java    |  69 -------
 .../examples/partitioned/EmployeeData.java      |  31 +--
 .../geode/examples/partitioned/EmployeeKey.java |  58 +++---
 .../geode/examples/partitioned/Example.java     |  61 ++++++
 .../geode/examples/partitioned/Producer.java    | 101 ----------
 .../examples/partitioned/ConsumerTest.java      |  65 -------
 .../examples/partitioned/EmployeeDataTest.java  |  68 -------
 .../examples/partitioned/EmployeeKeyTest.java   |  59 ------
 .../geode/examples/partitioned/ExampleTest.java |  38 ++++
 .../examples/partitioned/PartitionedTest.java   | 164 ----------------
 .../examples/partitioned/ProducerTest.java      |  44 -----
 replicated/README.md                            |  47 ++---
 replicated/build.gradle                         |  20 --
 replicated/scripts/.gitignore                   |   2 -
 replicated/scripts/pidkiller.sh                 |  35 ----
 replicated/scripts/setEnv.sh                    |  33 ----
 replicated/scripts/start.gfsh                   |  25 +++
 replicated/scripts/startAll.sh                  |  45 -----
 replicated/scripts/stop.gfsh                    |  18 ++
 replicated/scripts/stopAll.sh                   |  28 ---
 .../geode/examples/replicated/BaseClient.java   |  60 ------
 .../geode/examples/replicated/Consumer.java     |  37 ----
 .../geode/examples/replicated/Example.java      |  56 ++++++
 .../geode/examples/replicated/Producer.java     |  37 ----
 replicated/src/main/main2.iml                   |   6 -
 .../geode/examples/replicated/ConsumerTest.java |  70 -------
 .../geode/examples/replicated/ExampleTest.java  |  38 ++++
 .../geode/examples/replicated/ProducerTest.java |  68 -------
 .../examples/replicated/ReplicatedTest.java     | 165 ----------------
 replicated/src/test/test5.iml                   |   6 -
 settings.gradle                                 |   2 -
 .../java/org/geode/examples/util/Mocks.java     |  55 ++++++
 .../apache/geode/examples/utils/ShellUtil.java  | 106 ----------
 utils/src/main/main5.iml                        |   6 -
 50 files changed, 617 insertions(+), 1762 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode-examples/blob/c21e76b2/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index bcef9b8..8a77c32 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -18,6 +18,8 @@ language: java
 jdk:
   - oraclejdk8
 
+script: ./gradlew runAll
+
 before_cache:
   - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
 

http://git-wip-us.apache.org/repos/asf/geode-examples/blob/c21e76b2/BUILDING.md
----------------------------------------------------------------------
diff --git a/BUILDING.md b/BUILDING.md
deleted file mode 100644
index 3885f87..0000000
--- a/BUILDING.md
+++ /dev/null
@@ -1,51 +0,0 @@
-<!--
-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.
--->
-
-# Building this Release from Source
-
-Build instructions differ slightly for Unix and Windows platforms.
-All platforms require a Java installation, with JDK 1.8 or more recent version.
-
-## Build from Source on Unix
-
-1. Set the JAVA\_HOME environment variable.  For example:
-
-    ```     
-    JAVA_HOME=/usr/java/jdk1.8.0_60
-    export JAVA_HOME
-    ```
-2. Download the project source from the Releases page at [Apache Geode] (http://geode.apache.org), and unpack the source code.
-3. Within the directory containing the unpacked source code, build and run the tests:
-    
-    ```
-    $ ./gradlew build
-    ```
-
-## Build from Source on Windows
-
-1. Set the JAVA\_HOME environment variable.  For example:
-
-    ```
-    $ set JAVA_HOME="C:\Program Files\Java\jdk1.8.0_60"
-    ```
-2. Install Gradle, version 3.3 or a more recent version.
-3. Download the project source from the Releases page at [Apache Geode] (http://geode.apache.org), and unpack the source code.
-4. Within the folder containing the unpacked source code, build and run the tests:
-
-    ```
-    $ gradle build
-    ```

http://git-wip-us.apache.org/repos/asf/geode-examples/blob/c21e76b2/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index 14ceb87..1894591 100644
--- a/README.md
+++ b/README.md
@@ -17,29 +17,59 @@ limitations under the License.
 
 [<img src="https://geode.apache.org/img/apache_geode_logo.png" align="center"/>](http://geode.apache.org)
 
-[![Build Status](https://travis-ci.org/apache/geode-examples.svg?branch=develop)](https://travis-ci.org/apache/geode-examples) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0) 
+[![Build Status](https://travis-ci.org/apache/geode-examples.svg?branch=develop)](https://travis-ci.org/apache/geode-examples) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0)
 
 # Apache Geode examples
 
-This is the home of Apache Geode examples that are bundled with the project. Contributions<sup>[2]</sup> and corrections are welcome. Please talk to us about your suggestions at [dev@geode.apache.org](mailto:dev@geode.apache.org) or submit a [pull request](https://github.com/apache/geode/pull/new/develop).
+This is the home of Apache Geode examples that are bundled with the project.
+Contributions<sup>[2]</sup> and corrections are welcome. Please talk to us
+about your suggestions at [dev@geode.apache.org](mailto:dev@geode.apache.org)
+or submit a [pull request](https://github.com/apache/geode/pull/new/develop).
 
-## Example requirements
+## Adding a new example
 
-All examples:
+Follow this approach to add a new example:
 
-*  Need to be testable. Use unit tests, integration tests or whatever is applicable. Tests will run through the project's CI.
-*  Should be `Gradle` projects or part of existing ones. There may be exceptions here, but the community should have a consensus to accept.
-*  Have to follow code format & style from Apache Geode <sup>[1]</sup> guidelines.
-*  Should contain a `README.md` file with step-by-step instruction on how to set up and run the example. *Diagrams give you extra credit.*
-*  Donations need to be licensed through ASL 2.0 and contributors need to file an ICLA<sup>[3]</sup>.
+* Create a subdirectory with a descriptive name like `cache-writer`
+* Create a `README.md` file in the example subproject to walk the user through the tutorial
+* Create a Java class with a main method in the `org.apache.geode.examples.$name.Example` class
+* Create a cluster initialization script in `scripts/start.gfsh`
+* Create a cluster shutdown script in `scripts/stop.gfsh`
 
-## Structure
+The scripts should contain `gfsh` commands for starting locators, servers, and
+creating regions--everything that the example program will need to use.  Where
+appropriate you should also add unit tests.  To customize the build you can add
+a `build.gradle` file.
 
-### Installation and a Tutorial for Beginners
+Note that the build may fail if you do not add ASF license headers or use the
+correct formatting (you can fix formatting with `gradle spotlessApply`).
 
-*  [How to Install](http://geode.apache.org/docs/guide/getting_started/installation/install_standalone.html)
-*  Set a `GEODE_HOME` environment variable to point to the root directory of the installation; this directory contains `bin/`. For those that have built from source, it will be the `/path/to/geode/geode-assembly/build/install/apache-geode` directory.
-*  If desired run the tutorial: [Apache Geode in 15 minutes or Less](http://geode.apache.org/docs/guide/getting_started/15_minute_quickstart_gfsh.html)
+## Running an example
+
+The gradle build will automatically download and install a Geode release in the
+`build` directory.  You can run an example with the following gradle targets:
+
+* `build` - compiles the example and runs unit tests
+* `start` - initializes the Geode cluster
+* `run` - runs the example Application
+* `stop` - shuts down the cluster
+* `runAll` - invokes start, run, stop
+
+The commands you need to invoke will be given in the `README.md` file.  Sample
+usage:
+
+    $ ./gradle :replicated:start
+    $ ./gradle :replicated:run
+    $ ./gradle :replicated:stop
+    $ ./gradle runAll
+
+## Catalog of examples
+
+The following sections call out ready-made examples or new examples that could
+be built.  You may want to start your journey with the [Apache Geode in 15
+minutes or
+Less](http://geode.apache.org/docs/guide/getting_started/15_minute_quickstart_gfsh.html)
+tutorial.
 
 ### Basics
 
@@ -78,7 +108,8 @@ All examples:
 
 ### Use cases, integrations and external examples
 
-This section has self-contained little projects that illustrate a use case or an integration with other projects.
+This section has self-contained little projects that illustrate a use case or
+an integration with other projects.
 
 *  SpringBoot Application
 *  HTTP Session replication

http://git-wip-us.apache.org/repos/asf/geode-examples/blob/c21e76b2/build.gradle
----------------------------------------------------------------------
diff --git a/build.gradle b/build.gradle
index cceeb3b..8289ead 100644
--- a/build.gradle
+++ b/build.gradle
@@ -44,7 +44,7 @@ task downloadGeode {
 task verifyGeode(type: de.undercouch.gradle.tasks.download.Verify, dependsOn: downloadGeode) {
   src installFile
   algorithm "SHA-256"
-  doFirst { 
+  doFirst {
     checksum file("${installFile}.sha256").text.split(' ')[0]
   }
 }
@@ -57,52 +57,56 @@ task installGeode(type: Copy, dependsOn: verifyGeode) {
   into buildDir
 }
 
-subprojects {
-    apply plugin:'java'
+allprojects {
+  apply plugin:'java'
 
-    repositories {
-        mavenCentral()
-    }
+  repositories { mavenCentral() }
 
-    dependencies {
-        compile "org.apache.geode:geode-core:$geodeVersion"
-        compile "org.apache.commons:commons-exec:$commonsExecVersion"
-        runtime "org.slf4j:slf4j-log4j12:$slf4jVersion"
+  dependencies {
+    compile "org.apache.geode:geode-core:$geodeVersion"
+    
+    testCompile "com.jayway.awaitility:awaitility:$awaitilityVersion"
+    testCompile "junit:junit:$junitVersion"
+    testCompile "org.mockito:mockito-core:$mockitocoreVersion"
+    testCompile "com.github.stefanbirkner:system-rules:$systemrulesVersion"
+    testCompile "org.assertj:assertj-core:$assertjVersion"
+  }
+}
 
-        testCompile "com.jayway.awaitility:awaitility:$awaitilityVersion"
-        testCompile project(":utils")
-        testCompile "junit:junit:$junitVersion"
-        testCompile "org.mockito:mockito-core:$mockitocoreVersion"
-    }
+subprojects {
+  dependencies {
+    runtime "org.slf4j:slf4j-log4j12:$slf4jVersion"
+    
+    testCompile project.parent.sourceSets.test.output
+  }
+  
+  def geodePath = "${System.env.PATH}${System.getProperty('path.separator')}${installDir}/bin"
+  task start(type: Exec, dependsOn: [installGeode, build]) {
+    workingDir buildDir
+    environment 'GEODE_HOME', installDir
+    environment 'PATH', geodePath
+    commandLine 'sh', '-c', "gfsh run --file=${projectDir}/scripts/start.gfsh"
+  }
 
-    task run(type: JavaExec) {
-        description = 'Run example'
-        def mainClass = rootProject.hasProperty('main') ? "${rootProject.getProperty('main')}" : 'Main'
-        main = "org.apache.geode.examples.${project.name}.$mainClass"
-        classpath = sourceSets.main.runtimeClasspath
-        standardInput = System.in
-        systemProperties = System.getProperties()
-        if (rootProject.hasProperty('args')) {
-            args = ["${rootProject.getProperty('args')}"]
-        }
-    }
+  task stop(type: Exec, dependsOn: installGeode) {
+    workingDir buildDir
+    environment 'GEODE_HOME', installDir
+    environment 'PATH', geodePath
+    commandLine 'sh', '-c', "gfsh run --file=${projectDir}/scripts/stop.gfsh"
+  }
 
-    test.dependsOn installGeode
-    test {
-	environment 'GEODE_HOME': "$rootProject.buildDir/apache-geode-$geodeVersion"
-    }
+  task run(type: JavaExec, dependsOn: build) {
+    description = 'Run example'
+    classpath = sourceSets.main.runtimeClasspath
+    main = "org.apache.geode.examples.${project.name}.Example"
+  }
 
-    apply plugin: "com.diffplug.gradle.spotless"
-    spotless {
-	lineEndings = 'unix';
-	java {
-	    target project.fileTree(project.projectDir) {
-		include '**/*.java'
-	    }
-	    eclipseFormatFile "${rootProject.projectDir}/etc/eclipse-java-google-style.xml"
-	}
-    }
+  task runAll(dependsOn: [start, run, stop])
+  run.mustRunAfter start
+  stop.mustRunAfter run
 }
 
+apply from: "gradle/spotless.gradle"
+apply from: "gradle/ide.gradle"
 apply from: "gradle/rat.gradle"
 apply from: "gradle/release.gradle"

http://git-wip-us.apache.org/repos/asf/geode-examples/blob/c21e76b2/gradle.properties
----------------------------------------------------------------------
diff --git a/gradle.properties b/gradle.properties
index 06f3b2d..83479a1 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -17,8 +17,10 @@
 version = 1.2.0-SNAPSHOT
 
 geodeVersion = 1.1.0
+
+assertjVersion = 3.6.2
+awaitilityVersion = 1.7.0
 junitVersion = 4.12
 mockitocoreVersion = 1.10.19
-commonsExecVersion = 1.3
-awaitilityVersion = 1.7.0
 slf4jVersion = 1.7.22
+systemrulesVersion = 1.16.1

http://git-wip-us.apache.org/repos/asf/geode-examples/blob/c21e76b2/gradle/ide.gradle
----------------------------------------------------------------------
diff --git a/gradle/ide.gradle b/gradle/ide.gradle
new file mode 100644
index 0000000..b3da6ab
--- /dev/null
+++ b/gradle/ide.gradle
@@ -0,0 +1,30 @@
+/*
+ * 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: 'eclipse'
+  eclipse {
+    classpath {
+      defaultOutputDir = file('build-eclipse')
+      downloadSources = true
+    }
+  }
+
+  apply plugin: 'idea'
+  idea {
+    module { downloadSources = true }
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode-examples/blob/c21e76b2/gradle/spotless.gradle
----------------------------------------------------------------------
diff --git a/gradle/spotless.gradle b/gradle/spotless.gradle
new file mode 100644
index 0000000..77d29d2
--- /dev/null
+++ b/gradle/spotless.gradle
@@ -0,0 +1,26 @@
+/*
+ * 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.diffplug.gradle.spotless"
+  spotless {
+    lineEndings = 'unix';
+    java {
+      target project.fileTree(project.projectDir) { include '**/*.java' }
+      eclipseFormatFile "${rootProject.projectDir}/etc/eclipse-java-google-style.xml"
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode-examples/blob/c21e76b2/partitioned/README.md
----------------------------------------------------------------------
diff --git a/partitioned/README.md b/partitioned/README.md
index 75be8b5..1643d06 100644
--- a/partitioned/README.md
+++ b/partitioned/README.md
@@ -17,143 +17,103 @@ limitations under the License.
 
 # Geode partitioned region example
 
-This example demonstrates the basic property of partitioning.
-The basic property of partitioning is that data entries are distributed 
-across all servers that host a region.
-The distribution is like database sharding, except that the distribution
-occurs automatically. 
-
-In this example,
-two servers host a single partitioned region. 
-There is no redundancy, so that the basic property of partitioning
-may be observed.
-The Producer code puts the 10 entries into the region.
-The Consumer gets and prints the entries from the region.
-Because the region is partitioned,
-its entries are distributed among the two servers hosting the region.
-Since there is no redundancy of the data within the region,
-when one of the servers goes away,
-the entries hosted within that server are also gone;
+This example demonstrates the basic property of partitioning.  The basic
+property of partitioning is that data entries are distributed across all
+servers that host a region.  The distribution is like database sharding, except
+that the distribution occurs automatically.
+
+In this example, two servers host a single partitioned region.  There is no
+redundancy, so that the basic property of partitioning may be observed.  The
+example puts 10 entries into the region and prints them.  Because the region is
+partitioned, its entries are distributed among the two servers hosting the
+region.  Since there is no redundancy of the data within the region, when one
+of the servers goes away, the entries hosted within that server are also gone;
 the example demonstrates this.
 
+This example assumes that Java and Geode are installed.
+
 ## Demonstration of Partitioning
 1. Set directory ```geode-examples/partitioned``` to be the
 current working directory.
 Each step in this example specifies paths relative to that directory.
 
-1. Build the jar (with the ```EmployeeKey``` and ```EmployeeData``` classes):
-
-    ```
-    $   ../gradlew build
-    ```
-1. Run a script that starts a locator and two servers.
-The built JAR will be placed onto the classpath when the script 
-starts the servers:
-
-    ```
-    $ scripts/startAll.sh
-    ```
-    Each of the servers hosts the partitioned region.
-    
-1. Run the producer to put 10 entries into the ```EmployeeRegion```.
-
-    ```
-    $ ../gradlew run -Pmain=Producer
-    ...
-    ... 
-    INFO: Inserted 10 entries in EmployeeRegion.
-    ```
-
-1. There are several ways to see the contents of the region.
-Run the consumer to get and print all 10 entries in the `EmployeeRegion`.
-
-    ```
-    $ ../gradlew run -Pmain=Consumer
-    ...
-    INFO: 10 entries in EmployeeRegion on the server(s).
-    ...
-    ```
-
-    If desired, use a ```gfsh``` query to see contents of the region keys:
-
-    ```
-    $ $GEODE_HOME/bin/gfsh
-    ...
-    gfsh>connect
-    gfsh>query --query="select e.key from /EmployeeRegion.entries e"
-    ...
-    ```
+1. Build the example (with the `EmployeeKey` and `EmployeeData` classes)
+
+        $ ./gradlew build
+
+2. Run a script that starts a locator and two servers.  Each of the servers
+hosts the partitioned region.  The example classes will be placed onto the
+classpath when the script starts the servers.
+
+        $ gfsh run --file=scripts/start.gfsh
+
+3. Run the example to put 10 entries into the `example-region`. The data
+will also be retrieved from the region and printed to the console.
+
+        $ ./gradlew run
+
+4. Run a `gfsh` command to see the contents of the region
+
+        $ gfsh
+        ...
+        gfsh>connect --locators=127.0.0.1[10334]
+        gfsh>query --query="select e.key from /example-region.entries e"
+        ...
 
     Note that the quantity of entries may also be observed with `gfsh`:
- 
-    ```
-    gfsh>describe region --name=EmployeeRegion
-    ..........................................................
-    Name            : EmployeeRegion
-    Data Policy     : partition
-    Hosting Members : server2
-                      server1
-
-    Non-Default Attributes Shared By Hosting Members  
-
-     Type  |    Name     | Value
-    ------ | ----------- | ---------
-    Region | size        | 10
-           | data-policy | PARTITION
-    ```
+
+        gfsh>describe region --name=example-region
+        ..........................................................
+        Name            : example-region
+        Data Policy     : partition
+        Hosting Members : server2
+                          server1
+
+        Non-Default Attributes Shared By Hosting Members  
+
+         Type  |    Name     | Value
+        ------ | ----------- | ---------
+        Region | size        | 10
+               | data-policy | PARTITION
 
     As an alternative, `gfsh` maybe used to identify how many entries
     are in the region on each server by looking at statistics.
 
-    ```
-    gfsh>show metrics --categories=partition --region=/EmployeeRegion --member=server1
-    ```
-
-    Within the output, the result for `totalBucketSize` identifies
-    the number of entries hosted on the specified server.
-    Vary the command to see statistics for both `server1` and `server2`.
-    Note that approximately half the entries will be on each server.
-    And, the quantity on each server may vary if the example is started
-    over and run again.
-
-1. The region entries are distributed across both servers.
-Kill one of the servers:
-
-    ```
-    $ $GEODE_HOME/bin/gfsh
-    ...
-    gfsh>connect
-    gfsh>stop server --name=server1
-    gfsh>quit
-    ```
-
-1. Run the consumer a second time, and notice that approximately half of
-the entries of the ```EmployeeRegion``` are still available on the 
+        gfsh>show metrics --categories=partition --region=/example-region --member=server1
+
+    Within the output, the result for `totalBucketSize` identifies the number
+    of entries hosted on the specified server.  Vary the command to see
+    statistics for both `server1` and `server2`.  Note that approximately half
+    the entries will be on each server.  And, the quantity on each server may
+    vary if the example is started over and run again.
+
+5. The region entries are distributed across both servers.
+Stop one of the servers
+
+        $ gfsh
+        ...
+        gfsh>connect --locators=127.0.0.1[10334]
+        gfsh>stop server --name=server1
+        gfsh>quit
+
+6. Run the consumer a second time, and notice that approximately half of
+the entries of the ```EmployeeRegion``` are still available on the
 remaining server.
 Those hosted by the server that was stopped were lost.
 
-    ```
-    $ ../gradlew run -Pmain=Consumer
-    ...
-    ...
-    INFO: 5 entries in EmployeeRegion on the server(s).
-    ...
-    ```
+        $ ./gradlew run
 
-6. Shut down the system:
+7. Shut down the cluster
 
-    ```
-    $ scripts/stopAll.sh
-    ```
+        $ gfsh run --file=scripts/stop.gfsh
 
 ## Things to Get Right for Partitioned Regions
 
-- Hashing distributes entries among buckets that reside on servers.
-A good hash code is important in order to spread the entries among buckets
-(and therefore, among servers).
+- Hashing distributes entries among buckets that reside on servers.  A good
+hash code is important in order to spread the entries among buckets (and
+therefore, among servers).
 
-- Besides the hash code, equals() needs to be defined.
+- Besides the hash code, `equals()` needs to be defined.
 
-- A system that ought to not lose data if a system member goes down
-will use redundancy in conjunction with partitioning
-in production systems.
+- A system that ought to not lose data if a system member goes down will use
+redundancy in conjunction with partitioning in production systems.

http://git-wip-us.apache.org/repos/asf/geode-examples/blob/c21e76b2/partitioned/build.gradle
----------------------------------------------------------------------
diff --git a/partitioned/build.gradle b/partitioned/build.gradle
deleted file mode 100644
index 52283ec..0000000
--- a/partitioned/build.gradle
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * 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.
- */
-
-sourceSets.test {
-  resources.srcDirs = ["${projectDir}/scripts"]
-}

http://git-wip-us.apache.org/repos/asf/geode-examples/blob/c21e76b2/partitioned/scripts/.gitignore
----------------------------------------------------------------------
diff --git a/partitioned/scripts/.gitignore b/partitioned/scripts/.gitignore
deleted file mode 100644
index 32f8870..0000000
--- a/partitioned/scripts/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-locator1/
-server*/

http://git-wip-us.apache.org/repos/asf/geode-examples/blob/c21e76b2/partitioned/scripts/pidkiller.sh
----------------------------------------------------------------------
diff --git a/partitioned/scripts/pidkiller.sh b/partitioned/scripts/pidkiller.sh
deleted file mode 100755
index ecf8f2d..0000000
--- a/partitioned/scripts/pidkiller.sh
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/bin/bash
-#
-# 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.
-#
-# @brief Script that look for .pid files on a directory and kill those processes.
-#
-
-export DIR=$1
-
-if [ $# -eq 0 ]
-  then
-    echo "No arguments supplied. Script needs directory to look for pid files."
-    exit 1
-fi
-
-for pid in `find $DIR -name "*.pid"`
-do
- echo "Found: $pid"
- kill -9 `cat $pid`
- echo "Killed."
-done
-

http://git-wip-us.apache.org/repos/asf/geode-examples/blob/c21e76b2/partitioned/scripts/setEnv.sh
----------------------------------------------------------------------
diff --git a/partitioned/scripts/setEnv.sh b/partitioned/scripts/setEnv.sh
deleted file mode 100755
index 0afe249..0000000
--- a/partitioned/scripts/setEnv.sh
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/bin/bash
-#
-# 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.
-#
-
-## check if locator port has been set otherwise set to default
-export GEODE_LOCATOR_PORT="${GEODE_LOCATOR_PORT:-10334}"
-
-## check if GEODE_HOME has been set
-: ${GEODE_HOME?"GEODE_HOME enviroment variable needs to be set"}
-
-## check if gfsh script is accessible and print version
-: ${GEODE_HOME/bin/gfsh?"gfsh doesn't seem to be available. Please check $GEODE_HOME"}
-echo "Geode version: `$GEODE_HOME/bin/gfsh version`"
-
-## prefer GEODE_HOME for finding gfsh
-export PATH=$GEODE_HOME/bin:$PATH
-
-: ${GEODE_LOCATOR_PORT?}

http://git-wip-us.apache.org/repos/asf/geode-examples/blob/c21e76b2/partitioned/scripts/start.gfsh
----------------------------------------------------------------------
diff --git a/partitioned/scripts/start.gfsh b/partitioned/scripts/start.gfsh
new file mode 100644
index 0000000..0da16d8
--- /dev/null
+++ b/partitioned/scripts/start.gfsh
@@ -0,0 +1,25 @@
+#
+# 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.
+#
+start locator --bind-address=127.0.0.1
+
+start server --name=server1 --locators=127.0.0.1[10334] --server-port=0 --classpath=../classes/main
+start server --name=server2 --locators=127.0.0.1[10334] --server-port=0 --classpath=../classes/main
+
+create region --name=example-region --type=PARTITION
+
+list members
+describe region --name=example-region
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/geode-examples/blob/c21e76b2/partitioned/scripts/startAll.sh
----------------------------------------------------------------------
diff --git a/partitioned/scripts/startAll.sh b/partitioned/scripts/startAll.sh
deleted file mode 100755
index c7c9fe0..0000000
--- a/partitioned/scripts/startAll.sh
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/bin/bash
-#
-# 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.
-#
-
-set -e
-current=`pwd`
-cd `dirname $0`
-. ./setEnv.sh
-cd $current
-
-#export GEODE_LOCATOR_PORT="${GEODE_LOCATOR_PORT:-10334}"
-# start a locator
-gfsh start locator --name=locator1 --mcast-port=0 --port=${GEODE_LOCATOR_PORT}
-
-# start 2 servers on a random available port
-for N in {1..2}
-do
- gfsh start server --locators=localhost[${GEODE_LOCATOR_PORT}] --name=server$N  --server-port=0 --mcast-port=0 --classpath=${PWD}/build/libs/partitioned-1.2.0-SNAPSHOT.jar
-done
-
-# create 2 regions with the same data using GFSH, one that works well,
-#  good keys, and the other that implements a bad hashCode on the key
-gfsh -e "connect --locator=localhost[${GEODE_LOCATOR_PORT}]" -e "create region --name=EmployeeRegion --type=PARTITION"
-
-gfsh -e "connect --locator=localhost[${GEODE_LOCATOR_PORT}]" -e "list members"
-
-exit 0
-

http://git-wip-us.apache.org/repos/asf/geode-examples/blob/c21e76b2/partitioned/scripts/stop.gfsh
----------------------------------------------------------------------
diff --git a/partitioned/scripts/stop.gfsh b/partitioned/scripts/stop.gfsh
new file mode 100644
index 0000000..9281b31
--- /dev/null
+++ b/partitioned/scripts/stop.gfsh
@@ -0,0 +1,18 @@
+#
+# 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.
+#
+connect --locator=127.0.0.1[10334]
+shutdown --include-locators=true
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/geode-examples/blob/c21e76b2/partitioned/scripts/stopAll.sh
----------------------------------------------------------------------
diff --git a/partitioned/scripts/stopAll.sh b/partitioned/scripts/stopAll.sh
deleted file mode 100755
index a6364a8..0000000
--- a/partitioned/scripts/stopAll.sh
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/bin/bash
-#
-# 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.
-#
-set -e
-
-current=`pwd`
-
-cd `dirname $0`
-
-. ./setEnv.sh
-
-cd $current
-
-gfsh -e "connect --locator=localhost[${GEODE_LOCATOR_PORT}]" -e "shutdown --include-locators=true"

http://git-wip-us.apache.org/repos/asf/geode-examples/blob/c21e76b2/partitioned/src/main/java/org/apache/geode/examples/partitioned/Consumer.java
----------------------------------------------------------------------
diff --git a/partitioned/src/main/java/org/apache/geode/examples/partitioned/Consumer.java b/partitioned/src/main/java/org/apache/geode/examples/partitioned/Consumer.java
deleted file mode 100644
index 1525280..0000000
--- a/partitioned/src/main/java/org/apache/geode/examples/partitioned/Consumer.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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 org.apache.geode.examples.partitioned;
-
-import java.util.*;
-import java.util.logging.Logger;
-
-import org.apache.geode.cache.client.ClientCache;
-import org.apache.geode.cache.Region;
-import org.apache.geode.cache.client.ClientCacheFactory;
-import org.apache.geode.cache.client.ClientRegionShortcut;
-
-public class Consumer {
-
-  static final Logger logger = Logger.getAnonymousLogger();
-  private Region region1;
-  private final String locatorHost = System.getProperty("GEODE_LOCATOR_HOST", "localhost");
-  private final int locatorPort = Integer.getInteger("GEODE_LOCATOR_PORT", 10334);
-  protected static final String REGION1_NAME = "EmployeeRegion";
-
-  public static void main(String[] args) {
-    Consumer c = new Consumer();
-    c.setUpRegion();
-    c.printRegionContents();
-  }
-
-
-  public Consumer() {}
-
-  public Consumer(Region r) {
-    region1 = r;
-  }
-
-
-  public void setUpRegion() {
-    ClientCache clientCache = new ClientCacheFactory().addPoolLocator(locatorHost, locatorPort)
-        .set("log-level", "WARN").create();
-    region1 =
-        clientCache.<EmployeeKey, EmployeeData>createClientRegionFactory(ClientRegionShortcut.PROXY)
-            .create(REGION1_NAME);
-  }
-
-
-  public void printRegionContents() {
-    /* Print EmployeeRegion size and contents */
-    Set<EmployeeKey> setOfKeys1 = region1.keySetOnServer();
-    logger.info(setOfKeys1.size() + " entries in EmployeeRegion on the server(s).");
-    if (setOfKeys1.size() > 0) {
-      logger.info("Contents of EmployeeRegion:");
-      for (EmployeeKey key : setOfKeys1) {
-        logger.info(region1.get(key).toString());
-      }
-    }
-  }
-
-
-}

http://git-wip-us.apache.org/repos/asf/geode-examples/blob/c21e76b2/partitioned/src/main/java/org/apache/geode/examples/partitioned/EmployeeData.java
----------------------------------------------------------------------
diff --git a/partitioned/src/main/java/org/apache/geode/examples/partitioned/EmployeeData.java b/partitioned/src/main/java/org/apache/geode/examples/partitioned/EmployeeData.java
index c79962d..234458f 100644
--- a/partitioned/src/main/java/org/apache/geode/examples/partitioned/EmployeeData.java
+++ b/partitioned/src/main/java/org/apache/geode/examples/partitioned/EmployeeData.java
@@ -17,44 +17,33 @@ package org.apache.geode.examples.partitioned;
 import java.io.Serializable;
 
 public class EmployeeData implements Serializable {
-
   private static final long serialVersionUID = 1L;
 
   private EmployeeKey nameAndNumber;
   private int salary;
   private int hoursPerWeek;
 
-  public EmployeeData() {}
-
-  public EmployeeData(EmployeeKey k, int s, int hrs) {
-    this.nameAndNumber = k;
-    this.salary = s;
-    this.hoursPerWeek = hrs;
+  public EmployeeData(EmployeeKey nameAndNumber, int salary, int hoursPerWeek) {
+    this.nameAndNumber = nameAndNumber;
+    this.salary = salary;
+    this.hoursPerWeek = hoursPerWeek;
   }
 
   public EmployeeKey getNameAndNumber() {
-    return (nameAndNumber);
+    return nameAndNumber;
   }
 
   public int getSalary() {
-    return (salary);
+    return salary;
   }
 
   public int getHoursPerWeek() {
-    return (hoursPerWeek);
-  }
-
-  public boolean equals(EmployeeData e) {
-    if (this.nameAndNumber.equals(e.getNameAndNumber()) && (this.salary == e.getSalary())
-        && (this.hoursPerWeek == e.getHoursPerWeek())) {
-      return true;
-    }
-    return false;
+    return hoursPerWeek;
   }
 
+  @Override
   public String toString() {
-    return (this.nameAndNumber.toString() + " salary=" + this.salary + " hoursPerWeek="
-        + this.hoursPerWeek);
+    return "EmployeeData [nameAndNumber=" + nameAndNumber + ", salary=" + salary + ", hoursPerWeek="
+        + hoursPerWeek + "]";
   }
-
 }

http://git-wip-us.apache.org/repos/asf/geode-examples/blob/c21e76b2/partitioned/src/main/java/org/apache/geode/examples/partitioned/EmployeeKey.java
----------------------------------------------------------------------
diff --git a/partitioned/src/main/java/org/apache/geode/examples/partitioned/EmployeeKey.java b/partitioned/src/main/java/org/apache/geode/examples/partitioned/EmployeeKey.java
index 7581676..dd9d6ec 100644
--- a/partitioned/src/main/java/org/apache/geode/examples/partitioned/EmployeeKey.java
+++ b/partitioned/src/main/java/org/apache/geode/examples/partitioned/EmployeeKey.java
@@ -17,53 +17,55 @@ package org.apache.geode.examples.partitioned;
 import java.io.Serializable;
 
 public class EmployeeKey implements Serializable {
-
   private static final long serialVersionUID = 1L;
 
   private String name;
   private int emplNumber;
 
-  public EmployeeKey() {}
+  public String getName() {
+    return name;
+  }
 
-  public EmployeeKey(String n, int en) {
-    this.name = n;
-    this.emplNumber = en;
+  public int getEmplNumber() {
+    return emplNumber;
   }
 
-  public String getName() {
-    return (name);
+  public EmployeeKey(String name, int emplNumber) {
+    super();
+    this.name = name;
+    this.emplNumber = emplNumber;
   }
 
-  public int getEmplNumber() {
-    return (emplNumber);
+  @Override
+  public int hashCode() {
+    final int prime = 31;
+    int result = 1;
+    result = prime * result + emplNumber;
+    result = prime * result + ((name == null) ? 0 : name.hashCode());
+    return result;
   }
 
   @Override
-  public boolean equals(Object o) {
-    if (this == o) {
+  public boolean equals(Object obj) {
+    if (this == obj)
       return true;
-    }
-    if (o == null || getClass() != o.getClass()) {
+    if (obj == null)
       return false;
-    }
-
-    EmployeeKey that = (EmployeeKey) o;
-
-    if (emplNumber != that.emplNumber) {
+    if (getClass() != obj.getClass())
+      return false;
+    EmployeeKey other = (EmployeeKey) obj;
+    if (emplNumber != other.emplNumber)
       return false;
-    }
-    return name.equals(that.name);
+    if (name == null) {
+      if (other.name != null)
+        return false;
+    } else if (!name.equals(other.name))
+      return false;
+    return true;
   }
 
   @Override
-  public int hashCode() {
-    int result = name.hashCode();
-    result = 31 * result + emplNumber;
-    return result;
-  }
-
   public String toString() {
-    return ("Name: " + this.name + " Employee Number: " + this.emplNumber);
+    return "EmployeeKey [name=" + name + ", emplNumber=" + emplNumber + "]";
   }
-
 }

http://git-wip-us.apache.org/repos/asf/geode-examples/blob/c21e76b2/partitioned/src/main/java/org/apache/geode/examples/partitioned/Example.java
----------------------------------------------------------------------
diff --git a/partitioned/src/main/java/org/apache/geode/examples/partitioned/Example.java b/partitioned/src/main/java/org/apache/geode/examples/partitioned/Example.java
new file mode 100644
index 0000000..d60894e
--- /dev/null
+++ b/partitioned/src/main/java/org/apache/geode/examples/partitioned/Example.java
@@ -0,0 +1,61 @@
+/*
+ * 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 org.apache.geode.examples.partitioned;
+
+import java.util.Arrays;
+import java.util.Random;
+import java.util.function.Consumer;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.client.ClientCache;
+import org.apache.geode.cache.client.ClientCacheFactory;
+import org.apache.geode.cache.client.ClientRegionShortcut;
+
+public class Example implements Consumer<Region<EmployeeKey, EmployeeData>> {
+  public static void main(String[] args) {
+    // connect to the locator using default port 10334
+    ClientCache cache = new ClientCacheFactory().addPoolLocator("127.0.0.1", 10334)
+        .set("log-level", "WARN").create();
+
+    // create a local region that matches the server region
+    Region<EmployeeKey, EmployeeData> region = cache
+        .<EmployeeKey, EmployeeData>createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY)
+        .create("example-region");
+
+    new Example().accept(region);
+    cache.close();
+  }
+
+  @Override
+  public void accept(Region<EmployeeKey, EmployeeData> region) {
+    // insert values into the region
+    Random r = new Random();
+    String[] names =
+        "Alex Able,Bertie Bell,Kris Call,Dale Driver,Frankie Forth,Jamie Jive,Morgan Minnow,Pat Puts,Ricky Reliable,Taylor Tack"
+            .split(",");
+    Arrays.stream(names).forEach(name -> {
+      EmployeeKey key = new EmployeeKey(name, r.nextInt());
+      EmployeeData val = new EmployeeData(key, r.nextInt(), 40);
+      region.put(key, val);
+    });
+
+    // count the values in the region
+    int inserted = region.keySetOnServer().size();
+    System.out.println(String.format("Counted %d keys in region %s", inserted, region.getName()));
+
+    // fetch the values in the region
+    region.keySetOnServer().forEach(key -> System.out.println(region.get(key)));
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode-examples/blob/c21e76b2/partitioned/src/main/java/org/apache/geode/examples/partitioned/Producer.java
----------------------------------------------------------------------
diff --git a/partitioned/src/main/java/org/apache/geode/examples/partitioned/Producer.java b/partitioned/src/main/java/org/apache/geode/examples/partitioned/Producer.java
deleted file mode 100644
index 9fc87e8..0000000
--- a/partitioned/src/main/java/org/apache/geode/examples/partitioned/Producer.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * 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 org.apache.geode.examples.partitioned;
-
-import org.apache.geode.cache.client.ClientCache;
-import org.apache.geode.cache.Region;
-import org.apache.geode.cache.client.ClientCacheFactory;
-import org.apache.geode.cache.client.ClientRegionShortcut;
-
-import java.util.logging.Logger;
-
-public class Producer {
-
-  static final Logger logger = Logger.getAnonymousLogger();
-  private Region region1;
-  private final String locatorHost = System.getProperty("GEODE_LOCATOR_HOST", "localhost");
-  private final int locatorPort = Integer.getInteger("GEODE_LOCATOR_PORT", 10334);
-  protected static final String REGION1_NAME = "EmployeeRegion";
-
-  public static void main(String[] args) {
-    Producer p = new Producer();
-    p.setUpRegion();
-    p.populateRegion();
-  }
-
-
-  public Producer() {
-
-  }
-
-  public Producer(Region r) {
-    region1 = r;
-  }
-
-  public void setUpRegion() {
-    ClientCache clientCache = new ClientCacheFactory().addPoolLocator(locatorHost, locatorPort)
-        .set("log-level", "WARN").create();
-    region1 =
-        clientCache.<EmployeeKey, EmployeeData>createClientRegionFactory(ClientRegionShortcut.PROXY)
-            .create(REGION1_NAME);
-  }
-
-  /* Put 10 entries into the region with a quality hashing function. */
-  public void populateRegion() {
-
-    EmployeeKey k1 = new EmployeeKey("Alex Able", 160);
-    EmployeeData d1 = new EmployeeData(k1, 70000, 40);
-    region1.put(k1, d1);
-
-    EmployeeKey k2 = new EmployeeKey("Bertie Bell", 170);
-    EmployeeData d2 = new EmployeeData(k2, 72000, 40);
-    region1.put(k2, d2);
-
-    EmployeeKey k3 = new EmployeeKey("Kris Call", 180);
-    EmployeeData d3 = new EmployeeData(k3, 68000, 40);
-    region1.put(k3, d3);
-
-    EmployeeKey k4 = new EmployeeKey("Dale Driver", 190);
-    EmployeeData d4 = new EmployeeData(k4, 81500, 36);
-    region1.put(k4, d4);
-
-    EmployeeKey k5 = new EmployeeKey("Frankie Forth", 201);
-    EmployeeData d5 = new EmployeeData(k5, 45000, 40);
-    region1.put(k5, d5);
-
-    EmployeeKey k6 = new EmployeeKey("Jamie Jive", 220);
-    EmployeeData d6 = new EmployeeData(k6, 56500, 40);
-    region1.put(k6, d6);
-
-    EmployeeKey k7 = new EmployeeKey("Morgan Minnow", 230);
-    EmployeeData d7 = new EmployeeData(k7, 65000, 36);
-    region1.put(k7, d7);
-
-    EmployeeKey k8 = new EmployeeKey("Pat Puts", 240);
-    EmployeeData d8 = new EmployeeData(k8, 67000, 40);
-    region1.put(k8, d8);
-
-    EmployeeKey k9 = new EmployeeKey("Ricky Reliable", 2500);
-    EmployeeData d9 = new EmployeeData(k9, 71000, 40);
-    region1.put(k9, d9);
-
-    EmployeeKey k10 = new EmployeeKey("Taylor Tack", 260);
-    EmployeeData d10 = new EmployeeData(k10, 70000, 40);
-    region1.put(k10, d10);
-
-    logger.info("Inserted 10 entries in EmployeeRegion.");
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode-examples/blob/c21e76b2/partitioned/src/test/java/org/apache/geode/examples/partitioned/ConsumerTest.java
----------------------------------------------------------------------
diff --git a/partitioned/src/test/java/org/apache/geode/examples/partitioned/ConsumerTest.java b/partitioned/src/test/java/org/apache/geode/examples/partitioned/ConsumerTest.java
deleted file mode 100644
index 7a399a8..0000000
--- a/partitioned/src/test/java/org/apache/geode/examples/partitioned/ConsumerTest.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * 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 org.apache.geode.examples.partitioned;
-
-import static org.mockito.Mockito.*;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-
-import org.apache.geode.cache.Region;
-
-
-public class ConsumerTest {
-
-  @Rule
-  public ExpectedException expectedException = ExpectedException.none();
-  private Region region = mock(Region.class);
-
-
-  @Before
-  public void setup() {
-
-    /* Make a small map that will provide values as a region would */
-    Map<EmployeeKey, EmployeeData> emplMap = new HashMap<>();
-    EmployeeKey k1 = new EmployeeKey("Bertie Bell", 170);
-    EmployeeData d1 = new EmployeeData(k1, 72000, 40);
-    emplMap.put(k1, d1);
-    EmployeeKey k2 = new EmployeeKey("Toni Tiptoe", 180);
-    EmployeeData d2 = new EmployeeData(k2, 70000, 40);
-    emplMap.put(k2, d2);
-    /* Use HashMap as fake region for keySetOnServer, size, and get methods */
-    when(region.keySetOnServer()).thenReturn(emplMap.keySet());
-    when(region.size()).thenReturn(emplMap.size());
-    when(region.get(eq(k1))).thenReturn(emplMap.get(k1));
-    when(region.get(eq(k2))).thenReturn(emplMap.get(k2));
-
-  }
-
-
-  @Test
-  public void testPrintRegionContents() {
-    Consumer c = new Consumer(region);
-    c.printRegionContents();
-  }
-
-
-}

http://git-wip-us.apache.org/repos/asf/geode-examples/blob/c21e76b2/partitioned/src/test/java/org/apache/geode/examples/partitioned/EmployeeDataTest.java
----------------------------------------------------------------------
diff --git a/partitioned/src/test/java/org/apache/geode/examples/partitioned/EmployeeDataTest.java b/partitioned/src/test/java/org/apache/geode/examples/partitioned/EmployeeDataTest.java
deleted file mode 100644
index b3112e7..0000000
--- a/partitioned/src/test/java/org/apache/geode/examples/partitioned/EmployeeDataTest.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * 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 org.apache.geode.examples.partitioned;
-
-import static org.junit.Assert.*;
-
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-
-
-public class EmployeeDataTest {
-  private EmployeeData d;
-
-  @Rule
-  public ExpectedException expectedException = ExpectedException.none();
-
-  @Before
-  public void setup() {
-    EmployeeKey k = new EmployeeKey("First Last", 3001);
-    d = new EmployeeData(k, 40000, 38);
-  }
-
-  @Test
-  public void testGetNameAndNumber() {
-    assertEquals("First Last", d.getNameAndNumber().getName());
-    assertEquals(3001, d.getNameAndNumber().getEmplNumber());
-  }
-
-  @Test
-  public void testGetSalary() {
-    assertEquals(40000, d.getSalary());
-  }
-
-  @Test
-  public void testGetHoursPerWeek() {
-    assertEquals(38, d.getHoursPerWeek());
-  }
-
-  @Test
-  public void testEquals() {
-    EmployeeKey otherKey = new EmployeeKey("First Last", 3001);
-    EmployeeData otherData = new EmployeeData(otherKey, 40000, 38);
-    assertTrue(d.equals(otherData));
-    EmployeeKey nonMatchingKey = new EmployeeKey("Othername", 1);
-    EmployeeData nonMatchingData = new EmployeeData(nonMatchingKey, 39999, 40);
-    assertFalse(d.equals(nonMatchingData));
-  }
-
-  @Test
-  public void testToString() {
-    assertEquals(d.getNameAndNumber().toString() + " salary=40000 hoursPerWeek=38", d.toString());
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode-examples/blob/c21e76b2/partitioned/src/test/java/org/apache/geode/examples/partitioned/EmployeeKeyTest.java
----------------------------------------------------------------------
diff --git a/partitioned/src/test/java/org/apache/geode/examples/partitioned/EmployeeKeyTest.java b/partitioned/src/test/java/org/apache/geode/examples/partitioned/EmployeeKeyTest.java
deleted file mode 100644
index c5e880f..0000000
--- a/partitioned/src/test/java/org/apache/geode/examples/partitioned/EmployeeKeyTest.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * 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 org.apache.geode.examples.partitioned;
-
-import static org.junit.Assert.*;
-
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-
-
-public class EmployeeKeyTest {
-
-  private EmployeeKey k;
-
-  @Rule
-  public ExpectedException expectedException = ExpectedException.none();
-
-  @Before
-  public void setup() {
-    k = new EmployeeKey("First Last", 3001);
-  }
-
-  @Test
-  public void testGetName() {
-    assertEquals("First Last", k.getName());
-  }
-
-  @Test
-  public void testGetEmplNumber() {
-    assertEquals(3001, k.getEmplNumber());
-  }
-
-  @Test
-  public void testEquals() {
-    EmployeeKey otherKey = new EmployeeKey("First Last", 3001);
-    assertTrue(k.equals(otherKey));
-    EmployeeKey nonMatchingKey = new EmployeeKey("Othername", 1);
-    assertFalse(k.equals(nonMatchingKey));
-  }
-
-  @Test
-  public void testToString() {
-    assertEquals("Name: First Last Employee Number: 3001", k.toString());
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode-examples/blob/c21e76b2/partitioned/src/test/java/org/apache/geode/examples/partitioned/ExampleTest.java
----------------------------------------------------------------------
diff --git a/partitioned/src/test/java/org/apache/geode/examples/partitioned/ExampleTest.java b/partitioned/src/test/java/org/apache/geode/examples/partitioned/ExampleTest.java
new file mode 100644
index 0000000..757e664
--- /dev/null
+++ b/partitioned/src/test/java/org/apache/geode/examples/partitioned/ExampleTest.java
@@ -0,0 +1,38 @@
+/*
+ * 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 org.apache.geode.examples.partitioned;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.apache.geode.cache.Region;
+import org.geode.examples.util.Mocks;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.contrib.java.lang.system.SystemOutRule;
+
+public class ExampleTest {
+
+  @Rule
+  public SystemOutRule systemOutRule = new SystemOutRule().enableLog();
+
+  @Test
+  public void testExample() throws Exception {
+    Region<EmployeeKey, EmployeeData> region = Mocks.region("example-region");
+    new Example().accept(region);
+
+    assertThat(systemOutRule.getLog()).contains("Counted 10 keys in region");
+    assertThat(systemOutRule.getLog()).contains("Jamie Jive");
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode-examples/blob/c21e76b2/partitioned/src/test/java/org/apache/geode/examples/partitioned/PartitionedTest.java
----------------------------------------------------------------------
diff --git a/partitioned/src/test/java/org/apache/geode/examples/partitioned/PartitionedTest.java b/partitioned/src/test/java/org/apache/geode/examples/partitioned/PartitionedTest.java
deleted file mode 100644
index d2a1288..0000000
--- a/partitioned/src/test/java/org/apache/geode/examples/partitioned/PartitionedTest.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * 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 org.apache.geode.examples.partitioned;
-
-import static org.hamcrest.core.Is.*;
-import static org.junit.Assert.*;
-import static org.junit.Assume.*;
-
-import java.io.IOException;
-import java.net.ServerSocket;
-import java.util.Map;
-import java.util.concurrent.TimeUnit;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.apache.commons.exec.CommandLine;
-import org.apache.commons.exec.DefaultExecuteResultHandler;
-import org.apache.commons.exec.ExecuteException;
-import org.apache.commons.exec.environment.EnvironmentUtils;
-import org.apache.geode.examples.utils.ShellUtil;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
-
-/**
- * Tests for the shell scripts of the partitioned example
- */
-public class PartitionedTest {
-
-  public static final String GEODE_LOCATOR_PORT = "GEODE_LOCATOR_PORT=";
-  private static final String startScriptFileName = "startAll.sh";
-  private static final String stopScriptFileName = "stopAll.sh";
-  private static final String pidkillerScriptFileName = "pidkiller.sh";
-  private boolean processRunning = false;
-  private ShellUtil shell = new ShellUtil();
-  private final long scriptTimeout = TimeUnit.SECONDS.toMillis(120);
-  private static final Logger logger = Logger.getAnonymousLogger();
-
-  @Rule
-  public TemporaryFolder testFolder = new TemporaryFolder();
-
-  private int locatorPort;
-  private Map environment;
-
-  @Before
-  public void setup() throws IOException {
-    // ignores test if running on windows
-    assumeThat(System.getProperty("os.name").startsWith("Windows"), is(false));
-
-    locatorPort = getAvailablePort();
-    environment = EnvironmentUtils.getProcEnvironment();
-    EnvironmentUtils.addVariableToEnvironment(environment, GEODE_LOCATOR_PORT + locatorPort);
-    logger.fine("Locator port: " + locatorPort);
-  }
-
-  @Test
-  public void checkIfScriptsExistsAndAreExecutable() throws IOException {
-    assertTrue(
-        shell.getFileFromClassLoader(startScriptFileName).map(x -> x.isFile()).orElse(false));
-    assertTrue(shell.getFileFromClassLoader(stopScriptFileName).map(x -> x.isFile()).orElse(false));
-  }
-
-  @Test
-  public void executeStartThenStopScript() throws InterruptedException, IOException {
-    final int exitCodeStart = executeScript(startScriptFileName);
-    assertEquals(0, exitCodeStart);
-
-    final int exitCodeStop = executeScript(stopScriptFileName);
-    assertEquals(0, exitCodeStop);
-  }
-
-  @Test
-  public void failToStopWhenNoServersAreRunning() throws InterruptedException, IOException {
-    final int exitCode;
-
-    exitCode = executeScript(stopScriptFileName);
-    assertEquals(1, exitCode);
-  }
-
-  /**
-   * Execute the kill script that looks for pid files
-   * 
-   * @throws IOException
-   * @throws InterruptedException
-   */
-  private void runKillScript() throws IOException, InterruptedException {
-    CommandLine cmdLine = CommandLine.parse(shell.getFileFromClassLoader(pidkillerScriptFileName)
-        .map(x -> x.getAbsolutePath()).orElseThrow(IllegalArgumentException::new));
-    cmdLine.addArgument(testFolder.getRoot().getAbsolutePath());
-
-    DefaultExecuteResultHandler resultHandler =
-        shell.execute(cmdLine, scriptTimeout, environment, testFolder.getRoot());
-    resultHandler.waitFor(scriptTimeout);
-  }
-
-  /**
-   * Given a script file name, runs the script and return the exit code. If exitCode != 0 extract
-   * and prints exception.
-   * 
-   * @param scriptName
-   * @return <code>int</code> with exitCode
-   * @throws IOException
-   * @throws InterruptedException
-   */
-  private int executeScript(String scriptName) throws IOException, InterruptedException {
-    final int exitCode;
-    DefaultExecuteResultHandler resultHandler =
-        shell.execute(scriptName, scriptTimeout, environment, testFolder.getRoot());
-    processRunning = true;
-    resultHandler.waitFor();
-
-    logger.finest(String.format("Executing %s...", scriptName));
-    exitCode = resultHandler.getExitValue();
-
-    // extract and log exception if any happened
-    if (exitCode != 0) {
-      ExecuteException executeException = resultHandler.getException();
-      logger.log(Level.SEVERE, executeException.getMessage(), executeException);
-    }
-    return exitCode;
-  }
-
-  @After
-  public void tearDown() {
-    if (processRunning) {
-      try {
-        runKillScript();
-      } catch (IOException | InterruptedException e) {
-        e.printStackTrace();
-      }
-    }
-  }
-
-  /**
-   * Get a random available port
-   * 
-   * @return <code>int</code> port number
-   */
-  private static int getAvailablePort() {
-    try (ServerSocket socket = new ServerSocket(0)) {
-      int port = socket.getLocalPort();
-      socket.close();
-      return port;
-    } catch (IOException ioex) {
-      logger.log(Level.SEVERE, ioex.getMessage(), ioex);
-    }
-    throw new IllegalStateException("No TCP/IP ports available.");
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode-examples/blob/c21e76b2/partitioned/src/test/java/org/apache/geode/examples/partitioned/ProducerTest.java
----------------------------------------------------------------------
diff --git a/partitioned/src/test/java/org/apache/geode/examples/partitioned/ProducerTest.java b/partitioned/src/test/java/org/apache/geode/examples/partitioned/ProducerTest.java
deleted file mode 100644
index c042af5..0000000
--- a/partitioned/src/test/java/org/apache/geode/examples/partitioned/ProducerTest.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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 org.apache.geode.examples.partitioned;
-
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.*;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-
-import org.apache.geode.cache.Region;
-
-public class ProducerTest {
-
-  @Rule
-  public ExpectedException expectedException = ExpectedException.none();
-
-  private Producer pMock = mock(Producer.class);
-  private Region<EmployeeKey, EmployeeData> region = mock(Region.class);
-  private EmployeeData dataMock = mock(EmployeeData.class);
-
-
-  @Test
-  public void testPopulateRegion() {
-    Producer producer = new Producer(region);
-    producer.populateRegion();
-    verify(region, times(10)).put(any(), any());
-
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode-examples/blob/c21e76b2/replicated/README.md
----------------------------------------------------------------------
diff --git a/replicated/README.md b/replicated/README.md
index 6af34a5..696c48a 100644
--- a/replicated/README.md
+++ b/replicated/README.md
@@ -17,47 +17,28 @@ limitations under the License.
 
 # Geode replicated region example
 
-This is one of the most basic examples. 
-Two servers host a replicated region.
-The producer puts 50 entries into the replicated region. The consumer prints the number of entries in the region.
+This is a simple example that demonstrates putting values into a
+replicated region, checking the size, and retrieving the values.
 
-## Steps
-1. From the ```geode-examples/replicated``` directory, start the locator and two servers:
-
-        $ scripts/startAll.sh
+This example assumes you have installed Java and Geode.
 
-2. Run the producer:
-
-        $ ../gradlew run -Pmain=Producer
-        ...
-        ... 
-        INFO: Done. Inserted 50 entries.
+## Steps
+1. From the ```geode-examples/replicated``` directory, start the locator and two servers
 
-3. Run the consumer:
+        $ gfsh run --file=scripts/start.gfsh
 
-        $ ../gradlew run -Pmain=Consumer
-        ...
-        ...
-        INFO: Done. 50 entries available on the server(s).
+2. Run the example to create entries in the region
 
-4. Kill one of the servers:
+        $ ./gradlew run
 
-        $ $GEODE_HOME/bin/gfsh
-        ...
-        gfsh>connect
-        gfsh>stop server --name=server1
-        gfsh>quit
+3. Kill one of the servers
 
-5. Run the consumer a second time, and notice that all the entries are still available due to replication: 
+        $ gfsh -e "connect --locator=127.0.0.1[10334]" -e "stop server --name=server1"
 
-        $ ../gradlew run -Pmain=Consumer
-        ...
-        ...
-        INFO: Done. 50 entries available on the server(s).
+4. Run the example a second time, and notice that all the entries are still available due to replication
 
-6. Shut down the system:
+        $ ./gradlew run 
 
-        $ scripts/stopAll.sh
+5. Shut down the system:
 
-This example is a simple demonstration of using gfsh and some basic Geode APIs,
-as well how to write tests using mocks for Geode applications.
+        $ gfsh run --file=scripts/stop.gfsh

http://git-wip-us.apache.org/repos/asf/geode-examples/blob/c21e76b2/replicated/build.gradle
----------------------------------------------------------------------
diff --git a/replicated/build.gradle b/replicated/build.gradle
deleted file mode 100644
index 52283ec..0000000
--- a/replicated/build.gradle
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * 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.
- */
-
-sourceSets.test {
-  resources.srcDirs = ["${projectDir}/scripts"]
-}

http://git-wip-us.apache.org/repos/asf/geode-examples/blob/c21e76b2/replicated/scripts/.gitignore
----------------------------------------------------------------------
diff --git a/replicated/scripts/.gitignore b/replicated/scripts/.gitignore
deleted file mode 100644
index 32f8870..0000000
--- a/replicated/scripts/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-locator1/
-server*/

http://git-wip-us.apache.org/repos/asf/geode-examples/blob/c21e76b2/replicated/scripts/pidkiller.sh
----------------------------------------------------------------------
diff --git a/replicated/scripts/pidkiller.sh b/replicated/scripts/pidkiller.sh
deleted file mode 100755
index ecf8f2d..0000000
--- a/replicated/scripts/pidkiller.sh
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/bin/bash
-#
-# 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.
-#
-# @brief Script that look for .pid files on a directory and kill those processes.
-#
-
-export DIR=$1
-
-if [ $# -eq 0 ]
-  then
-    echo "No arguments supplied. Script needs directory to look for pid files."
-    exit 1
-fi
-
-for pid in `find $DIR -name "*.pid"`
-do
- echo "Found: $pid"
- kill -9 `cat $pid`
- echo "Killed."
-done
-

http://git-wip-us.apache.org/repos/asf/geode-examples/blob/c21e76b2/replicated/scripts/setEnv.sh
----------------------------------------------------------------------
diff --git a/replicated/scripts/setEnv.sh b/replicated/scripts/setEnv.sh
deleted file mode 100755
index e9e860e..0000000
--- a/replicated/scripts/setEnv.sh
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/bin/bash
-#
-# 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.
-#
-
-## check if locator port has been set otherwise set to default
-export GEODE_LOCATOR_PORT="${GEODE_LOCATOR_PORT:-10334}"
-
-## check if GEODE_HOME has been set
-: ${GEODE_HOME?"GEODE_HOME enviroment variable needs to be set"}
-
-## check if gfsh script is accessible and print version
-: ${GEODE_HOME/bin/gfsh?"gfsh doesn't seem to be available. Please check $GEODE_HOME"}
-echo "Geode version: `$GEODE_HOME/bin/gfsh version`"
-
-## prefer GEODE_HOME for finding gfsh
-export PATH=$GEODE_HOME/bin:$PATH
-
-
-: ${GEODE_LOCATOR_PORT?}

http://git-wip-us.apache.org/repos/asf/geode-examples/blob/c21e76b2/replicated/scripts/start.gfsh
----------------------------------------------------------------------
diff --git a/replicated/scripts/start.gfsh b/replicated/scripts/start.gfsh
new file mode 100644
index 0000000..3399719
--- /dev/null
+++ b/replicated/scripts/start.gfsh
@@ -0,0 +1,25 @@
+#
+# 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.
+#
+start locator --bind-address=127.0.0.1
+
+start server --name=server1 --locators=127.0.0.1[10334] --server-port=0
+start server --name=server2 --locators=127.0.0.1[10334] --server-port=0
+
+create region --name=example-region --type=REPLICATE
+
+list members
+describe region --name=example-region
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/geode-examples/blob/c21e76b2/replicated/scripts/startAll.sh
----------------------------------------------------------------------
diff --git a/replicated/scripts/startAll.sh b/replicated/scripts/startAll.sh
deleted file mode 100755
index 2b08f19..0000000
--- a/replicated/scripts/startAll.sh
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/bin/bash
-#
-# 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.
-#
-
-set -e
-
-current=`pwd`
-
-cd `dirname $0`
-
-. ./setEnv.sh
-
-cd $current
-
-#export GEODE_LOCATOR_PORT="${GEODE_LOCATOR_PORT:-10334}"
-# start a locator
-gfsh start locator --name=locator1 --mcast-port=0 --port=${GEODE_LOCATOR_PORT}
-
-# start 2 servers on a random available port
-for N in {1..2}
-do
- gfsh start server --locators=localhost[${GEODE_LOCATOR_PORT}] --name=server$N  --server-port=0 --mcast-port=0
-done
-
-# create a region using GFSH
-gfsh -e "connect --locator=localhost[${GEODE_LOCATOR_PORT}]" -e "create region --name=myRegion --type=REPLICATE"
-
-gfsh -e "connect --locator=localhost[${GEODE_LOCATOR_PORT}]" -e "list members"
-
-exit 0
-

http://git-wip-us.apache.org/repos/asf/geode-examples/blob/c21e76b2/replicated/scripts/stop.gfsh
----------------------------------------------------------------------
diff --git a/replicated/scripts/stop.gfsh b/replicated/scripts/stop.gfsh
new file mode 100644
index 0000000..9281b31
--- /dev/null
+++ b/replicated/scripts/stop.gfsh
@@ -0,0 +1,18 @@
+#
+# 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.
+#
+connect --locator=127.0.0.1[10334]
+shutdown --include-locators=true
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/geode-examples/blob/c21e76b2/replicated/scripts/stopAll.sh
----------------------------------------------------------------------
diff --git a/replicated/scripts/stopAll.sh b/replicated/scripts/stopAll.sh
deleted file mode 100755
index a6364a8..0000000
--- a/replicated/scripts/stopAll.sh
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/bin/bash
-#
-# 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.
-#
-set -e
-
-current=`pwd`
-
-cd `dirname $0`
-
-. ./setEnv.sh
-
-cd $current
-
-gfsh -e "connect --locator=localhost[${GEODE_LOCATOR_PORT}]" -e "shutdown --include-locators=true"

http://git-wip-us.apache.org/repos/asf/geode-examples/blob/c21e76b2/replicated/src/main/java/org/apache/geode/examples/replicated/BaseClient.java
----------------------------------------------------------------------
diff --git a/replicated/src/main/java/org/apache/geode/examples/replicated/BaseClient.java b/replicated/src/main/java/org/apache/geode/examples/replicated/BaseClient.java
deleted file mode 100644
index fb54a52..0000000
--- a/replicated/src/main/java/org/apache/geode/examples/replicated/BaseClient.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * 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 org.apache.geode.examples.replicated;
-
-import java.util.logging.Logger;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.cache.client.ClientCache;
-import org.apache.geode.cache.client.ClientCacheFactory;
-import org.apache.geode.cache.client.ClientRegionShortcut;
-
-
-public abstract class BaseClient {
-
-  static final Logger logger = Logger.getAnonymousLogger();
-  protected ClientCache clientCache;
-
-  protected void setRegion(Region region) {
-    this.region = region;
-  }
-
-  private Region region;
-  private final String locatorHost = System.getProperty("GEODE_LOCATOR_HOST", "localhost");
-  private final int locatorPort = Integer.getInteger("GEODE_LOCATOR_PORT", 10334);
-  protected static final String REGION_NAME = "myRegion";
-  static final int NUM_ENTRIES = 50;
-
-  public BaseClient() {
-    this.clientCache = getClientCache();
-  }
-
-  protected Region getRegion() {
-    if (region == null) {
-      region = getClientCache()
-          .<String, String>createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY)
-          .create(REGION_NAME);
-    }
-    return region;
-  }
-
-  protected ClientCache getClientCache() {
-    if (clientCache == null) {
-      clientCache = new ClientCacheFactory().addPoolLocator(locatorHost, locatorPort)
-          .set("log-level", "WARN").create();
-    }
-    return clientCache;
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode-examples/blob/c21e76b2/replicated/src/main/java/org/apache/geode/examples/replicated/Consumer.java
----------------------------------------------------------------------
diff --git a/replicated/src/main/java/org/apache/geode/examples/replicated/Consumer.java b/replicated/src/main/java/org/apache/geode/examples/replicated/Consumer.java
deleted file mode 100644
index 8124199..0000000
--- a/replicated/src/main/java/org/apache/geode/examples/replicated/Consumer.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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 org.apache.geode.examples.replicated;
-
-import org.apache.geode.cache.client.ClientCache;
-
-public class Consumer extends BaseClient {
-
-  public static void main(String[] args) {
-    new Consumer().countEntriesOnServer();
-  }
-
-  public Consumer() {}
-
-  public Consumer(ClientCache clientCache) {
-    this.clientCache = clientCache;
-  }
-
-  public int countEntriesOnServer() {
-    int size = getRegion().keySetOnServer().size();
-    logger.info(String.format("Done. %d entries available on the server(s).", size));
-    return size;
-  }
-
-}


Mime
View raw message