Skip to content

Commit

Permalink
Release version 0.4.0 (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
Vignesh Raja authored Dec 19, 2016
1 parent 1a63d81 commit 08735da
Show file tree
Hide file tree
Showing 37 changed files with 473 additions and 445 deletions.
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
/.idea/misc.xml
.idea
.DS_Store
/build
/captures
Expand Down
22 changes: 0 additions & 22 deletions .idea/compiler.xml

This file was deleted.

3 changes: 0 additions & 3 deletions .idea/copyright/profiles_settings.xml

This file was deleted.

7 changes: 0 additions & 7 deletions .idea/dictionaries/jdeffibaugh.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/encodings.xml

This file was deleted.

22 changes: 0 additions & 22 deletions .idea/gradle.xml

This file was deleted.

36 changes: 0 additions & 36 deletions .idea/inspectionProfiles/Project_Default.xml

This file was deleted.

7 changes: 0 additions & 7 deletions .idea/inspectionProfiles/profiles_settings.xml

This file was deleted.

13 changes: 0 additions & 13 deletions .idea/modules.xml

This file was deleted.

12 changes: 0 additions & 12 deletions .idea/runConfigurations.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
# Optimizely Android X SDK Changelog
### 0.4.0
December 15, 2016

*New Features*

- Add support for IP anonymization

*Breaking Changes*

- Rename `AndroidUserExperimentRecord` to `AndroidUserProfile`
- Change position of `activateExperiment` parameter in live variable getters

### 0.3.0
December 8, 2016

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ config common for all modules.
- Uses a Service so events can be sent without the app being reopened
- Persists events in a SQLite3 database
- Required to be implemented by the Optimizely Java core
3. User Experiment Record
3. User Profile
- Optional implementation for Optimizely Java core
- Makes bucketing persistent
- Once a user is bucketed in an variation they will remain in that variation
Expand Down Expand Up @@ -68,7 +68,7 @@ config common for all modules.
7. Discover more gradle tasks
* `./gradlew tasks`
* To see the task of an individual module
* `./gradlew user-experiment-record:tasks`
* `./gradlew user-profile:tasks`

### Android Studio

Expand Down
4 changes: 2 additions & 2 deletions android-sdk/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ android {

dependencies {
compile project(':event-handler')
compile project(':user-experiment-record')
compile project(':user-profile')
provided "com.android.support:support-annotations:$support_annotations_ver"

testCompile "junit:junit:$junit_ver"
Expand All @@ -75,7 +75,7 @@ dependencies {

uploadArchives {
dependsOn = [':android-sdk:clean', ':android-sdk:releaseJavadocJar', ':android-sdk:releaseSourcesJar']
shouldRunAfter = [':event-handler:uploadArchives', ':user-experiment-record:uploadArchives']
shouldRunAfter = [':event-handler:uploadArchives', ':user-profile:uploadArchives']
repositories {
mavenDeployer {
repository(url: "https://api.bintray.com/maven/optimizely/optimizely/optimizely-sdk-android") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public void setup() {

@Test
public void request200() throws IOException {
URL url = new URL(String.format(DataFileLoader.FORMAT_CDN_URL, "1"));
URL url = new URL(DataFileService.getDatafileUrl("1"));
when(client.openConnection(url)).thenReturn(urlConnection);
when(urlConnection.getResponseCode()).thenReturn(200);
when(client.readStream(urlConnection)).thenReturn("{}");
Expand All @@ -87,7 +87,7 @@ public void request200() throws IOException {

@Test
public void request201() throws IOException {
URL url = new URL(String.format(DataFileLoader.FORMAT_CDN_URL, "1"));
URL url = new URL(DataFileService.getDatafileUrl("1"));
when(client.openConnection(url)).thenReturn(urlConnection);
when(urlConnection.getResponseCode()).thenReturn(201);
when(client.readStream(urlConnection)).thenReturn("{}");
Expand All @@ -112,7 +112,7 @@ public void request201() throws IOException {

@Test
public void request299() throws IOException {
URL url = new URL(String.format(DataFileLoader.FORMAT_CDN_URL, "1"));
URL url = new URL(DataFileService.getDatafileUrl("1"));
when(client.openConnection(url)).thenReturn(urlConnection);
when(urlConnection.getResponseCode()).thenReturn(299);
when(client.readStream(urlConnection)).thenReturn("{}");
Expand All @@ -137,7 +137,7 @@ public void request299() throws IOException {

@Test
public void request300() throws IOException {
URL url = new URL(String.format(DataFileLoader.FORMAT_CDN_URL, "1"));
URL url = new URL(DataFileService.getDatafileUrl("1"));
when(client.openConnection(url)).thenReturn(urlConnection);
when(urlConnection.getResponseCode()).thenReturn(300);

Expand All @@ -157,7 +157,7 @@ public void request300() throws IOException {

@Test
public void handlesIOException() throws IOException {
URL url = new URL(String.format(DataFileLoader.FORMAT_CDN_URL, "1"));
URL url = new URL(DataFileService.getDatafileUrl("1"));
when(client.openConnection(url)).thenReturn(urlConnection);
when(urlConnection.getResponseCode()).thenReturn(200);
doThrow(new IOException()).when(client).readStream(urlConnection);
Expand All @@ -179,14 +179,14 @@ public void handlesIOException() throws IOException {

@Test
public void handlesNullResponse() throws MalformedURLException {
URL url = new URL(String.format(DataFileLoader.FORMAT_CDN_URL, "1"));
URL url = new URL(DataFileService.getDatafileUrl("1"));
when(client.execute(any(Client.Request.class), eq(2), eq(3))).thenReturn(null);
assertNull(dataFileClient.request(url.toString()));
}

@Test
public void handlesEmptyStringResponse() throws MalformedURLException {
URL url = new URL(String.format(DataFileLoader.FORMAT_CDN_URL, "1"));
URL url = new URL(DataFileService.getDatafileUrl("1"));
when(client.execute(any(Client.Request.class), eq(2), eq(3))).thenReturn("");
assertEquals("", dataFileClient.request(url.toString()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

import java.util.concurrent.TimeoutException;

import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
Expand Down Expand Up @@ -112,4 +113,14 @@ public void testNoProjectIdIntentStart() throws TimeoutException {
dataFileService.onStartCommand(intent, 0, 0);
verify(logger).warn("Data file service received an intent with no project id extra");
}

@RequiresApi(api = Build.VERSION_CODES.HONEYCOMB)
@Test
public void testGetDatafileUrl(){
// HARD-CODING link here to make sure we don't unintentionally mess up the datafile version
// and url by accidentally changing those constants. Bumping datafile versions will force
// us to update this test.
String datafileUrl = DataFileService.getDatafileUrl("1");
assertEquals("https://cdn.optimizely.com/public/1/datafile_v3.json", datafileUrl);
}
}
Loading

0 comments on commit 08735da

Please sign in to comment.