Search in sources :

Example 21 with SourceState

use of com.airbnb.spinaltap.common.source.SourceState in project SpinalTap by airbnb.

the class AbstractMysqlSourceTest method testSaveState.

@Test
public void testSaveState() throws Exception {
    TestSource source = new TestSource();
    SourceState savedState = mock(SourceState.class);
    SourceState newState = mock(SourceState.class);
    when(stateRepository.read()).thenReturn(savedState);
    source.saveState(newState);
    verify(stateRepository, times(1)).save(newState);
    assertEquals(newState, source.getLastSavedState().get());
}
Also used : SourceState(com.airbnb.spinaltap.common.source.SourceState) Test(org.junit.Test)

Aggregations

SourceState (com.airbnb.spinaltap.common.source.SourceState)21 Test (org.junit.Test)16 MysqlMutationMetadata (com.airbnb.spinaltap.mysql.mutation.MysqlMutationMetadata)3 MysqlInsertMutation (com.airbnb.spinaltap.mysql.mutation.MysqlInsertMutation)2 MysqlMutation (com.airbnb.spinaltap.mysql.mutation.MysqlMutation)2 AtomicReference (java.util.concurrent.atomic.AtomicReference)2 Repository (com.airbnb.spinaltap.common.util.Repository)1 BinlogFilePos (com.airbnb.spinaltap.mysql.BinlogFilePos)1 TableCache (com.airbnb.spinaltap.mysql.TableCache)1 BinlogEvent (com.airbnb.spinaltap.mysql.event.BinlogEvent)1 DeleteEvent (com.airbnb.spinaltap.mysql.event.DeleteEvent)1 QueryEvent (com.airbnb.spinaltap.mysql.event.QueryEvent)1 StartEvent (com.airbnb.spinaltap.mysql.event.StartEvent)1 TableMapEvent (com.airbnb.spinaltap.mysql.event.TableMapEvent)1 UpdateEvent (com.airbnb.spinaltap.mysql.event.UpdateEvent)1 WriteEvent (com.airbnb.spinaltap.mysql.event.WriteEvent)1 XidEvent (com.airbnb.spinaltap.mysql.event.XidEvent)1 Row (com.airbnb.spinaltap.mysql.mutation.schema.Row)1 Collection (java.util.Collection)1 InvocationOnMock (org.mockito.invocation.InvocationOnMock)1