diff --git a/.functests b/.functests index 64c1220d..63c0c9d2 100755 --- a/.functests +++ b/.functests @@ -14,6 +14,8 @@ if [ "$FLAVOR" != "jenkins" ] && [ "$FLAVOR" != "dev" ]; then fi shift +ant build_storlets + SRC_DIR=$(python -c "import os; print os.path.dirname(os.path.realpath('$0'))") cd ${SRC_DIR}/tests/functional if [ "$FLAVOR" == "jenkins" ]; then diff --git a/.gitignore b/.gitignore index 4cd8d69e..deb0910e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ *.py[cod] # C extensions +*.o *.so # Packages @@ -35,11 +36,16 @@ install/swift/hosts Engine/SMScripts/bin/ # auto created on build -Engine/dependencies/ -Engine/SBus/SBusJavaFacade/org_openstack_storlet_sbus_SBusJNI.h +src/java/dependencies/ +src/java/SBus/org_openstack_storlet_sbus_SBusJNI.h # Storlets build -bin +*.class +*.jar +StorletSamples/java/*/bin + +# scripts build +scripts/restart_docker_container # Unit test / coverage reports .coverage diff --git a/Engine/SBus/SBusJavaFacade/.gitignore b/Engine/SBus/SBusJavaFacade/.gitignore deleted file mode 100644 index cc71ef62..00000000 --- a/Engine/SBus/SBusJavaFacade/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -/bin/* -/org_openstack_storlet_sbus_SBusJNI.h -/bin/ diff --git a/Engine/SBus/SBusPythonFacade/.gitignore b/Engine/SBus/SBusPythonFacade/.gitignore deleted file mode 100644 index 77e4dbf9..00000000 --- a/Engine/SBus/SBusPythonFacade/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -build -dist -*.egg-info -*.pyc diff --git a/Engine/SBus/SBusPythonFacade/build.xml b/Engine/SBus/SBusPythonFacade/build.xml deleted file mode 100644 index 1b283929..00000000 --- a/Engine/SBus/SBusPythonFacade/build.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/Engine/SBus/SBusPythonFacade/setup.py b/Engine/SBus/SBusPythonFacade/setup.py deleted file mode 100755 index f77621c3..00000000 --- a/Engine/SBus/SBusPythonFacade/setup.py +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/python -'''------------------------------------------------------------------------- -Copyright IBM Corp. 2015, 2015 All Rights Reserved -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -Limitations under the License. --------------------------------------------------------------------------''' -from setuptools import setup, find_packages - -setup(name='sbus', - version='1.0', - packages=find_packages()) diff --git a/Engine/SBus/SBusTransportLayer/.gitignore b/Engine/SBus/SBusTransportLayer/.gitignore deleted file mode 100644 index 5b450d48..00000000 --- a/Engine/SBus/SBusTransportLayer/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/bin/* diff --git a/Engine/SBus/SBusTransportLayer/build.xml b/Engine/SBus/SBusTransportLayer/build.xml deleted file mode 100644 index 20e7b8a6..00000000 --- a/Engine/SBus/SBusTransportLayer/build.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Engine/SCommon/.gitignore b/Engine/SCommon/.gitignore deleted file mode 100644 index fe99505d..00000000 --- a/Engine/SCommon/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -bin - diff --git a/Engine/SDaemon/.gitignore b/Engine/SDaemon/.gitignore deleted file mode 100644 index fe99505d..00000000 --- a/Engine/SDaemon/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -bin - diff --git a/Engine/SMScripts/build.xml b/Engine/SMScripts/build.xml deleted file mode 100644 index 1feba354..00000000 --- a/Engine/SMScripts/build.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Engine/agent/.gitignore b/Engine/agent/.gitignore deleted file mode 100644 index 674f765e..00000000 --- a/Engine/agent/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -*.pyc -build -dist -*.egg-info diff --git a/Engine/agent/build.xml b/Engine/agent/build.xml deleted file mode 100644 index ca77fb37..00000000 --- a/Engine/agent/build.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/Engine/agent/setup.py b/Engine/agent/setup.py deleted file mode 100644 index 640e64e1..00000000 --- a/Engine/agent/setup.py +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/python -'''------------------------------------------------------------------------- -Copyright IBM Corp. 2015, 2015 All Rights Reserved -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -Limitations under the License. --------------------------------------------------------------------------''' -from setuptools import setup, find_packages - -setup(name='storlets_agent', - version='1.0', - packages=find_packages(), - scripts=['bin/storlets-daemon-factory', 'bin/storlets-daemon'] - ) diff --git a/Engine/swift/build.xml b/Engine/swift/build.xml deleted file mode 100644 index ac659192..00000000 --- a/Engine/swift/build.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/Engine/swift/setup.py b/Engine/swift/setup.py deleted file mode 100644 index 63b0df92..00000000 --- a/Engine/swift/setup.py +++ /dev/null @@ -1,30 +0,0 @@ -"""------------------------------------------------------------------------- -Copyright IBM Corp. 2015, 2015 All Rights Reserved -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -Limitations under the License. --------------------------------------------------------------------------""" -from setuptools import setup, find_packages - - -paste_factory = ['storlet_handler = ' - 'storlet_middleware.storlet_handler:filter_factory'] -gateways = [ - 'stub = storlet_gateway.gateways.stub:StorletGatewayStub', - 'docker = storlet_gateway.gateways.docker:StorletGatewayDocker'] - - -setup(name='storlets', - version='1.0', - packages=find_packages(), - entry_points={'paste.filter_factory': paste_factory, - 'storlets.gateways': gateways} - ) diff --git a/StorletSamples/java/CompressStorlet/build.xml b/StorletSamples/java/CompressStorlet/build.xml index 99537e7f..a8ea72e8 100644 --- a/StorletSamples/java/CompressStorlet/build.xml +++ b/StorletSamples/java/CompressStorlet/build.xml @@ -20,7 +20,7 @@ diff --git a/StorletSamples/java/CsvStorlet/build.xml b/StorletSamples/java/CsvStorlet/build.xml index 076ebd18..dc84df97 100644 --- a/StorletSamples/java/CsvStorlet/build.xml +++ b/StorletSamples/java/CsvStorlet/build.xml @@ -22,7 +22,7 @@ diff --git a/StorletSamples/java/ExecDepStorlet/build.xml b/StorletSamples/java/ExecDepStorlet/build.xml index ab29215e..005116cb 100644 --- a/StorletSamples/java/ExecDepStorlet/build.xml +++ b/StorletSamples/java/ExecDepStorlet/build.xml @@ -20,7 +20,7 @@ diff --git a/StorletSamples/java/HalfStorlet/build.xml b/StorletSamples/java/HalfStorlet/build.xml index 45c9a8b1..49c31f4c 100644 --- a/StorletSamples/java/HalfStorlet/build.xml +++ b/StorletSamples/java/HalfStorlet/build.xml @@ -20,7 +20,7 @@ diff --git a/StorletSamples/java/IdentityStorlet/build.xml b/StorletSamples/java/IdentityStorlet/build.xml index 7da1bd3e..bbcaa9ce 100644 --- a/StorletSamples/java/IdentityStorlet/build.xml +++ b/StorletSamples/java/IdentityStorlet/build.xml @@ -21,7 +21,7 @@ diff --git a/StorletSamples/java/MultiInputStorlet/build.xml b/StorletSamples/java/MultiInputStorlet/build.xml index aa80a6eb..b45b8331 100644 --- a/StorletSamples/java/MultiInputStorlet/build.xml +++ b/StorletSamples/java/MultiInputStorlet/build.xml @@ -24,7 +24,7 @@ diff --git a/StorletSamples/java/PartitionsIdentityStorlet/build.xml b/StorletSamples/java/PartitionsIdentityStorlet/build.xml index efbbadcd..7d882cd8 100644 --- a/StorletSamples/java/PartitionsIdentityStorlet/build.xml +++ b/StorletSamples/java/PartitionsIdentityStorlet/build.xml @@ -23,7 +23,7 @@ diff --git a/StorletSamples/java/TestMetadataStorlet/build.xml b/StorletSamples/java/TestMetadataStorlet/build.xml index 373f4ede..13618002 100644 --- a/StorletSamples/java/TestMetadataStorlet/build.xml +++ b/StorletSamples/java/TestMetadataStorlet/build.xml @@ -21,7 +21,7 @@ + path="../../../src/java/SCommon/bin/SCommon.jar"/> + path="../../../src/java/SCommon/bin/SCommon.jar"/> - + diff --git a/Engine/agent/bin/storlets-daemon b/bin/storlets-daemon similarity index 66% rename from Engine/agent/bin/storlets-daemon rename to bin/storlets-daemon index b9c62147..74a66074 100755 --- a/Engine/agent/bin/storlets-daemon +++ b/bin/storlets-daemon @@ -1,6 +1,6 @@ #!/usr/bin/env python import sys -from storlet_daemon.daemon import main +from storlets.agent.daemon.manager import main if __name__ == "__main__": diff --git a/Engine/agent/bin/storlets-daemon-factory b/bin/storlets-daemon-factory similarity index 63% rename from Engine/agent/bin/storlets-daemon-factory rename to bin/storlets-daemon-factory index 0068eefc..c9e7c3af 100755 --- a/Engine/agent/bin/storlets-daemon-factory +++ b/bin/storlets-daemon-factory @@ -1,6 +1,6 @@ #!/usr/bin/env python import sys -from storlet_daemon_factory.daemon_factory import main +from storlets.agent.daemon_factory.manager import main if __name__ == "__main__": diff --git a/build.xml b/build.xml index 7d4d3a97..523856db 100644 --- a/build.xml +++ b/build.xml @@ -17,11 +17,20 @@ - + - + + + + + + + + + + @@ -35,9 +44,11 @@ - - - + + + + + + + @@ -22,9 +24,9 @@ @@ -39,8 +41,8 @@ - - + + @@ -56,4 +58,14 @@ + + + + + + + + + + diff --git a/Engine/SBus/SBusJavaFacade/src/org/openstack/storlet/sbus/SBus.java b/src/java/SBus/src/main/org/openstack/storlet/sbus/SBus.java similarity index 100% rename from Engine/SBus/SBusJavaFacade/src/org/openstack/storlet/sbus/SBus.java rename to src/java/SBus/src/main/org/openstack/storlet/sbus/SBus.java diff --git a/Engine/SBus/SBusJavaFacade/src/org/openstack/storlet/sbus/SBusBackend.java b/src/java/SBus/src/main/org/openstack/storlet/sbus/SBusBackend.java similarity index 100% rename from Engine/SBus/SBusJavaFacade/src/org/openstack/storlet/sbus/SBusBackend.java rename to src/java/SBus/src/main/org/openstack/storlet/sbus/SBusBackend.java diff --git a/Engine/SBus/SBusJavaFacade/src/org/openstack/storlet/sbus/SBusHandler.java b/src/java/SBus/src/main/org/openstack/storlet/sbus/SBusHandler.java similarity index 100% rename from Engine/SBus/SBusJavaFacade/src/org/openstack/storlet/sbus/SBusHandler.java rename to src/java/SBus/src/main/org/openstack/storlet/sbus/SBusHandler.java diff --git a/Engine/SBus/SBusJavaFacade/src/org/openstack/storlet/sbus/SBusJNI.java b/src/java/SBus/src/main/org/openstack/storlet/sbus/SBusJNI.java similarity index 100% rename from Engine/SBus/SBusJavaFacade/src/org/openstack/storlet/sbus/SBusJNI.java rename to src/java/SBus/src/main/org/openstack/storlet/sbus/SBusJNI.java diff --git a/Engine/SBus/SBusJavaFacade/src/org/openstack/storlet/sbus/SBusRawMessage.java b/src/java/SBus/src/main/org/openstack/storlet/sbus/SBusRawMessage.java similarity index 100% rename from Engine/SBus/SBusJavaFacade/src/org/openstack/storlet/sbus/SBusRawMessage.java rename to src/java/SBus/src/main/org/openstack/storlet/sbus/SBusRawMessage.java diff --git a/Engine/SBus/SBusJavaFacade/src/org/openstack/storlet/sbus/ServerSBusInDatagram.java b/src/java/SBus/src/main/org/openstack/storlet/sbus/ServerSBusInDatagram.java similarity index 100% rename from Engine/SBus/SBusJavaFacade/src/org/openstack/storlet/sbus/ServerSBusInDatagram.java rename to src/java/SBus/src/main/org/openstack/storlet/sbus/ServerSBusInDatagram.java diff --git a/Engine/SBus/SBusJavaFacade/src/org/openstack/storlet/sbus/ServerSBusOutDatagram.java b/src/java/SBus/src/main/org/openstack/storlet/sbus/ServerSBusOutDatagram.java similarity index 100% rename from Engine/SBus/SBusJavaFacade/src/org/openstack/storlet/sbus/ServerSBusOutDatagram.java rename to src/java/SBus/src/main/org/openstack/storlet/sbus/ServerSBusOutDatagram.java diff --git a/Engine/SCommon/build.xml b/src/java/SCommon/build.xml similarity index 69% rename from Engine/SCommon/build.xml rename to src/java/SCommon/build.xml index 87b3c11a..613e45dc 100644 --- a/Engine/SCommon/build.xml +++ b/src/java/SCommon/build.xml @@ -14,6 +14,9 @@ --> + + + @@ -21,9 +24,9 @@ - + - + @@ -34,12 +37,12 @@ - + - + - @@ -53,4 +56,13 @@ + + + + + + + + + diff --git a/Engine/SCommon/src/org/openstack/storlet/common/IStorlet.java b/src/java/SCommon/src/main/org/openstack/storlet/common/IStorlet.java similarity index 100% rename from Engine/SCommon/src/org/openstack/storlet/common/IStorlet.java rename to src/java/SCommon/src/main/org/openstack/storlet/common/IStorlet.java diff --git a/Engine/SCommon/src/org/openstack/storlet/common/ObjectRequestEntry.java b/src/java/SCommon/src/main/org/openstack/storlet/common/ObjectRequestEntry.java similarity index 100% rename from Engine/SCommon/src/org/openstack/storlet/common/ObjectRequestEntry.java rename to src/java/SCommon/src/main/org/openstack/storlet/common/ObjectRequestEntry.java diff --git a/Engine/SCommon/src/org/openstack/storlet/common/ObjectRequestsTable.java b/src/java/SCommon/src/main/org/openstack/storlet/common/ObjectRequestsTable.java similarity index 100% rename from Engine/SCommon/src/org/openstack/storlet/common/ObjectRequestsTable.java rename to src/java/SCommon/src/main/org/openstack/storlet/common/ObjectRequestsTable.java diff --git a/Engine/SCommon/src/org/openstack/storlet/common/RangeFileInputStream.java b/src/java/SCommon/src/main/org/openstack/storlet/common/RangeFileInputStream.java similarity index 100% rename from Engine/SCommon/src/org/openstack/storlet/common/RangeFileInputStream.java rename to src/java/SCommon/src/main/org/openstack/storlet/common/RangeFileInputStream.java diff --git a/Engine/SCommon/src/org/openstack/storlet/common/RangeStorletInputStream.java b/src/java/SCommon/src/main/org/openstack/storlet/common/RangeStorletInputStream.java similarity index 100% rename from Engine/SCommon/src/org/openstack/storlet/common/RangeStorletInputStream.java rename to src/java/SCommon/src/main/org/openstack/storlet/common/RangeStorletInputStream.java diff --git a/Engine/SCommon/src/org/openstack/storlet/common/StorletContainerHandle.java b/src/java/SCommon/src/main/org/openstack/storlet/common/StorletContainerHandle.java similarity index 100% rename from Engine/SCommon/src/org/openstack/storlet/common/StorletContainerHandle.java rename to src/java/SCommon/src/main/org/openstack/storlet/common/StorletContainerHandle.java diff --git a/Engine/SCommon/src/org/openstack/storlet/common/StorletException.java b/src/java/SCommon/src/main/org/openstack/storlet/common/StorletException.java similarity index 100% rename from Engine/SCommon/src/org/openstack/storlet/common/StorletException.java rename to src/java/SCommon/src/main/org/openstack/storlet/common/StorletException.java diff --git a/Engine/SCommon/src/org/openstack/storlet/common/StorletInputStream.java b/src/java/SCommon/src/main/org/openstack/storlet/common/StorletInputStream.java similarity index 100% rename from Engine/SCommon/src/org/openstack/storlet/common/StorletInputStream.java rename to src/java/SCommon/src/main/org/openstack/storlet/common/StorletInputStream.java diff --git a/Engine/SCommon/src/org/openstack/storlet/common/StorletLogger.java b/src/java/SCommon/src/main/org/openstack/storlet/common/StorletLogger.java similarity index 100% rename from Engine/SCommon/src/org/openstack/storlet/common/StorletLogger.java rename to src/java/SCommon/src/main/org/openstack/storlet/common/StorletLogger.java diff --git a/Engine/SCommon/src/org/openstack/storlet/common/StorletObjectOutputStream.java b/src/java/SCommon/src/main/org/openstack/storlet/common/StorletObjectOutputStream.java similarity index 100% rename from Engine/SCommon/src/org/openstack/storlet/common/StorletObjectOutputStream.java rename to src/java/SCommon/src/main/org/openstack/storlet/common/StorletObjectOutputStream.java diff --git a/Engine/SCommon/src/org/openstack/storlet/common/StorletOutputStream.java b/src/java/SCommon/src/main/org/openstack/storlet/common/StorletOutputStream.java similarity index 100% rename from Engine/SCommon/src/org/openstack/storlet/common/StorletOutputStream.java rename to src/java/SCommon/src/main/org/openstack/storlet/common/StorletOutputStream.java diff --git a/Engine/SCommon/src/org/openstack/storlet/common/StorletUtils.java b/src/java/SCommon/src/main/org/openstack/storlet/common/StorletUtils.java similarity index 100% rename from Engine/SCommon/src/org/openstack/storlet/common/StorletUtils.java rename to src/java/SCommon/src/main/org/openstack/storlet/common/StorletUtils.java diff --git a/Engine/SCommon/test/TestRangedFile.java b/src/java/SCommon/test/TestRangedFile.java similarity index 100% rename from Engine/SCommon/test/TestRangedFile.java rename to src/java/SCommon/test/TestRangedFile.java diff --git a/Engine/SDaemon/build.xml b/src/java/SDaemon/build.xml similarity index 76% rename from Engine/SDaemon/build.xml rename to src/java/SDaemon/build.xml index 129394b4..49976ebd 100644 --- a/Engine/SDaemon/build.xml +++ b/src/java/SDaemon/build.xml @@ -14,16 +14,19 @@ --> + + + - + + path="../SBus/bin/SBusJavaFacade.jar"/> - - + + + + + + + + + diff --git a/Engine/SDaemon/src/org/openstack/storlet/daemon/SAbstractTask.java b/src/java/SDaemon/src/main/org/openstack/storlet/daemon/SAbstractTask.java similarity index 100% rename from Engine/SDaemon/src/org/openstack/storlet/daemon/SAbstractTask.java rename to src/java/SDaemon/src/main/org/openstack/storlet/daemon/SAbstractTask.java diff --git a/Engine/SDaemon/src/org/openstack/storlet/daemon/SCancelTask.java b/src/java/SDaemon/src/main/org/openstack/storlet/daemon/SCancelTask.java similarity index 100% rename from Engine/SDaemon/src/org/openstack/storlet/daemon/SCancelTask.java rename to src/java/SDaemon/src/main/org/openstack/storlet/daemon/SCancelTask.java diff --git a/Engine/SDaemon/src/org/openstack/storlet/daemon/SDaemon.java b/src/java/SDaemon/src/main/org/openstack/storlet/daemon/SDaemon.java similarity index 100% rename from Engine/SDaemon/src/org/openstack/storlet/daemon/SDaemon.java rename to src/java/SDaemon/src/main/org/openstack/storlet/daemon/SDaemon.java diff --git a/Engine/SDaemon/src/org/openstack/storlet/daemon/SDescriptorTask.java b/src/java/SDaemon/src/main/org/openstack/storlet/daemon/SDescriptorTask.java similarity index 100% rename from Engine/SDaemon/src/org/openstack/storlet/daemon/SDescriptorTask.java rename to src/java/SDaemon/src/main/org/openstack/storlet/daemon/SDescriptorTask.java diff --git a/Engine/SDaemon/src/org/openstack/storlet/daemon/SExecutionTask.java b/src/java/SDaemon/src/main/org/openstack/storlet/daemon/SExecutionTask.java similarity index 100% rename from Engine/SDaemon/src/org/openstack/storlet/daemon/SExecutionTask.java rename to src/java/SDaemon/src/main/org/openstack/storlet/daemon/SExecutionTask.java diff --git a/Engine/SDaemon/src/org/openstack/storlet/daemon/SHaltTask.java b/src/java/SDaemon/src/main/org/openstack/storlet/daemon/SHaltTask.java similarity index 100% rename from Engine/SDaemon/src/org/openstack/storlet/daemon/SHaltTask.java rename to src/java/SDaemon/src/main/org/openstack/storlet/daemon/SHaltTask.java diff --git a/Engine/SDaemon/src/org/openstack/storlet/daemon/SPingTask.java b/src/java/SDaemon/src/main/org/openstack/storlet/daemon/SPingTask.java similarity index 100% rename from Engine/SDaemon/src/org/openstack/storlet/daemon/SPingTask.java rename to src/java/SDaemon/src/main/org/openstack/storlet/daemon/SPingTask.java diff --git a/Engine/SDaemon/src/org/openstack/storlet/daemon/STaskFactory.java b/src/java/SDaemon/src/main/org/openstack/storlet/daemon/STaskFactory.java similarity index 100% rename from Engine/SDaemon/src/org/openstack/storlet/daemon/STaskFactory.java rename to src/java/SDaemon/src/main/org/openstack/storlet/daemon/STaskFactory.java diff --git a/Engine/build.xml b/src/java/build.xml similarity index 76% rename from Engine/build.xml rename to src/java/build.xml index 38bef860..74e845b8 100644 --- a/Engine/build.xml +++ b/src/java/build.xml @@ -33,24 +33,17 @@ dest="dependencies/slf4j-api-1.7.7.jar" verbose="true" usetimestamp="true"/> - - - - - - + - - - @@ -59,6 +52,12 @@ - + + + + + + + diff --git a/storlet_daemon b/storlet_daemon deleted file mode 120000 index da424f7a..00000000 --- a/storlet_daemon +++ /dev/null @@ -1 +0,0 @@ -Engine/agent/storlet_daemon \ No newline at end of file diff --git a/storlet_daemon_factory b/storlet_daemon_factory deleted file mode 120000 index 0f569bd6..00000000 --- a/storlet_daemon_factory +++ /dev/null @@ -1 +0,0 @@ -Engine/agent/storlet_daemon_factory \ No newline at end of file diff --git a/storlet_gateway b/storlet_gateway deleted file mode 120000 index 99fc227e..00000000 --- a/storlet_gateway +++ /dev/null @@ -1 +0,0 @@ -Engine/swift/storlet_gateway \ No newline at end of file diff --git a/storlet_middleware b/storlet_middleware deleted file mode 120000 index f5fc3b2d..00000000 --- a/storlet_middleware +++ /dev/null @@ -1 +0,0 @@ -Engine/swift/storlet_middleware \ No newline at end of file diff --git a/Engine/agent/storlet_daemon/__init__.py b/storlets/__init__.py similarity index 100% rename from Engine/agent/storlet_daemon/__init__.py rename to storlets/__init__.py diff --git a/Engine/agent/storlet_daemon_factory/__init__.py b/storlets/agent/__init__.py similarity index 100% rename from Engine/agent/storlet_daemon_factory/__init__.py rename to storlets/agent/__init__.py diff --git a/Engine/swift/storlet_gateway/__init__.py b/storlets/agent/daemon/__init__.py similarity index 100% rename from Engine/swift/storlet_gateway/__init__.py rename to storlets/agent/daemon/__init__.py diff --git a/Engine/agent/storlet_daemon/files.py b/storlets/agent/daemon/files.py similarity index 100% rename from Engine/agent/storlet_daemon/files.py rename to storlets/agent/daemon/files.py diff --git a/Engine/agent/storlet_daemon/daemon.py b/storlets/agent/daemon/manager.py similarity index 98% rename from Engine/agent/storlet_daemon/daemon.py rename to storlets/agent/daemon/manager.py index c5f411bc..56906b6e 100644 --- a/Engine/agent/storlet_daemon/daemon.py +++ b/storlets/agent/daemon/manager.py @@ -19,10 +19,10 @@ import os import pwd import sys import uuid -from sbus import SBus -from sbus.command import SBUS_CMD_PREFIX -from storlet_daemon.files import StorletInputFile, StorletRangeInputFile, \ - StorletOutputFile, StorletLogger +from storlets.sbus import SBus +from storlets.sbus.command import SBUS_CMD_PREFIX +from storlets.agent.daemon.files import StorletInputFile, \ + StorletRangeInputFile, StorletOutputFile, StorletLogger EXIT_SUCCESS = 0 diff --git a/Engine/swift/storlet_gateway/common/__init__.py b/storlets/agent/daemon_factory/__init__.py similarity index 100% rename from Engine/swift/storlet_gateway/common/__init__.py rename to storlets/agent/daemon_factory/__init__.py diff --git a/Engine/agent/storlet_daemon_factory/daemon_factory.py b/storlets/agent/daemon_factory/manager.py similarity index 99% rename from Engine/agent/storlet_daemon_factory/daemon_factory.py rename to storlets/agent/daemon_factory/manager.py index d38d1efd..8d5975c3 100644 --- a/Engine/agent/storlet_daemon_factory/daemon_factory.py +++ b/storlets/agent/daemon_factory/manager.py @@ -22,9 +22,9 @@ import signal import subprocess import time -from sbus import SBus -from sbus.datagram import SBusDatagram -from sbus.command import SBUS_CMD_PREFIX, SBUS_CMD_HALT, SBUS_CMD_PING +from storlets.sbus import SBus +from storlets.sbus.datagram import SBusDatagram +from storlets.sbus.command import SBUS_CMD_PREFIX, SBUS_CMD_HALT, SBUS_CMD_PING EXIT_SUCCESS = 0 diff --git a/Engine/swift/storlet_gateway/gateways/__init__.py b/storlets/gateway/__init__.py similarity index 100% rename from Engine/swift/storlet_gateway/gateways/__init__.py rename to storlets/gateway/__init__.py diff --git a/Engine/swift/storlet_middleware/__init__.py b/storlets/gateway/common/__init__.py similarity index 100% rename from Engine/swift/storlet_middleware/__init__.py rename to storlets/gateway/common/__init__.py diff --git a/Engine/swift/storlet_gateway/common/exceptions.py b/storlets/gateway/common/exceptions.py similarity index 100% rename from Engine/swift/storlet_gateway/common/exceptions.py rename to storlets/gateway/common/exceptions.py diff --git a/Engine/swift/storlet_gateway/common/file_manager.py b/storlets/gateway/common/file_manager.py similarity index 100% rename from Engine/swift/storlet_gateway/common/file_manager.py rename to storlets/gateway/common/file_manager.py diff --git a/Engine/swift/storlet_gateway/common/logger.py b/storlets/gateway/common/logger.py similarity index 100% rename from Engine/swift/storlet_gateway/common/logger.py rename to storlets/gateway/common/logger.py diff --git a/Engine/swift/storlet_gateway/common/stob.py b/storlets/gateway/common/stob.py similarity index 98% rename from Engine/swift/storlet_gateway/common/stob.py rename to storlets/gateway/common/stob.py index 08111f6d..d8df06be 100644 --- a/Engine/swift/storlet_gateway/common/stob.py +++ b/storlets/gateway/common/stob.py @@ -16,7 +16,7 @@ import copy import os import select -from storlet_gateway.common.exceptions import StorletTimeout +from storlets.gateway.common.exceptions import StorletTimeout class FileDescriptorIterator(object): diff --git a/tests/unit/agent/storlet_daemon/__init__.py b/storlets/gateway/gateways/__init__.py similarity index 100% rename from tests/unit/agent/storlet_daemon/__init__.py rename to storlets/gateway/gateways/__init__.py diff --git a/Engine/swift/storlet_gateway/gateways/base.py b/storlets/gateway/gateways/base.py similarity index 96% rename from Engine/swift/storlet_gateway/gateways/base.py rename to storlets/gateway/gateways/base.py index 030eb7d8..b3e7f179 100644 --- a/Engine/swift/storlet_gateway/gateways/base.py +++ b/storlets/gateway/gateways/base.py @@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and Limitations under the License. -------------------------------------------------------------------------""" -from storlet_gateway.common.stob import StorletRequest +from storlets.gateway.common.stob import StorletRequest class StorletGatewayBase(object): diff --git a/Engine/swift/storlet_gateway/gateways/docker/__init__.py b/storlets/gateway/gateways/docker/__init__.py similarity index 89% rename from Engine/swift/storlet_gateway/gateways/docker/__init__.py rename to storlets/gateway/gateways/docker/__init__.py index b1cdb82f..d62a93ad 100644 --- a/Engine/swift/storlet_gateway/gateways/docker/__init__.py +++ b/storlets/gateway/gateways/docker/__init__.py @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from storlet_gateway.gateways.docker.gateway import StorletGatewayDocker +from storlets.gateway.gateways.docker.gateway import StorletGatewayDocker __all__ = [ 'StorletGatewayDocker', diff --git a/Engine/swift/storlet_gateway/gateways/docker/gateway.py b/storlets/gateway/gateways/docker/gateway.py similarity index 98% rename from Engine/swift/storlet_gateway/gateways/docker/gateway.py rename to storlets/gateway/gateways/docker/gateway.py index 5400759b..b98a1173 100644 --- a/Engine/swift/storlet_gateway/gateways/docker/gateway.py +++ b/storlets/gateway/gateways/docker/gateway.py @@ -16,9 +16,9 @@ Limitations under the License. import os import shutil -from storlet_gateway.common.stob import StorletRequest -from storlet_gateway.gateways.base import StorletGatewayBase -from storlet_gateway.gateways.docker.runtime import RunTimePaths, \ +from storlets.gateway.common.stob import StorletRequest +from storlets.gateway.gateways.base import StorletGatewayBase +from storlets.gateway.gateways.docker.runtime import RunTimePaths, \ RunTimeSandbox, StorletInvocationProtocol diff --git a/Engine/swift/storlet_gateway/gateways/docker/runtime.py b/storlets/gateway/gateways/docker/runtime.py similarity index 95% rename from Engine/swift/storlet_gateway/gateways/docker/runtime.py rename to storlets/gateway/gateways/docker/runtime.py index baa895df..e7b5b2bd 100644 --- a/Engine/swift/storlet_gateway/gateways/docker/runtime.py +++ b/storlets/gateway/gateways/docker/runtime.py @@ -26,18 +26,14 @@ import eventlet import json from contextlib import contextmanager -from sbus import SBus -from sbus.datagram import FDMetadata, SBusDatagram -from sbus.file_description import SBUS_FD_INPUT_OBJECT, \ - SBUS_FD_LOGGER, SBUS_FD_OUTPUT_OBJECT, SBUS_FD_OUTPUT_OBJECT_METADATA, \ - SBUS_FD_OUTPUT_TASK_ID -from sbus.command import SBUS_CMD_CANCEL, \ - SBUS_CMD_DAEMON_STATUS, SBUS_CMD_EXECUTE, SBUS_CMD_PING, \ - SBUS_CMD_START_DAEMON, SBUS_CMD_STOP_DAEMON -from storlet_gateway.common.exceptions import StorletRuntimeException, \ +from storlets.sbus import SBus +from storlets.sbus.datagram import FDMetadata, SBusDatagram +from storlets.sbus import file_description as sbus_fd +from storlets.sbus import command as sbus_cmd +from storlets.gateway.common.exceptions import StorletRuntimeException, \ StorletTimeout -from storlet_gateway.common.logger import StorletLogger -from storlet_gateway.common.stob import StorletResponse +from storlets.gateway.common.logger import StorletLogger +from storlets.gateway.common.stob import StorletResponse MAX_METADATA_SIZE = 4096 @@ -267,7 +263,7 @@ class RunTimeSandbox(object): with _open_pipe() as (read_fd, write_fd): dtg = SBusDatagram.create_service_datagram( - SBUS_CMD_PING, + sbus_cmd.SBUS_CMD_PING, write_fd) rc = SBus.send(pipe_path, dtg) if (rc < 0): @@ -321,8 +317,8 @@ class RunTimeSandbox(object): storlet_mount = '%s:%s' % (self.paths.host_storlet_prefix(), self.paths.sandbox_storlet_dir_prefix) - cmd = [self.paths.host_restart_script_dir + - '/restart_docker_container', + cmd = [os.path.join(self.paths.host_restart_script_dir, + 'restart_docker_container'), docker_container_name, docker_image_name, pipe_mount, storlet_mount] @@ -365,7 +361,7 @@ class RunTimeSandbox(object): with _open_pipe() as (read_fd, write_fd): dtg = SBusDatagram.create_service_datagram( - SBUS_CMD_START_DAEMON, + sbus_cmd.SBUS_CMD_START_DAEMON, write_fd, prms) @@ -389,7 +385,7 @@ class RunTimeSandbox(object): """ with _open_pipe() as (read_fd, write_fd): dtg = SBusDatagram.create_service_datagram( - SBUS_CMD_STOP_DAEMON, + sbus_cmd.SBUS_CMD_STOP_DAEMON, write_fd, {'storlet_name': storlet_id}) pipe_path = self.paths.host_factory_pipe() @@ -413,7 +409,7 @@ class RunTimeSandbox(object): """ with _open_pipe() as (read_fd, write_fd): dtg = SBusDatagram.create_service_datagram( - SBUS_CMD_DAEMON_STATUS, + sbus_cmd.SBUS_CMD_DAEMON_STATUS, write_fd, {'storlet_name': storlet_id}) pipe_path = self.paths.host_factory_pipe() @@ -592,22 +588,26 @@ class StorletInvocationProtocol(object): Metadata about file descriptors to be passed to container side """ input_fd_metadata = FDMetadata( - SBUS_FD_INPUT_OBJECT, + sbus_fd.SBUS_FD_INPUT_OBJECT, storage_metadata=self.srequest.user_metadata) + if self.srequest.user_metadata: + input_fd_metadata.storage_metadata.update( + self.srequest.user_metadata) if self.srequest.has_range: input_fd_metadata.storlets_metadata['start'] = \ str(self.srequest.start) input_fd_metadata.storlets_metadata['end'] = \ str(self.srequest.end) - fds_metadata = [input_fd_metadata.to_dict(), - FDMetadata(SBUS_FD_OUTPUT_TASK_ID).to_dict(), - FDMetadata(SBUS_FD_OUTPUT_OBJECT).to_dict(), - FDMetadata(SBUS_FD_OUTPUT_OBJECT_METADATA).to_dict(), - FDMetadata(SBUS_FD_LOGGER).to_dict()] + fds_metadata = [ + input_fd_metadata.to_dict(), + FDMetadata(sbus_fd.SBUS_FD_OUTPUT_TASK_ID).to_dict(), + FDMetadata(sbus_fd.SBUS_FD_OUTPUT_OBJECT).to_dict(), + FDMetadata(sbus_fd.SBUS_FD_OUTPUT_OBJECT_METADATA).to_dict(), + FDMetadata(sbus_fd.SBUS_FD_LOGGER).to_dict()] for source in self.extra_data_sources: fdmd = FDMetadata( - SBUS_FD_INPUT_OBJECT, + sbus_fd.SBUS_FD_INPUT_OBJECT, storage_metadata=source['user_metadata']) fds_metadata.append(fdmd.to_dict()) return fds_metadata @@ -683,7 +683,7 @@ class StorletInvocationProtocol(object): """ with _open_pipe() as (read_fd, write_fd): dtg = SBusDatagram.create_service_datagram( - SBUS_CMD_CANCEL, + sbus_cmd.SBUS_CMD_CANCEL, write_fd, None, self.task_id) @@ -711,7 +711,7 @@ class StorletInvocationProtocol(object): execution """ dtg = SBusDatagram( - SBUS_CMD_EXECUTE, + sbus_cmd.SBUS_CMD_EXECUTE, self.remote_fds, self.remote_fds_metadata, self.srequest.params) diff --git a/Engine/swift/storlet_gateway/gateways/stub.py b/storlets/gateway/gateways/stub.py similarity index 91% rename from Engine/swift/storlet_gateway/gateways/stub.py rename to storlets/gateway/gateways/stub.py index 79e727c0..ae8cbdb5 100644 --- a/Engine/swift/storlet_gateway/gateways/stub.py +++ b/storlets/gateway/gateways/stub.py @@ -12,8 +12,8 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and Limitations under the License. -------------------------------------------------------------------------''' -from storlet_gateway.common.stob import StorletRequest, StorletResponse -from storlet_gateway.gateways.base import StorletGatewayBase +from storlets.gateway.common.stob import StorletRequest, StorletResponse +from storlets.gateway.gateways.base import StorletGatewayBase class StorletGatewayStub(StorletGatewayBase): diff --git a/Engine/swift/storlet_gateway/loader.py b/storlets/gateway/loader.py similarity index 96% rename from Engine/swift/storlet_gateway/loader.py rename to storlets/gateway/loader.py index 2451b660..873d3f29 100644 --- a/Engine/swift/storlet_gateway/loader.py +++ b/storlets/gateway/loader.py @@ -14,7 +14,7 @@ # limitations under the License. import sys from stevedore import driver -from storlet_gateway.common.exceptions import StorletGatewayLoadError +from storlets.gateway.common.exceptions import StorletGatewayLoadError def load_gateway(gateway_name): diff --git a/Engine/SBus/SBusPythonFacade/sbus/__init__.py b/storlets/sbus/__init__.py similarity index 91% rename from Engine/SBus/SBusPythonFacade/sbus/__init__.py rename to storlets/sbus/__init__.py index 39d6c557..5d6469dc 100644 --- a/Engine/SBus/SBusPythonFacade/sbus/__init__.py +++ b/storlets/sbus/__init__.py @@ -13,23 +13,20 @@ # See the License for the specific language governing permissions and # limitations under the License. -import ctypes -from sbus.datagram import SBusDatagram - -from ctypes import c_char_p -from ctypes import c_int -from ctypes import POINTER +from ctypes import c_char_p, c_int, CDLL, POINTER +from storlets.sbus.datagram import SBusDatagram class SBus(object): - '''@summary: This class wraps low level C-API for SBus functionality - to be used with Python - ''' - SBUS_SO_NAME = '/usr/local/lib/python2.7/dist-packages/sbus.so' + """ + Wrapper class for low level C-API for SBus functionality + + """ + SBUS_SO_NAME = '/usr/local/lib/storlets/libsbus.so' def __init__(self): # load the C-library - self.sbus_back_ = ctypes.CDLL(SBus.SBUS_SO_NAME) + self.sbus_back_ = CDLL(SBus.SBUS_SO_NAME) # create SBus self.sbus_back_.sbus_create.argtypes = [c_char_p] @@ -62,7 +59,7 @@ class SBus(object): @staticmethod def start_logger(str_log_level='DEBUG', container_id=None): # load the C-library - sbus_back_ = ctypes.CDLL(SBus.SBUS_SO_NAME) + sbus_back_ = CDLL(SBus.SBUS_SO_NAME) sbus_back_.sbus_start_logger.argtypes = [c_char_p, c_char_p] sbus_back_.sbus_start_logger(str_log_level, container_id) @@ -70,7 +67,7 @@ class SBus(object): @staticmethod def stop_logger(): # load the C-library - sbus_back_ = ctypes.CDLL(SBus.SBUS_SO_NAME) + sbus_back_ = CDLL(SBus.SBUS_SO_NAME) sbus_back_.sbus_stop_logger() def create(self, sbus_name): diff --git a/Engine/SBus/SBusPythonFacade/sbus/command.py b/storlets/sbus/command.py similarity index 100% rename from Engine/SBus/SBusPythonFacade/sbus/command.py rename to storlets/sbus/command.py diff --git a/Engine/SBus/SBusPythonFacade/sbus/datagram.py b/storlets/sbus/datagram.py similarity index 99% rename from Engine/SBus/SBusPythonFacade/sbus/datagram.py rename to storlets/sbus/datagram.py index ad176447..285aa8f1 100644 --- a/Engine/SBus/SBusPythonFacade/sbus/datagram.py +++ b/storlets/sbus/datagram.py @@ -15,7 +15,7 @@ import copy import json -import sbus.file_description as sbus_fd +from storlets.sbus import file_description as sbus_fd class FDMetadata(object): diff --git a/Engine/SBus/SBusPythonFacade/sbus/file_description.py b/storlets/sbus/file_description.py similarity index 100% rename from Engine/SBus/SBusPythonFacade/sbus/file_description.py rename to storlets/sbus/file_description.py diff --git a/tests/unit/agent/storlet_daemon_factory/__init__.py b/storlets/swift_middleware/__init__.py similarity index 100% rename from tests/unit/agent/storlet_daemon_factory/__init__.py rename to storlets/swift_middleware/__init__.py diff --git a/Engine/swift/storlet_middleware/handlers/__init__.py b/storlets/swift_middleware/handlers/__init__.py similarity index 76% rename from Engine/swift/storlet_middleware/handlers/__init__.py rename to storlets/swift_middleware/handlers/__init__.py index 37b3143e..e800b02f 100644 --- a/Engine/swift/storlet_middleware/handlers/__init__.py +++ b/storlets/swift_middleware/handlers/__init__.py @@ -13,9 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -from storlet_middleware.handlers.base import StorletBaseHandler -from storlet_middleware.handlers.proxy import StorletProxyHandler -from storlet_middleware.handlers.obj import StorletObjectHandler +from storlets.swift_middleware.handlers.base import StorletBaseHandler +from storlets.swift_middleware.handlers.proxy import StorletProxyHandler +from storlets.swift_middleware.handlers.obj import StorletObjectHandler __all__ = [ diff --git a/Engine/swift/storlet_middleware/handlers/base.py b/storlets/swift_middleware/handlers/base.py similarity index 99% rename from Engine/swift/storlet_middleware/handlers/base.py rename to storlets/swift_middleware/handlers/base.py index b0e65afb..7bd758b5 100644 --- a/Engine/swift/storlet_middleware/handlers/base.py +++ b/storlets/swift_middleware/handlers/base.py @@ -18,8 +18,8 @@ from swift.common.internal_client import InternalClient from swift.common.swob import HTTPBadRequest, Response, Range from swift.common.utils import config_true_value -from storlet_gateway.common.exceptions import FileManagementError -from storlet_gateway.common.file_manager import FileManager +from storlets.gateway.common.exceptions import FileManagementError +from storlets.gateway.common.file_manager import FileManager class NotStorletRequest(Exception): diff --git a/Engine/swift/storlet_middleware/handlers/obj.py b/storlets/swift_middleware/handlers/obj.py similarity index 98% rename from Engine/swift/storlet_middleware/handlers/obj.py rename to storlets/swift_middleware/handlers/obj.py index 4c231ca8..a3f0af3d 100644 --- a/Engine/swift/storlet_middleware/handlers/obj.py +++ b/storlets/swift_middleware/handlers/obj.py @@ -16,7 +16,7 @@ from swift.common.swob import HTTPMethodNotAllowed, \ HTTPRequestedRangeNotSatisfiable, Range from swift.common.utils import public -from storlet_middleware.handlers.base import StorletBaseHandler, \ +from storlets.swift_middleware.handlers.base import StorletBaseHandler, \ NotStorletRequest diff --git a/Engine/swift/storlet_middleware/handlers/proxy.py b/storlets/swift_middleware/handlers/proxy.py similarity index 99% rename from Engine/swift/storlet_middleware/handlers/proxy.py rename to storlets/swift_middleware/handlers/proxy.py index 8c048d6d..e3ba4e3c 100644 --- a/Engine/swift/storlet_middleware/handlers/proxy.py +++ b/storlets/swift_middleware/handlers/proxy.py @@ -32,7 +32,7 @@ from swift.common.utils import config_true_value, public, FileLikeIter, \ from swift.common.middleware.acl import clean_acl from swift.common.wsgi import make_subrequest from swift.proxy.controllers.base import get_account_info -from storlet_middleware.handlers.base import StorletBaseHandler, \ +from storlets.swift_middleware.handlers.base import StorletBaseHandler, \ NotStorletRequest, NotStorletExecution diff --git a/Engine/swift/storlet_middleware/storlet_handler.py b/storlets/swift_middleware/storlet_handler.py similarity index 80% rename from Engine/swift/storlet_middleware/storlet_handler.py rename to storlets/swift_middleware/storlet_handler.py index f79fddf2..28d864b9 100644 --- a/Engine/swift/storlet_middleware/storlet_handler.py +++ b/storlets/swift_middleware/storlet_handler.py @@ -1,26 +1,28 @@ -"""------------------------------------------------------------------------- -Copyright IBM Corp. 2015, 2015 All Rights Reserved -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at -http://www.apache.org/licenses/LICENSE-2.0 -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -Limitations under the License. --------------------------------------------------------------------------""" +# Copyright (c) 2015, 2016 OpenStack Foundation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. from six.moves import configparser as ConfigParser from eventlet import Timeout from swift.common.swob import HTTPException, HTTPInternalServerError, wsgify from swift.common.utils import get_logger, register_swift_info -from storlet_gateway.common.exceptions import StorletRuntimeException, \ +from storlets.gateway.common.exceptions import StorletRuntimeException, \ StorletTimeout -from storlet_gateway.loader import load_gateway -from storlet_middleware.handlers.base import NotStorletRequest, \ +from storlets.gateway.loader import load_gateway +from storlets.swift_middleware.handlers.base import NotStorletRequest, \ get_container_names -from storlet_middleware.handlers import StorletProxyHandler, \ +from storlets.swift_middleware.handlers import StorletProxyHandler, \ StorletObjectHandler diff --git a/tests/unit/swift/storlet_gateway/__init__.py b/storlets/tools/__init__.py similarity index 100% rename from tests/unit/swift/storlet_gateway/__init__.py rename to storlets/tools/__init__.py diff --git a/tools/cluster_config_parser.py b/storlets/tools/cluster_config_parser.py similarity index 100% rename from tools/cluster_config_parser.py rename to storlets/tools/cluster_config_parser.py diff --git a/tools/deploy_storlet.py b/storlets/tools/deploy_storlet.py similarity index 94% rename from tools/deploy_storlet.py rename to storlets/tools/deploy_storlet.py index 4a3e3324..51ad2243 100644 --- a/tools/deploy_storlet.py +++ b/storlets/tools/deploy_storlet.py @@ -14,8 +14,8 @@ Limitations under the License. -------------------------------------------------------------------------''' import sys import zipfile -from cluster_config_parser import ClusterConfig -from utils import get_auth, deploy_storlet +from storlets.tools.cluster_config_parser import ClusterConfig +from storlets.tools.utils import get_auth, deploy_storlet CLS_SUFFIX = '.class' diff --git a/tools/utils.py b/storlets/tools/utils.py similarity index 100% rename from tools/utils.py rename to storlets/tools/utils.py diff --git a/tests/functional/__init__.py b/tests/functional/__init__.py index c6b96298..fa86914b 100644 --- a/tests/functional/__init__.py +++ b/tests/functional/__init__.py @@ -15,10 +15,9 @@ # limitations under the License. import unittest -from tools.cluster_config_parser import ClusterConfig -from tools.utils import get_admin_auth,\ - deploy_storlet, put_local_file from swiftclient import client as swiftclient +from storlets.tools.cluster_config_parser import ClusterConfig +from storlets.tools.utils import deploy_storlet, get_admin_auth, put_local_file CONFIG_FILE = '../../cluster_config.json' PATH_TO_STORLETS = '../../StorletSamples' diff --git a/tests/functional/java/test_deploy_storlet.py b/tests/functional/java/test_deploy_storlet.py index d3b0c575..b900301a 100644 --- a/tests/functional/java/test_deploy_storlet.py +++ b/tests/functional/java/test_deploy_storlet.py @@ -21,7 +21,7 @@ from tests.functional.java import BIN_DIR class TestExecDepStorlet(StorletBaseFunctionalTest): def setUp(self): super(TestExecDepStorlet, self).setUp() - self.deploy_storlet_path = '../../tools/deploy_storlet.py' + self.deploy_storlet_path = '../../storlets/tools/deploy_storlet.py' self.execdep_storlet_path = '%s/java/%s/%s' % (PATH_TO_STORLETS, 'ExecDepStorlet', BIN_DIR) diff --git a/tests/functional/java/test_test_storlet.py b/tests/functional/java/test_test_storlet.py index ffe5973e..2c80aa38 100644 --- a/tests/functional/java/test_test_storlet.py +++ b/tests/functional/java/test_test_storlet.py @@ -17,8 +17,8 @@ import threading from swiftclient import client as swift_client from swiftclient import ClientException from nose.plugins.attrib import attr +from storlets.tools.utils import get_member_auth from tests.functional.java import StorletJavaFunctionalTest -from tools.utils import get_member_auth class myTestThread (threading.Thread): diff --git a/tests/unit/__init__.py b/tests/unit/__init__.py index 3bca8bc2..8e2163a9 100644 --- a/tests/unit/__init__.py +++ b/tests/unit/__init__.py @@ -12,10 +12,12 @@ # implied. # See the License for the specific language governing permissions and # limitations under the License. - -from tempfile import mkdtemp -from shutil import rmtree +import sys +import traceback import functools +from collections import defaultdict +from shutil import rmtree +from tempfile import mkdtemp def with_tempdir(f): @@ -39,3 +41,36 @@ class MockSBus(object): def send(self, path, datagram): # return success code return 0 + + +class FakeLogger(object): + def __init__(self, *args, **kwargs): + self._log_lines = defaultdict(list) + + def _print_log(self, level, msg): + self._log_lines[level.lower()].append(msg) + print('%s: %s' % (level, msg)) + + def get_log_lines(self, level): + return self._log_lines[level.lower()] + + def debug(self, msg): + self._print_log('DEBUG', msg) + + def info(self, msg): + self._print_log('INFO', msg) + + def warning(self, msg): + self._print_log('WARN', msg) + + warn = warning + + def error(self, msg): + self._print_log('ERROR', msg) + + def exception(self, msg): + exc_type, exc_value, exc_traceback = sys.exc_info() + exc_msg = traceback.format_exception(exc_type, exc_value, + exc_traceback) + new_msg = '%s: %s' % (msg, exc_msg) + self._print_log('EXCEPTION', new_msg) diff --git a/tests/unit/swift/storlet_gateway/common/__init__.py b/tests/unit/agent/daemon/__init__.py similarity index 100% rename from tests/unit/swift/storlet_gateway/common/__init__.py rename to tests/unit/agent/daemon/__init__.py diff --git a/tests/unit/agent/storlet_daemon/test_files.py b/tests/unit/agent/daemon/test_files.py similarity index 98% rename from tests/unit/agent/storlet_daemon/test_files.py rename to tests/unit/agent/daemon/test_files.py index e0f3e31f..ee4ad13a 100644 --- a/tests/unit/agent/storlet_daemon/test_files.py +++ b/tests/unit/agent/daemon/test_files.py @@ -16,7 +16,7 @@ import json import os import tempfile import unittest -from storlet_daemon.files import StorletFile, StorletInputFile, \ +from storlets.agent.daemon.files import StorletFile, StorletInputFile, \ StorletRangeInputFile, StorletOutputFile diff --git a/tests/unit/swift/storlet_gateway/gateways/docker/__init__.py b/tests/unit/agent/daemon_factory/__init__.py similarity index 100% rename from tests/unit/swift/storlet_gateway/gateways/docker/__init__.py rename to tests/unit/agent/daemon_factory/__init__.py diff --git a/tests/unit/agent/storlet_daemon_factory/test_daemon_factory.py b/tests/unit/agent/daemon_factory/test_manager.py similarity index 95% rename from tests/unit/agent/storlet_daemon_factory/test_daemon_factory.py rename to tests/unit/agent/daemon_factory/test_manager.py index 919a6bac..c3c71717 100644 --- a/tests/unit/agent/storlet_daemon_factory/test_daemon_factory.py +++ b/tests/unit/agent/daemon_factory/test_manager.py @@ -19,10 +19,10 @@ import mock import unittest from six import StringIO -import sbus.command +import storlets.sbus.command as sbus_cmd -from tests.unit.swift import FakeLogger -from storlet_daemon_factory.daemon_factory import CommandResponse, \ +from tests.unit import FakeLogger +from storlets.agent.daemon_factory.manager import CommandResponse, \ CommandSuccess, CommandFailure, SDaemonError, DaemonFactory, start_logger @@ -100,7 +100,7 @@ class TestLogger(unittest.TestCase): class TestDaemonFactory(unittest.TestCase): - base_path = 'storlet_daemon_factory.daemon_factory' + base_path = 'storlets.agent.daemon_factory.manager' kill_path = base_path + '.os.kill' waitpid_path = base_path + '.os.waitpid' sbus_path = base_path + '.SBus' @@ -115,7 +115,7 @@ class TestDaemonFactory(unittest.TestCase): def test_get_jvm_args(self): dummy_env = {'CLASSPATH': '/default/classpath', 'LD_LIBRARY_PATH': '/default/ld/library/path'} - with mock.patch('storlet_daemon_factory.daemon_factory.os.environ', + with mock.patch('storlets.agent.daemon_factory.manager.os.environ', dummy_env): pargs, env = self.dfactory.get_jvm_args( 'java', 'path/to/storlet/a', 'Storlet-1.0.jar', @@ -126,22 +126,25 @@ class TestDaemonFactory(unittest.TestCase): self.container_id], pargs) self.assertEqual( - {'CLASSPATH': '/default/classpath:' - '/opt/storlets/logback-classic-1.1.2.jar:' - '/opt/storlets/logback-core-1.1.2.jar:' - '/opt/storlets/slf4j-api-1.7.7.jar:' - '/opt/storlets/json_simple-1.1.jar:' - '/opt/storlets/SBusJavaFacade.jar:' - '/opt/storlets/SCommon.jar:' - '/opt/storlets/SDaemon.jar:' - '/opt/storlets/:path/to/storlet/a', - 'LD_LIBRARY_PATH': '/default/ld/library/path:' - '/opt/storlets/'}, + {'CLASSPATH': + '/default/classpath:' + '/opt/storlets/logback-classic-1.1.2.jar:' + '/opt/storlets/logback-core-1.1.2.jar:' + '/opt/storlets/slf4j-api-1.7.7.jar:' + '/opt/storlets/json_simple-1.1.jar:' + '/opt/storlets/SBusJavaFacade.jar:' + '/opt/storlets/SCommon.jar:' + '/opt/storlets/SDaemon.jar:' + '/opt/storlets/:' + 'path/to/storlet/a', + 'LD_LIBRARY_PATH': + '/default/ld/library/path:' + '/opt/storlets/'}, env) def test_get_python_args(self): dummy_env = {'PYTHONPATH': '/default/pythonpath'} - with mock.patch('storlet_daemon_factory.daemon_factory.os.environ', + with mock.patch('storlets.agent.daemon_factory.manager.os.environ', dummy_env): pargs, env = self.dfactory.get_python_args( 'python', 'path/to/storlet', 'test_storlet.TestStorlet', @@ -697,32 +700,32 @@ class TestDaemonFactory(unittest.TestCase): self.assertEqual( self.dfactory.start_daemon, self.dfactory.get_handler( - sbus.command.SBUS_CMD_START_DAEMON)) + sbus_cmd.SBUS_CMD_START_DAEMON)) # stop daemon self.assertEqual( self.dfactory.stop_daemon, self.dfactory.get_handler( - sbus.command.SBUS_CMD_STOP_DAEMON)) + sbus_cmd.SBUS_CMD_STOP_DAEMON)) # daemon status self.assertEqual( self.dfactory.daemon_status, self.dfactory.get_handler( - sbus.command.SBUS_CMD_DAEMON_STATUS)) + sbus_cmd.SBUS_CMD_DAEMON_STATUS)) # stop daemons self.assertEqual( self.dfactory.stop_daemons, self.dfactory.get_handler( - sbus.command.SBUS_CMD_STOP_DAEMONS)) + sbus_cmd.SBUS_CMD_STOP_DAEMONS)) # halt self.assertEqual( self.dfactory.halt, self.dfactory.get_handler( - sbus.command.SBUS_CMD_HALT)) + sbus_cmd.SBUS_CMD_HALT)) # ping self.assertEqual( self.dfactory.ping, self.dfactory.get_handler( - sbus.command.SBUS_CMD_PING)) + sbus_cmd.SBUS_CMD_PING)) # invalid with self.assertRaises(ValueError): self.dfactory.get_handler('FOO') diff --git a/tools/__init__.py b/tests/unit/gateway/__init__.py similarity index 100% rename from tools/__init__.py rename to tests/unit/gateway/__init__.py diff --git a/tests/unit/gateway/common/__init__.py b/tests/unit/gateway/common/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/unit/swift/storlet_gateway/common/test_stob.py b/tests/unit/gateway/common/test_stob.py similarity index 96% rename from tests/unit/swift/storlet_gateway/common/test_stob.py rename to tests/unit/gateway/common/test_stob.py index 8c239980..e7c4c8f1 100644 --- a/tests/unit/swift/storlet_gateway/common/test_stob.py +++ b/tests/unit/gateway/common/test_stob.py @@ -18,7 +18,7 @@ import mock import os import tempfile import unittest -from storlet_gateway.common.stob import FileDescriptorIterator +from storlets.gateway.common.stob import FileDescriptorIterator class TestFileDescriptorIterator(unittest.TestCase): @@ -48,7 +48,7 @@ class TestFileDescriptorIterator(unittest.TestCase): @contextmanager def _mock_select(self): # TODO(takashi): This is needed to avoid PermissionError in UT - with mock.patch('storlet_gateway.common.stob.select.select', + with mock.patch('storlets.gateway.common.stob.select.select', self._fake_select): yield diff --git a/tests/unit/swift/storlet_gateway/gateways/__init__.py b/tests/unit/gateway/gateways/__init__.py similarity index 100% rename from tests/unit/swift/storlet_gateway/gateways/__init__.py rename to tests/unit/gateway/gateways/__init__.py diff --git a/tests/unit/gateway/gateways/docker/__init__.py b/tests/unit/gateway/gateways/docker/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/unit/swift/storlet_gateway/gateways/docker/test_gateway.py b/tests/unit/gateway/gateways/docker/test_gateway.py similarity index 97% rename from tests/unit/swift/storlet_gateway/gateways/docker/test_gateway.py rename to tests/unit/gateway/gateways/docker/test_gateway.py index e26de876..d4246828 100644 --- a/tests/unit/swift/storlet_gateway/gateways/docker/test_gateway.py +++ b/tests/unit/gateway/gateways/docker/test_gateway.py @@ -18,9 +18,9 @@ import six from six import StringIO from swift.common.swob import Request, Response from swift.common.utils import FileLikeIter -from tests.unit.swift import FakeLogger -from tests.unit.swift.storlet_gateway.gateways import FakeFileManager -from storlet_gateway.gateways.docker.gateway import DockerStorletRequest, \ +from tests.unit import FakeLogger +from tests.unit.gateway.gateways import FakeFileManager +from storlets.gateway.gateways.docker.gateway import DockerStorletRequest, \ StorletGatewayDocker from tests.unit import MockSBus import os @@ -426,7 +426,7 @@ use = egg:swift#catch_errors called_fd_and_bodies = [] invocation_protocol = \ - 'storlet_gateway.gateways.docker.runtime.' \ + 'storlets.gateway.gateways.docker.runtime.' \ 'StorletInvocationProtocol._write_input_data' def mock_writer(self, fd, app_iter): @@ -439,14 +439,14 @@ use = egg:swift#catch_errors # SBus -> mock SBus.send() for container communication # os.read -> mock reading the file descriptor from container # select.slect -> mock fd communication wich can be readable - @mock.patch('storlet_gateway.gateways.docker.runtime.SBus', MockSBus) - @mock.patch('storlet_gateway.gateways.docker.runtime.os.read', + @mock.patch('storlets.gateway.gateways.docker.runtime.SBus', MockSBus) + @mock.patch('storlets.gateway.gateways.docker.runtime.os.read', mock_read) - @mock.patch('storlet_gateway.gateways.docker.runtime.os.close', + @mock.patch('storlets.gateway.gateways.docker.runtime.os.close', mock_close) - @mock.patch('storlet_gateway.gateways.docker.runtime.select.select', + @mock.patch('storlets.gateway.gateways.docker.runtime.select.select', lambda r, w, x, timeout=None: (r, w, x)) - @mock.patch('storlet_gateway.common.stob.os.read', + @mock.patch('storlets.gateway.common.stob.os.read', mock_read) @mock.patch(invocation_protocol, mock_writer) def test_invocation_flow(): diff --git a/tests/unit/swift/storlet_gateway/gateways/docker/test_runtime.py b/tests/unit/gateway/gateways/docker/test_runtime.py similarity index 94% rename from tests/unit/swift/storlet_gateway/gateways/docker/test_runtime.py rename to tests/unit/gateway/gateways/docker/test_runtime.py index 2d5b81b6..04c5b94c 100644 --- a/tests/unit/swift/storlet_gateway/gateways/docker/test_runtime.py +++ b/tests/unit/gateway/gateways/docker/test_runtime.py @@ -22,22 +22,21 @@ from contextlib import contextmanager from six import StringIO from stat import ST_MODE -from storlet_gateway.common.exceptions import StorletRuntimeException, \ +from storlets.gateway.common.exceptions import StorletRuntimeException, \ StorletTimeout -from storlet_gateway.gateways.docker.gateway import DockerStorletRequest -from storlet_gateway.gateways.docker.runtime import RunTimeSandbox, \ +from storlets.gateway.gateways.docker.gateway import DockerStorletRequest +from storlets.gateway.gateways.docker.runtime import RunTimeSandbox, \ RunTimePaths, StorletInvocationProtocol -from tests.unit.swift import FakeLogger -from tests.unit import with_tempdir -from tests.unit.swift.storlet_gateway.gateways import FakeFileManager +from tests.unit import FakeLogger, with_tempdir +from tests.unit.gateway.gateways import FakeFileManager from exceptions import AssertionError @contextmanager def _mock_sbus(send_status=0): - with mock.patch('storlet_gateway.gateways.docker.runtime.' + with mock.patch('storlets.gateway.gateways.docker.runtime.' 'SBusDatagram.create_service_datagram'), \ - mock.patch('storlet_gateway.gateways.docker.runtime.' + mock.patch('storlets.gateway.gateways.docker.runtime.' 'SBus.send') as fake_send: fake_send.return_value = send_status yield @@ -76,11 +75,11 @@ def _mock_os_pipe(bufs): except StopIteration: raise AssertionError('pipe called more than expected') - with mock.patch('storlet_gateway.gateways.docker.runtime.os.pipe', + with mock.patch('storlets.gateway.gateways.docker.runtime.os.pipe', mock_os_pipe), \ - mock.patch('storlet_gateway.gateways.docker.runtime.os.read', + mock.patch('storlets.gateway.gateways.docker.runtime.os.read', fake_os_read) as fake_os_read,\ - mock.patch('storlet_gateway.gateways.docker.runtime.os.close', + mock.patch('storlets.gateway.gateways.docker.runtime.os.close', fake_os_close) as fake_os_close: yield pipes @@ -303,7 +302,7 @@ class TestRunTimeSandbox(unittest.TestCase): def test_wait(self): with _mock_os_pipe(['True:OK']) as pipes, _mock_sbus(0), \ - mock.patch('storlet_gateway.gateways.docker.runtime.' + mock.patch('storlets.gateway.gateways.docker.runtime.' 'time.sleep') as _s: self.sbox.wait() self.assertEqual(_s.call_count, 0) @@ -311,14 +310,14 @@ class TestRunTimeSandbox(unittest.TestCase): with _mock_os_pipe(['False:ERROR', 'True:OK']) as pipes, \ _mock_sbus(0), \ - mock.patch('storlet_gateway.gateways.docker.runtime.' + mock.patch('storlets.gateway.gateways.docker.runtime.' 'time.sleep') as _s: self.sbox.wait() self.assertEqual(_s.call_count, 1) self._check_all_pipese_closed(pipes) with _mock_os_pipe(['Foo']) as pipes, _mock_sbus(0), \ - mock.patch('storlet_gateway.gateways.docker.runtime.' + mock.patch('storlets.gateway.gateways.docker.runtime.' 'time.sleep') as _s: with self.assertRaises(StorletRuntimeException): self.sbox.wait() @@ -327,9 +326,9 @@ class TestRunTimeSandbox(unittest.TestCase): # TODO(takashi): should test timeout case def test_restart(self): - with mock.patch('storlet_gateway.gateways.docker.runtime.' + with mock.patch('storlets.gateway.gateways.docker.runtime.' 'RunTimePaths.create_host_pipe_prefix'), \ - mock.patch('storlet_gateway.gateways.docker.runtime.' + mock.patch('storlets.gateway.gateways.docker.runtime.' 'subprocess.call'): _wait = self.sbox.wait @@ -340,9 +339,9 @@ class TestRunTimeSandbox(unittest.TestCase): self.sbox.restart() self.sbox.wait = _wait - with mock.patch('storlet_gateway.gateways.docker.runtime.' + with mock.patch('storlets.gateway.gateways.docker.runtime.' 'RunTimePaths.create_host_pipe_prefix'), \ - mock.patch('storlet_gateway.gateways.docker.runtime.' + mock.patch('storlets.gateway.gateways.docker.runtime.' 'subprocess.call'): _wait = self.sbox.wait diff --git a/tests/unit/swift/storlet_gateway/test_loader.py b/tests/unit/gateway/test_loader.py similarity index 76% rename from tests/unit/swift/storlet_gateway/test_loader.py rename to tests/unit/gateway/test_loader.py index 678425e9..1bf3820f 100644 --- a/tests/unit/swift/storlet_gateway/test_loader.py +++ b/tests/unit/gateway/test_loader.py @@ -13,10 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. import unittest -from storlet_gateway.common.exceptions import StorletGatewayLoadError -from storlet_gateway.loader import load_gateway -from storlet_gateway.gateways.stub import StorletGatewayStub -from storlet_gateway.gateways.docker import StorletGatewayDocker +from storlets.gateway.common.exceptions import StorletGatewayLoadError +from storlets.gateway.loader import load_gateway +from storlets.gateway.gateways.stub import StorletGatewayStub +from storlets.gateway.gateways.docker import StorletGatewayDocker class TestLoader(unittest.TestCase): @@ -41,19 +41,19 @@ class TestLoader(unittest.TestCase): # If the given class path exists self.assertEqual( StorletGatewayStub, - load_gateway('storlet_gateway.gateways.stub.StorletGatewayStub')) + load_gateway('storlets.gateway.gateways.stub.StorletGatewayStub')) self.assertEqual( StorletGatewayDocker, - load_gateway('storlet_gateway.gateways.docker.' + load_gateway('storlets.gateway.gateways.docker.' 'StorletGatewayDocker')) # If module does not exist with self.assertRaises(StorletGatewayLoadError): - load_gateway('storlet_gateway.gateways.another_stub.' + load_gateway('storlets.gateway.gateways.another_stub.' 'StorletGatewayStub') # If class does not exist with self.assertRaises(StorletGatewayLoadError): - load_gateway('storlet_gateway.gateways.stub.' + load_gateway('storlets.gateway.gateways.stub.' 'StorletGatewayAnotherStub') diff --git a/tests/unit/sbus/test_datagram.py b/tests/unit/sbus/test_datagram.py index c7c7b5d7..f0ad4b0b 100644 --- a/tests/unit/sbus/test_datagram.py +++ b/tests/unit/sbus/test_datagram.py @@ -15,8 +15,8 @@ import json import unittest -import sbus.file_description as sbus_fd -from sbus.datagram import FDMetadata, SBusDatagram +import storlets.sbus.file_description as sbus_fd +from storlets.sbus.datagram import FDMetadata, SBusDatagram class TestFDMetadata(unittest.TestCase): diff --git a/tests/unit/swift/__init__.py b/tests/unit/swift/__init__.py deleted file mode 100644 index 651d0ef0..00000000 --- a/tests/unit/swift/__init__.py +++ /dev/null @@ -1,50 +0,0 @@ -# Copyright (c) 2010-2015 OpenStack Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or -# implied. -# See the License for the specific language governing permissions and -# limitations under the License. -import sys -import traceback -from collections import defaultdict - - -class FakeLogger(object): - def __init__(self, *args, **kwargs): - self._log_lines = defaultdict(list) - - def _print_log(self, level, msg): - self._log_lines[level.lower()].append(msg) - print('%s: %s' % (level, msg)) - - def get_log_lines(self, level): - return self._log_lines[level.lower()] - - def debug(self, msg): - self._print_log('DEBUG', msg) - - def info(self, msg): - self._print_log('INFO', msg) - - def warning(self, msg): - self._print_log('WARN', msg) - - warn = warning - - def error(self, msg): - self._print_log('ERROR', msg) - - def exception(self, msg): - exc_type, exc_value, exc_traceback = sys.exc_info() - exc_msg = traceback.format_exception(exc_type, exc_value, - exc_traceback) - new_msg = '%s: %s' % (msg, exc_msg) - self._print_log('EXCEPTION', new_msg) diff --git a/tests/unit/swift/storlet_middleware/__init__.py b/tests/unit/swift_middleware/__init__.py similarity index 100% rename from tests/unit/swift/storlet_middleware/__init__.py rename to tests/unit/swift_middleware/__init__.py diff --git a/tests/unit/swift/storlet_middleware/handlers/__init__.py b/tests/unit/swift_middleware/handlers/__init__.py similarity index 81% rename from tests/unit/swift/storlet_middleware/handlers/__init__.py rename to tests/unit/swift_middleware/handlers/__init__.py index 17c3a504..d41c7e9b 100644 --- a/tests/unit/swift/storlet_middleware/handlers/__init__.py +++ b/tests/unit/swift_middleware/handlers/__init__.py @@ -16,11 +16,11 @@ import mock import unittest -from storlet_gateway.gateways.stub import StorletGatewayStub -from storlet_middleware import storlet_handler +from storlets.gateway.gateways.stub import StorletGatewayStub +from storlets.swift_middleware import storlet_handler -from tests.unit.swift import FakeLogger -from tests.unit.swift.storlet_middleware import FakeApp +from tests.unit import FakeLogger +from tests.unit.swift_middleware import FakeApp def create_handler_config(exec_server): @@ -38,7 +38,8 @@ class BaseTestStorletMiddleware(unittest.TestCase): pass def get_app(self, app, global_conf, **local_conf): - with mock.patch('storlet_middleware.storlet_handler.get_logger') as \ + with mock.patch('storlets.swift_middleware.storlet_handler.' + 'get_logger') as \ get_fake_logger: get_fake_logger.return_value = FakeLogger() factory = storlet_handler.filter_factory(global_conf, **local_conf) diff --git a/tests/unit/swift/storlet_middleware/handlers/test_base.py b/tests/unit/swift_middleware/handlers/test_base.py similarity index 94% rename from tests/unit/swift/storlet_middleware/handlers/test_base.py rename to tests/unit/swift_middleware/handlers/test_base.py index 21cb14d3..613973ea 100644 --- a/tests/unit/swift/storlet_middleware/handlers/test_base.py +++ b/tests/unit/swift_middleware/handlers/test_base.py @@ -19,11 +19,11 @@ from contextlib import contextmanager from six import StringIO from swift.common.swob import Request -from storlet_gateway.common.exceptions import FileManagementError -from storlet_middleware.handlers import StorletBaseHandler -from storlet_middleware.handlers.base import get_container_names, \ +from storlets.gateway.common.exceptions import FileManagementError +from storlets.swift_middleware.handlers import StorletBaseHandler +from storlets.swift_middleware.handlers.base import get_container_names, \ SwiftFileManager -from tests.unit.swift import FakeLogger +from tests.unit import FakeLogger class TestUtils(unittest.TestCase): @@ -54,7 +54,8 @@ class TestSwiftFileManager(unittest.TestCase): @contextmanager def _mock_internal_client(self, cls): - with mock.patch('storlet_middleware.handlers.base.InternalClient', + with mock.patch('storlets.swift_middleware.handlers.base.' + 'InternalClient', cls): yield diff --git a/tests/unit/swift/storlet_middleware/handlers/test_obj.py b/tests/unit/swift_middleware/handlers/test_obj.py similarity index 98% rename from tests/unit/swift/storlet_middleware/handlers/test_obj.py rename to tests/unit/swift_middleware/handlers/test_obj.py index be9e7525..79d174c2 100644 --- a/tests/unit/swift/storlet_middleware/handlers/test_obj.py +++ b/tests/unit/swift_middleware/handlers/test_obj.py @@ -17,9 +17,9 @@ import mock import unittest from swift.common.swob import Request, HTTPOk, HTTPCreated -from storlet_middleware.handlers import StorletObjectHandler +from storlets.swift_middleware.handlers import StorletObjectHandler -from tests.unit.swift.storlet_middleware.handlers import \ +from tests.unit.swift_middleware.handlers import \ BaseTestStorletMiddleware, create_handler_config diff --git a/tests/unit/swift/storlet_middleware/handlers/test_proxy.py b/tests/unit/swift_middleware/handlers/test_proxy.py similarity index 99% rename from tests/unit/swift/storlet_middleware/handlers/test_proxy.py rename to tests/unit/swift_middleware/handlers/test_proxy.py index dfbabbe6..6b28e0bd 100644 --- a/tests/unit/swift/storlet_middleware/handlers/test_proxy.py +++ b/tests/unit/swift_middleware/handlers/test_proxy.py @@ -20,16 +20,16 @@ import itertools from contextlib import contextmanager from swift.common.swob import Request, HTTPOk, HTTPCreated, HTTPAccepted, \ HTTPNoContent, HTTPNotFound -from storlet_middleware.handlers import StorletProxyHandler -from storlet_middleware.handlers.proxy import REFERER_PREFIX +from storlets.swift_middleware.handlers import StorletProxyHandler +from storlets.swift_middleware.handlers.proxy import REFERER_PREFIX -from tests.unit.swift.storlet_middleware.handlers import \ +from tests.unit.swift_middleware.handlers import \ BaseTestStorletMiddleware, create_handler_config @contextmanager def fake_acc_info(acc_info): - with mock.patch('storlet_middleware.handlers.proxy.' + with mock.patch('storlets.swift_middleware.handlers.proxy.' 'get_account_info') as ai: ai.return_value = acc_info yield diff --git a/tests/unit/swift/storlet_middleware/test_storlet_handler.py b/tests/unit/swift_middleware/test_storlet_handler.py similarity index 100% rename from tests/unit/swift/storlet_middleware/test_storlet_handler.py rename to tests/unit/swift_middleware/test_storlet_handler.py diff --git a/tox.ini b/tox.ini index 4c69959a..fcbdedd9 100644 --- a/tox.ini +++ b/tox.ini @@ -25,17 +25,19 @@ whitelist_externals = bash [testenv:pep8python] commands = flake8 - flake8 --filename=* Engine/agent/bin + flake8 --filename=* bin [testenv:py34] commands = nosetests -v \ - tests/unit/swift/storlet_gateway + tests/unit/gateway [testenv:py35] commands = {[testenv:py34]commands} [testenv:func] +deps = + -r{toxinidir}/test-requirements.txt commands = ./.functests jenkins [testenv:venv]