Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasKaminsky committed Feb 15, 2020
2 parents 2d82f80 + 490b292 commit 020e5a2
Show file tree
Hide file tree
Showing 12 changed files with 161 additions and 26 deletions.
16 changes: 15 additions & 1 deletion .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,21 @@ steps:

services:
- name: server
image: nextcloudci/server:server-3
image: nextcloudci/server:server-17 # also change in updateScreenshots.sh
commands:
- /usr/local/bin/initnc.sh
- su www-data -c "OC_PASS=user1 php /var/www/html/occ user:add --password-from-env --display-name='User One' user1"
- su www-data -c "OC_PASS=user2 php /var/www/html/occ user:add --password-from-env --display-name='User Two' user2"
- su www-data -c "OC_PASS=user3 php /var/www/html/occ user:add --password-from-env --display-name='User Three' user3"
- su www-data -c "php /var/www/html/occ user:setting user2 files quota 1G"
- su www-data -c "php /var/www/html/occ group:add users"
- su www-data -c "php /var/www/html/occ group:adduser users user1"
- su www-data -c "php /var/www/html/occ group:adduser users user2"
- su www-data -c "git clone -b master https://github.com/nextcloud/activity.git /var/www/html/apps/activity/"
- su www-data -c "php /var/www/html/occ app:enable activity"
- su www-data -c "git clone -b master https://github.com/nextcloud/text.git /var/www/html/apps/text/"
- su www-data -c "php /var/www/html/occ app:enable text"
- /usr/local/bin/run.sh

trigger:
branch:
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion scripts/analysis/findbugs-results.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
387
386
16 changes: 13 additions & 3 deletions scripts/updateScreenshots.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ emulator -avd uiComparison -no-snapshot -gpu swiftshader_indirect -no-window -no
PID=$(echo $!)

## server
docker run --name=uiComparison nextcloudci/server 1>/dev/null &
docker run --name=uiComparison nextcloudci/server:server-17 1>/dev/null &
sleep 5
IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' uiComparison)

Expand All @@ -28,9 +28,19 @@ fi
cp gradle.properties gradle.properties_
sed -i s"/server/$IP/" gradle.properties
scripts/wait_for_emulator.sh
scripts/wait_for_server.sh ${IP}

## update all screenshots
# setup test server
docker exec uiComparison /bin/sh -c "/usr/local/bin/initnc.sh"
docker exec uiComparison /bin/sh -c "su www-data -c \"OC_PASS=user1 php /var/www/html/occ user:add --password-from-env --display-name='User One' user1\""
docker exec uiComparison /bin/sh -c "su www-data -c \"OC_PASS=user2 php /var/www/html/occ user:add --password-from-env --display-name='User Two' user2\""
docker exec uiComparison /bin/sh -c "su www-data -c \"OC_PASS=user3 php /var/www/html/occ user:add --password-from-env --display-name='User Three' user3\""
docker exec uiComparison /bin/sh -c "su www-data -c \"php /var/www/html/occ user:setting user2 files quota 1G\""
docker exec uiComparison /bin/sh -c "su www-data -c \"php /var/www/html/occ group:add users\""
docker exec uiComparison /bin/sh -c "su www-data -c \"php /var/www/html/occ group:adduser users user1\""
docker exec uiComparison /bin/sh -c "su www-data -c \"php /var/www/html/occ group:adduser users user2\""
docker exec uiComparison /bin/sh -c "/usr/local/bin/run.sh"

## update/create all screenshots
./gradlew executeScreenshotTests -Precord

## update screenshots in a class
Expand Down
52 changes: 36 additions & 16 deletions scripts/uploadReport.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
#!/usr/bin/env bash

