Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
8881325
Implement Firebase segmentation SDK device local cache
diwu-arete Jun 13, 2019
864748f
[Firebase Segmentation] Add custom installation id cache layer and te…
diwu-arete Jun 14, 2019
0a3ebf6
Add test for updating cache
diwu-arete Jun 14, 2019
2d158ed
Switch to use SQLiteOpenHelper
diwu-arete Jun 15, 2019
f118d39
Switch to use SharedPreferences from SQLite.
diwu-arete Jun 17, 2019
4da5d31
Change the cache class to be singleton
diwu-arete Jun 18, 2019
d1ff0ec
Wrap shared pref commit in a async task.
diwu-arete Jun 18, 2019
2c5102c
Merge branch 'master' of github.com:firebase/firebase-android-sdk int…
diwu-arete Jun 18, 2019
41fbfee
Address comments
diwu-arete Jun 18, 2019
5fd2fa0
Google format fix
diwu-arete Jun 18, 2019
e950003
Merge branch 'master' of github.com:firebase/firebase-android-sdk int…
diwu-arete Jun 18, 2019
dba0c0e
Replace some deprecated code.
diwu-arete Jun 18, 2019
dc37bf8
Merge branch 'floc-master' of github.com:firebase/firebase-android-sd…
diwu-arete Jun 18, 2019
ebdd626
Merge branch 'master' of github.com:firebase/firebase-android-sdk int…
diwu-arete Jun 18, 2019
f26741e
Merge branch 'floc-master' of github.com:firebase/firebase-android-sd…
diwu-arete Jun 18, 2019
38c403f
Merge branch 'floc-master' of github.com:firebase/firebase-android-sd…
diwu-arete Jun 18, 2019
a9a43a4
Package refactor
diwu-arete Jun 18, 2019
ca6dacf
nit
diwu-arete Jun 18, 2019
e7fff81
nit
diwu-arete Jun 18, 2019
bb8bf45
Merge branch 'floc-master' of github.com:firebase/firebase-android-sd…
diwu-arete Jun 18, 2019
b381889
Add the state machine of updating custom installation id in the local
diwu-arete Jun 19, 2019
a72cf60
Merge branch 'floc-master' of github.com:firebase/firebase-android-sd…
diwu-arete Jun 19, 2019
1adcfbd
minor format fix
diwu-arete Jun 20, 2019
6091f82
Address comments #1
diwu-arete Jun 20, 2019
ada5577
Merge branch 'master' of github.com:firebase/firebase-android-sdk int…
diwu-arete Jun 20, 2019
af5bcd1
Merge branch 'floc-master' of github.com:firebase/firebase-android-sd…
diwu-arete Jun 20, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add test for updating cache
  • Loading branch information
diwu-arete committed Jun 14, 2019
commit 0a3ebf6a5b2aa44d36469caf016e938e9376255b
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
package com.google.firebase.segmentation;

import static com.google.common.truth.Truth.assertThat;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;

import androidx.test.InstrumentationRegistry;
Expand Down Expand Up @@ -66,12 +65,21 @@ public void testUpdateAndReadCacheEntry() {
cache.insertOrUpdateCacheEntry(
firebaseApp0,
CustomInstallationIdCacheEntryValue.create(
"123456", "cAAAAAAAAAA", CustomInstallationIdCache.CacheStatus.SYNCED));
"123456", "cAAAAAAAAAA", CustomInstallationIdCache.CacheStatus.PENDING));
CustomInstallationIdCacheEntryValue entryValue = cache.readCacheEntryValue(firebaseApp0);
assertNotNull(entryValue);
assertThat(entryValue.getCustomInstallationId()).isEqualTo("123456");
assertThat(entryValue.getFirebaseInstanceId()).isEqualTo("cAAAAAAAAAA");
assertThat(entryValue.getCacheStatus()).isEqualTo(CustomInstallationIdCache.CacheStatus.SYNCED);
assertThat(entryValue.getCacheStatus())
.isEqualTo(CustomInstallationIdCache.CacheStatus.PENDING);
assertNull(cache.readCacheEntryValue(firebaseApp1));

cache.insertOrUpdateCacheEntry(
firebaseApp0,
CustomInstallationIdCacheEntryValue.create(
"123456", "cAAAAAAAAAA", CustomInstallationIdCache.CacheStatus.SYNCED));
entryValue = cache.readCacheEntryValue(firebaseApp0);
assertThat(entryValue.getCustomInstallationId()).isEqualTo("123456");
assertThat(entryValue.getFirebaseInstanceId()).isEqualTo("cAAAAAAAAAA");
assertThat(entryValue.getCacheStatus()).isEqualTo(CustomInstallationIdCache.CacheStatus.SYNCED);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,6 @@ CustomInstallationIdCacheEntryValue readCacheEntryValue(FirebaseApp firebaseApp)

void insertOrUpdateCacheEntry(
FirebaseApp firebaseApp, CustomInstallationIdCacheEntryValue entryValue) {
String gmpAppId = firebaseApp.getOptions().getApplicationId();
String appName = firebaseApp.getName();
localDb.execSQL(
String.format(
"INSERT OR REPLACE INTO %s(%s, %s, %s, %s, %s) VALUES(%s, %s, %s, %s, %s)",
Expand All @@ -120,8 +118,8 @@ void insertOrUpdateCacheEntry(
CUSTOM_INSTALLATION_ID_COLUMN_NAME,
INSTANCE_ID_COLUMN_NAME,
CACHE_STATUS_COLUMN,
"\"" + gmpAppId + "\"",
"\"" + appName + "\"",
"\"" + firebaseApp.getOptions().getApplicationId() + "\"",
"\"" + firebaseApp.getName() + "\"",
"\"" + entryValue.getCustomInstallationId() + "\"",
"\"" + entryValue.getFirebaseInstanceId() + "\"",
entryValue.getCacheStatus().ordinal()));
Expand Down