Search in sources :

Example 16 with JobDatabase

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

the class FastJobStorageTest method deleteJobs_writesToDatabase.

@Test
public void deleteJobs_writesToDatabase() {
    JobDatabase database = fixedDataDatabase(DataSet1.FULL_SPECS);
    FastJobStorage subject = new FastJobStorage(database);
    List<String> ids = Arrays.asList("id1", "id2");
    subject.init();
    subject.deleteJobs(ids);
    verify(database).deleteJobs(ids);
}
Also used : JobDatabase(org.thoughtcrime.securesms.database.JobDatabase) Test(org.junit.Test)

Example 17 with JobDatabase

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

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)

Example 18 with JobDatabase

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

the class FastJobStorageTest method insertJobs_memoryOnlyJob_doesNotWriteToDatabase.

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

Example 19 with JobDatabase

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

the class FastJobStorageTest method deleteJobs_memoryOnly_doesNotWriteToDatabase.

@Test
public void deleteJobs_memoryOnly_doesNotWriteToDatabase() {
    JobDatabase database = fixedDataDatabase(DataSetMemory.FULL_SPECS);
    FastJobStorage subject = new FastJobStorage(database);
    List<String> ids = Collections.singletonList("id1");
    subject.init();
    subject.deleteJobs(ids);
    verify(database, times(0)).deleteJobs(ids);
}
Also used : JobDatabase(org.thoughtcrime.securesms.database.JobDatabase) Test(org.junit.Test)

Example 20 with JobDatabase

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

the class FastJobStorageTest method updateJobRunningState_writesToDatabase.

@Test
public void updateJobRunningState_writesToDatabase() {
    JobDatabase database = fixedDataDatabase(DataSet1.FULL_SPECS);
    FastJobStorage subject = new FastJobStorage(database);
    subject.init();
    subject.updateJobRunningState("id1", true);
    verify(database).updateJobRunningState("id1", true);
}
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