From 300dd009781148eeb57f448313fb6cbaa987de4e Mon Sep 17 00:00:00 2001 From: alperozturk Date: Thu, 8 May 2025 10:30:03 +0200 Subject: [PATCH 1/3] fixes Signed-off-by: alperozturk --- .../java/com/owncloud/android/AbstractIT.java | 100 ++++++++++++------ 1 file changed, 65 insertions(+), 35 deletions(-) diff --git a/library/src/androidTest/java/com/owncloud/android/AbstractIT.java b/library/src/androidTest/java/com/owncloud/android/AbstractIT.java index 8e91093a2b..4b7ebbf80d 100644 --- a/library/src/androidTest/java/com/owncloud/android/AbstractIT.java +++ b/library/src/androidTest/java/com/owncloud/android/AbstractIT.java @@ -10,7 +10,6 @@ import static junit.framework.TestCase.assertTrue; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; import static org.junit.Assume.assumeTrue; import android.content.Context; @@ -19,6 +18,7 @@ import androidx.test.platform.app.InstrumentationRegistry; +import com.nextcloud.android.lib.resources.files.ToggleFileLockRemoteOperation; import com.nextcloud.common.NextcloudClient; import com.owncloud.android.lib.common.OwnCloudBasicCredentials; import com.owncloud.android.lib.common.OwnCloudClient; @@ -54,6 +54,7 @@ import java.security.NoSuchAlgorithmException; import java.security.cert.CertificateException; import java.security.cert.X509Certificate; +import java.util.concurrent.TimeUnit; import okhttp3.Credentials; @@ -77,7 +78,8 @@ public abstract class AbstractIT { protected String baseFolderPath = "/test_for_build/"; public static final String ASSETS__TEXT_FILE_NAME = "textFile.txt"; - private static String LOCAL_TRUSTSTORE_FILENAME = "knownServers.bks"; + private static final String LOCAL_TRUSTSTORE_FILENAME = "knownServers.bks"; + private static final String TAG = "AbstractIT"; @BeforeClass public static void beforeAll() throws InterruptedException, @@ -115,26 +117,26 @@ public static void beforeAll() throws InterruptedException, } private static void waitForServer(OwnCloudClient client, Uri baseUrl) { - // use http - Uri httpUrl = Uri.parse(baseUrl.toString().replaceFirst("https", "http")); - GetMethod get = new GetMethod(httpUrl + "/status.php"); + String statusUrl = baseUrl + "/status.php"; + GetMethod get; + int maxRetries = 3; - try { - int i = 0; - while (client.executeMethod(get) != HttpStatus.SC_OK && i < 3) { - System.out.println("wait…"); - Thread.sleep(60 * 1000); - i++; - } + for (int i=0;i Date: Thu, 8 May 2025 10:37:45 +0200 Subject: [PATCH 2/3] better log Signed-off-by: alperozturk --- .../java/com/owncloud/android/AbstractIT.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/library/src/androidTest/java/com/owncloud/android/AbstractIT.java b/library/src/androidTest/java/com/owncloud/android/AbstractIT.java index 4b7ebbf80d..d88f1ff419 100644 --- a/library/src/androidTest/java/com/owncloud/android/AbstractIT.java +++ b/library/src/androidTest/java/com/owncloud/android/AbstractIT.java @@ -121,7 +121,7 @@ private static void waitForServer(OwnCloudClient client, Uri baseUrl) { GetMethod get; int maxRetries = 3; - for (int i=0;i Date: Wed, 25 Jun 2025 10:33:34 +0200 Subject: [PATCH 3/3] Update library/src/androidTest/java/com/owncloud/android/AbstractIT.java MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Tom <70907959+ZetaTom@users.noreply.github.com> Signed-off-by: Alper Öztürk <67455295+alperozturk96@users.noreply.github.com> --- .../src/androidTest/java/com/owncloud/android/AbstractIT.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/library/src/androidTest/java/com/owncloud/android/AbstractIT.java b/library/src/androidTest/java/com/owncloud/android/AbstractIT.java index d88f1ff419..d36d360d1f 100644 --- a/library/src/androidTest/java/com/owncloud/android/AbstractIT.java +++ b/library/src/androidTest/java/com/owncloud/android/AbstractIT.java @@ -292,8 +292,7 @@ private void removeOnClient(OwnCloudClient client) { } boolean isRemoteFileRemoved = removeRemoteFile(remotePath); - final var removeFileOperationErrorMessage = ("Failed to remove " + remotePath); - assertTrue(removeFileOperationErrorMessage, isRemoteFileRemoved); + assertTrue("Failed to remove " + remotePath, isRemoteFileRemoved); } boolean isKeyStoreDeleted = new File(context.getFilesDir(), LOCAL_TRUSTSTORE_FILENAME).delete();