From 84119661f053c20587c0f6164139426c4c5a4960 Mon Sep 17 00:00:00 2001 From: Martin Ndegwa Date: Wed, 18 Sep 2024 17:15:38 +0300 Subject: [PATCH] Revert "Disable failing tests" This reverts commit 5bdafb144a8051ec3df9485e7496f708493410c3. --- .../io/ona/kujaku/services/TrackingService.java | 2 +- .../MapboxOfflineDownloaderServiceTest.java | 15 ++++++--------- .../ona/kujaku/services/TrackingServiceTest.java | 3 --- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/library/src/main/java/io/ona/kujaku/services/TrackingService.java b/library/src/main/java/io/ona/kujaku/services/TrackingService.java index e3c4f924..9359d4bf 100644 --- a/library/src/main/java/io/ona/kujaku/services/TrackingService.java +++ b/library/src/main/java/io/ona/kujaku/services/TrackingService.java @@ -502,7 +502,7 @@ private synchronized void recordPendingLocation() { /** * Volatile because different methods are called from the main thread and serviceThread */ - private final LocationListener locationListener = new LocationListener() { + private volatile LocationListener locationListener = new LocationListener() { @Override public void onStatusChanged(String provider, int status, Bundle extras) { diff --git a/library/src/test/java/io/ona/kujaku/services/MapboxOfflineDownloaderServiceTest.java b/library/src/test/java/io/ona/kujaku/services/MapboxOfflineDownloaderServiceTest.java index c84dc5b8..4d1ef513 100644 --- a/library/src/test/java/io/ona/kujaku/services/MapboxOfflineDownloaderServiceTest.java +++ b/library/src/test/java/io/ona/kujaku/services/MapboxOfflineDownloaderServiceTest.java @@ -21,7 +21,6 @@ import org.json.JSONObject; import org.junit.After; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mockito; @@ -66,6 +65,11 @@ import static org.junit.Assert.fail; import static org.mockito.Mockito.mock; +/** + * + * + * Created by Ephraim Kigamba - ekigamba@ona.io on 05/12/2017. + */ @RunWith(RobolectricTestRunner.class) @Config(manifest = Config.NONE, shadows = { @@ -85,7 +89,7 @@ public class MapboxOfflineDownloaderServiceTest { private Context context; private MapboxOfflineDownloaderService mapboxOfflineDownloaderService; - private final String sampleValidMapboxStyleURL = "mapbox://styles/ona/90kiosdcIJ3d"; + private String sampleValidMapboxStyleURL = "mapbox://styles/ona/90kiosdcIJ3d"; private String mapboxAccessToken; private float minZoom = 22; private float maxZoom = 10; @@ -241,19 +245,16 @@ public void persistOfflineMapTaskShouldSaveQueueTaskWhenGivenValidDownloadTask() } @Test - @Ignore("Hanging on CI") public void sendBroadcastShouldProduceValidIntentWhenGivenDownloadUpdate() { assertValidBroadcastCreatedWhenSendBroadcastIsCalled(MapboxOfflineDownloaderService.SERVICE_ACTION_RESULT.SUCCESSFUL, mapName, "9.0%", MapboxOfflineDownloaderService.SERVICE_ACTION.DOWNLOAD_MAP); } @Test - @Ignore("Hanging on CI") public void sendBroadcast2ShouldProduceValidIntentWhenGivenDownloadUpdate() { assertValidBroadcastCreatedWhenSendBroadcast2IsCalled(MapboxOfflineDownloaderService.SERVICE_ACTION_RESULT.SUCCESSFUL, mapName, MapboxOfflineDownloaderService.SERVICE_ACTION.DELETE_MAP); } @Test - @Ignore("Hanging on CI") public void mapboxTileLimitExceededShouldCreateValidBroadcast() throws InterruptedException, NoSuchFieldException, IllegalAccessException { latch = new CountDownLatch(1); @@ -269,7 +270,6 @@ public void mapboxTileLimitExceededShouldCreateValidBroadcast() throws Interrupt } @Test - @Ignore("Failing : To Do Fix") public void onErrorShouldCreateValidBroadcastWhenGivenNonEmptyReasonAndMessage() throws NoSuchFieldException, IllegalAccessException { latch = new CountDownLatch(1); @@ -286,7 +286,6 @@ public void onErrorShouldCreateValidBroadcastWhenGivenNonEmptyReasonAndMessage() } @Test - @Ignore("Hanging on CI") public void onErrorShouldCreateValidBroadcastWhenGivenNonEmptyReasonAndEmptyMessage() throws NoSuchFieldException, IllegalAccessException, InterruptedException { latch = new CountDownLatch(1); @@ -304,7 +303,6 @@ public void onErrorShouldCreateValidBroadcastWhenGivenNonEmptyReasonAndEmptyMess } @Test - @Ignore("Hanging on CI") public void onStatusChangedShouldShowProgressNotificationWhenGivenIncompleteOfflineRegionStatus() throws NoSuchFieldException, IllegalAccessException, InterruptedException, NoSuchMethodException, InvocationTargetException { latch = new CountDownLatch(1); OfflineRegionStatus incompleteOfflineRegionStatus = createOfflineRegion(OfflineRegion.STATE_ACTIVE, 200, 98923, 898, 230909, 300, true, false); @@ -427,7 +425,6 @@ public void getTaskStatusShouldUpdateCurrentDownloadMapNameWhenGivenValidDeleteQ } @Test - @Ignore("Hanging on CI") public synchronized void onStatusChangedShouldShowDownloadCompleteNotificationWhenGivenCompletedOfflineRegion() throws Throwable { latch = new CountDownLatch(1); OfflineRegionStatus completeOfflineRegionStatus = createOfflineRegion(OfflineRegion.STATE_ACTIVE, 300, 98923, 898, 230909, 300, true, true); diff --git a/library/src/test/java/io/ona/kujaku/services/TrackingServiceTest.java b/library/src/test/java/io/ona/kujaku/services/TrackingServiceTest.java index 2309d4ac..e6e40d76 100644 --- a/library/src/test/java/io/ona/kujaku/services/TrackingServiceTest.java +++ b/library/src/test/java/io/ona/kujaku/services/TrackingServiceTest.java @@ -192,7 +192,6 @@ public void testTrackingServiceDefaultUiConfiguration() { } @Test - @Ignore("Hanging on CI") public void testStartAndBindService() throws InterruptedException { CountDownLatch latch1 = new CountDownLatch(1); CountDownLatch latch2 = new CountDownLatch(1); @@ -222,7 +221,6 @@ public void onServiceDisconnected(ComponentName name) { } @Test - @Ignore("Hanging on CI") public void testServiceWithLocationInDistanceTolerance() throws InterruptedException { controller = Robolectric.buildService(TrackingService.class, TrackingService.getIntent(context, MapActivity.class, new TrackingServiceHighAccuracyOptions())); @@ -320,7 +318,6 @@ public void onServiceDisconnected() { } @Test - @Ignore("Flakey Unit Test : To Do Fix") public void testServiceWithTags() throws InterruptedException { long startTag = 1000; long nextTag = 2000;