Merge pull request #23985 from owncloud/ext-fix-namespaces

Fix namespaces for files_external
This commit is contained in:
Morris Jobke 2016-04-14 16:32:01 +02:00
commit dba08f5fca
39 changed files with 132 additions and 121 deletions

View File

@ -26,17 +26,7 @@
* *
*/ */
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['OC_Mount_Config'] = 'files_external/lib/config.php';
OC::$CLASSPATH['OCA\Files\External\Api'] = 'files_external/lib/api.php';
require_once __DIR__ . '/../3rdparty/autoload.php'; require_once __DIR__ . '/../3rdparty/autoload.php';

View File

@ -61,6 +61,6 @@ $this->create('files_external_list_applicable', '/applicable')
\OCP\API::register('get', \OCP\API::register('get',
'/apps/files_external/api/v1/mounts', '/apps/files_external/api/v1/mounts',
array('\OCA\Files\External\Api', 'getUserMounts'), array('\OCA\Files_External\Lib\Api', 'getUserMounts'),
'files_external'); 'files_external');

View File

@ -23,7 +23,7 @@
* *
*/ */
namespace OCA\Files\External; namespace OCA\Files_External\Lib;
class Api { class Api {

View File

@ -38,7 +38,7 @@ class AmazonS3 extends Backend {
$this $this
->setIdentifier('amazons3') ->setIdentifier('amazons3')
->addIdentifierAlias('\OC\Files\Storage\AmazonS3') // legacy compat ->addIdentifierAlias('\OC\Files\Storage\AmazonS3') // legacy compat
->setStorageClass('\OC\Files\Storage\AmazonS3') ->setStorageClass('\OCA\Files_External\Lib\Storage\AmazonS3')
->setText($l->t('Amazon S3')) ->setText($l->t('Amazon S3'))
->addParameters([ ->addParameters([
(new DefinitionParameter('bucket', $l->t('Bucket'))), (new DefinitionParameter('bucket', $l->t('Bucket'))),

View File

@ -38,7 +38,7 @@ class Dropbox extends Backend {
$this $this
->setIdentifier('dropbox') ->setIdentifier('dropbox')
->addIdentifierAlias('\OC\Files\Storage\Dropbox') // legacy compat ->addIdentifierAlias('\OC\Files\Storage\Dropbox') // legacy compat
->setStorageClass('\OC\Files\Storage\Dropbox') ->setStorageClass('\OCA\Files_External\Lib\Storage\Dropbox')
->setText($l->t('Dropbox')) ->setText($l->t('Dropbox'))
->addParameters([ ->addParameters([
// all parameters handled in OAuth1 mechanism // all parameters handled in OAuth1 mechanism

View File

@ -38,7 +38,7 @@ class FTP extends Backend {
$this $this
->setIdentifier('ftp') ->setIdentifier('ftp')
->addIdentifierAlias('\OC\Files\Storage\FTP') // legacy compat ->addIdentifierAlias('\OC\Files\Storage\FTP') // legacy compat
->setStorageClass('\OC\Files\Storage\FTP') ->setStorageClass('\OCA\Files_External\Lib\Storage\FTP')
->setText($l->t('FTP')) ->setText($l->t('FTP'))
->addParameters([ ->addParameters([
(new DefinitionParameter('host', $l->t('Host'))), (new DefinitionParameter('host', $l->t('Host'))),

View File

@ -38,7 +38,7 @@ class Google extends Backend {
$this $this
->setIdentifier('googledrive') ->setIdentifier('googledrive')
->addIdentifierAlias('\OC\Files\Storage\Google') // legacy compat ->addIdentifierAlias('\OC\Files\Storage\Google') // legacy compat
->setStorageClass('\OC\Files\Storage\Google') ->setStorageClass('\OCA\Files_External\Lib\Storage\Google')
->setText($l->t('Google Drive')) ->setText($l->t('Google Drive'))
->addParameters([ ->addParameters([
// all parameters handled in OAuth2 mechanism // all parameters handled in OAuth2 mechanism

View File

@ -35,7 +35,7 @@ class OwnCloud extends Backend {
$this $this
->setIdentifier('owncloud') ->setIdentifier('owncloud')
->addIdentifierAlias('\OC\Files\Storage\OwnCloud') // legacy compat ->addIdentifierAlias('\OC\Files\Storage\OwnCloud') // legacy compat
->setStorageClass('\OC\Files\Storage\OwnCloud') ->setStorageClass('\OCA\Files_External\Lib\Storage\OwnCloud')
->setText($l->t('ownCloud')) ->setText($l->t('ownCloud'))
->addParameters([ ->addParameters([
(new DefinitionParameter('host', $l->t('URL'))), (new DefinitionParameter('host', $l->t('URL'))),

View File

@ -35,7 +35,7 @@ class SFTP extends Backend {
$this $this
->setIdentifier('sftp') ->setIdentifier('sftp')
->addIdentifierAlias('\OC\Files\Storage\SFTP') // legacy compat ->addIdentifierAlias('\OC\Files\Storage\SFTP') // legacy compat
->setStorageClass('\OC\Files\Storage\SFTP') ->setStorageClass('\OCA\Files_External\Lib\Storage\SFTP')
->setText($l->t('SFTP')) ->setText($l->t('SFTP'))
->addParameters([ ->addParameters([
(new DefinitionParameter('host', $l->t('Host'))), (new DefinitionParameter('host', $l->t('Host'))),

View File

@ -34,7 +34,7 @@ class SFTP_Key extends Backend {
public function __construct(IL10N $l, RSA $legacyAuth, SFTP $sftpBackend) { public function __construct(IL10N $l, RSA $legacyAuth, SFTP $sftpBackend) {
$this $this
->setIdentifier('\OC\Files\Storage\SFTP_Key') ->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')) ->setText($l->t('SFTP with secret key login'))
->addParameters([ ->addParameters([
(new DefinitionParameter('host', $l->t('Host'))), (new DefinitionParameter('host', $l->t('Host'))),

View File

@ -40,7 +40,7 @@ class SMB extends Backend {
$this $this
->setIdentifier('smb') ->setIdentifier('smb')
->addIdentifierAlias('\OC\Files\Storage\SMB') // legacy compat ->addIdentifierAlias('\OC\Files\Storage\SMB') // legacy compat
->setStorageClass('\OC\Files\Storage\SMB') ->setStorageClass('\OCA\Files_External\Lib\Storage\SMB')
->setText($l->t('SMB / CIFS')) ->setText($l->t('SMB / CIFS'))
->addParameters([ ->addParameters([
(new DefinitionParameter('host', $l->t('Host'))), (new DefinitionParameter('host', $l->t('Host'))),

View File

@ -42,7 +42,7 @@ class SMB_OC extends Backend {
public function __construct(IL10N $l, SessionCredentials $legacyAuth, SMB $smbBackend) { public function __construct(IL10N $l, SessionCredentials $legacyAuth, SMB $smbBackend) {
$this $this
->setIdentifier('\OC\Files\Storage\SMB_OC') ->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')) ->setText($l->t('SMB / CIFS using OC login'))
->addParameters([ ->addParameters([
(new DefinitionParameter('host', $l->t('Host'))), (new DefinitionParameter('host', $l->t('Host'))),

View File

@ -38,7 +38,7 @@ class Swift extends Backend {
$this $this
->setIdentifier('swift') ->setIdentifier('swift')
->addIdentifierAlias('\OC\Files\Storage\Swift') // legacy compat ->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')) ->setText($l->t('OpenStack Object Storage'))
->addParameters([ ->addParameters([
(new DefinitionParameter('service_name', $l->t('Service name'))) (new DefinitionParameter('service_name', $l->t('Service name')))

View File

@ -33,7 +33,7 @@
* *
*/ */
namespace OC\Files\Storage; namespace OCA\Files_External\Lib\Storage;
set_include_path(get_include_path() . PATH_SEPARATOR . set_include_path(get_include_path() . PATH_SEPARATOR .
\OC_App::getAppPath('files_external') . '/3rdparty/aws-sdk-php'); \OC_App::getAppPath('files_external') . '/3rdparty/aws-sdk-php');

View File

@ -27,7 +27,7 @@
* *
*/ */
namespace OC\Files\Storage; namespace OCA\Files_External\Lib\Storage;
use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Exception\RequestException;
use Icewind\Streams\IteratorDirectory; use Icewind\Streams\IteratorDirectory;
@ -59,7 +59,7 @@ class Dropbox extends \OC\Files\Storage\Common {
// note: Dropbox_API connection is lazy // note: Dropbox_API connection is lazy
$this->dropbox = new \Dropbox_API($this->oauth, 'auto'); $this->dropbox = new \Dropbox_API($this->oauth, 'auto');
} else { } else {
throw new \Exception('Creating \OC\Files\Storage\Dropbox storage failed'); throw new \Exception('Creating Dropbox storage failed');
} }
} }

View File

@ -28,11 +28,11 @@
* *
*/ */
namespace OC\Files\Storage; namespace OCA\Files_External\Lib\Storage;
use Icewind\Streams\RetryWrapper; use Icewind\Streams\RetryWrapper;
class FTP extends \OC\Files\Storage\StreamWrapper{ class FTP extends StreamWrapper{
private $password; private $password;
private $user; private $user;
private $host; private $host;
@ -59,7 +59,7 @@ class FTP extends \OC\Files\Storage\StreamWrapper{
$this->root .= '/'; $this->root .= '/';
} }
} else { } else {
throw new \Exception('Creating \OC\Files\Storage\FTP storage failed'); throw new \Exception('Creating FTP storage failed');
} }
} }

View File

@ -31,7 +31,7 @@
* *
*/ */
namespace OC\Files\Storage; namespace OCA\Files_External\Lib\Storage;
use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Exception\RequestException;
use Icewind\Streams\IteratorDirectory; use Icewind\Streams\IteratorDirectory;
@ -79,7 +79,7 @@ class Google extends \OC\Files\Storage\Common {
$token = json_decode($params['token'], true); $token = json_decode($params['token'], true);
$this->id = 'google::'.substr($params['client_id'], 0, 30).$token['created']; $this->id = 'google::'.substr($params['client_id'], 0, 30).$token['created'];
} else { } else {
throw new \Exception('Creating \OC\Files\Storage\Google storage failed'); throw new \Exception('Creating Google storage failed');
} }
} }

View File

@ -21,7 +21,7 @@
* *
*/ */
namespace OC\Files\Storage; namespace OCA\Files_External\Lib\Storage;
/** /**
* ownCloud backend for external storage based on DAV backend. * ownCloud backend for external storage based on DAV backend.

View File

@ -29,7 +29,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/> * 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\IteratorDirectory;
use Icewind\Streams\RetryWrapper; use Icewind\Streams\RetryWrapper;

View File

@ -28,7 +28,7 @@
* *
*/ */
namespace OC\Files\Storage; namespace OCA\Files_External\Lib\Storage;
use Icewind\SMB\Exception\ConnectException; use Icewind\SMB\Exception\ConnectException;
use Icewind\SMB\Exception\Exception; use Icewind\SMB\Exception\Exception;
@ -42,7 +42,7 @@ use OC\Cache\CappedMemoryCache;
use OC\Files\Filesystem; use OC\Files\Filesystem;
use OCP\Files\StorageNotAvailableException; use OCP\Files\StorageNotAvailableException;
class SMB extends Common { class SMB extends \OC\Files\Storage\Common {
/** /**
* @var \Icewind\SMB\Server * @var \Icewind\SMB\Server
*/ */

View File

@ -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 * @param string $path

View File

@ -32,7 +32,7 @@
* *
*/ */
namespace OC\Files\Storage; namespace OCA\Files_External\Lib\Storage;
use Guzzle\Http\Url; use Guzzle\Http\Url;
use Guzzle\Http\Exception\ClientErrorResponseException; use Guzzle\Http\Exception\ClientErrorResponseException;

View File

@ -24,14 +24,16 @@
*/ */
namespace Test\Files\Storage; namespace OCA\Files_External\Tests;
use OCA\Files_External\Lib\Storage\AmazonS3;
/** /**
* Class AmazonS3Migration * Class AmazonS3Migration
* *
* @group DB * @group DB
* *
* @package Test\Files\Storage * @package OCA\Files_External\Tests
*/ */
class AmazonS3Migration extends \Test\TestCase { 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')); $fileId = $oldCache->put('foobar', array('size' => 0, 'mtime' => time(), 'mimetype' => 'httpd/directory'));
try { try {
$this->instance = new \OC\Files\Storage\AmazonS3($this->params); $this->instance = new AmazonS3($this->params);
} catch (\Exception $e) { } catch (\Exception $e) {
//ignore //ignore
} }
@ -103,7 +105,7 @@ class AmazonS3Migration extends \Test\TestCase {
$fileId = $oldCache->put('/', array('size' => 0, 'mtime' => time(), 'mimetype' => 'httpd/directory')); $fileId = $oldCache->put('/', array('size' => 0, 'mtime' => time(), 'mimetype' => 'httpd/directory'));
try { try {
$this->instance = new \OC\Files\Storage\AmazonS3($this->params); $this->instance = new AmazonS3($this->params);
} catch (\Exception $e) { } catch (\Exception $e) {
//ignore //ignore
} }

View File

@ -51,7 +51,7 @@ abstract class StoragesControllerTest extends \Test\TestCase {
/** /**
* @return \OCA\Files_External\Lib\Backend\Backend * @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') $backend = $this->getMockBuilder('\OCA\Files_External\Lib\Backend\Backend')
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
@ -104,7 +104,7 @@ abstract class StoragesControllerTest extends \Test\TestCase {
$response = $this->controller->create( $response = $this->controller->create(
'mount', 'mount',
'\OC\Files\Storage\SMB', '\OCA\Files_External\Lib\Storage\SMB',
'\OCA\Files_External\Lib\Auth\NullMechanism', '\OCA\Files_External\Lib\Auth\NullMechanism',
array(), array(),
[], [],
@ -146,7 +146,7 @@ abstract class StoragesControllerTest extends \Test\TestCase {
$response = $this->controller->update( $response = $this->controller->update(
1, 1,
'mount', 'mount',
'\OC\Files\Storage\SMB', '\OCA\Files_External\Lib\Storage\SMB',
'\OCA\Files_External\Lib\Auth\NullMechanism', '\OCA\Files_External\Lib\Auth\NullMechanism',
array(), array(),
[], [],
@ -188,7 +188,7 @@ abstract class StoragesControllerTest extends \Test\TestCase {
$response = $this->controller->create( $response = $this->controller->create(
$mountPoint, $mountPoint,
'\OC\Files\Storage\SMB', '\OCA\Files_External\Lib\Storage\SMB',
'\OCA\Files_External\Lib\Auth\NullMechanism', '\OCA\Files_External\Lib\Auth\NullMechanism',
array(), array(),
[], [],
@ -202,7 +202,7 @@ abstract class StoragesControllerTest extends \Test\TestCase {
$response = $this->controller->update( $response = $this->controller->update(
1, 1,
$mountPoint, $mountPoint,
'\OC\Files\Storage\SMB', '\OCA\Files_External\Lib\Storage\SMB',
'\OCA\Files_External\Lib\Auth\NullMechanism', '\OCA\Files_External\Lib\Auth\NullMechanism',
array(), array(),
[], [],
@ -279,7 +279,7 @@ abstract class StoragesControllerTest extends \Test\TestCase {
$response = $this->controller->update( $response = $this->controller->update(
255, 255,
'mount', 'mount',
'\OC\Files\Storage\SMB', '\OCA\Files_External\Lib\Storage\SMB',
'\OCA\Files_External\Lib\Auth\NullMechanism', '\OCA\Files_External\Lib\Auth\NullMechanism',
array(), array(),
[], [],
@ -375,7 +375,7 @@ abstract class StoragesControllerTest extends \Test\TestCase {
$response = $this->controller->create( $response = $this->controller->create(
'mount', 'mount',
'\OC\Files\Storage\SMB', '\OCA\Files_External\Lib\Storage\SMB',
'\OCA\Files_External\Lib\Auth\NullMechanism', '\OCA\Files_External\Lib\Auth\NullMechanism',
array(), array(),
[], [],

View File

@ -78,7 +78,7 @@ class UserStoragesControllerTest extends StoragesControllerTest {
$response = $this->controller->create( $response = $this->controller->create(
'mount', 'mount',
'\OC\Files\Storage\SMB', '\OCA\Files_External\Lib\Storage\SMB',
'\Auth\Mechanism', '\Auth\Mechanism',
array(), array(),
[], [],
@ -92,7 +92,7 @@ class UserStoragesControllerTest extends StoragesControllerTest {
$response = $this->controller->update( $response = $this->controller->update(
1, 1,
'mount', 'mount',
'\OC\Files\Storage\SMB', '\OCA\Files_External\Lib\Storage\SMB',
'\Auth\Mechanism', '\Auth\Mechanism',
array(), array(),
[], [],

View File

@ -23,14 +23,14 @@
* *
*/ */
namespace Test\Files\Storage; namespace OCA\Files_External\Tests;
/** /**
* Class OwnCloudFunctions * Class OwnCloudFunctions
* *
* @group DB * @group DB
* *
* @package Test\Files\Storage * @package OCA\Files_External\Tests
*/ */
class OwnCloudFunctions extends \Test\TestCase { class OwnCloudFunctions extends \Test\TestCase {
@ -109,7 +109,7 @@ class OwnCloudFunctions extends \Test\TestCase {
public function testConfig($config, $expectedUri) { public function testConfig($config, $expectedUri) {
$config['user'] = 'someuser'; $config['user'] = 'someuser';
$config['password'] = 'somepassword'; $config['password'] = 'somepassword';
$instance = new \OC\Files\Storage\OwnCloud($config); $instance = new \OCA\Files_External\Lib\Storage\OwnCloud($config);
$this->assertEquals($expectedUri, $instance->createBaseUri()); $this->assertEquals($expectedUri, $instance->createBaseUri());
} }
} }

View File

@ -121,9 +121,9 @@ abstract class StoragesServiceTest extends \Test\TestCase {
$this->backendService->method('getAuthMechanisms') $this->backendService->method('getAuthMechanisms')
->will($this->returnValue($authMechanisms)); ->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 = [ $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:\OCA\Files_External\Lib\Backend\SFTP' => $sftpBackend,
'identifier:sftp_alias' => $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') $backend = $this->getMockBuilder('\OCA\Files_External\Lib\Backend\Backend')
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();

View File

@ -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 * @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; private $config;
@ -44,7 +46,7 @@ class AmazonS3 extends Storage {
if ( ! is_array($this->config) or ! $this->config['run']) { if ( ! is_array($this->config) or ! $this->config['run']) {
$this->markTestSkipped('AmazonS3 backend not configured'); $this->markTestSkipped('AmazonS3 backend not configured');
} }
$this->instance = new \OC\Files\Storage\AmazonS3($this->config); $this->instance = new AmazonS3($this->config);
} }
protected function tearDown() { protected function tearDown() {

View File

@ -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 * @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; private $config;
protected function setUp() { protected function setUp() {
@ -45,7 +47,7 @@ class Dropbox extends Storage {
$this->markTestSkipped('Dropbox backend not configured'); $this->markTestSkipped('Dropbox backend not configured');
} }
$this->config['dropbox']['root'] .= '/' . $id; //make sure we have an new empty folder to work in $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() { protected function tearDown() {

View File

@ -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 * @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; private $config;
protected function setUp() { protected function setUp() {
@ -45,7 +47,7 @@ class FTP extends Storage {
$this->markTestSkipped('FTP backend not configured'); $this->markTestSkipped('FTP backend not configured');
} }
$this->config['root'] .= '/' . $id; //make sure we have an new empty folder to work in $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('/'); $this->instance->mkdir('/');
} }
@ -63,31 +65,31 @@ class FTP extends Storage {
'password' => 'ftp', 'password' => 'ftp',
'root' => '/', 'root' => '/',
'secure' => false ); 'secure' => false );
$instance = new \OC\Files\Storage\FTP($config); $instance = new FTP($config);
$this->assertEquals('ftp://ftp:ftp@localhost/', $instance->constructUrl('')); $this->assertEquals('ftp://ftp:ftp@localhost/', $instance->constructUrl(''));
$config['secure'] = true; $config['secure'] = true;
$instance = new \OC\Files\Storage\FTP($config); $instance = new FTP($config);
$this->assertEquals('ftps://ftp:ftp@localhost/', $instance->constructUrl('')); $this->assertEquals('ftps://ftp:ftp@localhost/', $instance->constructUrl(''));
$config['secure'] = 'false'; $config['secure'] = 'false';
$instance = new \OC\Files\Storage\FTP($config); $instance = new FTP($config);
$this->assertEquals('ftp://ftp:ftp@localhost/', $instance->constructUrl('')); $this->assertEquals('ftp://ftp:ftp@localhost/', $instance->constructUrl(''));
$config['secure'] = 'true'; $config['secure'] = 'true';
$instance = new \OC\Files\Storage\FTP($config); $instance = new FTP($config);
$this->assertEquals('ftps://ftp:ftp@localhost/', $instance->constructUrl('')); $this->assertEquals('ftps://ftp:ftp@localhost/', $instance->constructUrl(''));
$config['root'] = ''; $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')); $this->assertEquals('ftps://ftp:ftp@localhost/somefile.txt', $instance->constructUrl('somefile.txt'));
$config['root'] = '/abc'; $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')); $this->assertEquals('ftps://ftp:ftp@localhost/abc/somefile.txt', $instance->constructUrl('somefile.txt'));
$config['root'] = '/abc/'; $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')); $this->assertEquals('ftps://ftp:ftp@localhost/abc/somefile.txt', $instance->constructUrl('somefile.txt'));
} }
} }

View File

@ -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 * @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; private $config;
@ -49,7 +49,7 @@ class Google extends Storage {
) { ) {
$this->markTestSkipped('Google Drive backend not configured'); $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() { protected function tearDown() {

View File

@ -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 * @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; private $config;
@ -44,7 +46,7 @@ class OwnCloud extends Storage {
$this->markTestSkipped('ownCloud backend not configured'); $this->markTestSkipped('ownCloud backend not configured');
} }
$this->config['owncloud']['root'] .= '/' . $id; //make sure we have an new empty folder to work in $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('/'); $this->instance->mkdir('/');
} }

View File

@ -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 * @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; private $config;
protected function setUp() { protected function setUp() {
@ -44,7 +46,7 @@ class SFTP_Key extends Storage {
} }
// Make sure we have an new empty folder to work in // Make sure we have an new empty folder to work in
$this->config['sftp_key']['root'] .= '/' . $id; $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('/'); $this->instance->mkdir('/');
} }

View File

@ -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 * @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; protected $instance;
@ -50,7 +52,7 @@ class SFTP extends Storage {
$this->markTestSkipped('SFTP backend not configured'); $this->markTestSkipped('SFTP backend not configured');
} }
$this->config['root'] .= '/' . $id; //make sure we have an new empty folder to work in $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('/'); $this->instance->mkdir('/');
} }
@ -66,7 +68,7 @@ class SFTP extends Storage {
* @dataProvider configProvider * @dataProvider configProvider
*/ */
public function testStorageId($config, $expectedStorageId) { public function testStorageId($config, $expectedStorageId) {
$instance = new \OC\Files\Storage\SFTP($config); $instance = new SFTP($config);
$this->assertEquals($expectedStorageId, $instance->getId()); $this->assertEquals($expectedStorageId, $instance->getId());
} }

View File

@ -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 * @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() { protected function setUp() {
parent::setUp(); parent::setUp();
@ -46,7 +48,7 @@ class SMB extends Storage {
$config['root'] .= '/'; $config['root'] .= '/';
} }
$config['root'] .= $id; //make sure we have an new empty folder to work in $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('/'); $this->instance->mkdir('/');
} }
@ -71,7 +73,7 @@ class SMB extends Storage {
} }
public function testStorageId() { public function testStorageId() {
$this->instance = new \OC\Files\Storage\SMB([ $this->instance = new SMB([
'host' => 'testhost', 'host' => 'testhost',
'user' => 'testuser', 'user' => 'testuser',
'password' => 'somepass', 'password' => 'somepass',

View File

@ -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 * @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; private $config;
@ -44,7 +46,7 @@ class Swift extends Storage {
if (!is_array($this->config) or !$this->config['run']) { if (!is_array($this->config) or !$this->config['run']) {
$this->markTestSkipped('OpenStack Object Storage backend not configured'); $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() { protected function tearDown() {

View File

@ -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 * @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() { protected function setUp() {
parent::setUp(); parent::setUp();
@ -46,7 +48,7 @@ class DAV extends Storage {
$this->waitDelay = $config['wait']; $this->waitDelay = $config['wait'];
} }
$config['root'] .= '/' . $id; //make sure we have an new empty folder to work in $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('/'); $this->instance->mkdir('/');
} }

View File

@ -178,7 +178,7 @@ EOF
return; return;
fi 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 FILES_EXTERNAL_BACKEND_ENV_PATH=../apps/files_external/tests/env
for startFile in `ls -1 $FILES_EXTERNAL_BACKEND_ENV_PATH | grep start`; do for startFile in `ls -1 $FILES_EXTERNAL_BACKEND_ENV_PATH | grep start`; do
@ -198,16 +198,17 @@ EOF
# getting backend to test from filename # getting backend to test from filename
# it's the part between the dots startSomething.TestToRun.sh # it's the part between the dots startSomething.TestToRun.sh
testToRun=`echo $startFile | cut -d '-' -f 2` testToRun=`echo $startFile | cut -d '-' -f 2`
testToRun="${testToRun}test.php"
# run the specific test # run the specific test
if [ -z "$NOCOVERAGE" ]; then if [ -z "$NOCOVERAGE" ]; then
rm -rf "coverage-external-html-$1-$name" rm -rf "coverage-external-html-$1-$name"
mkdir "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=$? RESULT=$?
else else
echo "No coverage" 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=$? RESULT=$?
fi fi
else else

View File

@ -8,7 +8,7 @@
<testsuite name='ownCloud files external'> <testsuite name='ownCloud files external'>
<directory suffix=".php">../apps/files_external/tests</directory> <directory suffix=".php">../apps/files_external/tests</directory>
<!-- exclude backends as they are called separately --> <!-- exclude backends as they are called separately -->
<exclude>../apps/files_external/tests/backends/</exclude> <exclude>../apps/files_external/tests/storage/</exclude>
</testsuite> </testsuite>
<!-- filters for code coverage --> <!-- filters for code coverage -->
<filter> <filter>