Skip to content

Commit 0f998e1

Browse files
authored
Merge pull request #98 from optimizely/devel
2 parents 1a1fddf + 7fe96ad commit 0f998e1

File tree

66 files changed

+1043
-889
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+1043
-889
lines changed

CHANGELOG.md

+14
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
11
# Optimizely Android X SDK Changelog
2+
### 1.2.0
3+
March 20, 2017
4+
5+
- Add event tags to the `track` API
6+
- Deprecated `eventValue` parameter from the `track` API. Use event tags to pass in event value instead
7+
- Update to java-core 1.6.0 (https://github.com/optimizely/java-sdk/blob/master/CHANGELOG.md#160)
8+
9+
### 1.1.0
10+
February 17, 2017
11+
12+
- Support Android TV SDK client engine
13+
- Update to java-core 1.5.0 (https://github.com/optimizely/java-sdk/blob/master/CHANGELOG.md#150)
14+
15+
216
### 1.0.0
317
January 23, 2017
418

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@
187187
same "printed page" as the copyright notice for easier
188188
identification within third-party archives.
189189

190-
Copyright 2016, Optimizely
190+
Copyright 2016-2017, Optimizely, Inc. and contributors
191191

192192
Licensed under the Apache License, Version 2.0 (the "License");
193193
you may not use this file except in compliance with the License.

android-sdk/build.gradle

+15-15
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
/*
2-
* Copyright 2016, Optimizely
3-
* <p/>
4-
* Licensed under the Apache License, Version 2.0 (the "License");
5-
* you may not use this file except in compliance with the License.
6-
* You may obtain a copy of the License at
7-
* <p/>
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
* <p/>
10-
* Unless required by applicable law or agreed to in writing, software
11-
* distributed under the License is distributed on an "AS IS" BASIS,
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
* See the License for the specific language governing permissions and
14-
* limitations under the License.
15-
*/
1+
/****************************************************************************
2+
* Copyright 2016, Optimizely, Inc. and contributors *
3+
* *
4+
* Licensed under the Apache License, Version 2.0 (the "License"); *
5+
* you may not use this file except in compliance with the License. *
6+
* You may obtain a copy of the License at *
7+
* *
8+
* http://www.apache.org/licenses/LICENSE-2.0 *
9+
* *
10+
* Unless required by applicable law or agreed to in writing, software *
11+
* distributed under the License is distributed on an "AS IS" BASIS, *
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
13+
* See the License for the specific language governing permissions and *
14+
* limitations under the License. *
15+
***************************************************************************/
1616

1717
apply plugin: 'com.android.library'
1818
apply plugin: 'maven'

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

+16-16
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
1-
/*
2-
* Copyright 2016, Optimizely
3-
* <p/>
4-
* Licensed under the Apache License, Version 2.0 (the "License");
5-
* you may not use this file except in compliance with the License.
6-
* You may obtain a copy of the License at
7-
* <p/>
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
* <p/>
10-
* Unless required by applicable law or agreed to in writing, software
11-
* distributed under the License is distributed on an "AS IS" BASIS,
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
* See the License for the specific language governing permissions and
14-
* limitations under the License.
15-
*/
1+
/****************************************************************************
2+
* Copyright 2016, Optimizely, Inc. and contributors *
3+
* *
4+
* Licensed under the Apache License, Version 2.0 (the "License"); *
5+
* you may not use this file except in compliance with the License. *
6+
* You may obtain a copy of the License at *
7+
* *
8+
* http://www.apache.org/licenses/LICENSE-2.0 *
9+
* *
10+
* Unless required by applicable law or agreed to in writing, software *
11+
* distributed under the License is distributed on an "AS IS" BASIS, *
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
13+
* See the License for the specific language governing permissions and *
14+
* limitations under the License. *
15+
***************************************************************************/
16+
1617
package com.optimizely.ab.android.sdk;
1718

1819
import android.support.test.InstrumentationRegistry;
@@ -27,7 +28,6 @@
2728
import org.junit.runners.JUnit4;
2829
import org.slf4j.Logger;
2930

30-
import java.io.FileNotFoundException;
3131
import java.io.IOException;
3232
import java.util.List;
3333

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

+16-17
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
1-
/*
2-
* Copyright 2016, Optimizely
3-
* <p/>
4-
* Licensed under the Apache License, Version 2.0 (the "License");
5-
* you may not use this file except in compliance with the License.
6-
* You may obtain a copy of the License at
7-
* <p/>
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
* <p/>
10-
* Unless required by applicable law or agreed to in writing, software
11-
* distributed under the License is distributed on an "AS IS" BASIS,
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
* See the License for the specific language governing permissions and
14-
* limitations under the License.
15-
*/
1+
/****************************************************************************
2+
* Copyright 2016, Optimizely, Inc. and contributors *
3+
* *
4+
* Licensed under the Apache License, Version 2.0 (the "License"); *
5+
* you may not use this file except in compliance with the License. *
6+
* You may obtain a copy of the License at *
7+
* *
8+
* http://www.apache.org/licenses/LICENSE-2.0 *
9+
* *
10+
* Unless required by applicable law or agreed to in writing, software *
11+
* distributed under the License is distributed on an "AS IS" BASIS, *
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
13+
* See the License for the specific language governing permissions and *
14+
* limitations under the License. *
15+
***************************************************************************/
16+
1617
package com.optimizely.ab.android.sdk;
1718

1819
import android.support.test.InstrumentationRegistry;
@@ -27,11 +28,9 @@
2728
import org.junit.runner.RunWith;
2829
import org.slf4j.Logger;
2930

30-
import java.io.FileNotFoundException;
3131
import java.io.IOException;
3232

3333
import static junit.framework.Assert.assertEquals;
34-
import static junit.framework.Assert.assertFalse;
3534
import static junit.framework.Assert.assertNotNull;
3635
import static junit.framework.Assert.assertNull;
3736
import static junit.framework.Assert.assertTrue;

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

+16-16
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
/*
2-
* Copyright 2016, Optimizely
3-
* <p/>
4-
* Licensed under the Apache License, Version 2.0 (the "License");
5-
* you may not use this file except in compliance with the License.
6-
* You may obtain a copy of the License at
7-
* <p/>
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
* <p/>
10-
* Unless required by applicable law or agreed to in writing, software
11-
* distributed under the License is distributed on an "AS IS" BASIS,
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
* See the License for the specific language governing permissions and
14-
* limitations under the License.
15-
*/
16-
package com.optimizely.ab.android.sdk;
1+
/****************************************************************************
2+
* Copyright 2016, Optimizely, Inc. and contributors *
3+
* *
4+
* Licensed under the Apache License, Version 2.0 (the "License"); *
5+
* you may not use this file except in compliance with the License. *
6+
* You may obtain a copy of the License at *
7+
* *
8+
* http://www.apache.org/licenses/LICENSE-2.0 *
9+
* *
10+
* Unless required by applicable law or agreed to in writing, software *
11+
* distributed under the License is distributed on an "AS IS" BASIS, *
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
13+
* See the License for the specific language governing permissions and *
14+
* limitations under the License. *
15+
***************************************************************************/
1716

17+
package com.optimizely.ab.android.sdk;
1818

1919
import com.optimizely.ab.android.shared.Client;
2020

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

+16-16
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
1-
/*
2-
* Copyright 2016, Optimizely
3-
* <p/>
4-
* Licensed under the Apache License, Version 2.0 (the "License");
5-
* you may not use this file except in compliance with the License.
6-
* You may obtain a copy of the License at
7-
* <p/>
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
* <p/>
10-
* Unless required by applicable law or agreed to in writing, software
11-
* distributed under the License is distributed on an "AS IS" BASIS,
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
* See the License for the specific language governing permissions and
14-
* limitations under the License.
15-
*/
1+
/****************************************************************************
2+
* Copyright 2016, Optimizely, Inc. and contributors *
3+
* *
4+
* Licensed under the Apache License, Version 2.0 (the "License"); *
5+
* you may not use this file except in compliance with the License. *
6+
* You may obtain a copy of the License at *
7+
* *
8+
* http://www.apache.org/licenses/LICENSE-2.0 *
9+
* *
10+
* Unless required by applicable law or agreed to in writing, software *
11+
* distributed under the License is distributed on an "AS IS" BASIS, *
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
13+
* See the License for the specific language governing permissions and *
14+
* limitations under the License. *
15+
***************************************************************************/
16+
1617
package com.optimizely.ab.android.sdk;
1718

1819
import android.content.Context;
@@ -168,5 +169,4 @@ public void warningsAreLogged() throws IOException {
168169
verify(logger).warn("Unable to save new datafile");
169170
verify(dataFileLoadedListener, atMost(1)).onDataFileLoaded("{}");
170171
}
171-
172172
}

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

+16-15
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
1-
/*
2-
* Copyright 2016, Optimizely
3-
* <p/>
4-
* Licensed under the Apache License, Version 2.0 (the "License");
5-
* you may not use this file except in compliance with the License.
6-
* You may obtain a copy of the License at
7-
* <p/>
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
* <p/>
10-
* Unless required by applicable law or agreed to in writing, software
11-
* distributed under the License is distributed on an "AS IS" BASIS,
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
* See the License for the specific language governing permissions and
14-
* limitations under the License.
15-
*/
1+
/****************************************************************************
2+
* Copyright 2016, Optimizely, Inc. and contributors *
3+
* *
4+
* Licensed under the Apache License, Version 2.0 (the "License"); *
5+
* you may not use this file except in compliance with the License. *
6+
* You may obtain a copy of the License at *
7+
* *
8+
* http://www.apache.org/licenses/LICENSE-2.0 *
9+
* *
10+
* Unless required by applicable law or agreed to in writing, software *
11+
* distributed under the License is distributed on an "AS IS" BASIS, *
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
13+
* See the License for the specific language governing permissions and *
14+
* limitations under the License. *
15+
***************************************************************************/
16+
1617
package com.optimizely.ab.android.sdk;
1718

1819
import android.annotation.TargetApi;

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

+16-16
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
1-
/*
2-
* Copyright 2016, Optimizely
3-
* <p/>
4-
* Licensed under the Apache License, Version 2.0 (the "License");
5-
* you may not use this file except in compliance with the License.
6-
* You may obtain a copy of the License at
7-
* <p/>
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
* <p/>
10-
* Unless required by applicable law or agreed to in writing, software
11-
* distributed under the License is distributed on an "AS IS" BASIS,
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
* See the License for the specific language governing permissions and
14-
* limitations under the License.
15-
*/
1+
/****************************************************************************
2+
* Copyright 2016, Optimizely, Inc. and contributors *
3+
* *
4+
* Licensed under the Apache License, Version 2.0 (the "License"); *
5+
* you may not use this file except in compliance with the License. *
6+
* You may obtain a copy of the License at *
7+
* *
8+
* http://www.apache.org/licenses/LICENSE-2.0 *
9+
* *
10+
* Unless required by applicable law or agreed to in writing, software *
11+
* distributed under the License is distributed on an "AS IS" BASIS, *
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
13+
* See the License for the specific language governing permissions and *
14+
* limitations under the License. *
15+
***************************************************************************/
16+
1617
package com.optimizely.ab.android.sdk;
1718

1819
import android.content.Context;
@@ -38,7 +39,6 @@
3839
import static junit.framework.Assert.assertTrue;
3940
import static org.mockito.Mockito.mock;
4041
import static org.mockito.Mockito.verify;
41-
import static org.mockito.Mockito.when;
4242

4343
/**
4444
* Test for {@link DataFileService}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/****************************************************************************
2+
* Copyright 2017, Optimizely, Inc. and contributors *
3+
* *
4+
* Licensed under the Apache License, Version 2.0 (the "License"); *
5+
* you may not use this file except in compliance with the License. *
6+
* You may obtain a copy of the License at *
7+
* *
8+
* http://www.apache.org/licenses/LICENSE-2.0 *
9+
* *
10+
* Unless required by applicable law or agreed to in writing, software *
11+
* distributed under the License is distributed on an "AS IS" BASIS, *
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
13+
* See the License for the specific language governing permissions and *
14+
* limitations under the License. *
15+
***************************************************************************/
16+
17+
package com.optimizely.ab.android.sdk;
18+
19+
import android.app.UiModeManager;
20+
import android.content.Context;
21+
import android.content.res.Configuration;
22+
import android.os.Build;
23+
import android.support.annotation.RequiresApi;
24+
import android.support.test.runner.AndroidJUnit4;
25+
26+
import com.optimizely.ab.event.internal.payload.Event;
27+
28+
import org.junit.Test;
29+
import org.junit.runner.RunWith;
30+
31+
import static junit.framework.Assert.assertEquals;
32+
import static org.mockito.Mockito.mock;
33+
import static org.mockito.Mockito.when;
34+
35+
@RunWith(AndroidJUnit4.class)
36+
public class OptimizelyClientEngineTest {
37+
@RequiresApi(api = Build.VERSION_CODES.HONEYCOMB_MR2)
38+
@Test
39+
public void testGetClientEngineFromContextAndroidTV() {
40+
Context context = mock(Context.class);
41+
UiModeManager uiModeManager = mock(UiModeManager.class);
42+
when(context.getSystemService(Context.UI_MODE_SERVICE)).thenReturn(uiModeManager);
43+
when(uiModeManager.getCurrentModeType()).thenReturn(Configuration.UI_MODE_TYPE_TELEVISION);
44+
assertEquals(Event.ClientEngine.ANDROID_TV_SDK, OptimizelyClientEngine.getClientEngineFromContext(context));
45+
}
46+
47+
@RequiresApi(api = Build.VERSION_CODES.HONEYCOMB_MR2)
48+
@Test
49+
public void testGetClientEngineFromContextAndroid() {
50+
Context context = mock(Context.class);
51+
UiModeManager uiModeManager = mock(UiModeManager.class);
52+
when(context.getSystemService(Context.UI_MODE_SERVICE)).thenReturn(uiModeManager);
53+
when(uiModeManager.getCurrentModeType()).thenReturn(Configuration.UI_MODE_TYPE_NORMAL);
54+
assertEquals(Event.ClientEngine.ANDROID_SDK, OptimizelyClientEngine.getClientEngineFromContext(context));
55+
}
56+
}

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

+16-15
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
1-
/*
2-
* Copyright 2016, Optimizely
3-
* <p/>
4-
* Licensed under the Apache License, Version 2.0 (the "License");
5-
* you may not use this file except in compliance with the License.
6-
* You may obtain a copy of the License at
7-
* <p/>
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
* <p/>
10-
* Unless required by applicable law or agreed to in writing, software
11-
* distributed under the License is distributed on an "AS IS" BASIS,
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
* See the License for the specific language governing permissions and
14-
* limitations under the License.
15-
*/
1+
/****************************************************************************
2+
* Copyright 2016, Optimizely, Inc. and contributors *
3+
* *
4+
* Licensed under the Apache License, Version 2.0 (the "License"); *
5+
* you may not use this file except in compliance with the License. *
6+
* You may obtain a copy of the License at *
7+
* *
8+
* http://www.apache.org/licenses/LICENSE-2.0 *
9+
* *
10+
* Unless required by applicable law or agreed to in writing, software *
11+
* distributed under the License is distributed on an "AS IS" BASIS, *
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
13+
* See the License for the specific language governing permissions and *
14+
* limitations under the License. *
15+
***************************************************************************/
16+
1617
package com.optimizely.ab.android.sdk;
1718

1819
import android.content.Context;

0 commit comments

Comments
 (0)