use of org.neo4j.kernel.impl.util.collection.TimedRepository in project neo4j by neo4j.
the class ConversationManagerTest method testConversationWorkflow.
@Test
public void testConversationWorkflow() throws Exception {
JobScheduler.JobHandle reaperJobHandle = mock(JobScheduler.JobHandle.class);
when(config.get(HaSettings.lock_read_timeout)).thenReturn(1L);
when(conversationSPI.scheduleRecurringJob(any(JobScheduler.Group.class), any(Long.class), any(Runnable.class))).thenReturn(reaperJobHandle);
RequestContext requestContext = getRequestContext();
conversationManager = getConversationManager();
TimedRepository conversationStorage = mock(TimedRepository.class);
conversationManager.conversations = conversationStorage;
conversationManager.begin(requestContext);
conversationManager.acquire(requestContext);
conversationManager.release(requestContext);
conversationManager.end(requestContext);
InOrder conversationOrder = inOrder(conversationStorage);
conversationOrder.verify(conversationStorage).begin(requestContext);
conversationOrder.verify(conversationStorage).acquire(requestContext);
conversationOrder.verify(conversationStorage).release(requestContext);
conversationOrder.verify(conversationStorage).end(requestContext);
}
use of org.neo4j.kernel.impl.util.collection.TimedRepository in project neo4j by neo4j.
the class ConversationManagerTest method testConversationStop.
@Test
public void testConversationStop() {
RequestContext requestContext = getRequestContext();
conversationManager = getConversationManager();
Conversation conversation = mock(Conversation.class);
when(conversation.isActive()).thenReturn(true);
TimedRepository conversationStorage = mock(TimedRepository.class);
when(conversationStorage.end(requestContext)).thenReturn(conversation);
conversationManager.conversations = conversationStorage;
conversationManager.stop(requestContext);
verify(conversationStorage).end(requestContext);
verify(conversation).stop();
}
Aggregations