use of android.app.backup.BackupDataOutput in project android_frameworks_base by AOSPA.
the class BackupDataTest method testDelete.
public void testDelete() throws IOException {
mFile = new File(mDirectory, "backup_delete_test.dat");
openForWriting();
BackupDataOutput bdo = new BackupDataOutput(mDataFile.getFileDescriptor());
for (int i = 0; i < KEYS.length; i++) {
deleteEntity(bdo, KEYS[i]);
}
mDataFile.close();
openForReading();
BackupDataInput bdi = new BackupDataInput(mDataFile.getFileDescriptor());
int count = 0;
while (bdi.readNextHeader()) {
readAndVerifyDeletedEntity(bdi, KEYS[count]);
count++;
}
assertEquals("four deletes in this stream", KEYS.length, count);
}
use of android.app.backup.BackupDataOutput in project android_frameworks_base by AOSPA.
the class BackupDataTest method testMultiple.
public void testMultiple() throws IOException {
mFile = new File(mDirectory, "backup_multiple_test.dat");
openForWriting();
BackupDataOutput bdo = new BackupDataOutput(mDataFile.getFileDescriptor());
for (int i = 0; i < KEYS.length; i++) {
writeEntity(bdo, KEYS[i], DATA[i].getBytes());
}
mDataFile.close();
openForReading();
BackupDataInput bdi = new BackupDataInput(mDataFile.getFileDescriptor());
int count = 0;
while (bdi.readNextHeader()) {
readAndVerifyEntity(bdi, KEYS[count], DATA[count].getBytes());
count++;
}
assertEquals("four entities in this stream", KEYS.length, count);
}
use of android.app.backup.BackupDataOutput in project android_frameworks_base by ResurrectionRemix.
the class BackupDataTest method testDelete.
public void testDelete() throws IOException {
mFile = new File(mDirectory, "backup_delete_test.dat");
openForWriting();
BackupDataOutput bdo = new BackupDataOutput(mDataFile.getFileDescriptor());
for (int i = 0; i < KEYS.length; i++) {
deleteEntity(bdo, KEYS[i]);
}
mDataFile.close();
openForReading();
BackupDataInput bdi = new BackupDataInput(mDataFile.getFileDescriptor());
int count = 0;
while (bdi.readNextHeader()) {
readAndVerifyDeletedEntity(bdi, KEYS[count]);
count++;
}
assertEquals("four deletes in this stream", KEYS.length, count);
}
use of android.app.backup.BackupDataOutput in project android_frameworks_base by crdroidandroid.
the class BackupDataTest method testMultiple.
public void testMultiple() throws IOException {
mFile = new File(mDirectory, "backup_multiple_test.dat");
openForWriting();
BackupDataOutput bdo = new BackupDataOutput(mDataFile.getFileDescriptor());
for (int i = 0; i < KEYS.length; i++) {
writeEntity(bdo, KEYS[i], DATA[i].getBytes());
}
mDataFile.close();
openForReading();
BackupDataInput bdi = new BackupDataInput(mDataFile.getFileDescriptor());
int count = 0;
while (bdi.readNextHeader()) {
readAndVerifyEntity(bdi, KEYS[count], DATA[count].getBytes());
count++;
}
assertEquals("four entities in this stream", KEYS.length, count);
}
use of android.app.backup.BackupDataOutput in project android_frameworks_base by crdroidandroid.
the class BackupDataTest method testSingle.
public void testSingle() throws IOException {
mFile = new File(mDirectory, "backup_mixed_sinlge.dat");
openForWriting();
BackupDataOutput bdo = new BackupDataOutput(mDataFile.getFileDescriptor());
writeEntity(bdo, KEY1, DATA1.getBytes());
mDataFile.close();
openForReading();
BackupDataInput bdi = new BackupDataInput(mDataFile.getFileDescriptor());
int count = 0;
while (bdi.readNextHeader()) {
readAndVerifyEntity(bdi, KEY1, DATA1.getBytes());
count++;
}
assertEquals("only one entity in this stream", 1, count);
}
Aggregations