upload() {
cd $1

find . -type d -exec curl -u $USER:$PASS -X MKCOL $URL/$REMOTE_FOLDER/$(echo {} | sed s#\./##) \;
find . -type f -exec curl -u $USER:$PASS -X PUT $URL/$REMOTE_FOLDER/$(echo {} | sed s#\./##) --upload-file {} \;
echo "Uploaded failing tests to https://www.kaminsky.me/nc-dev/android-integrationTests/$REMOTE_FOLDER"
curl -u $GITHUB_USER:$GITHUB_PASSWORD -X POST https://github.com/gitapi/repos/nextcloud/android/issues/$PR/comments \
-d "{ \"body\" : \"$TYPE test failed: https://www.kaminsky.me/nc-dev/android-integrationTests/$REMOTE_FOLDER \" }"
exit 1
}
#1: LOG_USERNAME
#2: LOG_PASSWORD
#3: DRONE_BUILD_NUMBER
Expand All @@ -13,6 +27,9 @@ ID=$3
USER=$1
PASS=$2
TYPE=$4
PR=$5
GITHUB_USER=$6
GITHUB_PASSWORD=$7
REMOTE_FOLDER=$ID-$TYPE
set -e
Expand All @@ -22,27 +39,30 @@ if [ $TYPE = "IT" ]; then
elif [ $TYPE = "Unit" ]; then
FOLDER=build/reports/tests/testGplayDebugUnitTest
else
FOLDER=build/reports/shot/verification/
FOLDER=build/reports/shot/verification
fi
if [ ! -e $FOLDER ]; then
if [ -e $FOLDER ]; then
upload $FOLDER
else
echo "$TYPE test failed, but no output was generated. Maybe a preliminary stage failed."
curl -u $6:$7 \
-X POST https://github.com/gitapi/repos/nextcloud/android/issues/$5/comments \
curl -u $GITHUB_USER:$GITHUB_PASSWORD \
-X POST https://github.com/gitapi/repos/nextcloud/android/issues/$PR/comments \
-d "{ \"body\" : \"$TYPE test failed, but no output was generated. Maybe a preliminary stage failed. \" }"
exit 1
fi

cd $FOLDER
if [ -e build/reports/androidTests/connected/flavors/GPLAY ] ; then
TYPE="IT"
upload "build/reports/androidTests/connected/flavors/GPLAY"
fi
find . -type d -exec curl -u $USER:$PASS -X MKCOL $URL/$REMOTE_FOLDER/$(echo {} | sed s#\./##) \;
find . -type f -exec curl -u $USER:$PASS -X PUT $URL/$REMOTE_FOLDER/$(echo {} | sed s#\./##) --upload-file {} \;
if [ -e build/reports/tests/testGplayDebugUnitTest ] ; then
TYPE="Unit"
upload "build/reports/tests/testGplayDebugUnitTest"
fi
echo "Uploaded failing tests to https://www.kaminsky.me/nc-dev/android-integrationTests/$REMOTE_FOLDER"
curl -u $6:$7 -X POST https://github.com/gitapi/repos/nextcloud/android/issues/$5/comments \
-d "{ \"body\" : \"$TYPE test failed: https://www.kaminsky.me/nc-dev/android-integrationTests/$REMOTE_FOLDER \" }"
exit 1
if [ -e build/reports/shot/verification ] ; then
TYPE="Screenshot"
upload "build/reports/shot/verification"
fi
fi
2 changes: 1 addition & 1 deletion scripts/wait_for_server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ until [[ $status = "false" ]]; do

if [[ "$status" =~ "false" || "$status" = "" ]]; then
let "counter += 1"
if [[ $counter -gt 2 ]]; then
if [[ $counter -gt 10 ]]; then
echo "Failed to wait for server"
exit 1
fi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,17 @@
import com.facebook.testing.screenshot.Screenshot;
import com.owncloud.android.AbstractIT;
import com.owncloud.android.R;
import com.owncloud.android.lib.resources.files.CreateFolderRemoteOperation;
import com.owncloud.android.lib.resources.files.ExistenceCheckRemoteOperation;
import com.owncloud.android.lib.resources.files.SearchRemoteOperation;
import com.owncloud.android.lib.resources.shares.CreateShareRemoteOperation;
import com.owncloud.android.lib.resources.shares.OCShare;
import com.owncloud.android.lib.resources.shares.ShareType;
import com.owncloud.android.ui.activity.FileDisplayActivity;
import com.owncloud.android.ui.events.SearchEvent;

import org.greenrobot.eventbus.EventBus;
import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;

Expand All @@ -40,6 +49,8 @@
import static androidx.test.espresso.Espresso.onView;
import static androidx.test.espresso.action.ViewActions.click;
import static androidx.test.espresso.matcher.ViewMatchers.withId;
import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
import static junit.framework.TestCase.assertTrue;


public class FileDisplayActivityIT extends AbstractIT {
Expand Down Expand Up @@ -69,6 +80,53 @@ public void drawer() {
Screenshot.snapActivity(sut).record();
}

@Test
public void showShares() {
assertTrue(new ExistenceCheckRemoteOperation("/shareToAdmin/", true).execute(client).isSuccess());
assertTrue(new CreateFolderRemoteOperation("/shareToAdmin/", true).execute(client).isSuccess());
assertTrue(new CreateFolderRemoteOperation("/shareToGroup/", true).execute(client).isSuccess());
assertTrue(new CreateFolderRemoteOperation("/shareViaLink/", true).execute(client).isSuccess());
assertTrue(new CreateFolderRemoteOperation("/noShare/", true).execute(client).isSuccess());

// share folder to user "admin"
assertTrue(new CreateShareRemoteOperation("/shareToAdmin/",
ShareType.USER,
"admin",
false,
"",
OCShare.MAXIMUM_PERMISSIONS_FOR_FOLDER)
.execute(client).isSuccess());

// share folder via public link
assertTrue(new CreateShareRemoteOperation("/shareViaLink/",
ShareType.PUBLIC_LINK,
"",
true,
"",
OCShare.READ_PERMISSION_FLAG)
.execute(client).isSuccess());

// share folder to group
Assert.assertTrue(new CreateShareRemoteOperation("/shareToGroup/",
ShareType.GROUP,
"users",
false,
"",
OCShare.DEFAULT_PERMISSION)
.execute(client).isSuccess());

Activity sut = activityRule.launchActivity(null);

getInstrumentation().waitForIdleSync();

EventBus.getDefault().post(new SearchEvent("",
SearchRemoteOperation.SearchType.SHARED_FILTER));

getInstrumentation().waitForIdleSync();

Screenshot.snapActivity(sut).record();
}

@Test
public void showAccounts() {
Activity sut = activityRule.launchActivity(null);
Expand Down
22 changes: 22 additions & 0 deletions src/androidTest/java/com/owncloud/android/AbstractIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,16 @@
import com.owncloud.android.lib.common.OwnCloudClient;
import com.owncloud.android.lib.common.OwnCloudClientFactory;
import com.owncloud.android.lib.common.accounts.AccountUtils;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.resources.files.ReadFolderRemoteOperation;
import com.owncloud.android.lib.resources.files.RemoveFileRemoteOperation;
import com.owncloud.android.lib.resources.files.model.RemoteFile;
import com.owncloud.android.utils.FileStorageUtils;

import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.io.FileUtils;
import org.junit.After;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
Expand All @@ -42,6 +47,7 @@
import static androidx.test.InstrumentationRegistry.getInstrumentation;
import static androidx.test.espresso.Espresso.onView;
import static androidx.test.espresso.matcher.ViewMatchers.withId;
import static org.junit.Assert.assertTrue;


/**
Expand Down Expand Up @@ -102,6 +108,22 @@ public static void beforeAll() {
}
}

@After
public void after() {
RemoteOperationResult result = new ReadFolderRemoteOperation("/").execute(client);
assertTrue(result.getLogMessage(), result.isSuccess());

for (Object object : result.getData()) {
RemoteFile remoteFile = (RemoteFile) object;

if (!remoteFile.getRemotePath().equals("/")) {
assertTrue(new RemoveFileRemoteOperation(remoteFile.getRemotePath())
.execute(client).isSuccess());
}
}
}


FileDataStorageManager getStorageManager() {
return new FileDataStorageManager(account, targetContext.getContentResolver());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ private void selectNavigationItem(final MenuItem menuItem) {
}
break;
case R.id.nav_shared:
handleSearchEvents(new SearchEvent("", SearchRemoteOperation.SearchType.SHARED_SEARCH),
handleSearchEvents(new SearchEvent("", SearchRemoteOperation.SearchType.SHARED_FILTER),
menuItem.getItemId());
break;
case R.id.nav_recently_modified:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ public class OCFileListFragment extends ExtendedListFragment implements
protected SearchType currentSearchType;
protected boolean searchFragment;
protected SearchEvent searchEvent;
protected AsyncTask remoteOperationAsyncTask;
protected AsyncTask<Void, Void, Boolean> remoteOperationAsyncTask;
protected String mLimitToMimeType;

@Inject DeviceInfo deviceInfo;
Expand Down Expand Up @@ -388,6 +388,10 @@ protected void prepareCurrentSearch(SearchEvent event) {
currentSearchType = SearchType.RECENTLY_MODIFIED_SEARCH;
break;

case SHARED_FILTER:
currentSearchType = SearchType.SHARED_FILTER;
break;

default:
// do nothing
break;
Expand Down Expand Up @@ -1587,7 +1591,7 @@ protected void onPostExecute(Boolean bool) {
}
};

remoteOperationAsyncTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, true);
remoteOperationAsyncTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}

@Subscribe(threadMode = ThreadMode.BACKGROUND)
Expand Down Expand Up @@ -1700,7 +1704,8 @@ private boolean isSearchEventSet(SearchEvent event) {
return event != null &&
event.getSearchType() != null &&
(!TextUtils.isEmpty(event.getSearchQuery()) ||
event.searchType == SearchRemoteOperation.SearchType.SHARED_SEARCH);
event.searchType == SearchRemoteOperation.SearchType.SHARED_SEARCH ||
event.searchType == SearchRemoteOperation.SearchType.SHARED_FILTER);
}

private void syncAndCheckFiles(Collection<OCFile> files) {
Expand Down
1 change: 1 addition & 0 deletions src/main/res/values-lt-rLT/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,7 @@
<string name="sync_file_nothing_to_do_msg">Failo turinys jau sunchronizuotas</string>
<string name="sync_foreign_files_forgotten_ticker">Keli vietiniai failai buvo užmiršti</string>
<string name="sync_in_progress">Gaunama paskiausia failo versija.</string>
<string name="sync_not_enough_space_dialog_title">Trūksta vietos</string>
<string name="sync_string_files">Failai</string>
<string name="synced_folder_settings_button">Nustatymų mygtukas</string>
<string name="synced_folders_configure_folders">Konfigūruokite aplankus</string>
Expand Down
5 changes: 5 additions & 0 deletions src/main/res/values-tr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@
<string name="copy_move_to_encrypted_folder_not_supported">Şifrelenmiş bir klasöre kopyalama ve taşıma işlemleri henüz desteklenmiyor.</string>
<string name="copy_to">Şuraya kopyala …</string>
<string name="could_not_download_image">Tam boyuttaki görsel indirilemedi</string>
<string name="could_not_retrieve_url">Adres alınamadı</string>
<string name="create_dir_fail_msg">Klasör oluşturulamadı</string>
<string name="create_new">Yeni ekle</string>
<string name="create_new_document">Yeni belge</string>
Expand Down Expand Up @@ -672,6 +673,10 @@
<string name="sync_foreign_files_forgotten_explanation">1.3.16 sürümünden sonra, veri kaybının önlenebilmesi için bu aygıttan yüklenen dosyalar, bir dosya birden fazla hesapla eşitlendiğinde %1$s yerel klasörüne kopyalanır.\n\nBu değişiklikten dolayı, bu uygulamanın yüklenmiş tüm önceki sürümündeki dosyalar %2$s klasörüne kopyalandı. Ancak hesap eşitlemesi sırasında bu işlemin tamamlanmasını engelleyen bir sorun çıktı. Dosyaları olduğu gibi bırakabilir ve %3$s bağlantısını kaldırabilir ya da dosyaları %1$s klasörüne taşıyıp %4$s bağlantısını koruyabilirsiniz.\n\nYerel dosyaları ve bağlı oldukları %5$s içindeki uzak dosyaların listesini aşağıda görebilirsiniz.</string>
<string name="sync_foreign_files_forgotten_ticker">Bazı yerel dosyalar unutulmuş</string>
<string name="sync_in_progress">Lütfen dosyanın en son sürümü alınırken bekleyin.</string>
<string name="sync_not_enough_space_dialog_action_choose">Eşitlenecek ögeleri seçin</string>
<string name="sync_not_enough_space_dialog_action_free_space">Yer aç</string>
<string name="sync_not_enough_space_dialog_placeholder">%1$s, %2$s, ancak aygıt üzerinde yalnız %3$s yer var.</string>
<string name="sync_not_enough_space_dialog_title">Yeterli alan yok</string>
<string name="sync_status_button">Eşitleme durumu düğmesi</string>
<string name="sync_string_files">Dosyalar</string>
<string name="synced_folder_settings_button">Ayarlar düğmesi</string>
Expand Down

0 comments on commit 020e5a2

Please sign in to comment.