Merge "Create an independent directory to place jar libraries"

This commit is contained in:
Zuul 2019-09-25 04:57:05 +00:00 committed by Gerrit Code Review
commit 1ec8a7bc9c
7 changed files with 30 additions and 23 deletions
install_libs.sh
src/java
storlets/agent/daemon_factory
tests/unit/agent/daemon_factory

@ -4,6 +4,7 @@
#
# NOTE: The libraries are currently installed under /usr/lib/storlets
# so you may need root privilege to execute this script
set -x
# build scripts
cd scripts

@ -15,7 +15,7 @@
-->
<project>
<property name="jarname" value="SBusJavaFacade.jar"/>
<property name="libdir" value="/usr/local/lib/storlets"/>
<property name="libdir" value="/usr/local/lib/storlets/java"/>
<target name="clean">
<delete dir="bin" />

@ -18,7 +18,7 @@
<project>
<property name="jarname" value="SCommon.jar"/>
<property environment="env"/>
<property name="libdir" value="/usr/local/lib/storlets"/>
<property name="libdir" value="/usr/local/lib/storlets/java"/>
<target name="clean">
<delete dir="bin" />

@ -16,7 +16,7 @@
<project>
<property name="jarname" value="SDaemon.jar"/>
<property name="libdir" value="/usr/local/lib/storlets"/>
<property name="libdir" value="/usr/local/lib/storlets/java"/>
<target name="clean">
<delete dir="bin" />

@ -37,7 +37,7 @@
</target>
<!-- Install build Dependencies-->
<target name="install_dependencies" depends="dependencies">
<copy todir="/usr/local/lib/storlets">
<copy todir="/usr/local/lib/storlets/java">
<fileset dir="dependencies" />
</copy>
</target>

@ -69,7 +69,8 @@ class StorletDaemonFactory(SBusServer):
:returns: (A list of the JVM arguments, A list of environ parameters)
"""
str_prfx = "/usr/local/lib/storlets"
lib_dir = "/usr/local/lib/storlets"
java_lib_dir = os.path.join(lib_dir, "java")
jar_deps = ['logback-classic-1.1.2.jar',
'logback-core-1.1.2.jar',
@ -79,9 +80,9 @@ class StorletDaemonFactory(SBusServer):
'SCommon.jar',
'SDaemon.jar',
'']
jar_deps = [os.path.join(str_prfx, x) for x in jar_deps]
str_dmn_clspth = ':'.join(jar_deps) + ':' + storlet_path
str_library_path = str_prfx
jar_deps = [os.path.join(java_lib_dir, x) for x in jar_deps]
str_dmn_clspth = ':'.join(jar_deps + [storlet_path])
str_library_path = ':'.join([lib_dir, java_lib_dir])
str_daemon_main_class = "org.openstack.storlet.daemon.SDaemon"

@ -65,22 +65,27 @@ class TestStorletDaemonFactory(unittest.TestCase):
'Storlet-1.0.jar', 'path/to/uds/a', 'DEBUG', '1',
self.container_id],
pargs)
self.assertIn('CLASSPATH', env)
self.assertEqual(
{'CLASSPATH':
'/default/classpath:'
'/usr/local/lib/storlets/logback-classic-1.1.2.jar:'
'/usr/local/lib/storlets/logback-core-1.1.2.jar:'
'/usr/local/lib/storlets/slf4j-api-1.7.7.jar:'
'/usr/local/lib/storlets/json_simple-1.1.jar:'
'/usr/local/lib/storlets/SBusJavaFacade.jar:'
'/usr/local/lib/storlets/SCommon.jar:'
'/usr/local/lib/storlets/SDaemon.jar:'
'/usr/local/lib/storlets/:'
'path/to/storlet/a',
'LD_LIBRARY_PATH':
'/default/ld/library/path:'
'/usr/local/lib/storlets'},
env)
['/default/classpath',
'/usr/local/lib/storlets/java/logback-classic-1.1.2.jar',
'/usr/local/lib/storlets/java/logback-core-1.1.2.jar',
'/usr/local/lib/storlets/java/slf4j-api-1.7.7.jar',
'/usr/local/lib/storlets/java/json_simple-1.1.jar',
'/usr/local/lib/storlets/java/SBusJavaFacade.jar',
'/usr/local/lib/storlets/java/SCommon.jar',
'/usr/local/lib/storlets/java/SDaemon.jar',
'/usr/local/lib/storlets/java/',
'path/to/storlet/a'],
env['CLASSPATH'].split(':'))
self.assertIn('LD_LIBRARY_PATH', env)
self.assertEqual(
['/default/ld/library/path',
'/usr/local/lib/storlets',
'/usr/local/lib/storlets/java'],
env['LD_LIBRARY_PATH'].split(':'))
def test_get_python_args(self):
self._test_get_python_args(DEFAULT_PY2, DEFAULT_PY2)