-
Notifications
You must be signed in to change notification settings - Fork 390
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
348 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,27 @@ | ||
apply plugin: 'com.android.library' | ||
|
||
android { | ||
compileSdkVersion 21 | ||
buildToolsVersion "21.1.2" | ||
compileSdkVersion 21 | ||
buildToolsVersion "21.1.2" | ||
|
||
defaultConfig { | ||
minSdkVersion 8 | ||
targetSdkVersion 21 | ||
} | ||
|
||
defaultConfig { | ||
minSdkVersion 8 | ||
targetSdkVersion 21 | ||
versionCode 1 | ||
versionName "1.0" | ||
} | ||
lintOptions { | ||
abortOnError false | ||
} | ||
} | ||
|
||
lintOptions { | ||
abortOnError false | ||
} | ||
configurations { | ||
optional | ||
compile.extendsFrom optional | ||
} | ||
|
||
dependencies { | ||
compile 'com.google.code.gson:gson:2.3.1' | ||
compile 'com.google.code.gson:gson:2.3.1' | ||
optional 'io.reactivex:rxandroid:0.25.0' | ||
} | ||
|
||
apply from: '../maven_push.gradle' |
65 changes: 65 additions & 0 deletions
65
hawk/src/androidTest/java/com/orhanobut/hawk/HawkRxTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package com.orhanobut.hawk; | ||
|
||
import android.content.Context; | ||
import android.test.InstrumentationTestCase; | ||
import android.util.Log; | ||
|
||
import rx.Subscriber; | ||
import rx.android.schedulers.AndroidSchedulers; | ||
import rx.schedulers.Schedulers; | ||
|
||
/** | ||
* @author Orhan Obut | ||
*/ | ||
public class HawkRxTest extends InstrumentationTestCase { | ||
|
||
Context context; | ||
|
||
@Override | ||
protected void setUp() throws Exception { | ||
super.setUp(); | ||
System.setProperty( | ||
"dexmaker.dexcache", | ||
getInstrumentation().getTargetContext().getCacheDir().getPath()); | ||
context = getInstrumentation().getContext(); | ||
Hawk.init(context, "testPassword"); | ||
} | ||
|
||
@Override | ||
protected void tearDown() throws Exception { | ||
super.tearDown(); | ||
context = null; | ||
Hawk.clear(); | ||
Hawk.resetCrypto(); | ||
} | ||
|
||
private static final String KEY = "TAG"; | ||
|
||
public void testString() throws Exception { | ||
Hawk.put(KEY, "hawk"); | ||
|
||
Hawk.<String>getObservable(KEY) | ||
.observeOn(Schedulers.io()) | ||
.subscribeOn(AndroidSchedulers.mainThread()) | ||
.subscribe(new Subscriber<String>() { | ||
@Override | ||
public void onCompleted() { | ||
Log.d("rxtest", "completed"); | ||
assertTrue(true); | ||
} | ||
|
||
@Override | ||
public void onError(Throwable e) { | ||
Log.d("rxtest", "error"); | ||
assertTrue(false); | ||
} | ||
|
||
@Override | ||
public void onNext(String s) { | ||
Log.d("rxtest", s); | ||
assertTrue(true); | ||
} | ||
}); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.