geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jinmeil...@apache.org
Subject [15/32] incubator-geode git commit: GEODE-1573: Use snappy java implementation
Date Tue, 05 Jul 2016 23:15:38 GMT
GEODE-1573: Use snappy java implementation

 * swapped JNI wrapper with a pure Java implementation
 * enabled tests in all platforms
 * deprecated getDefaultInstace on SnappyCompressor class
   and now constructor can be used to create an instance


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

Branch: refs/heads/feature/GEODE-1571
Commit: 92f3a96615c02f4e7c23db7658af0ed465c4beb2
Parents: 2f6dcec
Author: Sai Boorlagadda <sboorlagadda@pivotal.io>
Authored: Mon Jun 20 13:43:30 2016 -0700
Committer: Sai Boorlagadda <sboorlagadda@pivotal.io>
Committed: Tue Jul 5 11:14:35 2016 -0700

----------------------------------------------------------------------
 geode-assembly/build.gradle                     |  2 +-
 ...auncherLifecycleCommandsIntegrationTest.java |  2 +-
 .../src/test/resources/expected_jars.txt        |  2 +-
 geode-core/build.gradle                         |  4 +-
 .../gemfire/compression/SnappyCompressor.java   | 46 +++----------------
 .../CompressionCacheConfigDUnitTest.java        |  8 +---
 .../CompressionCacheListenerDUnitTest.java      | 22 +--------
 ...ompressionCacheListenerOffHeapDUnitTest.java |  8 +---
 .../CompressionRegionConfigDUnitTest.java       | 48 +++-----------------
 .../CompressionRegionFactoryDUnitTest.java      |  9 +---
 .../CompressionRegionOperationsDUnitTest.java   | 41 ++---------------
 ...ressionRegionOperationsOffHeapDUnitTest.java |  8 +---
 .../compression/SnappyCompressorJUnitTest.java  | 32 +------------
 gradle/dependency-versions.properties           |  2 +-
 14 files changed, 29 insertions(+), 205 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/92f3a966/geode-assembly/build.gradle
