Skip to content

Commit

Permalink
Update java-core dependency to 1.2.0 (#56)
Browse files Browse the repository at this point in the history
* Rename `AndroidUserExperimentRecord` to `AndroidUserProfile` (#54)
* Move activateExperiment param (#55)
  • Loading branch information
Vignesh Raja authored Dec 16, 2016
1 parent c3ade14 commit a00b1f6
Show file tree
Hide file tree
Showing 33 changed files with 299 additions and 426 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 @@ -24,7 +24,7 @@
import android.support.test.runner.AndroidJUnit4;

import com.optimizely.ab.android.shared.ServiceScheduler;
import com.optimizely.ab.android.user_experiment_record.AndroidUserExperimentRecord;
import com.optimizely.ab.android.user_profile.AndroidUserProfile;

import org.junit.Before;
import org.junit.Test;
Expand Down Expand Up @@ -117,19 +117,19 @@ public void stop() {
@Test
public void injectOptimizely() {
Context context = mock(Context.class);
AndroidUserExperimentRecord userExperimentRecord = mock(AndroidUserExperimentRecord.class);
AndroidUserProfile userProfile = mock(AndroidUserProfile.class);
ServiceScheduler serviceScheduler = mock(ServiceScheduler.class);
ArgumentCaptor<Intent> captor = ArgumentCaptor.forClass(Intent.class);
OptimizelyStartListener startListener = mock(OptimizelyStartListener.class);
optimizelyManager.setOptimizelyStartListener(startListener);
optimizelyManager.injectOptimizely(context, userExperimentRecord, serviceScheduler, minDataFile);
optimizelyManager.injectOptimizely(context, userProfile, serviceScheduler, minDataFile);
try {
executor.awaitTermination(5, TimeUnit.SECONDS);
} catch (InterruptedException e) {
fail("Timed out");
}

verify(userExperimentRecord).start();
verify(userProfile).start();
verify(serviceScheduler).schedule(captor.capture(), eq(TimeUnit.HOURS.toMillis(1L)));
verify(logger).info("Sending Optimizely instance to listener");
verify(startListener).onStart(any(OptimizelyClient.class));
Expand All @@ -140,18 +140,18 @@ public void injectOptimizely() {
public void injectOptimizelyNullListener() {
Context context = mock(Context.class);
when(context.getPackageName()).thenReturn("com.optly");
AndroidUserExperimentRecord userExperimentRecord = mock(AndroidUserExperimentRecord.class);
AndroidUserProfile userProfile = mock(AndroidUserProfile.class);
ServiceScheduler serviceScheduler = mock(ServiceScheduler.class);
ArgumentCaptor<Intent> captor = ArgumentCaptor.forClass(Intent.class);
optimizelyManager.setOptimizelyStartListener(null);
optimizelyManager.injectOptimizely(context, userExperimentRecord, serviceScheduler, minDataFile);
optimizelyManager.injectOptimizely(context, userProfile, serviceScheduler, minDataFile);
try {
executor.awaitTermination(5, TimeUnit.SECONDS);
} catch (InterruptedException e) {
fail("Timed out");
}

verify(userExperimentRecord).start();
verify(userProfile).start();
verify(serviceScheduler).schedule(captor.capture(), eq(TimeUnit.HOURS.toMillis(1L)));
verify(logger).info("No listener to send Optimizely to");

Expand All @@ -165,18 +165,18 @@ public void injectOptimizelyNullListener() {
public void injectOptimizelyHandlesInvalidDataFile() {
Context context = mock(Context.class);
when(context.getPackageName()).thenReturn("com.optly");
AndroidUserExperimentRecord userExperimentRecord = mock(AndroidUserExperimentRecord.class);
AndroidUserProfile userProfile = mock(AndroidUserProfile.class);
ServiceScheduler serviceScheduler = mock(ServiceScheduler.class);
ArgumentCaptor<Intent> captor = ArgumentCaptor.forClass(Intent.class);
optimizelyManager.setOptimizelyStartListener(null);
optimizelyManager.injectOptimizely(context, userExperimentRecord, serviceScheduler, "{}");
optimizelyManager.injectOptimizely(context, userProfile, serviceScheduler, "{}");
try {
executor.awaitTermination(5, TimeUnit.SECONDS);
} catch (InterruptedException e) {
fail("Timed out");
}

verify(userExperimentRecord).start();
verify(userProfile).start();
verify(serviceScheduler).schedule(captor.capture(), eq(TimeUnit.HOURS.toMillis(1L)));
verify(logger).error(eq("Unable to build optimizely instance"), any(Exception.class));

Expand All @@ -190,25 +190,25 @@ public void injectOptimizelyHandlesInvalidDataFile() {
public void injectOptimizelyDoesNotDuplicateCallback() {
Context context = mock(Context.class);
when(context.getPackageName()).thenReturn("com.optly");
AndroidUserExperimentRecord userExperimentRecord = mock(AndroidUserExperimentRecord.class);
AndroidUserProfile userProfile = mock(AndroidUserProfile.class);
ServiceScheduler serviceScheduler = mock(ServiceScheduler.class);
ArgumentCaptor<Intent> captor = ArgumentCaptor.forClass(Intent.class);
OptimizelyStartListener startListener = mock(OptimizelyStartListener.class);
optimizelyManager.setOptimizelyStartListener(startListener);
optimizelyManager.injectOptimizely(context, userExperimentRecord, serviceScheduler, minDataFile);
optimizelyManager.injectOptimizely(context, userProfile, serviceScheduler, minDataFile);
try {
executor.awaitTermination(5, TimeUnit.SECONDS);
} catch (InterruptedException e) {
fail("Timed out");
}

verify(userExperimentRecord).start();
verify(userProfile).start();
verify(serviceScheduler).schedule(captor.capture(), eq(TimeUnit.HOURS.toMillis(1L)));

verify(logger).info("Sending Optimizely instance to listener");
verify(startListener).onStart(any(OptimizelyClient.class));

optimizelyManager.injectOptimizely(context, userExperimentRecord, serviceScheduler, minDataFile);
optimizelyManager.injectOptimizely(context, userProfile, serviceScheduler, minDataFile);
try {
executor.awaitTermination(5, TimeUnit.SECONDS);
} catch (InterruptedException e) {
Expand Down
Loading

0 comments on commit a00b1f6

Please sign in to comment.