-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* event stream draft * extend KVS to support string and remove * replace storage implementation with event stream * draft AndroidStorage * draft InMemoryStorage * typo fix * update EventPipeline with new storage * update unit tests * fix broken unit tests * fix broken android unit tests * add unit test for event stream * add unit test for KVS * add unit test for storage and event stream * fix android unit tests * address comments * add more comments * add unit tests for android kvs * add unit tests for in memory storage * add EncryptedEventStream * finalize storage creation * finalize encrypted storage --------- Co-authored-by: Wenxi Zeng <[email protected]>
- Loading branch information
1 parent
b958b36
commit cff1a1c
Showing
26 changed files
with
1,828 additions
and
566 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
44 changes: 44 additions & 0 deletions
44
android/src/test/java/com/segment/analytics/kotlin/android/utilities/AndroidKVSTest.kt
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,44 @@ | ||
package com.segment.analytics.kotlin.android.utilities | ||
|
||
import com.segment.analytics.kotlin.android.utils.MemorySharedPreferences | ||
import com.segment.analytics.kotlin.core.utilities.KVS | ||
import org.junit.jupiter.api.Assertions | ||
import org.junit.jupiter.api.BeforeEach | ||
import org.junit.jupiter.api.Test | ||
|
||
class AndroidKVSTest { | ||
|
||
private lateinit var prefs: KVS | ||
|
||
@BeforeEach | ||
fun setup(){ | ||
val sharedPreferences = MemorySharedPreferences() | ||
prefs = AndroidKVS(sharedPreferences) | ||
prefs.put("int", 1) | ||
prefs.put("string", "string") | ||
} | ||
|
||
@Test | ||
fun getTest() { | ||
Assertions.assertEquals(1, prefs.get("int", 0)) | ||
Assertions.assertEquals("string", prefs.get("string", null)) | ||
Assertions.assertEquals(0, prefs.get("keyNotExists", 0)) | ||
Assertions.assertEquals(null, prefs.get("keyNotExists", null)) | ||
} | ||
|
||
@Test | ||
fun putTest() { | ||
prefs.put("int", 2) | ||
prefs.put("string", "stringstring") | ||
|
||
Assertions.assertEquals(2, prefs.get("int", 0)) | ||
Assertions.assertEquals("stringstring", prefs.get("string", null)) | ||
} | ||
|
||
@Test | ||
fun containsAndRemoveTest() { | ||
Assertions.assertTrue(prefs.contains("int")) | ||
prefs.remove("int") | ||
Assertions.assertFalse(prefs.contains("int")) | ||
} | ||
} |
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
Oops, something went wrong.