Skip to content

Commit d6c17bc

Browse files
author
Josh Deffibaugh
committed
Updates versions and fixes some warnings
1 parent ea46f60 commit d6c17bc

File tree

17 files changed

+29
-47
lines changed

17 files changed

+29
-47
lines changed

android-sdk/src/androidTest/java/com/optimizely/ab/android/sdk/DataFileLoaderTest.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public void existingDataFileWhenRequestingFromClient() throws MalformedURLExcept
6161
when(dataFileClient.request(url)).thenReturn("");
6262
when(dataFileCache.exists()).thenReturn(false);
6363
when(dataFileCache.save("")).thenReturn(true);
64-
String dataFile = task.doInBackground(null);
64+
String dataFile = task.doInBackground();
6565
assertEquals("", dataFile);
6666
verify(dataFileClient).request(url);
6767
verify(dataFileCache).save("");
@@ -77,7 +77,7 @@ public void existingDataFileWhenRequestingFromClientFailsToDelete() throws Malfo
7777
when(dataFileClient.request(url)).thenReturn("");
7878
when(dataFileCache.exists()).thenReturn(true);
7979
when(dataFileCache.delete()).thenReturn(false);
80-
String dataFile = task.doInBackground(null);
80+
String dataFile = task.doInBackground();
8181
assertEquals(null, dataFile);
8282
verify(logger).warn("Unable to delete old data file");
8383
}
@@ -92,7 +92,7 @@ public void existingDataFileWhenRequestingFromClientFailsToSave() throws Malform
9292
when(dataFileClient.request(url)).thenReturn("");
9393
when(dataFileCache.exists()).thenReturn(false);
9494
when(dataFileCache.save("")).thenReturn(false);
95-
String dataFile = task.doInBackground(null);
95+
String dataFile = task.doInBackground();
9696
assertEquals(null, dataFile);
9797
verify(logger).warn("Unable to save new data file");
9898
}
@@ -125,7 +125,7 @@ public void handlesNullListener() {
125125
public void loadFromCache() {
126126
DataFileLoader.LoadDataFileFromCacheTask task = new DataFileLoader.LoadDataFileFromCacheTask(dataFileCache, dataFileLoadedListener);
127127

128-
task.doInBackground(null);
128+
task.doInBackground();
129129
verify(dataFileCache).load();
130130
}
131131

@@ -141,7 +141,6 @@ public void loadFromCacheNullDataFile() {
141141
public void getDataFile() {
142142
DataFileLoader.TaskChain taskChain = mock(DataFileLoader.TaskChain.class);
143143
DataFileLoader dataFileLoader = new DataFileLoader(taskChain, logger);
144-
DataFileLoader.LoadDataFileFromCacheTask task = mock(DataFileLoader.LoadDataFileFromCacheTask.class);
145144
assertTrue(dataFileLoader.getDataFile("1", dataFileLoadedListener));
146145
verify(taskChain).start("1", dataFileLoadedListener);
147146
verify(logger).info("Refreshing data file");

android-sdk/src/main/java/com/optimizely/ab/android/sdk/DataFileCache.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
*/
3535
public class DataFileCache {
3636

37-
static final String OPTLY_DATA_FILE_NAME = "optly-data-file-%s.json";
37+
private static final String OPTLY_DATA_FILE_NAME = "optly-data-file-%s.json";
3838

3939
@NonNull private final Cache cache;
4040
@NonNull private final String projectId;

android-sdk/src/main/java/com/optimizely/ab/android/sdk/DataFileLoadedListener.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515
*/
1616
package com.optimizely.ab.android.sdk;
1717

18-
/**
19-
* Created by jdeffibaugh on 8/12/16 for Optimizely.
20-
*/
2118
public interface DataFileLoadedListener {
2219

2320
void onDataFileLoaded(String dataFile);

android-sdk/src/main/java/com/optimizely/ab/android/sdk/DataFileService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
import org.slf4j.LoggerFactory;
2828

2929
public class DataFileService extends Service {
30-
public static String EXTRA_PROJECT_ID = "com.optimizely.ab.android.EXTRA_PROJECT_ID";
30+
public static final String EXTRA_PROJECT_ID = "com.optimizely.ab.android.EXTRA_PROJECT_ID";
3131
@NonNull private final IBinder binder = new LocalBinder();
3232
Logger logger = LoggerFactory.getLogger(getClass());
3333
private boolean isBound;

build.gradle

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,19 @@ allprojects {
2222
}
2323

2424
ext {
25-
compile_sdk_version = 23
26-
build_tools_version = "23.0.3"
25+
compile_sdk_version = 24
26+
build_tools_version = "24.0.3"
2727
min_sdk_version = 14
28-
target_sdk_version = 23
28+
target_sdk_version = 24
2929

3030
java_core_ver = "0.1.71"
3131
android_logger_ver = "1.3.1"
32-
support_annotations_ver = "23.0.1"
32+
support_annotations_ver = "24.2.1"
3333
junit_ver = "4.12"
3434
mockito_ver = "1.10.19"
35-
support_test_runner_ver = "0.4"
35+
support_test_runner_ver = "0.5"
3636
dexmaker_ver = "1.2"
37-
espresso_ver = "2.2.1"
37+
espresso_ver = "2.2.2"
3838
version_name = "0.0.1"
3939
group_id = "com.optimizely.ab"
4040
}

event-handler/src/androidTest/java/com/optimizely/ab/android/event_handler/EventDispatcherTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ public void handleIntentSchedulesWhenNewEventFailsToSend() throws MalformedURLEx
122122
@Test
123123
public void getIntervalFromIntent() throws MalformedURLException {
124124
String url= "http://www.foo.com";
125-
Event event = new Event(new URL(url), "");
126125

127126
when(eventDAO.getEvents()).thenReturn(new LinkedList<Pair<Long, Event>>());
128127

event-handler/src/androidTest/java/com/optimizely/ab/android/event_handler/OptlyEventHandlerTest.java

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import org.slf4j.Logger;
2828

2929
import java.net.MalformedURLException;
30+
import java.util.HashMap;
3031

3132
import static org.mockito.Matchers.any;
3233
import static org.mockito.Mockito.mock;
@@ -57,28 +58,18 @@ public void setupEventHandler() {
5758

5859
@Test
5960
public void dispatchEventSuccess() throws MalformedURLException {
60-
optlyEventHandler.dispatchEvent(new LogEvent(null, url, null, requestBody));
61+
optlyEventHandler.dispatchEvent(new LogEvent(LogEvent.RequestMethod.POST, url, new HashMap<String, String>(), requestBody));
6162
verify(context).startService(any(Intent.class));
6263
verify(logger).info("Sent url {} to the event handler service", "http://www.foo.com");
6364
}
6465

65-
@Test public void dispatchEventNullURL() {
66-
optlyEventHandler.dispatchEvent(new LogEvent(null, null, null, requestBody));
67-
verify(logger).error("Event dispatcher received a null url");
68-
}
69-
70-
@Test public void dispatchEventNullParams() {
71-
optlyEventHandler.dispatchEvent(new LogEvent(null, url, null, null));
72-
verify(logger).error("Event dispatcher received a null request body");
73-
}
74-
7566
@Test public void dispatchEmptyUrlString() {
76-
optlyEventHandler.dispatchEvent(new LogEvent(null, "", null, requestBody));
67+
optlyEventHandler.dispatchEvent(new LogEvent(LogEvent.RequestMethod.POST, "", new HashMap<String, String>(), requestBody));
7768
verify(logger).error("Event dispatcher received an empty url");
7869
}
7970

8071
@Test public void dispatchEmptyParams() {
81-
optlyEventHandler.dispatchEvent(new LogEvent(null, url, null, ""));
72+
optlyEventHandler.dispatchEvent(new LogEvent(LogEvent.RequestMethod.POST, url, new HashMap<String, String>(), requestBody));
8273
verify(context).startService(any(Intent.class));
8374
verify(logger).info("Sent url {} to the event handler service", "http://www.foo.com");
8475
}

event-handler/src/main/java/com/optimizely/ab/android/event_handler/EventDispatcher.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import com.optimizely.ab.android.shared.OptlyStorage;
2525
import com.optimizely.ab.android.shared.ServiceScheduler;
2626

27-
import org.json.JSONArray;
2827
import org.slf4j.Logger;
2928

3029
import java.net.MalformedURLException;
@@ -115,7 +114,6 @@ private boolean dispatch() {
115114
Iterator<Pair<Long,Event>> iterator = events.iterator();
116115
while (iterator.hasNext()) {
117116
Pair<Long, Event> event = iterator.next();
118-
JSONArray jsonArray = new JSONArray();
119117
boolean eventWasSent = eventClient.sendEvent(event.second);
120118
if (eventWasSent) {
121119
iterator.remove();

event-handler/src/main/java/com/optimizely/ab/android/event_handler/EventIntentService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
public class EventIntentService extends IntentService {
3030
static final String EXTRA_URL = "com.optimizely.ab.android.EXTRA_URL";
31-
static final String EXTRA_REQUEST_BODY = "com.optimizely.ab.andrdoid.EXTRA_REQUEST_BODY";
31+
static final String EXTRA_REQUEST_BODY = "com.optimizely.ab.android.EXTRA_REQUEST_BODY";
3232
static final String EXTRA_INTERVAL = "com.optimizely.ab.android.EXTRA_INTERVAL";
3333
Logger logger = LoggerFactory.getLogger(EventIntentService.class);
3434
@Nullable EventDispatcher eventDispatcher;

shared/src/androidTest/java/com/optimizely/ab/android/shared/CacheTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
@RunWith(AndroidJUnit4.class)
4040
public class CacheTest {
4141

42-
public static final String FILE_NAME = "foo.txt";
42+
private static final String FILE_NAME = "foo.txt";
4343

4444
Cache cache;
4545
Logger logger;

0 commit comments

Comments
 (0)