----------------------------------------------------------------------
diff --git a/geode-assembly/build.gradle b/geode-assembly/build.gradle
index ce303bb..6570c7d 100755
--- a/geode-assembly/build.gradle
+++ b/geode-assembly/build.gradle
@@ -164,7 +164,7 @@ def cp = {
       it.contains('slf4j-api') ||
       it.contains('spring-core') ||
       it.contains('spring-shell') ||
-      it.contains('snappy-java') ||
+      it.contains('snappy') ||
       it.contains('hbase') ||
       it.contains('jgroups') ||
       it.contains('netty') ||

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/92f3a966/geode-assembly/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/LauncherLifecycleCommandsIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/LauncherLifecycleCommandsIntegrationTest.java
b/geode-assembly/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/LauncherLifecycleCommandsIntegrationTest.java
index 22c6947..32d6df2 100644
--- a/geode-assembly/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/LauncherLifecycleCommandsIntegrationTest.java
+++ b/geode-assembly/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/LauncherLifecycleCommandsIntegrationTest.java
@@ -79,7 +79,7 @@ public class LauncherLifecycleCommandsIntegrationTest {
     assertTrue(coreDependenciesJar + " is not a file", coreDependenciesJar.isFile());
 
     Collection<String> expectedJarDependencies = Arrays.asList("antlr", "commons-io",
"commons-lang", "commons-logging",
-            "geode", "jackson-annotations", "jackson-core", "jackson-databind", "jansi",
"jline", "snappy-java",
+            "geode", "jackson-annotations", "jackson-core", "jackson-databind", "jansi",
"jline", "snappy",
             "spring-core", "spring-shell", "jetty-server", "jetty-servlet", "jetty-webapp",
"jetty-util", "jetty-http",
             "servlet-api", "jetty-io", "jetty-security", "jetty-xml"
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/92f3a966/geode-assembly/src/test/resources/expected_jars.txt
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/resources/expected_jars.txt b/geode-assembly/src/test/resources/expected_jars.txt
index 6104dbb..939464a 100644
--- a/geode-assembly/src/test/resources/expected_jars.txt
+++ b/geode-assembly/src/test/resources/expected_jars.txt
@@ -59,7 +59,7 @@ scala-library
 scala-reflect
 shiro-core
 slf4j-api
-snappy-java
+snappy
 spring-aop
 spring-aspects
 spring-beans

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/92f3a966/geode-core/build.gradle
----------------------------------------------------------------------
diff --git a/geode-core/build.gradle b/geode-core/build.gradle
index af5c02b..030885e 100755
--- a/geode-core/build.gradle
+++ b/geode-core/build.gradle
@@ -96,9 +96,9 @@ dependencies {
     exclude module: 'spring-context-support'
     ext.optional = true
   }
-  compile ('org.xerial.snappy:snappy-java:' + project.'snappy-java.version') {
+  compile ('org.iq80.snappy:snappy:' + project.'snappy-java.version') {
     ext.optional = true
-  }
+  } 
 
   compile 'org.apache.shiro:shiro-core:' + project.'shiro.version'
  

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/92f3a966/geode-core/src/main/java/com/gemstone/gemfire/compression/SnappyCompressor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/compression/SnappyCompressor.java
b/geode-core/src/main/java/com/gemstone/gemfire/compression/SnappyCompressor.java
index 512756a..63ec29d 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/compression/SnappyCompressor.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/compression/SnappyCompressor.java
@@ -17,76 +17,44 @@
 
 package com.gemstone.gemfire.compression;
 
-import java.io.IOException;
 import java.io.Serializable;
-import java.util.concurrent.atomic.AtomicReference;
 
-import org.xerial.snappy.Snappy;
-import org.xerial.snappy.SnappyError;
-
-import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
+import org.iq80.snappy.CorruptionException;
+import org.iq80.snappy.Snappy;
 
 /**
  * An implementation of {@link Compressor} for Google's Snappy compression
- * codec. Utilizes the xerial java-snappy wrapper.
+ * codec. Utilizes the java-snappy wrapper.
  * 
  * @since GemFire 8.0
  */
 public final class SnappyCompressor implements Compressor, Serializable {
   private static final long serialVersionUID = 496609875302446099L;
   
-  // It's possible to create more than one, but there only needs to be a single
-  // instance in the VM.
-  private static final AtomicReference<SnappyCompressor> defaultInstance = new AtomicReference<SnappyCompressor>();
-  
-  // Set to true when we've loaded the Snappy native library.
-  private static boolean nativeLibraryLoaded = false;
-  
   /**
    * Create a new instance of the SnappyCompressor.
-   * @throws IllegalStateException when the Snappy native library is unavailable
    */
   public SnappyCompressor() {
-    synchronized (defaultInstance) {
-      if (!nativeLibraryLoaded) {
-        try {
-          String s = Snappy.getNativeLibraryVersion();
-          System.out.println(s);
-        } catch (SnappyError se) {
-          throw new IllegalStateException(LocalizedStrings.SnappyCompressor_UNABLE_TO_LOAD_NATIVE_SNAPPY_LIBRARY.toLocalizedString(),
se);
-        }
-        nativeLibraryLoaded = true;
-      }
-    }
   }
   
   /**
    * Get the single, default instance of the SnappyCompressor.
+   * @deprecated As of Geode 1.0, getDefaultInstance is deprecated. Use constructor instead.
    */
   public static final SnappyCompressor getDefaultInstance() {
-    SnappyCompressor instance = defaultInstance.get();
-    if (instance != null) {
-      return instance;
-    }
-
-    defaultInstance.compareAndSet(null, new SnappyCompressor());
-    return defaultInstance.get();
+    return new SnappyCompressor();
   }
 
   @Override
   public byte[] compress(byte[] input) {
-    try {
       return Snappy.compress(input);
-    } catch (IOException e) {
-      throw new CompressionException(e);
-    }
   }
 
   @Override
   public byte[] decompress(byte[] input) {
     try {
-      return Snappy.uncompress(input);
-    } catch (IOException e) {
+      return Snappy.uncompress(input, 0, input.length);
+    } catch (CorruptionException e) {
       throw new CompressionException(e);
     }
   }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/92f3a966/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionCacheConfigDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionCacheConfigDUnitTest.java
b/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionCacheConfigDUnitTest.java
index a757c56..f5f0977 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionCacheConfigDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionCacheConfigDUnitTest.java
@@ -67,15 +67,9 @@ public class CompressionCacheConfigDUnitTest extends JUnit4CacheTestCase
{
    */
   @Test
   public void testCreateCacheWithGoodCompressor() throws Exception {
-    try {
-      SnappyCompressor.getDefaultInstance();
-    } catch (Throwable t) { // TODO: use junit Assume
-      // Not a supported OS
-      return;
-    }
     File cacheXml = createCacheXml(GOOD_COMPRESSOR);
     assertTrue(createCacheOnVM(getVM(0),cacheXml.getCanonicalPath()));
-    assertCompressorOnVM(getVM(0),SnappyCompressor.getDefaultInstance(),REGION_NAME);
+    assertCompressorOnVM(getVM(0), new SnappyCompressor(), REGION_NAME);
     cleanup(getVM(0));
     cacheXml.delete();
   }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/92f3a966/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionCacheListenerDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionCacheListenerDUnitTest.java
b/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionCacheListenerDUnitTest.java
index f649d9a..988d49b 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionCacheListenerDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionCacheListenerDUnitTest.java
@@ -177,25 +177,13 @@ public class CompressionCacheListenerDUnitTest extends JUnit4CacheTestCase
{
   }
   
   protected void createRegion() {
-    try {
-      SnappyCompressor.getDefaultInstance();
-    } catch (Throwable t) {
-      // Not a supported OS
-      return;
-    }
-    createCompressedRegionOnVm(getVM(TEST_VM), REGION_NAME, SnappyCompressor.getDefaultInstance());
+    createCompressedRegionOnVm(getVM(TEST_VM), REGION_NAME, new SnappyCompressor());
   }
 
   @Override
   public final void preTearDownCacheTestCase() throws Exception {
     preTearDownCompressionCacheListenerDUnitTest();
-    
-    try {
-      SnappyCompressor.getDefaultInstance();
-      cleanup(getVM(TEST_VM));
-    } catch (Throwable t) {
-      // Not a supported OS
-    }
+    cleanup(getVM(TEST_VM));
   }
   
   protected void preTearDownCompressionCacheListenerDUnitTest() throws Exception {
@@ -251,12 +239,6 @@ public class CompressionCacheListenerDUnitTest extends JUnit4CacheTestCase
{
    * @param vm a virtual machine to perform the test on.
    */
   private void testCacheListenerAndWriterWithVM(final VM vm) {
-    try {
-      SnappyCompressor.getDefaultInstance();
-    } catch (Throwable t) {
-      // Not a supported OS
-      return;
-    }
     vm.invoke(new SerializableRunnable() {
       @Override
       public void run() {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/92f3a966/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionCacheListenerOffHeapDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionCacheListenerOffHeapDUnitTest.java
b/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionCacheListenerOffHeapDUnitTest.java
index 56ce303..a615297 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionCacheListenerOffHeapDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionCacheListenerOffHeapDUnitTest.java
@@ -56,13 +56,7 @@ public class CompressionCacheListenerOffHeapDUnitTest extends CompressionCacheLi
 
   @Override
   protected void createRegion() {
-    try {
-      SnappyCompressor.getDefaultInstance();
-    } catch (Throwable t) {
-      // Not a supported OS
-      return;
-    }
-    createCompressedRegionOnVm(getVM(TEST_VM), REGION_NAME, SnappyCompressor.getDefaultInstance(),
true);
+    createCompressedRegionOnVm(getVM(TEST_VM), REGION_NAME, new SnappyCompressor(), true);
   }
   
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/92f3a966/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionRegionConfigDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionRegionConfigDUnitTest.java
b/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionRegionConfigDUnitTest.java
index 93c8c00..80b2845 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionRegionConfigDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionRegionConfigDUnitTest.java
@@ -86,13 +86,7 @@ public class CompressionRegionConfigDUnitTest extends JUnit4CacheTestCase
{
    */
   @Test
   public void testReplicateRegion() throws Exception {
-    Compressor compressor = null;
-    try {
-      compressor = SnappyCompressor.getDefaultInstance();
-    } catch (Throwable t) {
-      // Not a supported OS
-      return;
-    }
+    Compressor compressor = new SnappyCompressor();
     assertTrue(createCompressedRegionOnVm(getVM(0), REGION_NAME, DataPolicy.REPLICATE, compressor));
     assertTrue(createCompressedRegionOnVm(getVM(1), REGION_NAME, DataPolicy.REPLICATE, compressor));
     assertNull(putUsingVM(getVM(0),KEY_1,VALUE_1));
@@ -107,13 +101,7 @@ public class CompressionRegionConfigDUnitTest extends JUnit4CacheTestCase
{
    */
   @Test
   public void testReplicatePersistentRegion() throws Exception {
-    Compressor compressor = null;
-    try {
-      compressor = SnappyCompressor.getDefaultInstance();
-    } catch (Throwable t) {
-      // Not a supported OS
-      return;
-    }
+    Compressor compressor = new SnappyCompressor();
     assertTrue(createCompressedRegionOnVm(getVM(0), REGION_NAME, DataPolicy.PERSISTENT_REPLICATE,
compressor, DISK_STORE));
     assertTrue(createCompressedRegionOnVm(getVM(1), REGION_NAME, DataPolicy.PERSISTENT_REPLICATE,
compressor));
     assertNull(putUsingVM(getVM(0),KEY_1,VALUE_1));
@@ -130,13 +118,7 @@ public class CompressionRegionConfigDUnitTest extends JUnit4CacheTestCase
{
    */
   @Test
   public void testPartitionedRegion() {
-    Compressor compressor = null;
-    try {
-      compressor = SnappyCompressor.getDefaultInstance();
-    } catch (Throwable t) {
-      // Not a supported OS
-      return;
-    }
+    Compressor compressor = new SnappyCompressor();
     assertTrue(createCompressedRegionOnVm(getVM(0), REGION_NAME, DataPolicy.PARTITION, compressor));
     assertTrue(createCompressedRegionOnVm(getVM(1), REGION_NAME, DataPolicy.PARTITION, compressor));
     assertNull(putUsingVM(getVM(0),KEY_1,VALUE_1));
@@ -150,13 +132,7 @@ public class CompressionRegionConfigDUnitTest extends JUnit4CacheTestCase
{
    */
   @Test
   public void testPartitionedPersistentRegion() {
-    Compressor compressor = null;
-    try {
-      compressor = SnappyCompressor.getDefaultInstance();
-    } catch (Throwable t) {
-      // Not a supported OS
-      return;
-    }
+    Compressor compressor = new SnappyCompressor();
     assertTrue(createCompressedRegionOnVm(getVM(0), REGION_NAME, DataPolicy.PERSISTENT_PARTITION,
compressor, DISK_STORE));
     assertTrue(createCompressedRegionOnVm(getVM(1), REGION_NAME, DataPolicy.PERSISTENT_PARTITION,
compressor));
     assertNull(putUsingVM(getVM(0),KEY_1,VALUE_1));
@@ -173,13 +149,7 @@ public class CompressionRegionConfigDUnitTest extends JUnit4CacheTestCase
{
    */
   @Test
   public void testClientProxyRegion() {
-    Compressor compressor = null;
-    try {
-      compressor = SnappyCompressor.getDefaultInstance();
-    } catch (Throwable t) {
-      // Not a supported OS
-      return;
-    }
+    Compressor compressor = new SnappyCompressor();
     assertTrue(createCompressedServerRegionOnVm(getVM(0), REGION_NAME, DataPolicy.REPLICATE,
compressor));
     assertTrue(createCompressedClientRegionOnVm(getVM(1), REGION_NAME, compressor, ClientRegionShortcut.PROXY));
     assertNull(putUsingClientVM(getVM(1),KEY_1,VALUE_1));
@@ -194,13 +164,7 @@ public class CompressionRegionConfigDUnitTest extends JUnit4CacheTestCase
{
    */
   @Test
   public void testCachingClientProxyRegion() {
-    Compressor compressor = null;
-    try {
-      compressor = SnappyCompressor.getDefaultInstance();
-    } catch (Throwable t) {
-      // Not a supported OS
-      return;
-    }
+    Compressor compressor = new SnappyCompressor();
     assertTrue(createCompressedServerRegionOnVm(getVM(0), REGION_NAME, DataPolicy.REPLICATE,
compressor));
     assertTrue(createCompressedClientRegionOnVm(getVM(1), REGION_NAME, compressor, ClientRegionShortcut.CACHING_PROXY));
     assertNull(putUsingClientVM(getVM(1),KEY_1,VALUE_1));

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/92f3a966/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionRegionFactoryDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionRegionFactoryDUnitTest.java
b/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionRegionFactoryDUnitTest.java
index 43f7d23..793e4fd 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionRegionFactoryDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionRegionFactoryDUnitTest.java
@@ -48,7 +48,7 @@ public class CompressionRegionFactoryDUnitTest extends JUnit4CacheTestCase
{
   /**
    * A valid compressor.
    */
-  protected static final Compressor compressor = SnappyCompressor.getDefaultInstance();
+  protected static final Compressor compressor = new SnappyCompressor();
   
   /**
    * Our test vm.
@@ -69,13 +69,6 @@ public class CompressionRegionFactoryDUnitTest extends JUnit4CacheTestCase
{
    */
   @Test
   public void testRegionFactoryCompressor() {
-    Compressor compressor = null;
-    try {
-      compressor = SnappyCompressor.getDefaultInstance();
-    } catch (Throwable t) {
-      // Not a supported OS
-      return;
-    }
     assertTrue(createCompressedRegionOnVm(getVM(TEST_VM), COMPRESSED_REGION_NAME, compressor));
     assertCompressor(getVM(TEST_VM), COMPRESSED_REGION_NAME, compressor);
     cleanup(getVM(TEST_VM));

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/92f3a966/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionRegionOperationsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionRegionOperationsDUnitTest.java
b/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionRegionOperationsDUnitTest.java
index 1f56859..245bd86 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionRegionOperationsDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionRegionOperationsDUnitTest.java
@@ -131,13 +131,7 @@ public class CompressionRegionOperationsDUnitTest extends JUnit4CacheTestCase
{
   }
   
   protected void createRegion() {
-    Compressor compressor = null;
-    try {
-      compressor = SnappyCompressor.getDefaultInstance();;
-    } catch (Throwable t) {
-      // Not a supported OS
-      return;
-    }
+    Compressor compressor = new SnappyCompressor();
     createCompressedRegionOnVm(getVM(TEST_VM), REGION_NAME, compressor);
   }
   
@@ -153,13 +147,8 @@ public class CompressionRegionOperationsDUnitTest extends JUnit4CacheTestCase
{
     } catch (Exception e) {
       exception = e;
     }
-    
-    try {
-      SnappyCompressor.getDefaultInstance();
-      cleanup(getVM(TEST_VM));
-    } catch (Throwable t) {
-      // Not a supported OS
-    }
+
+    cleanup(getVM(TEST_VM));
     
     if (error != null) {
       throw error;
@@ -194,12 +183,6 @@ public class CompressionRegionOperationsDUnitTest extends JUnit4CacheTestCase
{
    * @param vm a test virtual machine.
    */
   private void testGetPutOperationsOnVM(final VM vm) {
-    try {
-      SnappyCompressor.getDefaultInstance();
-    } catch (Throwable t) {
-      // Not a supported OS
-      return;
-    }
     vm.invoke(new SerializableRunnable() {
       @Override
       public void run() {
@@ -267,12 +250,6 @@ public class CompressionRegionOperationsDUnitTest extends JUnit4CacheTestCase
{
    * @param vm a test virtual machine.
    */
   private void testKeysAndValuesOperationsOnVM(final VM vm) {
-    try {
-      SnappyCompressor.getDefaultInstance();
-    } catch (Throwable t) {
-      // Not a supported OS
-      return;
-    }
     vm.invoke(new SerializableRunnable() {        
       @Override
       public void run() {
@@ -354,12 +331,6 @@ public class CompressionRegionOperationsDUnitTest extends JUnit4CacheTestCase
{
    * @param vm a test virtual machine.
    */
   private void testGetPutOperationsWithCachedDeserializableOnVM(final VM vm) {
-    try {
-      SnappyCompressor.getDefaultInstance();
-    } catch (Throwable t) {
-      // Not a supported OS
-      return;
-    }
     vm.invoke(new SerializableRunnable() {
       @Override
       public void run() {
@@ -424,12 +395,6 @@ public class CompressionRegionOperationsDUnitTest extends JUnit4CacheTestCase
{
    * @param vm a test virtual machine.
    */
   private void testGetPutOperationsWithByteArraysOnVM(final VM vm) {
-    try {
-      SnappyCompressor.getDefaultInstance();
-    } catch (Throwable t) {
-      // Not a supported OS
-      return;
-    }
     vm.invoke(new SerializableRunnable() {
       @Override
       public void run() {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/92f3a966/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionRegionOperationsOffHeapDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionRegionOperationsOffHeapDUnitTest.java
b/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionRegionOperationsOffHeapDUnitTest.java
index 0bfa910..0ef0cc5 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionRegionOperationsOffHeapDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionRegionOperationsOffHeapDUnitTest.java
@@ -56,13 +56,7 @@ public class CompressionRegionOperationsOffHeapDUnitTest extends CompressionRegi
 
   @Override
   protected void createRegion() {
-    Compressor compressor = null;
-    try {
-      compressor = SnappyCompressor.getDefaultInstance();;
-    } catch (Throwable t) {
-      // Not a supported OS
-      return;
-    }
+    Compressor compressor = new SnappyCompressor();
     createCompressedRegionOnVm(getVM(TEST_VM), REGION_NAME, compressor, true);
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/92f3a966/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/SnappyCompressorJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/SnappyCompressorJUnitTest.java
b/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/SnappyCompressorJUnitTest.java
index ae8bf7b..cf52e53 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/SnappyCompressorJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/SnappyCompressorJUnitTest.java
@@ -18,13 +18,8 @@ package com.gemstone.gemfire.internal.compression;
 
 import static org.junit.Assert.*;
 
-import java.io.File;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
-import org.xerial.snappy.SnappyLoader;
 
 import com.gemstone.gemfire.compression.Compressor;
 import com.gemstone.gemfire.compression.SnappyCompressor;
@@ -42,34 +37,9 @@ public class SnappyCompressorJUnitTest {
   @Test
   public void testCompressByteArray() throws Exception {
     String compressMe = "Hello, how are you?";
-    byte[] compressMeData = SnappyCompressor.getDefaultInstance().compress(compressMe.getBytes());
+    byte[] compressMeData = new SnappyCompressor().compress(compressMe.getBytes());
     String uncompressedMe = new String(SnappyCompressor.getDefaultInstance().decompress(compressMeData));
 
     assertEquals(compressMe, uncompressedMe);
   }
-  
-  /**
-   * Tests {@link SnappyCompressor#SnappyCompressor()} constructor.
-   */
-  @Test
-  public void testConstructor() throws Exception {
-    SnappyCompressor.getDefaultInstance();
-
-    // repeat findNativeLibrary and make sure it's pointing at a file in tmpdir
-    Method findNativeLibraryMethod = SnappyLoader.class.getDeclaredMethod("findNativeLibrary",
new Class[0]);
-    findNativeLibraryMethod.setAccessible(true);
-    File nativeLibrary = (File) findNativeLibraryMethod.invoke(null);
-
-    System.out.println(nativeLibrary);
-
-    assertNotNull(nativeLibrary);
-    assertTrue(nativeLibrary + " does not exist", nativeLibrary.exists());
-
-    File tmpDir = new File(System.getProperty("java.io.tmpdir"));
-    assertTrue(tmpDir.exists());
-
-    File parent = nativeLibrary.getParentFile();
-    assertNotNull(parent);
-    assertEquals(tmpDir, parent);
-  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/92f3a966/gradle/dependency-versions.properties
----------------------------------------------------------------------
diff --git a/gradle/dependency-versions.properties b/gradle/dependency-versions.properties
index 9de665c..196a4f8 100644
--- a/gradle/dependency-versions.properties
+++ b/gradle/dependency-versions.properties
@@ -90,7 +90,7 @@ scala.version = 2.10.0
 selenium.version=2.53.0
 shiro.version=1.2.4
 slf4j-api.version = 1.7.7
-snappy-java.version = 1.1.1.6
+snappy-java.version=0.4
 spring-hateos.version = 0.16.0.RELEASE
 spring-shell.version = 1.1.0.RELEASE
 spring-ldap-core.version = 1.3.2.RELEASE


Mime
View raw message