Search in sources :

Example 21 with JobDatabase

use of org.thoughtcrime.securesms.database.JobDatabase in project Signal-Android by signalapp.

the class FastJobStorageTest method updateJobAfterRetry_writesToDatabase.

@Test
public void updateJobAfterRetry_writesToDatabase() {
    JobDatabase database = fixedDataDatabase(DataSet1.FULL_SPECS);
    FastJobStorage subject = new FastJobStorage(database);
    subject.init();
    subject.updateJobAfterRetry("id1", true, 1, 10, "a");
    verify(database).updateJobAfterRetry("id1", true, 1, 10, "a");
}
Also used : JobDatabase(org.thoughtcrime.securesms.database.JobDatabase) Test(org.junit.Test)

Example 22 with JobDatabase

use of org.thoughtcrime.securesms.database.JobDatabase in project Signal-Android by signalapp.

the class FastJobStorageTest method updateJobAfterRetry_memoryOnly_doesNotWriteToDatabase.

@Test
public void updateJobAfterRetry_memoryOnly_doesNotWriteToDatabase() {
    JobDatabase database = fixedDataDatabase(DataSetMemory.FULL_SPECS);
    FastJobStorage subject = new FastJobStorage(database);
    subject.init();
    subject.updateJobAfterRetry("id1", true, 1, 10, "a");
    verify(database, times(0)).updateJobAfterRetry("id1", true, 1, 10, "a");
}
Also used : JobDatabase(org.thoughtcrime.securesms.database.JobDatabase) Test(org.junit.Test)

Example 23 with JobDatabase

use of org.thoughtcrime.securesms.database.JobDatabase in project Signal-Android by signalapp.

the class FastJobStorageTest method updateJobs_memoryOnly_doesNotWriteToDatabase.

@Test
public void updateJobs_memoryOnly_doesNotWriteToDatabase() {
    JobDatabase database = fixedDataDatabase(DataSetMemory.FULL_SPECS);
    FastJobStorage subject = new FastJobStorage(database);
    List<JobSpec> jobs = Collections.singletonList(new JobSpec("id1", "f1", null, 1, 1, 1, 1, 1, EMPTY_DATA, null, false, false));
    subject.init();
    subject.updateJobs(jobs);
    verify(database, times(0)).updateJobs(jobs);
}
Also used : JobDatabase(org.thoughtcrime.securesms.database.JobDatabase) JobSpec(org.thoughtcrime.securesms.jobmanager.persistence.JobSpec) Test(org.junit.Test)

Example 24 with JobDatabase

use of org.thoughtcrime.securesms.database.JobDatabase in project Signal-Android by signalapp.

the class FastJobStorageTest method insertJobs_writesToDatabase.

@Test
public void insertJobs_writesToDatabase() {
    JobDatabase database = noopDatabase();
    FastJobStorage subject = new FastJobStorage(database);
    subject.insertJobs(DataSet1.FULL_SPECS);
    verify(database).insertJobs(DataSet1.FULL_SPECS);
}
Also used : JobDatabase(org.thoughtcrime.securesms.database.JobDatabase) Test(org.junit.Test)

Aggregations

JobDatabase (org.thoughtcrime.securesms.database.JobDatabase)24 Test (org.junit.Test)20 JobSpec (org.thoughtcrime.securesms.jobmanager.persistence.JobSpec)4 Stream (com.annimon.stream.Stream)2 FullSpec (org.thoughtcrime.securesms.jobmanager.persistence.FullSpec)2