TestNotesMigration: Configure readChangeSequence bit explicitly
This was previously set to match the readChanges bit, which was mostly out of laziness, so that the NoteDbMode that enabled reading changes would also exercise the sequence codepath without having to call additional setters. Doing it this way means that it is impossible for NotesMigrationState.forNotesMigration(testNotesMigration) to return READ_WRITE_NO_SEQUENCE, which screws with migration tests. Fortunately, since NoteDbMode is now tied to a specific NotesMigrationState, we know that NoteDbMode.READ_WRITE will trigger the sequence codepath, since it uses NotesMigrationState.READ_WRITE_WITH_SEQUENCE_REVIEW_DB_PRIMARY. Thus there is no more reason to tie those two bits together in TestNotesMigration. Change-Id: I4729368dd9a0f26ddb44897bac0fe27e79b8a6f6
This commit is contained in:
		@@ -25,6 +25,7 @@ import com.google.inject.Singleton;
 | 
			
		||||
public class TestNotesMigration extends NotesMigration {
 | 
			
		||||
  private volatile boolean readChanges;
 | 
			
		||||
  private volatile boolean writeChanges;
 | 
			
		||||
  private volatile boolean readChangeSequence;
 | 
			
		||||
  private volatile PrimaryStorage changePrimaryStorage = PrimaryStorage.REVIEW_DB;
 | 
			
		||||
  private volatile boolean disableChangeReviewDb;
 | 
			
		||||
  private volatile boolean fuseUpdates;
 | 
			
		||||
@@ -41,9 +42,7 @@ public class TestNotesMigration extends NotesMigration {
 | 
			
		||||
 | 
			
		||||
  @Override
 | 
			
		||||
  public boolean readChangeSequence() {
 | 
			
		||||
    // Unlike ConfigNotesMigration, read change numbers from NoteDb by default
 | 
			
		||||
    // when reads are enabled, to improve test coverage.
 | 
			
		||||
    return readChanges;
 | 
			
		||||
    return readChangeSequence;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  @Override
 | 
			
		||||
@@ -83,6 +82,11 @@ public class TestNotesMigration extends NotesMigration {
 | 
			
		||||
    return this;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  public TestNotesMigration setReadChangeSequence(boolean readChangeSequence) {
 | 
			
		||||
    this.readChangeSequence = readChangeSequence;
 | 
			
		||||
    return this;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  public TestNotesMigration setChangePrimaryStorage(PrimaryStorage changePrimaryStorage) {
 | 
			
		||||
    this.changePrimaryStorage = checkNotNull(changePrimaryStorage);
 | 
			
		||||
    return this;
 | 
			
		||||
@@ -115,6 +119,7 @@ public class TestNotesMigration extends NotesMigration {
 | 
			
		||||
  public TestNotesMigration setFrom(NotesMigration other) {
 | 
			
		||||
    setWriteChanges(other.rawWriteChangesSetting());
 | 
			
		||||
    setReadChanges(other.readChanges());
 | 
			
		||||
    setReadChangeSequence(other.readChangeSequence());
 | 
			
		||||
    setChangePrimaryStorage(other.changePrimaryStorage());
 | 
			
		||||
    setDisableChangeReviewDb(other.disableChangeReviewDb());
 | 
			
		||||
    setFuseUpdates(other.fuseUpdates());
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user