summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/private/Files/ObjectStore/S3ObjectTrait.php4
-rw-r--r--tests/lib/Files/ObjectStore/S3Test.php21
2 files changed, 19 insertions, 6 deletions
diff --git a/lib/private/Files/ObjectStore/S3ObjectTrait.php b/lib/private/Files/ObjectStore/S3ObjectTrait.php
index 6527614e8d5..93204896c1c 100644
--- a/lib/private/Files/ObjectStore/S3ObjectTrait.php
+++ b/lib/private/Files/ObjectStore/S3ObjectTrait.php
@@ -74,7 +74,7 @@ trait S3ObjectTrait {
}
- private function singlePartUpload($urn, $stream) {
+ protected function singlePartUpload($urn, $stream) {
$this->getConnection()->putObject([
'Bucket' => $this->bucket,
'Key' => $urn,
@@ -82,7 +82,7 @@ trait S3ObjectTrait {
]);
}
- private function multiPartUpload($urn, $stream) {
+ protected function multiPartUpload($urn, $stream) {
$uploader = new MultipartUploader($this->getConnection(), $stream, [
'bucket' => $this->bucket,
'key' => $urn,
diff --git a/tests/lib/Files/ObjectStore/S3Test.php b/tests/lib/Files/ObjectStore/S3Test.php
index b93e9beebdc..14167656fb5 100644
--- a/tests/lib/Files/ObjectStore/S3Test.php
+++ b/tests/lib/Files/ObjectStore/S3Test.php
@@ -23,19 +23,32 @@ namespace Test\Files\ObjectStore;
use OC\Files\ObjectStore\S3;
+class MultiPartUploadS3 extends S3 {
+ public function multiPartUpload($urn, $stream) {
+ parent::multiPartUpload($urn, $stream);
+ }
+}
+
/**
* @group PRIMARY-s3
*/
class S3Test extends ObjectStoreTest {
- /**
- * @return \OCP\Files\ObjectStore\IObjectStore
- */
protected function getInstance() {
$config = \OC::$server->getConfig()->getSystemValue('objectstore');
if (!is_array($config) || $config['class'] !== 'OC\\Files\\ObjectStore\\S3') {
$this->markTestSkipped('objectstore not configured for s3');
}
- return new S3($config['arguments']);
+ return new MultiPartUploadS3($config['arguments']);
+ }
+
+ public function testMultiPartUploader() {
+ $s3 = $this->getInstance();
+
+ $s3->multiPartUpload('multiparttest', fopen(__FILE__, 'r'));
+
+ $result = $s3->readObject('multiparttest');
+
+ $this->assertEquals(file_get_contents(__FILE__), stream_get_contents($result));
}
}