diff --git a/apps/files_external/appinfo/app.php b/apps/files_external/appinfo/app.php
index 46a4ecf079337b6d76394b2fb6813a673fc8b379..c98e772aa401d160530a4c02d30edc638b403939 100644
--- a/apps/files_external/appinfo/app.php
+++ b/apps/files_external/appinfo/app.php
@@ -26,15 +26,6 @@
  *
  */
 
-OC::$CLASSPATH['OC\Files\Storage\StreamWrapper'] = 'files_external/lib/streamwrapper.php';
-OC::$CLASSPATH['OC\Files\Storage\FTP'] = 'files_external/lib/ftp.php';
-OC::$CLASSPATH['OC\Files\Storage\OwnCloud'] = 'files_external/lib/owncloud.php';
-OC::$CLASSPATH['OC\Files\Storage\Google'] = 'files_external/lib/google.php';
-OC::$CLASSPATH['OC\Files\Storage\Swift'] = 'files_external/lib/swift.php';
-OC::$CLASSPATH['OC\Files\Storage\SMB'] = 'files_external/lib/smb.php';
-OC::$CLASSPATH['OC\Files\Storage\AmazonS3'] = 'files_external/lib/amazons3.php';
-OC::$CLASSPATH['OC\Files\Storage\Dropbox'] = 'files_external/lib/dropbox.php';
-OC::$CLASSPATH['OC\Files\Storage\SFTP'] = 'files_external/lib/sftp.php';
 OC::$CLASSPATH['OC_Mount_Config'] = 'files_external/lib/config.php';
 OC::$CLASSPATH['OCA\Files\External\Api'] = 'files_external/lib/api.php';
 
