-
Notifications
You must be signed in to change notification settings - Fork 7
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
17 changed files
with
402 additions
and
19 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
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
92 changes: 92 additions & 0 deletions
92
src/androidTest/java/tests/storage/GeneralInfoStorageTest.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,92 @@ | ||
package tests.storage; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
import androidx.test.platform.app.InstrumentationRegistry; | ||
|
||
import org.junit.After; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
|
||
import helper.DatabaseHelper; | ||
import io.split.android.client.storage.db.SplitRoomDatabase; | ||
import io.split.android.client.storage.general.GeneralInfoStorage; | ||
import io.split.android.client.storage.general.GeneralInfoStorageImpl; | ||
|
||
public class GeneralInfoStorageTest { | ||
|
||
private SplitRoomDatabase mDb; | ||
private GeneralInfoStorage mGeneralInfoStorage; | ||
|
||
@Before | ||
public void setUp() { | ||
mDb = DatabaseHelper.getTestDatabase(InstrumentationRegistry.getInstrumentation().getContext()); | ||
mGeneralInfoStorage = new GeneralInfoStorageImpl(mDb.generalInfoDao()); | ||
} | ||
|
||
@After | ||
public void tearDown() { | ||
mDb.clearAllTables(); | ||
mDb.close(); | ||
} | ||
|
||
@Test | ||
public void setSplitsUpdateTimestamp() { | ||
long initialValue = mGeneralInfoStorage.getSplitsUpdateTimestamp(); | ||
mGeneralInfoStorage.setSplitsUpdateTimestamp(100L); | ||
long finalValue = mGeneralInfoStorage.getSplitsUpdateTimestamp(); | ||
|
||
assertEquals(0L, initialValue); | ||
assertEquals(100L, finalValue); | ||
} | ||
|
||
@Test | ||
public void setChangeNumber() { | ||
long initialValue = mGeneralInfoStorage.getChangeNumber(); | ||
mGeneralInfoStorage.setChangeNumber(100L); | ||
long finalValue = mGeneralInfoStorage.getChangeNumber(); | ||
|
||
assertEquals(-1L, initialValue); | ||
assertEquals(100L, finalValue); | ||
} | ||
|
||
@Test | ||
public void setSplitsFilterQueryString() { | ||
String initialValue = mGeneralInfoStorage.getSplitsFilterQueryString(); | ||
mGeneralInfoStorage.setSplitsFilterQueryString("queryString"); | ||
String finalValue = mGeneralInfoStorage.getSplitsFilterQueryString(); | ||
|
||
assertEquals("", initialValue); | ||
assertEquals("queryString", finalValue); | ||
} | ||
|
||
@Test | ||
public void setDatabaseEncryptionMode() { | ||
String initialValue = mGeneralInfoStorage.getDatabaseEncryptionMode(); | ||
mGeneralInfoStorage.setDatabaseEncryptionMode("MODE"); | ||
String finalValue = mGeneralInfoStorage.getDatabaseEncryptionMode(); | ||
|
||
assertEquals("", initialValue); | ||
assertEquals("MODE", finalValue); | ||
} | ||
|
||
@Test | ||
public void setFlagsSpec() { | ||
String initialValue = mGeneralInfoStorage.getFlagsSpec(); | ||
mGeneralInfoStorage.setFlagsSpec("4.4"); | ||
String finalValue = mGeneralInfoStorage.getFlagsSpec(); | ||
|
||
assertEquals("", initialValue); | ||
assertEquals("4.4", finalValue); | ||
} | ||
|
||
@Test | ||
public void setRolloutCacheLastClearTimestamp() { | ||
long initialValue = mGeneralInfoStorage.getRolloutCacheLastClearTimestamp(); | ||
mGeneralInfoStorage.setRolloutCacheLastClearTimestamp(100L); | ||
long finalValue = mGeneralInfoStorage.getRolloutCacheLastClearTimestamp(); | ||
|
||
assertEquals(0L, initialValue); | ||
assertEquals(100L, finalValue); | ||
} | ||
} |
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
33 changes: 33 additions & 0 deletions
33
src/main/java/io/split/android/client/storage/general/GeneralInfoStorage.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,33 @@ | ||
package io.split.android.client.storage.general; | ||
|
||
import androidx.annotation.NonNull; | ||
import androidx.annotation.Nullable; | ||
|
||
public interface GeneralInfoStorage { | ||
|
||
long getSplitsUpdateTimestamp(); | ||
|
||
void setSplitsUpdateTimestamp(long timestamp); | ||
|
||
long getChangeNumber(); | ||
|
||
void setChangeNumber(long changeNumber); | ||
|
||
@NonNull | ||
String getSplitsFilterQueryString(); | ||
|
||
void setSplitsFilterQueryString(String queryString); | ||
|
||
String getDatabaseEncryptionMode(); | ||
|
||
void setDatabaseEncryptionMode(String value); | ||
|
||
@Nullable | ||
String getFlagsSpec(); | ||
|
||
void setFlagsSpec(String value); | ||
|
||
long getRolloutCacheLastClearTimestamp(); | ||
|
||
void setRolloutCacheLastClearTimestamp(long timestamp); | ||
} |
Oops, something went wrong.