From 4b52fe88baaecf6987b07fc4e7c5ab95a50a78d3 Mon Sep 17 00:00:00 2001 From: Armin Date: Wed, 20 Mar 2024 13:14:13 +0100 Subject: [PATCH] Fix publish step sourcesJar --- .../de/cyface/persistence/AndroidTestUtils.java | 4 ++-- .../de/cyface/persistence/GeoLocationTest.java | 2 +- .../de/cyface/persistence/MeasurementTest.java | 12 ++++++------ .../{TestUtils.java => AndroidTestUtils.java} | 2 +- .../synchronization/CyfaceAuthenticatorTest.java | 11 +++++------ .../MeasurementContentProviderClientTest.java | 4 ++-- .../synchronization/SetAccountFlagTest.java | 12 ++++++------ .../cyface/synchronization/SyncAdapterTest.java | 10 +++++----- .../synchronization/SyncPerformerTest.java | 5 ++--- .../synchronization/UploadProgressTest.java | 16 ++++++---------- 10 files changed, 36 insertions(+), 42 deletions(-) rename synchronization/src/androidTest/java/de/cyface/synchronization/{TestUtils.java => AndroidTestUtils.java} (98%) diff --git a/persistence/src/androidTest/java/de/cyface/persistence/AndroidTestUtils.java b/persistence/src/androidTest/java/de/cyface/persistence/AndroidTestUtils.java index dda46272a..09c30301a 100644 --- a/persistence/src/androidTest/java/de/cyface/persistence/AndroidTestUtils.java +++ b/persistence/src/androidTest/java/de/cyface/persistence/AndroidTestUtils.java @@ -44,7 +44,7 @@ * @version 2.0.3 * @since 1.0.0 */ -class TestUtils { +class AndroidTestUtils { static final String AUTHORITY = "de.cyface.persistence.test.provider"; @@ -87,7 +87,7 @@ static void read(final ContentResolver mockResolver, final Uri contentUri, final List fixture = new ArrayList<>(); fixture.add(entry); Validate.notNull(cursor); - TestUtils.compareCursorWithValues(cursor, fixture); + AndroidTestUtils.compareCursorWithValues(cursor, fixture); } } diff --git a/persistence/src/androidTest/java/de/cyface/persistence/GeoLocationTest.java b/persistence/src/androidTest/java/de/cyface/persistence/GeoLocationTest.java index 245549598..2803f1f90 100644 --- a/persistence/src/androidTest/java/de/cyface/persistence/GeoLocationTest.java +++ b/persistence/src/androidTest/java/de/cyface/persistence/GeoLocationTest.java @@ -1,6 +1,6 @@ package de.cyface.persistence; -import static de.cyface.persistence.TestUtils.AUTHORITY; +import static de.cyface.persistence.AndroidTestUtils.AUTHORITY; import static de.cyface.persistence.Utils.getGeoLocationsUri; import static de.cyface.utils.CursorIsNullException.softCatchNullCursor; import static org.hamcrest.CoreMatchers.equalTo; diff --git a/persistence/src/androidTest/java/de/cyface/persistence/MeasurementTest.java b/persistence/src/androidTest/java/de/cyface/persistence/MeasurementTest.java index ef5b8eefa..e4dda525b 100644 --- a/persistence/src/androidTest/java/de/cyface/persistence/MeasurementTest.java +++ b/persistence/src/androidTest/java/de/cyface/persistence/MeasurementTest.java @@ -18,7 +18,7 @@ */ package de.cyface.persistence; -import static de.cyface.persistence.TestUtils.AUTHORITY; +import static de.cyface.persistence.AndroidTestUtils.AUTHORITY; import static de.cyface.persistence.Utils.getEventUri; import static de.cyface.persistence.Utils.getGeoLocationsUri; import static de.cyface.persistence.Utils.getMeasurementUri; @@ -96,9 +96,9 @@ public void tearDown() { public void testCascadingDeleteOneMeasurement() { // Create measurement with data - final long identifier = TestUtils.create(resolver, getMeasurementUri(AUTHORITY), fixtureMeasurement); + final long identifier = AndroidTestUtils.create(resolver, getMeasurementUri(AUTHORITY), fixtureMeasurement); final ContentValues fixtureGeoLocation = geoLocationContentValues(identifier); - TestUtils.create(resolver, getGeoLocationsUri(AUTHORITY), fixtureGeoLocation); + AndroidTestUtils.create(resolver, getGeoLocationsUri(AUTHORITY), fixtureGeoLocation); // Test load the create measurement try (final Cursor measurementCursor = resolver.query(getMeasurementUri(AUTHORITY), null, @@ -111,7 +111,7 @@ public void testCascadingDeleteOneMeasurement() { // Ensure deletion of measurement with data works final int rowsDeleted = resolver.delete(getMeasurementUri(AUTHORITY), null, null); assertThat("Delete was unsuccessful for uri " + getMeasurementUri(AUTHORITY), 2, is(rowsDeleted)); - assertThat(TestUtils.count(resolver, getGeoLocationsUri(AUTHORITY)), is(0)); + assertThat(AndroidTestUtils.count(resolver, getGeoLocationsUri(AUTHORITY)), is(0)); } /** @@ -122,9 +122,9 @@ public void testCascadingDeleteMultipleMeasurements() { // Create measurements with data for (int i = 0; i < 2; i++) { - final long identifier = TestUtils.create(resolver, getMeasurementUri(AUTHORITY), fixtureMeasurement); + final long identifier = AndroidTestUtils.create(resolver, getMeasurementUri(AUTHORITY), fixtureMeasurement); final ContentValues fixtureGeoLocation = geoLocationContentValues(identifier); - TestUtils.create(resolver, getGeoLocationsUri(AUTHORITY), fixtureGeoLocation); + AndroidTestUtils.create(resolver, getGeoLocationsUri(AUTHORITY), fixtureGeoLocation); } // Ensure deletion of measurements with data works diff --git a/synchronization/src/androidTest/java/de/cyface/synchronization/TestUtils.java b/synchronization/src/androidTest/java/de/cyface/synchronization/AndroidTestUtils.java similarity index 98% rename from synchronization/src/androidTest/java/de/cyface/synchronization/TestUtils.java rename to synchronization/src/androidTest/java/de/cyface/synchronization/AndroidTestUtils.java index b7b60b5a3..73ab215d8 100644 --- a/synchronization/src/androidTest/java/de/cyface/synchronization/TestUtils.java +++ b/synchronization/src/androidTest/java/de/cyface/synchronization/AndroidTestUtils.java @@ -26,7 +26,7 @@ * @version 2.4.0 * @since 2.1.0 */ -public final class TestUtils { +public final class AndroidTestUtils { /** * The tag used to identify Logcat messages from this module. */ diff --git a/synchronization/src/androidTest/java/de/cyface/synchronization/CyfaceAuthenticatorTest.java b/synchronization/src/androidTest/java/de/cyface/synchronization/CyfaceAuthenticatorTest.java index 50dc4066a..b3dc71a4c 100644 --- a/synchronization/src/androidTest/java/de/cyface/synchronization/CyfaceAuthenticatorTest.java +++ b/synchronization/src/androidTest/java/de/cyface/synchronization/CyfaceAuthenticatorTest.java @@ -19,9 +19,9 @@ package de.cyface.synchronization; import static de.cyface.synchronization.CyfaceSyncService.AUTH_TOKEN_TYPE; -import static de.cyface.synchronization.TestUtils.ACCOUNT_TYPE; -import static de.cyface.synchronization.TestUtils.AUTHORITY; -import static de.cyface.synchronization.TestUtils.TEST_API_URL; +import static de.cyface.synchronization.AndroidTestUtils.ACCOUNT_TYPE; +import static de.cyface.synchronization.AndroidTestUtils.AUTHORITY; +import static de.cyface.synchronization.AndroidTestUtils.TEST_API_URL; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.CoreMatchers.nullValue; @@ -43,7 +43,6 @@ import android.preference.PreferenceManager; import androidx.test.ext.junit.runners.AndroidJUnit4; -import androidx.test.filters.FlakyTest; import androidx.test.filters.LargeTest; import androidx.test.platform.app.InstrumentationRegistry; import de.cyface.testutils.SharedTestUtils; @@ -93,8 +92,8 @@ public void tearDown() { public void testGetAuthToken() throws NetworkErrorException { // Arrange - Account requestAccount = new Account(TestUtils.DEFAULT_USERNAME, ACCOUNT_TYPE); - accountManager.addAccountExplicitly(requestAccount, TestUtils.DEFAULT_PASSWORD, null); + Account requestAccount = new Account(AndroidTestUtils.DEFAULT_USERNAME, ACCOUNT_TYPE); + accountManager.addAccountExplicitly(requestAccount, AndroidTestUtils.DEFAULT_PASSWORD, null); SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); SharedPreferences.Editor editor = preferences.edit(); diff --git a/synchronization/src/androidTest/java/de/cyface/synchronization/MeasurementContentProviderClientTest.java b/synchronization/src/androidTest/java/de/cyface/synchronization/MeasurementContentProviderClientTest.java index e2cbc54e2..8cd43ef4e 100644 --- a/synchronization/src/androidTest/java/de/cyface/synchronization/MeasurementContentProviderClientTest.java +++ b/synchronization/src/androidTest/java/de/cyface/synchronization/MeasurementContentProviderClientTest.java @@ -22,8 +22,8 @@ import static de.cyface.persistence.Utils.getGeoLocationsUri; import static de.cyface.persistence.Utils.getMeasurementUri; import static de.cyface.persistence.model.MeasurementStatus.OPEN; -import static de.cyface.synchronization.TestUtils.AUTHORITY; -import static de.cyface.synchronization.TestUtils.TAG; +import static de.cyface.synchronization.AndroidTestUtils.AUTHORITY; +import static de.cyface.synchronization.AndroidTestUtils.TAG; import static de.cyface.testutils.SharedTestUtils.clearPersistenceLayer; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.is; diff --git a/synchronization/src/androidTest/java/de/cyface/synchronization/SetAccountFlagTest.java b/synchronization/src/androidTest/java/de/cyface/synchronization/SetAccountFlagTest.java index b3d026a75..2f53a3c76 100644 --- a/synchronization/src/androidTest/java/de/cyface/synchronization/SetAccountFlagTest.java +++ b/synchronization/src/androidTest/java/de/cyface/synchronization/SetAccountFlagTest.java @@ -18,8 +18,8 @@ */ package de.cyface.synchronization; -import static de.cyface.synchronization.TestUtils.ACCOUNT_TYPE; -import static de.cyface.synchronization.TestUtils.AUTHORITY; +import static de.cyface.synchronization.AndroidTestUtils.ACCOUNT_TYPE; +import static de.cyface.synchronization.AndroidTestUtils.AUTHORITY; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertThat; @@ -71,7 +71,7 @@ public class SetAccountFlagTest { /** * Logging TAG to identify logs associated with this test. */ - private final static String TAG = TestUtils.TAG; + private final static String TAG = AndroidTestUtils.TAG; /** * An object of the class under test. */ @@ -145,7 +145,7 @@ public void testSetConnected() throws InterruptedException { // Arrange - nothing to do // Act 1: Create new Account - final Account account = oocut.createAccount(TestUtils.DEFAULT_USERNAME, null); + final Account account = oocut.createAccount(AndroidTestUtils.DEFAULT_USERNAME, null); final CheckerParameters checkerParameters1 = createAccountFlagCheckerParameters(account, false, false, "createAccount()"); @@ -280,9 +280,9 @@ private void assertThatAccountFlagsChangeAsExpected(@NonNull final Account accou private static boolean isAccountFlagsSet(@NonNull final Account account, final boolean syncAutomaticallyEnabled, final boolean periodicSyncEnabled) { - final boolean periodicSyncRegisteredState = ContentResolver.getPeriodicSyncs(account, TestUtils.AUTHORITY) + final boolean periodicSyncRegisteredState = ContentResolver.getPeriodicSyncs(account, AndroidTestUtils.AUTHORITY) .size() > 0; - final boolean autoSyncEnabledState = ContentResolver.getSyncAutomatically(account, TestUtils.AUTHORITY); + final boolean autoSyncEnabledState = ContentResolver.getSyncAutomatically(account, AndroidTestUtils.AUTHORITY); return autoSyncEnabledState == syncAutomaticallyEnabled && periodicSyncRegisteredState == periodicSyncEnabled; } diff --git a/synchronization/src/androidTest/java/de/cyface/synchronization/SyncAdapterTest.java b/synchronization/src/androidTest/java/de/cyface/synchronization/SyncAdapterTest.java index 09f78aef5..e09dc01ba 100644 --- a/synchronization/src/androidTest/java/de/cyface/synchronization/SyncAdapterTest.java +++ b/synchronization/src/androidTest/java/de/cyface/synchronization/SyncAdapterTest.java @@ -18,9 +18,9 @@ */ package de.cyface.synchronization; -import static de.cyface.synchronization.TestUtils.ACCOUNT_TYPE; -import static de.cyface.synchronization.TestUtils.AUTHORITY; -import static de.cyface.synchronization.TestUtils.TAG; +import static de.cyface.synchronization.AndroidTestUtils.ACCOUNT_TYPE; +import static de.cyface.synchronization.AndroidTestUtils.AUTHORITY; +import static de.cyface.synchronization.AndroidTestUtils.TAG; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertThat; @@ -84,8 +84,8 @@ public void setUp() { SharedTestUtils.cleanupOldAccounts(accountManager, ACCOUNT_TYPE, AUTHORITY); // Add new sync account (usually done by DataCapturingService and WifiSurveyor) - account = new Account(TestUtils.DEFAULT_USERNAME, ACCOUNT_TYPE); - accountManager.addAccountExplicitly(account, TestUtils.DEFAULT_PASSWORD, null); + account = new Account(AndroidTestUtils.DEFAULT_USERNAME, ACCOUNT_TYPE); + accountManager.addAccountExplicitly(account, AndroidTestUtils.DEFAULT_PASSWORD, null); } @After diff --git a/synchronization/src/androidTest/java/de/cyface/synchronization/SyncPerformerTest.java b/synchronization/src/androidTest/java/de/cyface/synchronization/SyncPerformerTest.java index a13336cb0..af3a3f99d 100644 --- a/synchronization/src/androidTest/java/de/cyface/synchronization/SyncPerformerTest.java +++ b/synchronization/src/androidTest/java/de/cyface/synchronization/SyncPerformerTest.java @@ -18,8 +18,8 @@ */ package de.cyface.synchronization; -import static de.cyface.synchronization.TestUtils.AUTHORITY; -import static de.cyface.synchronization.TestUtils.TAG; +import static de.cyface.synchronization.AndroidTestUtils.AUTHORITY; +import static de.cyface.synchronization.AndroidTestUtils.TAG; import static de.cyface.testutils.SharedTestUtils.clearPersistenceLayer; import static de.cyface.testutils.SharedTestUtils.insertSampleMeasurementWithData; import static org.hamcrest.CoreMatchers.equalTo; @@ -54,7 +54,6 @@ import android.util.Log; import androidx.test.ext.junit.runners.AndroidJUnit4; -import androidx.test.filters.FlakyTest; import androidx.test.filters.LargeTest; import androidx.test.platform.app.InstrumentationRegistry; diff --git a/synchronization/src/androidTest/java/de/cyface/synchronization/UploadProgressTest.java b/synchronization/src/androidTest/java/de/cyface/synchronization/UploadProgressTest.java index ced94efe1..37a98c3d3 100644 --- a/synchronization/src/androidTest/java/de/cyface/synchronization/UploadProgressTest.java +++ b/synchronization/src/androidTest/java/de/cyface/synchronization/UploadProgressTest.java @@ -22,10 +22,10 @@ import static de.cyface.synchronization.BundlesExtrasCodes.SYNC_PERCENTAGE_ID; import static de.cyface.synchronization.CyfaceSyncService.AUTH_TOKEN_TYPE; import static de.cyface.synchronization.SyncAdapter.MOCK_IS_CONNECTED_TO_RETURN_TRUE; -import static de.cyface.synchronization.TestUtils.ACCOUNT_TYPE; -import static de.cyface.synchronization.TestUtils.AUTHORITY; -import static de.cyface.synchronization.TestUtils.TAG; -import static de.cyface.synchronization.TestUtils.TEST_API_URL; +import static de.cyface.synchronization.AndroidTestUtils.ACCOUNT_TYPE; +import static de.cyface.synchronization.AndroidTestUtils.AUTHORITY; +import static de.cyface.synchronization.AndroidTestUtils.TAG; +import static de.cyface.synchronization.AndroidTestUtils.TEST_API_URL; import static de.cyface.testutils.SharedTestUtils.clearPersistenceLayer; import static de.cyface.testutils.SharedTestUtils.insertGeoLocation; import static de.cyface.testutils.SharedTestUtils.insertMeasurementEntry; @@ -41,13 +41,9 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Mock; -import android.accounts.AbstractAccountAuthenticator; import android.accounts.Account; -import android.accounts.AccountAuthenticatorResponse; import android.accounts.AccountManager; -import android.accounts.NetworkErrorException; import android.content.BroadcastReceiver; import android.content.ContentProvider; import android.content.ContentProviderClient; @@ -115,8 +111,8 @@ public void setUp() throws CursorIsNullException { SharedTestUtils.cleanupOldAccounts(accountManager, ACCOUNT_TYPE, AUTHORITY); // Add new sync account (usually done by DataCapturingService and WifiSurveyor) - account = new Account(TestUtils.DEFAULT_USERNAME, ACCOUNT_TYPE); - accountManager.addAccountExplicitly(account, TestUtils.DEFAULT_PASSWORD, null); + account = new Account(AndroidTestUtils.DEFAULT_USERNAME, ACCOUNT_TYPE); + accountManager.addAccountExplicitly(account, AndroidTestUtils.DEFAULT_PASSWORD, null); oocut = new SyncAdapter(context, false, new MockedHttpConnection(), AUTH_TOKEN_TYPE, new MockAuth(context));