use of com.google.firebase.firestore.proto.Target in project firebase-android-sdk by firebase.
the class SQLiteSchemaTest method keepsLastLimboFreeSnapshotIfNotDowngraded.
@Test
public void keepsLastLimboFreeSnapshotIfNotDowngraded() {
schema.runSchemaUpgrades(0, 9);
db.execSQL("INSERT INTO targets (target_id, canonical_id, target_proto) VALUES (?,?, ?)", new Object[] { 1, "foo", createDummyQueryTargetWithLimboFreeVersion(1).toByteArray() });
// Make sure that we don't drop the lastLimboFreeSnapshotVersion if we are already on schema
// version 9.
schema.runSchemaUpgrades(9, 9);
new SQLitePersistence.Query(db, "SELECT target_proto FROM targets").forEach(cursor -> {
byte[] targetProtoBytes = cursor.getBlob(0);
try {
Target targetProto = Target.parseFrom(targetProtoBytes);
assertTrue(targetProto.hasLastLimboFreeSnapshotVersion());
} catch (InvalidProtocolBufferException e) {
fail("Failed to decode Target data");
}
});
}
Aggregations