use of io.prestosql.dispatcher.DispatchQuery in project hetu-core by openlookeng.
the class TestStateUpdater method testUpdateStates.
@Test
public void testUpdateStates() throws JsonProcessingException {
DispatchQuery dispatchQuery = mockDispatchQueryData(false);
StateStoreProvider stateStoreProvider = Mockito.mock(LocalStateStoreProvider.class);
StateUpdater stateUpdater = new StateUpdater(stateStoreProvider, updateInterval);
stateUpdater.registerQuery(STATE_COLLECTION_QUERY, dispatchQuery);
when(stateStoreProvider.getStateStore()).then(new Returns(stateStore));
when(stateStoreProvider.getStateStore().getStateCollection(any())).then(new Returns(Mockito.mock(StateMap.class)));
when(stateStoreProvider.getStateStore().getStateCollection(any()).getType()).then(new Returns(StateCollection.Type.MAP));
updateStateChange(dispatchQuery);
stateUpdater.updateStates();
int numberOfCalls = mockingDetails(stateStoreProvider.getStateStore().getStateCollection(any())).getInvocations().size();
assertNotEquals(numberOfCalls, ERROR_CODE_VALUE_INDEX_TIME_NO_INVOCATION);
stateUpdater.registerQuery(STATE_COLLECTION_QUERY, dispatchQuery);
}
Aggregations