Skip to content

Commit

Permalink
Fix publish step sourcesJar
Browse files Browse the repository at this point in the history
  • Loading branch information
hb0 committed Mar 20, 2024
1 parent 45c36f7 commit 4b52fe8
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down Expand Up @@ -87,7 +87,7 @@ static void read(final ContentResolver mockResolver, final Uri contentUri, final
List<ContentValues> fixture = new ArrayList<>();
fixture.add(entry);
Validate.notNull(cursor);
TestUtils.compareCursorWithValues(cursor, fixture);
AndroidTestUtils.compareCursorWithValues(cursor, fixture);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand All @@ -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));
}

/**
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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.
*/
Expand Down Expand Up @@ -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()");

Expand Down Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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));
Expand Down

0 comments on commit 4b52fe8

Please sign in to comment.