@ -9,7 +9,6 @@ import org.junit.BeforeClass;
import org.junit.Test ;
import java.lang.reflect.Field ;
import java.lang.reflect.Modifier ;
import static org.assertj.core.api.Assertions.assertThat ;
@ -37,18 +36,21 @@ public class EnvironmentTest {
isEqualTo ( ".jnilib" ) ;
assertThat ( Environment . getJniLibraryFileName ( "rocksdb" ) ) .
isEqualTo ( "librocksdbjni-osx.jnilib" ) ;
assertThat ( Environment . getFallbackJniLibraryFileName ( "rocksdb" ) ) . isNull ( ) ;
assertThat ( Environment . getSharedLibraryFileName ( "rocksdb" ) ) .
isEqualTo ( "librocksdbjni.dylib" ) ;
}
@Test
public void mac64 ( ) {
setEnvironmentClassFields ( "mac" , "x86- 64" ) ;
public void mac64_x86_64 ( ) {
setEnvironmentClassFields ( "mac" , "x86_ 64" ) ;
assertThat ( Environment . isWindows ( ) ) . isFalse ( ) ;
assertThat ( Environment . getJniLibraryExtension ( ) ) .
isEqualTo ( ".jnilib" ) ;
assertThat ( Environment . getJniLibraryFileName ( "rocksdb" ) ) .
isEqualTo ( "librocksdbjni-osx.jnilib" ) ;
assertThat ( Environment . getJniLibraryFileName ( "rocksdb" ) )
. isEqualTo ( "librocksdbjni-osx-x86_64.jnilib" ) ;
assertThat ( Environment . getFallbackJniLibraryFileName ( "rocksdb" ) )
. isEqualTo ( "librocksdbjni-osx.jnilib" ) ;
assertThat ( Environment . getSharedLibraryFileName ( "rocksdb" ) ) .
isEqualTo ( "librocksdbjni.dylib" ) ;
}
@ -59,7 +61,9 @@ public class EnvironmentTest {
assertThat ( Environment . isWindows ( ) ) . isFalse ( ) ;
assertThat ( Environment . getJniLibraryExtension ( ) ) . isEqualTo ( ".jnilib" ) ;
assertThat ( Environment . getJniLibraryFileName ( "rocksdb" ) )
. isEqualTo ( "librocksdbjni-osx-aarch64.jnilib" ) ;
. isEqualTo ( "librocksdbjni-osx-arm64.jnilib" ) ;
assertThat ( Environment . getFallbackJniLibraryFileName ( "rocksdb" ) )
. isEqualTo ( "librocksdbjni-osx.jnilib" ) ;
assertThat ( Environment . getSharedLibraryFileName ( "rocksdb" ) ) . isEqualTo ( "librocksdbjni.dylib" ) ;
}
@ -73,6 +77,7 @@ public class EnvironmentTest {
isEqualTo ( ".so" ) ;
assertThat ( Environment . getJniLibraryFileName ( "rocksdb" ) ) .
isEqualTo ( "librocksdbjni-linux32.so" ) ;
assertThat ( Environment . getFallbackJniLibraryFileName ( "rocksdb" ) ) . isNull ( ) ;
assertThat ( Environment . getSharedLibraryFileName ( "rocksdb" ) ) .
isEqualTo ( "librocksdbjni.so" ) ;
// Linux musl-libc (Alpine)
@ -103,7 +108,8 @@ public class EnvironmentTest {
assertThat ( Environment . isWindows ( ) ) . isFalse ( ) ;
assertThat ( Environment . getJniLibraryExtension ( ) ) .
isEqualTo ( ".so" ) ;
Environment . getJniLibraryFileName ( "rocksdb" ) ;
assertThat ( Environment . getJniLibraryFileName ( "rocksdb" ) ) . isEqualTo ( "blah" ) ;
assertThat ( Environment . getFallbackJniLibraryFileName ( "rocksdb" ) ) . isNull ( ) ;
}
@Test
@ -115,6 +121,7 @@ public class EnvironmentTest {
isEqualTo ( ".so" ) ;
assertThat ( Environment . getJniLibraryFileName ( "rocksdb" ) ) .
isEqualTo ( "librocksdbjni-linux64.so" ) ;
assertThat ( Environment . getFallbackJniLibraryFileName ( "rocksdb" ) ) . isNull ( ) ;
assertThat ( Environment . getSharedLibraryFileName ( "rocksdb" ) ) .
isEqualTo ( "librocksdbjni.so" ) ;
// Linux musl-libc (Alpine)
@ -124,6 +131,7 @@ public class EnvironmentTest {
isEqualTo ( ".so" ) ;
assertThat ( Environment . getJniLibraryFileName ( "rocksdb" ) ) .
isEqualTo ( "librocksdbjni-linux64-musl.so" ) ;
assertThat ( Environment . getFallbackJniLibraryFileName ( "rocksdb" ) ) . isNull ( ) ;
assertThat ( Environment . getSharedLibraryFileName ( "rocksdb" ) ) .
isEqualTo ( "librocksdbjni.so" ) ;
// UNIX
@ -134,6 +142,7 @@ public class EnvironmentTest {
isEqualTo ( ".so" ) ;
assertThat ( Environment . getJniLibraryFileName ( "rocksdb" ) ) .
isEqualTo ( "librocksdbjni-linux64.so" ) ;
assertThat ( Environment . getFallbackJniLibraryFileName ( "rocksdb" ) ) . isNull ( ) ;
assertThat ( Environment . getSharedLibraryFileName ( "rocksdb" ) ) .
isEqualTo ( "librocksdbjni.so" ) ;
// AIX
@ -143,6 +152,7 @@ public class EnvironmentTest {
isEqualTo ( ".so" ) ;
assertThat ( Environment . getJniLibraryFileName ( "rocksdb" ) ) .
isEqualTo ( "librocksdbjni-aix64.so" ) ;
assertThat ( Environment . getFallbackJniLibraryFileName ( "rocksdb" ) ) . isNull ( ) ;
assertThat ( Environment . getSharedLibraryFileName ( "rocksdb" ) ) .
isEqualTo ( "librocksdbjni.so" ) ;
}
@ -161,6 +171,7 @@ public class EnvironmentTest {
isEqualTo ( ".dll" ) ;
assertThat ( Environment . getJniLibraryFileName ( "rocksdb" ) ) .
isEqualTo ( "librocksdbjni-win64.dll" ) ;
assertThat ( Environment . getFallbackJniLibraryFileName ( "rocksdb" ) ) . isNull ( ) ;
assertThat ( Environment . getSharedLibraryFileName ( "rocksdb" ) ) .
isEqualTo ( "librocksdbjni.dll" ) ;
}
@ -177,6 +188,7 @@ public class EnvironmentTest {
assertThat ( Environment . getJniLibraryName ( "rocksdb" ) ) . isEqualTo ( "rocksdbjni-linux-ppc64le" ) ;
assertThat ( Environment . getJniLibraryFileName ( "rocksdb" ) )
. isEqualTo ( "librocksdbjni-linux-ppc64le.so" ) ;
assertThat ( Environment . getFallbackJniLibraryFileName ( "rocksdb" ) ) . isNull ( ) ;
assertThat ( Environment . getSharedLibraryFileName ( "rocksdb" ) ) . isEqualTo ( "librocksdbjni.so" ) ;
// Linux musl-libc (Alpine)
setEnvironmentClassField ( MUSL_LIBC_FIELD_NAME , true ) ;
@ -189,6 +201,7 @@ public class EnvironmentTest {
assertThat ( Environment . getJniLibraryName ( "rocksdb" ) ) . isEqualTo ( "rocksdbjni-linux-ppc64le-musl" ) ;
assertThat ( Environment . getJniLibraryFileName ( "rocksdb" ) )
. isEqualTo ( "librocksdbjni-linux-ppc64le-musl.so" ) ;
assertThat ( Environment . getFallbackJniLibraryFileName ( "rocksdb" ) ) . isNull ( ) ;
assertThat ( Environment . getSharedLibraryFileName ( "rocksdb" ) ) . isEqualTo ( "librocksdbjni.so" ) ;
setEnvironmentClassField ( MUSL_LIBC_FIELD_NAME , false ) ;
}
@ -205,6 +218,7 @@ public class EnvironmentTest {
assertThat ( Environment . getJniLibraryName ( "rocksdb" ) ) . isEqualTo ( "rocksdbjni-linux-aarch64" ) ;
assertThat ( Environment . getJniLibraryFileName ( "rocksdb" ) )
. isEqualTo ( "librocksdbjni-linux-aarch64.so" ) ;
assertThat ( Environment . getFallbackJniLibraryFileName ( "rocksdb" ) ) . isNull ( ) ;
assertThat ( Environment . getSharedLibraryFileName ( "rocksdb" ) ) . isEqualTo ( "librocksdbjni.so" ) ;
// Linux musl-libc (Alpine)
setEnvironmentClassField ( MUSL_LIBC_FIELD_NAME , true ) ;
@ -217,6 +231,7 @@ public class EnvironmentTest {
assertThat ( Environment . getJniLibraryName ( "rocksdb" ) ) . isEqualTo ( "rocksdbjni-linux-aarch64-musl" ) ;
assertThat ( Environment . getJniLibraryFileName ( "rocksdb" ) )
. isEqualTo ( "librocksdbjni-linux-aarch64-musl.so" ) ;
assertThat ( Environment . getFallbackJniLibraryFileName ( "rocksdb" ) ) . isNull ( ) ;
assertThat ( Environment . getSharedLibraryFileName ( "rocksdb" ) ) . isEqualTo ( "librocksdbjni.so" ) ;
setEnvironmentClassField ( MUSL_LIBC_FIELD_NAME , false ) ;
}