diff --git a/apps/files_external/lib/backend/amazons3.php b/apps/files_external/lib/backend/amazons3.php
index b2dedc10e4aba1faa77ef5a31a2214a37b80dd54..449b6c0379d69292c920346a2fa10e9546516ab4 100644
--- a/apps/files_external/lib/backend/amazons3.php
+++ b/apps/files_external/lib/backend/amazons3.php
@@ -38,7 +38,7 @@ class AmazonS3 extends Backend {
 		$this
 			->setIdentifier('amazons3')
 			->addIdentifierAlias('\OC\Files\Storage\AmazonS3') // legacy compat
-			->setStorageClass('\OC\Files\Storage\AmazonS3')
+			->setStorageClass('\OCA\Files_External\Lib\Storage\AmazonS3')
 			->setText($l->t('Amazon S3'))
 			->addParameters([
 				(new DefinitionParameter('bucket', $l->t('Bucket'))),
diff --git a/apps/files_external/lib/backend/dropbox.php b/apps/files_external/lib/backend/dropbox.php
index 7a4147311925f9f9bd9ba278ae74d23662d8c879..f9156082515831437421680980d1bd6e370426bf 100644
--- a/apps/files_external/lib/backend/dropbox.php
+++ b/apps/files_external/lib/backend/dropbox.php
@@ -38,7 +38,7 @@ class Dropbox extends Backend {
 		$this
 			->setIdentifier('dropbox')
 			->addIdentifierAlias('\OC\Files\Storage\Dropbox') // legacy compat
-			->setStorageClass('\OC\Files\Storage\Dropbox')
+			->setStorageClass('\OCA\Files_External\Lib\Storage\Dropbox')
 			->setText($l->t('Dropbox'))
 			->addParameters([
 				// all parameters handled in OAuth1 mechanism
diff --git a/apps/files_external/lib/backend/ftp.php b/apps/files_external/lib/backend/ftp.php
index b2b83a2740533dbfd0d66b03676b07d6c5f59fa6..3960592d0bcfda6cf5d4ffdc2982594200b29570 100644
--- a/apps/files_external/lib/backend/ftp.php
+++ b/apps/files_external/lib/backend/ftp.php
@@ -38,7 +38,7 @@ class FTP extends Backend {
 		$this
 			->setIdentifier('ftp')
 			->addIdentifierAlias('\OC\Files\Storage\FTP') // legacy compat
-			->setStorageClass('\OC\Files\Storage\FTP')
+			->setStorageClass('\OCA\Files_External\Lib\Storage\FTP')
 			->setText($l->t('FTP'))
 			->addParameters([
 				(new DefinitionParameter('host', $l->t('Host'))),
diff --git a/apps/files_external/lib/backend/google.php b/apps/files_external/lib/backend/google.php
index 93a8cd2177deac1be92497870fe1a40828963334..b2b48a0e402f2beb8ae64c2258c998da2e670a0d 100644
--- a/apps/files_external/lib/backend/google.php
+++ b/apps/files_external/lib/backend/google.php
@@ -38,7 +38,7 @@ class Google extends Backend {
 		$this
 			->setIdentifier('googledrive')
 			->addIdentifierAlias('\OC\Files\Storage\Google') // legacy compat
-			->setStorageClass('\OC\Files\Storage\Google')
+			->setStorageClass('\OCA\Files_External\Lib\Storage\Google')
 			->setText($l->t('Google Drive'))
 			->addParameters([
 				// all parameters handled in OAuth2 mechanism
diff --git a/apps/files_external/lib/backend/owncloud.php b/apps/files_external/lib/backend/owncloud.php
index e7da328c5f10b96a25c9cbf7fa2853ef9debf0f9..e92288b13543db2caf0f7decd5a40bea0ca34d02 100644
--- a/apps/files_external/lib/backend/owncloud.php
+++ b/apps/files_external/lib/backend/owncloud.php
@@ -35,7 +35,7 @@ class OwnCloud extends Backend {
 		$this
 			->setIdentifier('owncloud')
 			->addIdentifierAlias('\OC\Files\Storage\OwnCloud') // legacy compat
-			->setStorageClass('\OC\Files\Storage\OwnCloud')
+			->setStorageClass('\OCA\Files_External\Lib\Storage\OwnCloud')
 			->setText($l->t('ownCloud'))
 			->addParameters([
 				(new DefinitionParameter('host', $l->t('URL'))),
diff --git a/apps/files_external/lib/backend/sftp.php b/apps/files_external/lib/backend/sftp.php
index 3e5ecb90131e71168572924628eb82278928e2da..fa33caeb57608ac2b3c95434c8d0dc1e04c7d44c 100644
--- a/apps/files_external/lib/backend/sftp.php
+++ b/apps/files_external/lib/backend/sftp.php
@@ -35,7 +35,7 @@ class SFTP extends Backend {
 		$this
 			->setIdentifier('sftp')
 			->addIdentifierAlias('\OC\Files\Storage\SFTP') // legacy compat
-			->setStorageClass('\OC\Files\Storage\SFTP')
+			->setStorageClass('\OCA\Files_External\Lib\Storage\SFTP')
 			->setText($l->t('SFTP'))
 			->addParameters([
 				(new DefinitionParameter('host', $l->t('Host'))),
diff --git a/apps/files_external/lib/backend/sftp_key.php b/apps/files_external/lib/backend/sftp_key.php
index 58dddedf7842bd53b5b212e4d7d2a811891340ca..838cf6c52b265fc0bfc9f2bd3bf1b01aad2a73ce 100644
--- a/apps/files_external/lib/backend/sftp_key.php
+++ b/apps/files_external/lib/backend/sftp_key.php
@@ -34,7 +34,7 @@ class SFTP_Key extends Backend {
 	public function __construct(IL10N $l, RSA $legacyAuth, SFTP $sftpBackend) {
 		$this
 			->setIdentifier('\OC\Files\Storage\SFTP_Key')
-			->setStorageClass('\OC\Files\Storage\SFTP')
+			->setStorageClass('\OCA\Files_External\Lib\Storage\SFTP')
 			->setText($l->t('SFTP with secret key login'))
 			->addParameters([
 				(new DefinitionParameter('host', $l->t('Host'))),
diff --git a/apps/files_external/lib/backend/smb.php b/apps/files_external/lib/backend/smb.php
index 9b71636936abb78ebb02e32791954c2088d9213e..7ea30dd11bdc05005e7bc5be2a986a7e38ba7048 100644
--- a/apps/files_external/lib/backend/smb.php
+++ b/apps/files_external/lib/backend/smb.php
@@ -40,7 +40,7 @@ class SMB extends Backend {
 		$this
 			->setIdentifier('smb')
 			->addIdentifierAlias('\OC\Files\Storage\SMB') // legacy compat
-			->setStorageClass('\OC\Files\Storage\SMB')
+			->setStorageClass('\OCA\Files_External\Lib\Storage\SMB')
 			->setText($l->t('SMB / CIFS'))
 			->addParameters([
 				(new DefinitionParameter('host', $l->t('Host'))),
diff --git a/apps/files_external/lib/backend/smb_oc.php b/apps/files_external/lib/backend/smb_oc.php
index ba38754ce5a255e9037264e7b60742b874905ed2..c543a19bdd81e7472654c0b8bcc3b432bb7969b4 100644
--- a/apps/files_external/lib/backend/smb_oc.php
+++ b/apps/files_external/lib/backend/smb_oc.php
@@ -42,7 +42,7 @@ class SMB_OC extends Backend {
 	public function __construct(IL10N $l, SessionCredentials $legacyAuth, SMB $smbBackend) {
 		$this
 			->setIdentifier('\OC\Files\Storage\SMB_OC')
-			->setStorageClass('\OC\Files\Storage\SMB')
+			->setStorageClass('\OCA\Files_External\Lib\Storage\SMB')
 			->setText($l->t('SMB / CIFS using OC login'))
 			->addParameters([
 				(new DefinitionParameter('host', $l->t('Host'))),
diff --git a/apps/files_external/lib/backend/swift.php b/apps/files_external/lib/backend/swift.php
index d6e4ac12f9ace0a2e43c619aefa2c87fd67377c7..58677575f5298fc193e8064fd9162c5d4e3a3a5d 100644
--- a/apps/files_external/lib/backend/swift.php
+++ b/apps/files_external/lib/backend/swift.php
@@ -38,7 +38,7 @@ class Swift extends Backend {
 		$this
 			->setIdentifier('swift')
 			->addIdentifierAlias('\OC\Files\Storage\Swift') // legacy compat
-			->setStorageClass('\OC\Files\Storage\Swift')
+			->setStorageClass('\OCA\Files_External\Lib\Storage\Swift')
 			->setText($l->t('OpenStack Object Storage'))
 			->addParameters([
 				(new DefinitionParameter('service_name', $l->t('Service name')))
diff --git a/apps/files_external/lib/amazons3.php b/apps/files_external/lib/storage/amazons3.php
similarity index 99%
rename from apps/files_external/lib/amazons3.php
rename to apps/files_external/lib/storage/amazons3.php
index cb2082ee38b41965c485be5c2410d03342fa8dee..42df1deffb0c63d8d383085f9eb2c4ebe4c5dc39 100644
--- a/apps/files_external/lib/amazons3.php
+++ b/apps/files_external/lib/storage/amazons3.php
@@ -33,7 +33,7 @@
  *
  */
 
-namespace OC\Files\Storage;
+namespace OCA\Files_External\Lib\Storage;
 
 set_include_path(get_include_path() . PATH_SEPARATOR .
 	\OC_App::getAppPath('files_external') . '/3rdparty/aws-sdk-php');
diff --git a/apps/files_external/lib/dropbox.php b/apps/files_external/lib/storage/dropbox.php
similarity index 98%
rename from apps/files_external/lib/dropbox.php
rename to apps/files_external/lib/storage/dropbox.php
index 8381ccbae59cf3f95d5f0f99ec0fc871cc801950..2d83fdbe0cb10da88d111fba04ac8013f2276524 100644
--- a/apps/files_external/lib/dropbox.php
+++ b/apps/files_external/lib/storage/dropbox.php
@@ -27,7 +27,7 @@
  *
  */
 
-namespace OC\Files\Storage;
+namespace OCA\Files_External\Lib\Storage;
 
 use GuzzleHttp\Exception\RequestException;
 use Icewind\Streams\IteratorDirectory;
@@ -59,7 +59,7 @@ class Dropbox extends \OC\Files\Storage\Common {
 			// note: Dropbox_API connection is lazy
 			$this->dropbox = new \Dropbox_API($this->oauth, 'auto');
 		} else {
-			throw new \Exception('Creating \OC\Files\Storage\Dropbox storage failed');
+			throw new \Exception('Creating Dropbox storage failed');
 		}
 	}
 
diff --git a/apps/files_external/lib/ftp.php b/apps/files_external/lib/storage/ftp.php
similarity index 96%
rename from apps/files_external/lib/ftp.php
rename to apps/files_external/lib/storage/ftp.php
index 7249aeceb5d9250cffbc74311423bd1df6e672ae..051c1873009b49144338a4e8e30aaf409ffc4819 100644
--- a/apps/files_external/lib/ftp.php
+++ b/apps/files_external/lib/storage/ftp.php
@@ -28,11 +28,11 @@
  *
  */
 
-namespace OC\Files\Storage;
+namespace OCA\Files_External\Lib\Storage;
 
 use Icewind\Streams\RetryWrapper;
 
-class FTP extends \OC\Files\Storage\StreamWrapper{
+class FTP extends StreamWrapper{
 	private $password;
 	private $user;
 	private $host;
@@ -59,7 +59,7 @@ class FTP extends \OC\Files\Storage\StreamWrapper{
 				$this->root .= '/';
 			}
 		} else {
-			throw new \Exception('Creating \OC\Files\Storage\FTP storage failed');
+			throw new \Exception('Creating FTP storage failed');
 		}
 		
 	}
diff --git a/apps/files_external/lib/google.php b/apps/files_external/lib/storage/google.php
similarity index 99%
rename from apps/files_external/lib/google.php
rename to apps/files_external/lib/storage/google.php
index 62d264dfeefb90afdfa6e0248fcb1a1b2cc5909c..8d1fe808130de1c0ab78d6bcac7e032aaf06d8ac 100644
--- a/apps/files_external/lib/google.php
+++ b/apps/files_external/lib/storage/google.php
@@ -31,7 +31,7 @@
  *
  */
 
-namespace OC\Files\Storage;
+namespace OCA\Files_External\Lib\Storage;
 
 use GuzzleHttp\Exception\RequestException;
 use Icewind\Streams\IteratorDirectory;
@@ -79,7 +79,7 @@ class Google extends \OC\Files\Storage\Common {
 			$token = json_decode($params['token'], true);
 			$this->id = 'google::'.substr($params['client_id'], 0, 30).$token['created'];
 		} else {
-			throw new \Exception('Creating \OC\Files\Storage\Google storage failed');
+			throw new \Exception('Creating Google storage failed');
 		}
 	}
 
diff --git a/apps/files_external/lib/owncloud.php b/apps/files_external/lib/storage/owncloud.php
similarity index 97%
rename from apps/files_external/lib/owncloud.php
rename to apps/files_external/lib/storage/owncloud.php
index c4824e6bd14e7559bc5a84b250da6d76fc6e32c3..22ecb4c806a890ef5622880920e186d5319f2720 100644
--- a/apps/files_external/lib/owncloud.php
+++ b/apps/files_external/lib/storage/owncloud.php
@@ -21,7 +21,7 @@
  *
  */
 
-namespace OC\Files\Storage;
+namespace OCA\Files_External\Lib\Storage;
 
 /**
  * ownCloud backend for external storage based on DAV backend.
diff --git a/apps/files_external/lib/sftp.php b/apps/files_external/lib/storage/sftp.php
similarity index 99%
rename from apps/files_external/lib/sftp.php
rename to apps/files_external/lib/storage/sftp.php
index a6984f3b4e0e0fbf10169538be0feea43b8f569d..2375f84dcda982392c4053dabc3bbb792ac3e895 100644
--- a/apps/files_external/lib/sftp.php
+++ b/apps/files_external/lib/storage/sftp.php
@@ -29,7 +29,7 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>
  *
  */
-namespace OC\Files\Storage;
+namespace OCA\Files_External\Lib\Storage;
 use Icewind\Streams\IteratorDirectory;
 
 use Icewind\Streams\RetryWrapper;
diff --git a/apps/files_external/lib/smb.php b/apps/files_external/lib/storage/smb.php
similarity index 99%
rename from apps/files_external/lib/smb.php
rename to apps/files_external/lib/storage/smb.php
index 08c4b25a08883e0dd184d8fee3319dda0f24fc06..4249d13168c6987c5f35d392706c227db2cd0a7b 100644
--- a/apps/files_external/lib/smb.php
+++ b/apps/files_external/lib/storage/smb.php
@@ -28,7 +28,7 @@
  *
  */
 
-namespace OC\Files\Storage;
+namespace OCA\Files_External\Lib\Storage;
 
 use Icewind\SMB\Exception\ConnectException;
 use Icewind\SMB\Exception\Exception;
@@ -42,7 +42,7 @@ use OC\Cache\CappedMemoryCache;
 use OC\Files\Filesystem;
 use OCP\Files\StorageNotAvailableException;
 
-class SMB extends Common {
+class SMB extends \OC\Files\Storage\Common {
 	/**
 	 * @var \Icewind\SMB\Server
 	 */
diff --git a/apps/files_external/lib/streamwrapper.php b/apps/files_external/lib/storage/streamwrapper.php
similarity index 96%
rename from apps/files_external/lib/streamwrapper.php
rename to apps/files_external/lib/storage/streamwrapper.php
index efb51f32ba459803f620239978c31c88e2fb4778..0b4dff78c4fd0f85a3bab2a44bc725dd793c8b8a 100644
--- a/apps/files_external/lib/streamwrapper.php
+++ b/apps/files_external/lib/storage/streamwrapper.php
@@ -24,9 +24,9 @@
  *
  */
 
-namespace OC\Files\Storage;
+namespace OCA\Files_External\Lib\Storage;
 
-abstract class StreamWrapper extends Common {
+abstract class StreamWrapper extends \OC\Files\Storage\Common {
 
 	/**
 	 * @param string $path
diff --git a/apps/files_external/lib/swift.php b/apps/files_external/lib/storage/swift.php
similarity index 99%
rename from apps/files_external/lib/swift.php
rename to apps/files_external/lib/storage/swift.php
index 9282fe286691daf9e867742f06618d8bde1e91c9..4578cd9a5c716349b19c76101b8fd3bd9ad7825f 100644
--- a/apps/files_external/lib/swift.php
+++ b/apps/files_external/lib/storage/swift.php
@@ -32,7 +32,7 @@
  *
  */
 
-namespace OC\Files\Storage;
+namespace OCA\Files_External\Lib\Storage;
 
 use Guzzle\Http\Url;
 use Guzzle\Http\Exception\ClientErrorResponseException;
diff --git a/apps/files_external/tests/amazons3migration.php b/apps/files_external/tests/amazons3migration.php
index d4ea9e2c261502ab583872c176a65ff372f927fb..614d6ca33dfa670dd8f490e6d318eaf144992e33 100644
--- a/apps/files_external/tests/amazons3migration.php
+++ b/apps/files_external/tests/amazons3migration.php
@@ -24,14 +24,16 @@
  */
 
 
-namespace Test\Files\Storage;
+namespace OCA\Files_External\Tests;
+
+use OCA\Files_External\Lib\Storage\AmazonS3;
 
 /**
  * Class AmazonS3Migration
  *
  * @group DB
  *
- * @package Test\Files\Storage
+ * @package OCA\Files_External\Tests
  */
 class AmazonS3Migration extends \Test\TestCase {
 
@@ -77,7 +79,7 @@ class AmazonS3Migration extends \Test\TestCase {
 		$fileId = $oldCache->put('foobar', array('size' => 0, 'mtime' => time(), 'mimetype' => 'httpd/directory'));
 
 		try {
-			$this->instance = new \OC\Files\Storage\AmazonS3($this->params);
+			$this->instance = new AmazonS3($this->params);
 		} catch (\Exception $e) {
 			//ignore
 		}
@@ -103,7 +105,7 @@ class AmazonS3Migration extends \Test\TestCase {
 		$fileId = $oldCache->put('/', array('size' => 0, 'mtime' => time(), 'mimetype' => 'httpd/directory'));
 
 		try {
-			$this->instance = new \OC\Files\Storage\AmazonS3($this->params);
+			$this->instance = new AmazonS3($this->params);
 		} catch (\Exception $e) {
 			//ignore
 		}
diff --git a/apps/files_external/tests/controller/storagescontrollertest.php b/apps/files_external/tests/controller/storagescontrollertest.php
index 5854cb00fee66889448f662f48195f56058a2ce3..4c3c62d5d6fba624f74975249a2634536751139c 100644
--- a/apps/files_external/tests/controller/storagescontrollertest.php
+++ b/apps/files_external/tests/controller/storagescontrollertest.php
@@ -51,7 +51,7 @@ abstract class StoragesControllerTest extends \Test\TestCase {
 	/**
 	 * @return \OCA\Files_External\Lib\Backend\Backend
 	 */
-	protected function getBackendMock($class = '\OCA\Files_External\Lib\Backend\SMB', $storageClass = '\OC\Files\Storage\SMB') {
+	protected function getBackendMock($class = '\OCA\Files_External\Lib\Backend\SMB', $storageClass = '\OCA\Files_External\Lib\Storage\SMB') {
 		$backend = $this->getMockBuilder('\OCA\Files_External\Lib\Backend\Backend')
 			->disableOriginalConstructor()
 			->getMock();
@@ -104,7 +104,7 @@ abstract class StoragesControllerTest extends \Test\TestCase {
 
 		$response = $this->controller->create(
 			'mount',
-			'\OC\Files\Storage\SMB',
+			'\OCA\Files_External\Lib\Storage\SMB',
 			'\OCA\Files_External\Lib\Auth\NullMechanism',
 			array(),
 			[],
@@ -146,7 +146,7 @@ abstract class StoragesControllerTest extends \Test\TestCase {
 		$response = $this->controller->update(
 			1,
 			'mount',
-			'\OC\Files\Storage\SMB',
+			'\OCA\Files_External\Lib\Storage\SMB',
 			'\OCA\Files_External\Lib\Auth\NullMechanism',
 			array(),
 			[],
@@ -188,7 +188,7 @@ abstract class StoragesControllerTest extends \Test\TestCase {
 
 		$response = $this->controller->create(
 			$mountPoint,
-			'\OC\Files\Storage\SMB',
+			'\OCA\Files_External\Lib\Storage\SMB',
 			'\OCA\Files_External\Lib\Auth\NullMechanism',
 			array(),
 			[],
@@ -202,7 +202,7 @@ abstract class StoragesControllerTest extends \Test\TestCase {
 		$response = $this->controller->update(
 			1,
 			$mountPoint,
-			'\OC\Files\Storage\SMB',
+			'\OCA\Files_External\Lib\Storage\SMB',
 			'\OCA\Files_External\Lib\Auth\NullMechanism',
 			array(),
 			[],
@@ -279,7 +279,7 @@ abstract class StoragesControllerTest extends \Test\TestCase {
 		$response = $this->controller->update(
 			255,
 			'mount',
-			'\OC\Files\Storage\SMB',
+			'\OCA\Files_External\Lib\Storage\SMB',
 			'\OCA\Files_External\Lib\Auth\NullMechanism',
 			array(),
 			[],
@@ -375,7 +375,7 @@ abstract class StoragesControllerTest extends \Test\TestCase {
 
 		$response = $this->controller->create(
 			'mount',
-			'\OC\Files\Storage\SMB',
+			'\OCA\Files_External\Lib\Storage\SMB',
 			'\OCA\Files_External\Lib\Auth\NullMechanism',
 			array(),
 			[],
diff --git a/apps/files_external/tests/controller/userstoragescontrollertest.php b/apps/files_external/tests/controller/userstoragescontrollertest.php
index a7e854471b587fabe23618ea05bd2e0ebbd50ce5..804b752b6af9ade19757a8e5383040ae2d1bc6b5 100644
--- a/apps/files_external/tests/controller/userstoragescontrollertest.php
+++ b/apps/files_external/tests/controller/userstoragescontrollertest.php
@@ -78,7 +78,7 @@ class UserStoragesControllerTest extends StoragesControllerTest {
 
 		$response = $this->controller->create(
 			'mount',
-			'\OC\Files\Storage\SMB',
+			'\OCA\Files_External\Lib\Storage\SMB',
 			'\Auth\Mechanism',
 			array(),
 			[],
@@ -92,7 +92,7 @@ class UserStoragesControllerTest extends StoragesControllerTest {
 		$response = $this->controller->update(
 			1,
 			'mount',
-			'\OC\Files\Storage\SMB',
+			'\OCA\Files_External\Lib\Storage\SMB',
 			'\Auth\Mechanism',
 			array(),
 			[],
diff --git a/apps/files_external/tests/owncloudfunctions.php b/apps/files_external/tests/owncloudfunctions.php
index 019f988275e37d495e38525f8ae3c0e24f35440f..25aaa90d178b892063f646e739c71481a8734b47 100644
--- a/apps/files_external/tests/owncloudfunctions.php
+++ b/apps/files_external/tests/owncloudfunctions.php
@@ -23,14 +23,14 @@
  *
  */
 
-namespace Test\Files\Storage;
+namespace OCA\Files_External\Tests;
 
 /**
  * Class OwnCloudFunctions
  *
  * @group DB
  *
- * @package Test\Files\Storage
+ * @package OCA\Files_External\Tests
  */
 class OwnCloudFunctions extends \Test\TestCase {
 
@@ -109,7 +109,7 @@ class OwnCloudFunctions extends \Test\TestCase {
 	public function testConfig($config, $expectedUri) {
 		$config['user'] = 'someuser';
 		$config['password'] = 'somepassword';
-		$instance = new \OC\Files\Storage\OwnCloud($config);
+		$instance = new \OCA\Files_External\Lib\Storage\OwnCloud($config);
 		$this->assertEquals($expectedUri, $instance->createBaseUri());
 	}
 }
diff --git a/apps/files_external/tests/service/storagesservicetest.php b/apps/files_external/tests/service/storagesservicetest.php
index 3fbe3b755e1b8d71b4608078a1802179a04b7beb..f93c013481402c33f5f2f26349545c506cb908be 100644
--- a/apps/files_external/tests/service/storagesservicetest.php
+++ b/apps/files_external/tests/service/storagesservicetest.php
@@ -121,9 +121,9 @@ abstract class StoragesServiceTest extends \Test\TestCase {
 		$this->backendService->method('getAuthMechanisms')
 			->will($this->returnValue($authMechanisms));
 
-		$sftpBackend = $this->getBackendMock('\OCA\Files_External\Lib\Backend\SFTP', '\OC\Files\Storage\SFTP');
+		$sftpBackend = $this->getBackendMock('\OCA\Files_External\Lib\Backend\SFTP', '\OCA\Files_External\Lib\Storage\SFTP');
 		$backends = [
-			'identifier:\OCA\Files_External\Lib\Backend\SMB' => $this->getBackendMock('\OCA\Files_External\Lib\Backend\SMB', '\OC\Files\Storage\SMB'),
+			'identifier:\OCA\Files_External\Lib\Backend\SMB' => $this->getBackendMock('\OCA\Files_External\Lib\Backend\SMB', '\OCA\Files_External\Lib\Storage\SMB'),
 			'identifier:\OCA\Files_External\Lib\Backend\SFTP' => $sftpBackend,
 			'identifier:sftp_alias' => $sftpBackend,
 		];
@@ -171,7 +171,7 @@ abstract class StoragesServiceTest extends \Test\TestCase {
 		}
 	}
 
-	protected function getBackendMock($class = '\OCA\Files_External\Lib\Backend\SMB', $storageClass = '\OC\Files\Storage\SMB') {
+	protected function getBackendMock($class = '\OCA\Files_External\Lib\Backend\SMB', $storageClass = '\OCA\Files_External\Lib\Storage\SMB') {
 		$backend = $this->getMockBuilder('\OCA\Files_External\Lib\Backend\Backend')
 			->disableOriginalConstructor()
 			->getMock();
diff --git a/apps/files_external/tests/backends/amazons3.php b/apps/files_external/tests/storage/amazons3test.php
similarity index 85%
rename from apps/files_external/tests/backends/amazons3.php
rename to apps/files_external/tests/storage/amazons3test.php
index 3b43f81a92637b30ae00f589711cbfbc37f918f1..eb0e410764c281b0fb3b29dc816318fe66943e66 100644
--- a/apps/files_external/tests/backends/amazons3.php
+++ b/apps/files_external/tests/storage/amazons3test.php
@@ -24,16 +24,18 @@
  *
  */
 
-namespace Test\Files\Storage;
+namespace OCA\Files_External\Tests\Storage;
+
+use \OCA\Files_External\Lib\Storage\AmazonS3;
 
 /**
- * Class AmazonS3
+ * Class AmazonS3Test
  *
  * @group DB
  *
- * @package Test\Files\Storage
+ * @package OCA\Files_External\Tests\Storage
  */
-class AmazonS3 extends Storage {
+class AmazonS3Test extends \Test\Files\Storage\Storage {
 
 	private $config;
 
@@ -44,7 +46,7 @@ class AmazonS3 extends Storage {
 		if ( ! is_array($this->config) or ! $this->config['run']) {
 			$this->markTestSkipped('AmazonS3 backend not configured');
 		}
-		$this->instance = new \OC\Files\Storage\AmazonS3($this->config);
+		$this->instance = new AmazonS3($this->config);
 	}
 
 	protected function tearDown() {
diff --git a/apps/files_external/tests/backends/dropbox.php b/apps/files_external/tests/storage/dropboxtest.php
similarity index 88%
rename from apps/files_external/tests/backends/dropbox.php
rename to apps/files_external/tests/storage/dropboxtest.php
index 1bf8b4171fbea63bd5b2ce84d29d3fd8de255f63..d466d4b1b44ed3e1abaa7835c1521bbcafe1edbb 100644
--- a/apps/files_external/tests/backends/dropbox.php
+++ b/apps/files_external/tests/storage/dropboxtest.php
@@ -24,16 +24,18 @@
  *
  */
 
-namespace Test\Files\Storage;
+namespace OCA\Files_External\Tests\Storage;
+
+use \OCA\Files_External\Lib\Storage\Dropbox;
 
 /**
- * Class Dropbox
+ * Class DropboxTest
  *
  * @group DB
  *
- * @package Test\Files\Storage
+ * @package OCA\Files_External\Tests\Storage
  */
-class Dropbox extends Storage {
+class DropboxTest extends \Test\Files\Storage\Storage {
 	private $config;
 
 	protected function setUp() {
@@ -45,7 +47,7 @@ class Dropbox extends Storage {
 			$this->markTestSkipped('Dropbox backend not configured');
 		}
 		$this->config['dropbox']['root'] .= '/' . $id; //make sure we have an new empty folder to work in
-		$this->instance = new \OC\Files\Storage\Dropbox($this->config['dropbox']);
+		$this->instance = new Dropbox($this->config['dropbox']);
 	}
 
 	protected function tearDown() {
diff --git a/apps/files_external/tests/backends/ftp.php b/apps/files_external/tests/storage/ftptest.php
similarity index 83%
rename from apps/files_external/tests/backends/ftp.php
rename to apps/files_external/tests/storage/ftptest.php
index 868a022d38ffd7f0382bcae54909b7bd70213dd7..9af9ccff012039b3754eb04a7a456aa8c44d4015 100644
--- a/apps/files_external/tests/backends/ftp.php
+++ b/apps/files_external/tests/storage/ftptest.php
@@ -24,16 +24,18 @@
  *
  */
 
-namespace Test\Files\Storage;
+namespace OCA\Files_External\Tests\Storage;
+
+use \OCA\Files_External\Lib\Storage\FTP;
 
 /**
- * Class FTP
+ * Class FTPTest
  *
  * @group DB
  *
- * @package Test\Files\Storage
+ * @package OCA\Files_External\Tests\Storage
  */
-class FTP extends Storage {
+class FTPTest extends \Test\Files\Storage\Storage {
 	private $config;
 
 	protected function setUp() {
@@ -45,7 +47,7 @@ class FTP extends Storage {
 			$this->markTestSkipped('FTP backend not configured');
 		}
 		$this->config['root'] .= '/' . $id; //make sure we have an new empty folder to work in
-		$this->instance = new \OC\Files\Storage\FTP($this->config);
+		$this->instance = new FTP($this->config);
 		$this->instance->mkdir('/');
 	}
 
@@ -63,31 +65,31 @@ class FTP extends Storage {
 						  'password' => 'ftp',
 						  'root' => '/',
 						  'secure' => false );
-		$instance = new \OC\Files\Storage\FTP($config);
+		$instance = new FTP($config);
 		$this->assertEquals('ftp://ftp:ftp@localhost/', $instance->constructUrl(''));
 
 		$config['secure'] = true;
-		$instance = new \OC\Files\Storage\FTP($config);
+		$instance = new FTP($config);
 		$this->assertEquals('ftps://ftp:ftp@localhost/', $instance->constructUrl(''));
 
 		$config['secure'] = 'false';
-		$instance = new \OC\Files\Storage\FTP($config);
+		$instance = new FTP($config);
 		$this->assertEquals('ftp://ftp:ftp@localhost/', $instance->constructUrl(''));
 
 		$config['secure'] = 'true';
-		$instance = new \OC\Files\Storage\FTP($config);
+		$instance = new FTP($config);
 		$this->assertEquals('ftps://ftp:ftp@localhost/', $instance->constructUrl(''));
 
 		$config['root'] = '';
-		$instance = new \OC\Files\Storage\FTP($config);
+		$instance = new FTP($config);
 		$this->assertEquals('ftps://ftp:ftp@localhost/somefile.txt', $instance->constructUrl('somefile.txt'));
 
 		$config['root'] = '/abc';
-		$instance = new \OC\Files\Storage\FTP($config);
+		$instance = new FTP($config);
 		$this->assertEquals('ftps://ftp:ftp@localhost/abc/somefile.txt', $instance->constructUrl('somefile.txt'));
 
 		$config['root'] = '/abc/';
-		$instance = new \OC\Files\Storage\FTP($config);
+		$instance = new FTP($config);
 		$this->assertEquals('ftps://ftp:ftp@localhost/abc/somefile.txt', $instance->constructUrl('somefile.txt'));
 	}
 }
diff --git a/apps/files_external/tests/backends/google.php b/apps/files_external/tests/storage/googletest.php
similarity index 85%
rename from apps/files_external/tests/backends/google.php
rename to apps/files_external/tests/storage/googletest.php
index 7622f796407c637756b1d8a4a27d6cb268502f24..46aa4555b12ca9edcf713a91e4dd1b2949a044f9 100644
--- a/apps/files_external/tests/backends/google.php
+++ b/apps/files_external/tests/storage/googletest.php
@@ -25,18 +25,18 @@
  *
  */
 
-namespace Test\Files\Storage;
+namespace OCA\Files_External\Tests\Storage;
 
-require_once 'files_external/lib/google.php';
+use \OCA\Files_External\Lib\Storage\Google;
 
 /**
- * Class Google
+ * Class GoogleTest
  *
  * @group DB
  *
- * @package Test\Files\Storage
+ * @package OCA\Files_External\Tests\Storage
  */
-class Google extends Storage {
+class GoogleTest extends \Test\Files\Storage\Storage {
 
 	private $config;
 
@@ -49,7 +49,7 @@ class Google extends Storage {
 		) {
 			$this->markTestSkipped('Google Drive backend not configured');
 		}
-		$this->instance = new \OC\Files\Storage\Google($this->config['google']);
+		$this->instance = new Google($this->config['google']);
 	}
 
 	protected function tearDown() {
diff --git a/apps/files_external/tests/backends/owncloud.php b/apps/files_external/tests/storage/owncloudtest.php
similarity index 84%
rename from apps/files_external/tests/backends/owncloud.php
rename to apps/files_external/tests/storage/owncloudtest.php
index a56e9b2a186c4ef83add9fddbc60463b7a5814dd..cbc25e46fa0344d4efa6de9aa60b0e97cd056679 100644
--- a/apps/files_external/tests/backends/owncloud.php
+++ b/apps/files_external/tests/storage/owncloudtest.php
@@ -22,16 +22,18 @@
  *
  */
 
-namespace Test\Files\Storage;
+namespace OCA\Files_External\Tests\Storage;
+
+use \OCA\Files_External\Lib\Storage\OwnCloud;
 
 /**
- * Class OwnCloud
+ * Class OwnCloudTest
  *
  * @group DB
  *
- * @package Test\Files\Storage
+ * @package OCA\Files_External\Tests\Storage
  */
-class OwnCloud extends Storage {
+class OwnCloudTest extends \Test\Files\Storage\Storage {
 
 	private $config;
 
@@ -44,7 +46,7 @@ class OwnCloud extends Storage {
 			$this->markTestSkipped('ownCloud backend not configured');
 		}
 		$this->config['owncloud']['root'] .= '/' . $id; //make sure we have an new empty folder to work in
-		$this->instance = new \OC\Files\Storage\OwnCloud($this->config['owncloud']);
+		$this->instance = new OwnCloud($this->config['owncloud']);
 		$this->instance->mkdir('/');
 	}
 
diff --git a/apps/files_external/tests/backends/sftp_key.php b/apps/files_external/tests/storage/sftp_keytest.php
similarity index 90%
rename from apps/files_external/tests/backends/sftp_key.php
rename to apps/files_external/tests/storage/sftp_keytest.php
index 73c6a0b6432f1908b0cf0b6f09586329bc3d9202..b974f88555fcb28c91f3f905caee3cc696091cf8 100644
--- a/apps/files_external/tests/backends/sftp_key.php
+++ b/apps/files_external/tests/storage/sftp_keytest.php
@@ -22,16 +22,18 @@
  *
  */
 
-namespace Test\Files\Storage;
+namespace OCA\Files_External\Tests\Storage;
+
+use \OCA\Files_External\Lib\Storage\SFTP_Key;
 
 /**
- * Class SFTP_Key
+ * Class SFTP_KeyTest
  *
  * @group DB
  *
- * @package Test\Files\Storage
+ * @package OCA\Files_External\Tests\Storage
  */
-class SFTP_Key extends Storage {
+class SFTP_KeyTest extends \Test\Files\Storage\Storage {
 	private $config;
 
 	protected function setUp() {
@@ -44,7 +46,7 @@ class SFTP_Key extends Storage {
 		}
 		// Make sure we have an new empty folder to work in
 		$this->config['sftp_key']['root'] .= '/' . $id;
-		$this->instance = new \OC\Files\Storage\SFTP_Key($this->config['sftp_key']);
+		$this->instance = new SFTP_Key($this->config['sftp_key']);
 		$this->instance->mkdir('/');
 	}
 
diff --git a/apps/files_external/tests/backends/sftp.php b/apps/files_external/tests/storage/sftptest.php
similarity index 92%
rename from apps/files_external/tests/backends/sftp.php
rename to apps/files_external/tests/storage/sftptest.php
index 608982adbc48e7d3f96f9dde3d021f67a8c24cbe..329e93819fc26885ba869f443f15dd3973cde00d 100644
--- a/apps/files_external/tests/backends/sftp.php
+++ b/apps/files_external/tests/storage/sftptest.php
@@ -24,18 +24,20 @@
  *
  */
 
-namespace Test\Files\Storage;
+namespace OCA\Files_External\Tests\Storage;
+
+use \OCA\Files_External\Lib\Storage\SFTP;
 
 /**
- * Class SFTP
+ * Class SFTPTest
  *
  * @group DB
  *
- * @package Test\Files\Storage
+ * @package OCA\Files_External\Tests\Storage
  */
-class SFTP extends Storage {
+class SFTPTest extends \Test\Files\Storage\Storage {
 	/**
-	 * @var \OC\Files\Storage\SFTP instance
+	 * @var SFTP instance
 	 */
 	protected $instance;
 
@@ -50,7 +52,7 @@ class SFTP extends Storage {
 			$this->markTestSkipped('SFTP backend not configured');
 		}
 		$this->config['root'] .= '/' . $id; //make sure we have an new empty folder to work in
-		$this->instance = new \OC\Files\Storage\SFTP($this->config);
+		$this->instance = new SFTP($this->config);
 		$this->instance->mkdir('/');
 	}
 
@@ -66,7 +68,7 @@ class SFTP extends Storage {
 	 * @dataProvider configProvider
 	 */
 	public function testStorageId($config, $expectedStorageId) {
-		$instance = new \OC\Files\Storage\SFTP($config);
+		$instance = new SFTP($config);
 		$this->assertEquals($expectedStorageId, $instance->getId());
 	}
 
diff --git a/apps/files_external/tests/backends/smb.php b/apps/files_external/tests/storage/smbtest.php
similarity index 89%
rename from apps/files_external/tests/backends/smb.php
rename to apps/files_external/tests/storage/smbtest.php
index f9a377c271b4fed76c25d7a9d5665536beb0c0a8..fc2795702c64d0276904eabd1d98191e0a3c3ccc 100644
--- a/apps/files_external/tests/backends/smb.php
+++ b/apps/files_external/tests/storage/smbtest.php
@@ -23,16 +23,18 @@
  *
  */
 
-namespace Test\Files\Storage;
+namespace OCA\Files_External\Tests\Storage;
+
+use \OCA\Files_External\Lib\Storage\SMB;
 
 /**
- * Class SMB
+ * Class SMBTest
  *
  * @group DB
  *
- * @package Test\Files\Storage
+ * @package OCA\Files_External\Tests\Storage
  */
-class SMB extends Storage {
+class SMBTest extends \Test\Files\Storage\Storage {
 
 	protected function setUp() {
 		parent::setUp();
@@ -46,7 +48,7 @@ class SMB extends Storage {
 			$config['root'] .= '/';
 		}
 		$config['root'] .= $id; //make sure we have an new empty folder to work in
-		$this->instance = new \OC\Files\Storage\SMB($config);
+		$this->instance = new SMB($config);
 		$this->instance->mkdir('/');
 	}
 
@@ -71,7 +73,7 @@ class SMB extends Storage {
 	}
 
 	public function testStorageId() {
-		$this->instance = new \OC\Files\Storage\SMB([
+		$this->instance = new SMB([
 			'host' => 'testhost',
 			'user' => 'testuser',
 			'password' => 'somepass',
diff --git a/apps/files_external/tests/backends/swift.php b/apps/files_external/tests/storage/swifttest.php
similarity index 88%
rename from apps/files_external/tests/backends/swift.php
rename to apps/files_external/tests/storage/swifttest.php
index 9bdcd48ee6833e73be4ab8e1624b83286ff51d38..1bcbb8150675ce6ffe7d143782f48ff40ab6a59c 100644
--- a/apps/files_external/tests/backends/swift.php
+++ b/apps/files_external/tests/storage/swifttest.php
@@ -24,16 +24,18 @@
  *
  */
 
-namespace Test\Files\Storage;
+namespace OCA\Files_External\Tests\Storage;
+
+use \OCA\Files_External\Lib\Storage\Swift;
 
 /**
- * Class Swift
+ * Class SwiftTest
  *
  * @group DB
  *
- * @package Test\Files\Storage
+ * @package OCA\Files_External\Tests\Storage
  */
-class Swift extends Storage {
+class SwiftTest extends \Test\Files\Storage\Storage {
 
 	private $config;
 
@@ -44,7 +46,7 @@ class Swift extends Storage {
 		if (!is_array($this->config) or !$this->config['run']) {
 			$this->markTestSkipped('OpenStack Object Storage backend not configured');
 		}
-		$this->instance = new \OC\Files\Storage\Swift($this->config);
+		$this->instance = new Swift($this->config);
 	}
 
 	protected function tearDown() {
diff --git a/apps/files_external/tests/backends/webdav.php b/apps/files_external/tests/storage/webdavtest.php
similarity index 87%
rename from apps/files_external/tests/backends/webdav.php
rename to apps/files_external/tests/storage/webdavtest.php
index e1a710c94b40640596cd2a70590b334e3caa4b02..f8c5b19e04fa0c55ae464d4c6b0b3d878dbf2bb9 100644
--- a/apps/files_external/tests/backends/webdav.php
+++ b/apps/files_external/tests/storage/webdavtest.php
@@ -23,16 +23,18 @@
  *
  */
 
-namespace Test\Files\Storage;
+namespace OCA\Files_External\Tests\Storage;
+
+use \OC\Files\Storage\DAV;
 
 /**
- * Class DAV
+ * Class WebDAVTest
  *
  * @group DB
  *
- * @package Test\Files\Storage
+ * @package OCA\Files_External\Tests\Storage
  */
-class DAV extends Storage {
+class WebDAVTest extends \Test\Files\Storage\Storage {
 
 	protected function setUp() {
 		parent::setUp();
@@ -46,7 +48,7 @@ class DAV extends Storage {
 			$this->waitDelay = $config['wait'];
 		}
 		$config['root'] .= '/' . $id; //make sure we have an new empty folder to work in
-		$this->instance = new \OC\Files\Storage\DAV($config);
+		$this->instance = new DAV($config);
 		$this->instance->mkdir('/');
 	}
 
diff --git a/autotest-external.sh b/autotest-external.sh
index ef6516c0721055ca44d46a3ab666d3573eab3e92..9705980aa2bcd85f0dae74a42c12c43f04433c6d 100755
--- a/autotest-external.sh
+++ b/autotest-external.sh
@@ -178,7 +178,7 @@ EOF
 		return;
 	fi
 
-	FILES_EXTERNAL_BACKEND_PATH=../apps/files_external/tests/backends
+	FILES_EXTERNAL_BACKEND_PATH=../apps/files_external/tests/storage
 	FILES_EXTERNAL_BACKEND_ENV_PATH=../apps/files_external/tests/env
 
 	for startFile in `ls -1 $FILES_EXTERNAL_BACKEND_ENV_PATH | grep start`; do
@@ -198,16 +198,17 @@ EOF
 			# getting backend to test from filename
 			# it's the part between the dots startSomething.TestToRun.sh
 			testToRun=`echo $startFile | cut -d '-' -f 2`
+			testToRun="${testToRun}test.php"
 
 			# run the specific test
 			if [ -z "$NOCOVERAGE" ]; then
 				rm -rf "coverage-external-html-$1-$name"
 				mkdir "coverage-external-html-$1-$name"
-				"$PHPUNIT" --configuration phpunit-autotest-external.xml --log-junit "autotest-external-results-$1-$name.xml" --coverage-clover "autotest-external-clover-$1-$name.xml" --coverage-html "coverage-external-html-$1-$name" "$FILES_EXTERNAL_BACKEND_PATH/$testToRun.php"
+				"$PHPUNIT" --configuration phpunit-autotest-external.xml --log-junit "autotest-external-results-$1-$name.xml" --coverage-clover "autotest-external-clover-$1-$name.xml" --coverage-html "coverage-external-html-$1-$name" "$FILES_EXTERNAL_BACKEND_PATH/$testToRun"
 				RESULT=$?
 			else
 				echo "No coverage"
-				"$PHPUNIT" --configuration phpunit-autotest-external.xml --log-junit "autotest-external-results-$1-$name.xml" "$FILES_EXTERNAL_BACKEND_PATH/$testToRun.php"
+				"$PHPUNIT" --configuration phpunit-autotest-external.xml --log-junit "autotest-external-results-$1-$name.xml" "$FILES_EXTERNAL_BACKEND_PATH/$testToRun"
 				RESULT=$?
 			fi
 		else
diff --git a/tests/phpunit-autotest-external.xml b/tests/phpunit-autotest-external.xml
index 31d2e395a0123e6984964d99dd5d6c1aec789bce..1b48c4dc11ea643ef50c47e3d18bb1a51cb40244 100644
--- a/tests/phpunit-autotest-external.xml
+++ b/tests/phpunit-autotest-external.xml
@@ -8,7 +8,7 @@
 	<testsuite name='ownCloud files external'>
 		<directory suffix=".php">../apps/files_external/tests</directory>
 		<!-- exclude backends as they are called separately -->
-		<exclude>../apps/files_external/tests/backends/</exclude>
+		<exclude>../apps/files_external/tests/storage/</exclude>
 	</testsuite>
 	<!-- filters for code coverage -->
 	<filter>