geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mark...@apache.org
Subject incubator-geode git commit: [GEODE-33] Fixed hardcoded path for resources on tests - Included rat exclusion rules
Date Tue, 21 Jun 2016 07:02:09 GMT
Repository: incubator-geode
Updated Branches:
  refs/heads/feature/GEODE-33 d67bf627c -> a31b8482a


[GEODE-33] Fixed hardcoded path for resources on tests
- Included rat exclusion rules


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

Branch: refs/heads/feature/GEODE-33
Commit: a31b8482a3306856f9e97459649ac38d0db709bf
Parents: d67bf62
Author: William Markito <wmarkito@pivotal.io>
Authored: Tue Jun 21 00:00:41 2016 -0700
Committer: William Markito <wmarkito@pivotal.io>
Committed: Tue Jun 21 00:00:41 2016 -0700

----------------------------------------------------------------------
 geode-examples/.gitignore                       |   1 +
 .../gradle/wrapper/gradle-wrapper.jar           | Bin 53636 -> 53639 bytes
 .../gradle/wrapper/gradle-wrapper.properties    |   4 +-
 geode-examples/gradlew.bat                      |   2 +-
 geode-examples/replicated/build.gradle          |   4 +
 .../examples/replicated/ReplicatedTest.java     |  98 ++++---------------
 .../geode/examples/replicated/ShellUtil.java    |  13 ++-
 gradle/rat.gradle                               |   6 ++
 8 files changed, 42 insertions(+), 86 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/a31b8482/geode-examples/.gitignore
----------------------------------------------------------------------
diff --git a/geode-examples/.gitignore b/geode-examples/.gitignore
new file mode 100644
index 0000000..b1001a6
--- /dev/null
+++ b/geode-examples/.gitignore
@@ -0,0 +1 @@
+.idea/**

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/a31b8482/geode-examples/gradle/wrapper/gradle-wrapper.jar
----------------------------------------------------------------------
diff --git a/geode-examples/gradle/wrapper/gradle-wrapper.jar b/geode-examples/gradle/wrapper/gradle-wrapper.jar
index 9411448..2c6137b 100644
Binary files a/geode-examples/gradle/wrapper/gradle-wrapper.jar and b/geode-examples/gradle/wrapper/gradle-wrapper.jar
differ

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/a31b8482/geode-examples/gradle/wrapper/gradle-wrapper.properties
----------------------------------------------------------------------
diff --git a/geode-examples/gradle/wrapper/gradle-wrapper.properties b/geode-examples/gradle/wrapper/gradle-wrapper.properties
index 9af0d52..6132c99 100644
--- a/geode-examples/gradle/wrapper/gradle-wrapper.properties
+++ b/geode-examples/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Wed Jun 01 15:34:43 PDT 2016
+#Mon Jun 20 23:30:08 PDT 2016
 distributionBase=GRADLE_USER_HOME
 distributionPath=wrapper/dists
 zipStoreBase=GRADLE_USER_HOME
 zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-2.9-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-2.12-bin.zip

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/a31b8482/geode-examples/gradlew.bat
----------------------------------------------------------------------
diff --git a/geode-examples/gradlew.bat b/geode-examples/gradlew.bat
index 8a0b282..5f19212 100644
--- a/geode-examples/gradlew.bat
+++ b/geode-examples/gradlew.bat
@@ -46,7 +46,7 @@ echo location of your Java installation.
 goto fail
 
 :init
-@rem Get command-line arguments, handling Windowz variants
+@rem Get command-line arguments, handling Windows variants
 
 if not "%OS%" == "Windows_NT" goto win9xME_args
 if "%@eval[2+2]" == "4" goto 4NT_args

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/a31b8482/geode-examples/replicated/build.gradle
----------------------------------------------------------------------
diff --git a/geode-examples/replicated/build.gradle b/geode-examples/replicated/build.gradle
index ae6f28c..52283ec 100644
--- a/geode-examples/replicated/build.gradle
+++ b/geode-examples/replicated/build.gradle
@@ -14,3 +14,7 @@
  * 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/incubator-geode/blob/a31b8482/geode-examples/replicated/src/test/java/org/apache/geode/examples/replicated/ReplicatedTest.java
----------------------------------------------------------------------
diff --git a/geode-examples/replicated/src/test/java/org/apache/geode/examples/replicated/ReplicatedTest.java
b/geode-examples/replicated/src/test/java/org/apache/geode/examples/replicated/ReplicatedTest.java
index aeccf7b..6d777d0 100644
--- a/geode-examples/replicated/src/test/java/org/apache/geode/examples/replicated/ReplicatedTest.java
+++ b/geode-examples/replicated/src/test/java/org/apache/geode/examples/replicated/ReplicatedTest.java
@@ -16,62 +16,50 @@
  */
 package org.apache.geode.examples.replicated;
 
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import static org.junit.Assert.*;
 
+import java.io.File;
 import java.io.IOException;
-import java.nio.file.Paths;
 import java.util.concurrent.TimeUnit;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import org.junit.After;
