From c6a5a430093421dedea526cd096e62fd5a4be8d2 Mon Sep 17 00:00:00 2001 From: Sergio Bertolin Date: Thu, 14 Apr 2016 12:27:17 +0000 Subject: [PATCH 1/6] Added tests about overwriting files and folders as recipient --- .../features/bootstrap/BasicStructure.php | 11 +++++++ .../features/bootstrap/FederationContext.php | 2 +- .../federation_features/federated.feature | 30 +++++++++++++++++++ 3 files changed, 42 insertions(+), 1 deletion(-) diff --git a/build/integration/features/bootstrap/BasicStructure.php b/build/integration/features/bootstrap/BasicStructure.php index b8fb516fada..9248b2cd252 100644 --- a/build/integration/features/bootstrap/BasicStructure.php +++ b/build/integration/features/bootstrap/BasicStructure.php @@ -260,6 +260,17 @@ trait BasicStructure { } } + /** + * @Given User :user modifies text of :filename with text :text + * @param string $user + * @param string $filename + * @param string $text + */ + public function modifyTextOfFile($user, $filename, $text) { + self::removeFile("../../data/$user/files", "$filename"); + file_put_contents("../../data/$user/files" . "$filename", "$text"); + } + /** * @BeforeSuite */ diff --git a/build/integration/features/bootstrap/FederationContext.php b/build/integration/features/bootstrap/FederationContext.php index 2809c6974fa..55f3a55da0d 100644 --- a/build/integration/features/bootstrap/FederationContext.php +++ b/build/integration/features/bootstrap/FederationContext.php @@ -12,7 +12,7 @@ require __DIR__ . '/../../vendor/autoload.php'; */ class FederationContext implements Context, SnippetAcceptingContext { - use Sharing; + use WebDav; /** * @Given /^User "([^"]*)" from server "(LOCAL|REMOTE)" shares "([^"]*)" with user "([^"]*)" from server "(LOCAL|REMOTE)"$/ diff --git a/build/integration/federation_features/federated.feature b/build/integration/federation_features/federated.feature index acd1f91e908..7dcf97e5764 100644 --- a/build/integration/federation_features/federated.feature +++ b/build/integration/federation_features/federated.feature @@ -120,6 +120,36 @@ Feature: federated | share_with | user2 | | share_with_displayname | user2 | + Scenario: Overwrite a federated shared file as recipient + Given Using server "REMOTE" + And user "user1" exists + And user "user2" exists + And Using server "LOCAL" + And user "user0" exists + And User "user0" from server "LOCAL" shares "/textfile0.txt" with user "user1" from server "REMOTE" + And User "user1" from server "REMOTE" accepts last pending share + And Using server "REMOTE" + And As an "user1" + And User "user1" modifies text of "/textfile0.txt" with text "BLABLABLA" + When User "user1" uploads file "../../data/user1/files/textfile0.txt" to "/textfile0 (2).txt" + And Downloading file "/textfile0 (2).txt" with range "bytes=0-8" + Then Downloaded content should be "BLABLABLA" + + Scenario: Overwrite a federated shared folder as recipient + Given Using server "REMOTE" + And user "user1" exists + And user "user2" exists + And Using server "LOCAL" + And user "user0" exists + And User "user0" from server "LOCAL" shares "/PARENT" with user "user1" from server "REMOTE" + And User "user1" from server "REMOTE" accepts last pending share + And Using server "REMOTE" + And As an "user1" + And User "user1" modifies text of "/textfile0.txt" with text "BLABLABLA" + When User "user1" uploads file "../../data/user1/files/textfile0.txt" to "/PARENT (2)/textfile0.txt" + And Downloading file "/PARENT (2)/textfile0.txt" with range "bytes=0-8" + Then Downloaded content should be "BLABLABLA" + From a626aa21b1b282f73da7c3e6bd2efb4be25a2f72 Mon Sep 17 00:00:00 2001 From: Sergio Bertolin Date: Fri, 22 Apr 2016 07:44:01 +0000 Subject: [PATCH 2/6] add overwriting using chunking but failing --- .../federation_features/federated.feature | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/build/integration/federation_features/federated.feature b/build/integration/federation_features/federated.feature index 7dcf97e5764..a2922d1c2f2 100644 --- a/build/integration/federation_features/federated.feature +++ b/build/integration/federation_features/federated.feature @@ -150,6 +150,25 @@ Feature: federated And Downloading file "/PARENT (2)/textfile0.txt" with range "bytes=0-8" Then Downloaded content should be "BLABLABLA" + Scenario: Overwrite a federated shared file as recipient using chunking + Given Using server "REMOTE" + And user "user1" exists + And user "user2" exists + And Using server "LOCAL" + And user "user0" exists + And User "user0" from server "LOCAL" shares "/textfile0.txt" with user "user1" from server "REMOTE" + And User "user1" from server "REMOTE" accepts last pending share + And Using server "REMOTE" + And As an "user1" + And using dav path "remote.php/dav" + And user "user1" creates a new chunking upload with id "chunking-43" + And user "user1" uploads new chunk file "3" with "CCCCC" to id "chunking-43" + And user "user1" uploads new chunk file "2" with "BBBBB" to id "chunking-43" + And user "user1" uploads new chunk file "1" with "AAAAA" to id "chunking-43" + And user "user1" moves new chunk file with id "chunking-43" to "/textfile0 (2).txt" + And using dav path "remote.php/webdav" + And Downloading file "/textfile0 (2).txt" with range "bytes=0-4" + Then Downloaded content should be "AAAAA" From f2bf75d3b727cbf82b79d163f1c67ef764a2d445 Mon Sep 17 00:00:00 2001 From: Sergio Bertolin Date: Fri, 22 Apr 2016 08:47:42 +0000 Subject: [PATCH 3/6] userUploadsChunkFileOfWithToWithChecksum has chunking-42 hardcoded --- .../integration/federation_features/federated.feature | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/build/integration/federation_features/federated.feature b/build/integration/federation_features/federated.feature index a2922d1c2f2..ff5001c9e8c 100644 --- a/build/integration/federation_features/federated.feature +++ b/build/integration/federation_features/federated.feature @@ -161,11 +161,11 @@ Feature: federated And Using server "REMOTE" And As an "user1" And using dav path "remote.php/dav" - And user "user1" creates a new chunking upload with id "chunking-43" - And user "user1" uploads new chunk file "3" with "CCCCC" to id "chunking-43" - And user "user1" uploads new chunk file "2" with "BBBBB" to id "chunking-43" - And user "user1" uploads new chunk file "1" with "AAAAA" to id "chunking-43" - And user "user1" moves new chunk file with id "chunking-43" to "/textfile0 (2).txt" + And user "user1" creates a new chunking upload with id "chunking-42" + And user "user1" uploads new chunk file "3" with "CCCCC" to id "chunking-42" + And user "user1" uploads new chunk file "2" with "BBBBB" to id "chunking-42" + And user "user1" uploads new chunk file "1" with "AAAAA" to id "chunking-42" + And user "user1" moves new chunk file with id "chunking-42" to "/textfile0 (2).txt" And using dav path "remote.php/webdav" And Downloading file "/textfile0 (2).txt" with range "bytes=0-4" Then Downloaded content should be "AAAAA" From dc05f979c26c133966c07cf4df00e9746f3e1b12 Mon Sep 17 00:00:00 2001 From: Sergio Bertolin Date: Fri, 22 Apr 2016 09:02:15 +0000 Subject: [PATCH 4/6] Added same test using old chunking --- .../federation_features/federated.feature | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/build/integration/federation_features/federated.feature b/build/integration/federation_features/federated.feature index ff5001c9e8c..e1415e17325 100644 --- a/build/integration/federation_features/federated.feature +++ b/build/integration/federation_features/federated.feature @@ -150,7 +150,7 @@ Feature: federated And Downloading file "/PARENT (2)/textfile0.txt" with range "bytes=0-8" Then Downloaded content should be "BLABLABLA" - Scenario: Overwrite a federated shared file as recipient using chunking + Scenario: Overwrite a federated shared file as recipient using new chunking Given Using server "REMOTE" And user "user1" exists And user "user2" exists @@ -170,6 +170,22 @@ Feature: federated And Downloading file "/textfile0 (2).txt" with range "bytes=0-4" Then Downloaded content should be "AAAAA" + Scenario: Overwrite a federated shared file as recipient using old chunking + Given Using server "REMOTE" + And user "user1" exists + And user "user2" exists + And Using server "LOCAL" + And user "user0" exists + And User "user0" from server "LOCAL" shares "/textfile0.txt" with user "user1" from server "REMOTE" + And User "user1" from server "REMOTE" accepts last pending share + And Using server "REMOTE" + And As an "user1" + And user "user1" uploads chunk file "1" of "3" with "AAAAA" to "/textfile0 (2).txt" + And user "user1" uploads chunk file "2" of "3" with "BBBBB" to "/textfile0 (2).txt" + And user "user1" uploads chunk file "3" of "3" with "CCCCC" to "/textfile0 (2).txt" + And Downloading file "/textfile0 (2).txt" with range "bytes=0-4" + Then Downloaded content should be "AAAAA" + From a7167409e73489175a8ef3934a62137d083eef62 Mon Sep 17 00:00:00 2001 From: Sergio Bertolin Date: Fri, 22 Apr 2016 09:21:58 +0000 Subject: [PATCH 5/6] Added another case about overwriting folder using old chunking --- .../federation_features/federated.feature | 38 +++++++++---------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/build/integration/federation_features/federated.feature b/build/integration/federation_features/federated.feature index e1415e17325..c199ee2af60 100644 --- a/build/integration/federation_features/federated.feature +++ b/build/integration/federation_features/federated.feature @@ -150,26 +150,6 @@ Feature: federated And Downloading file "/PARENT (2)/textfile0.txt" with range "bytes=0-8" Then Downloaded content should be "BLABLABLA" - Scenario: Overwrite a federated shared file as recipient using new chunking - Given Using server "REMOTE" - And user "user1" exists - And user "user2" exists - And Using server "LOCAL" - And user "user0" exists - And User "user0" from server "LOCAL" shares "/textfile0.txt" with user "user1" from server "REMOTE" - And User "user1" from server "REMOTE" accepts last pending share - And Using server "REMOTE" - And As an "user1" - And using dav path "remote.php/dav" - And user "user1" creates a new chunking upload with id "chunking-42" - And user "user1" uploads new chunk file "3" with "CCCCC" to id "chunking-42" - And user "user1" uploads new chunk file "2" with "BBBBB" to id "chunking-42" - And user "user1" uploads new chunk file "1" with "AAAAA" to id "chunking-42" - And user "user1" moves new chunk file with id "chunking-42" to "/textfile0 (2).txt" - And using dav path "remote.php/webdav" - And Downloading file "/textfile0 (2).txt" with range "bytes=0-4" - Then Downloaded content should be "AAAAA" - Scenario: Overwrite a federated shared file as recipient using old chunking Given Using server "REMOTE" And user "user1" exists @@ -183,9 +163,25 @@ Feature: federated And user "user1" uploads chunk file "1" of "3" with "AAAAA" to "/textfile0 (2).txt" And user "user1" uploads chunk file "2" of "3" with "BBBBB" to "/textfile0 (2).txt" And user "user1" uploads chunk file "3" of "3" with "CCCCC" to "/textfile0 (2).txt" - And Downloading file "/textfile0 (2).txt" with range "bytes=0-4" + When Downloading file "/textfile0 (2).txt" with range "bytes=0-4" Then Downloaded content should be "AAAAA" + Scenario: Overwrite a federated shared folder as recipient using old chunking + Given Using server "REMOTE" + And user "user1" exists + And user "user2" exists + And Using server "LOCAL" + And user "user0" exists + And User "user0" from server "LOCAL" shares "/PARENT" with user "user1" from server "REMOTE" + And User "user1" from server "REMOTE" accepts last pending share + And Using server "REMOTE" + And As an "user1" + And user "user1" uploads chunk file "1" of "3" with "AAAAA" to "/PARENT (2)/textfile0.txt" + And user "user1" uploads chunk file "2" of "3" with "BBBBB" to "/PARENT (2)/textfile0.txt" + And user "user1" uploads chunk file "3" of "3" with "CCCCC" to "/PARENT (2)/textfile0.txt" + When Downloading file "/PARENT (2)/textfile0.txt" with range "bytes=5-9" + Then Downloaded content should be "BBBBB" + From 118050dcd08e16e670a198a3d76a7f125683980e Mon Sep 17 00:00:00 2001 From: Sergio Bertolin Date: Thu, 12 May 2016 12:37:55 +0000 Subject: [PATCH 6/6] Get a range from several chunks --- build/integration/federation_features/federated.feature | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/integration/federation_features/federated.feature b/build/integration/federation_features/federated.feature index c199ee2af60..8bf8e921b0f 100644 --- a/build/integration/federation_features/federated.feature +++ b/build/integration/federation_features/federated.feature @@ -179,8 +179,8 @@ Feature: federated And user "user1" uploads chunk file "1" of "3" with "AAAAA" to "/PARENT (2)/textfile0.txt" And user "user1" uploads chunk file "2" of "3" with "BBBBB" to "/PARENT (2)/textfile0.txt" And user "user1" uploads chunk file "3" of "3" with "CCCCC" to "/PARENT (2)/textfile0.txt" - When Downloading file "/PARENT (2)/textfile0.txt" with range "bytes=5-9" - Then Downloaded content should be "BBBBB" + When Downloading file "/PARENT (2)/textfile0.txt" with range "bytes=3-13" + Then Downloaded content should be "AABBBBBCCCC"