[ 
https://issues.apache.org/jira/browse/HADOOP-11627?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14346232#comment-14346232
 ] 

Akira AJISAKA commented on HADOOP-11627:
----------------------------------------

Getting close. Overall looks good to me without test code.
{code}
-    // Don't use native libs for this test.
-    Configuration conf = new Configuration();
-    conf.setBoolean(CommonConfigurationKeys.IO_NATIVE_LIB_AVAILABLE_KEY, 
false);
-    assertFalse("ZlibFactory is using native libs against request",
-        ZlibFactory.isNativeZlibLoaded(conf));
{code}
For testing non-native library, we can introduce a {{@VisibleForTesting}} 
setter method for {{ZlibFactory.nativeZlibLoaded}}. That way we can disable 
native zlib library in tests. It's the same for bzip2.
* Notice: We must reset {{ZlibFactory.nativeZlibLoad}} and 
{{Bzip2Factory.nativeBzip2Loaded}} by {{@After}} method when we use setter 
methods.

> Remove io.native.lib.available from trunk
> -----------------------------------------
>
>                 Key: HADOOP-11627
>                 URL: https://issues.apache.org/jira/browse/HADOOP-11627
>             Project: Hadoop Common
>          Issue Type: Improvement
>    Affects Versions: 3.0.0
>            Reporter: Akira AJISAKA
>            Assignee: Brahma Reddy Battula
>         Attachments: HADOOP-11627-002.patch, HADOOP-11627-003.patch, 
> HADOOP-11627.patch
>
>
> According to the discussion in HADOOP-8642, we should remove 
> {{io.native.lib.available}} from trunk, and always use native libraries if 
> they exist.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to