+import org.junit.Test;
 
 public class ReplicatedTest {
 
   //TODO: parameterize
-  private String startScript = "/Users/wmarkito/Pivotal/ASF/incubator-geode/geode-examples/replicated/scripts/startAll.sh";
-  private String stopScript = "/Users/wmarkito/Pivotal/ASF/incubator-geode/geode-examples/replicated/scripts/stopAll.sh";
+  private String startScriptFileName = "startAll.sh";
+  private String stopScriptFileName = "stopAll.sh";
   private boolean processRunning = false;
-  private ShellUtil shell;
+  private ShellUtil shell = new ShellUtil();
   private Process process;
 
-  private int waitTimeForScript=1000;
-
-  @Before
-  public void setup() {
-    if (processRunning) {
-      stop();
-    }
-  }
+  private int waitTimeForScript=60;
 
   @Test
   public void checkIfScriptsExists() throws IOException {
-//
-//    ClassLoader classLoader = getClass().getClassLoader();
-//
-//    File file = new File(classLoader.getResource("startAll.sh").getFile());
-//
-//    System.out.println(file.getCanonicalPath());
-
-    assertTrue(Paths.get(startScript).toFile().exists());
-    assertTrue(Paths.get(stopScript).toFile().exists());
+    ClassLoader classLoader = getClass().getClassLoader();
+
+    File file = new File(classLoader.getResource(startScriptFileName).getFile());
+    assertTrue(file.exists());
+
+    file = new File(classLoader.getResource(stopScriptFileName).getFile());
+    assertTrue(file.exists());
   }
 
 
   private Process start() {
-    Process p = new ShellUtil().exec(startScript).get();
+    Process p = shell.executeFile(startScriptFileName).get();
     processRunning = true;
     return p;
   }
 
   private Process stop() {
-    Process p = new ShellUtil().exec(stopScript).get();
+    Process p = shell.executeFile(stopScriptFileName).get();
     processRunning = false;
     return p;
   }
 
-
   @Test
   public void testStartAndStop() throws InterruptedException {
     boolean status = false;
@@ -100,56 +88,4 @@ public class ReplicatedTest {
     }
   }
 
-
-//  @Test
-//  public void testStopScript() {
-//    assertEquals(0, new ShellUtil().exec(stopScript).get().exitValue());
-//  }
-
-
-//  @Test
-//  public void test() {
-//    Producer producer = new Producer();
-//    Consumer consumer = new Consumer();
-//
-//    producer.populateRegion();
-//    int numEntries = consumer.countEntries();
-//
-//    assertEquals(BaseClient.NUM_ENTRIES, numEntries);
-//  }
-//
-//  private Cache setupCacheServer() {
-//    Cache cache = new CacheFactory()
-//            .set("name", "geode-server")
-//            .set("mcast-port", "0")
-//            .set("log-file", "ReplicatedTest.log")
-//            .set("log-level", "config")
-//            .create();
-//
-//    RegionFactory<String, String> regionFactory = cache.createRegionFactory();
-//
-//    regionFactory.setDataPolicy(DataPolicy.REPLICATE);
-//
-//    Region myRegion = regionFactory.create(BaseClient.REGION_NAME);
-//
-//    assertNotNull("The /myExample Region was not properly configured and initialized!",
myRegion);
-////    assertEquals(BaseClient.REGION_NAME, myRegion.getFullPath());
-//    assertEquals(BaseClient.REGION_NAME, myRegion.getName());
-//    assertTrue(myRegion.isEmpty());
-//
-//    CacheServer cacheServer = cache.addCacheServer();
-//
-//    cacheServer.setPort(0);
-//    cacheServer.setMaxConnections(5);
-//
-//    try {
-//      cacheServer.start();
-//    } catch (IOException e) {
-//      throw new RuntimeException(e);
-//    }
-//    assertTrue("Cache Server is not running!", cacheServer.isRunning());
-//
-//    return cache;
-//  }
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/a31b8482/geode-examples/replicated/src/test/java/org/apache/geode/examples/replicated/ShellUtil.java
----------------------------------------------------------------------
diff --git a/geode-examples/replicated/src/test/java/org/apache/geode/examples/replicated/ShellUtil.java
b/geode-examples/replicated/src/test/java/org/apache/geode/examples/replicated/ShellUtil.java
index 852ac88..b93f828 100644
--- a/geode-examples/replicated/src/test/java/org/apache/geode/examples/replicated/ShellUtil.java
+++ b/geode-examples/replicated/src/test/java/org/apache/geode/examples/replicated/ShellUtil.java
@@ -17,14 +17,23 @@
 
 package org.apache.geode.examples.replicated;
 
+import java.io.File;
 import java.io.IOException;
 import java.util.Optional;
 
 public class ShellUtil {
 
-  public Optional<Process> exec(String command) {
+  /**
+   * File name should available on the classpath
+   * @param fileName
+   * @return <Optional>Process</Optional>
+   */
+  public Optional<Process> executeFile(String fileName) {
     try {
-      return Optional.of(Runtime.getRuntime().exec(command));
+      ClassLoader classLoader = getClass().getClassLoader();
+      File file = new File(classLoader.getResource(fileName).getFile());
+
+      return Optional.of(Runtime.getRuntime().exec(file.getAbsolutePath()));
     } catch (IOException e) {
       e.printStackTrace();
     }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/a31b8482/gradle/rat.gradle
----------------------------------------------------------------------
diff --git a/gradle/rat.gradle b/gradle/rat.gradle
index f507993..7f18c95 100644
--- a/gradle/rat.gradle
+++ b/gradle/rat.gradle
@@ -43,6 +43,12 @@ rat {
     'geode-spark-connector/**/target/**',
     'geode-spark-connector/sbt',
 
+    // Geode examples
+    'geode-examples/*/scripts/**',
+    'geode-examples/.idea/**',
+    'geode-examples/gradlew*/**',
+    'geode-examples/gradle/wrapper/**',
+
     // IDE
     'etc/eclipseFormatterProfile.xml',
     'etc/intellijIdeaCodeStyle.xml',


Mime
View raw message