Search in sources :

Example 1 with ManagedBoltStateMachine

use of org.neo4j.kernel.api.bolt.ManagedBoltStateMachine in project neo4j by neo4j.

the class StandardBoltConnectionTrackerTest method shouldTrackConnectionsAndTheirOwners.

@Test
public void shouldTrackConnectionsAndTheirOwners() throws Exception {
    // given
    StandardBoltConnectionTracker tracker = new StandardBoltConnectionTracker();
    ManagedBoltStateMachine owner1machine1 = mock(ManagedBoltStateMachine.class);
    ManagedBoltStateMachine owner1machine2 = mock(ManagedBoltStateMachine.class);
    ManagedBoltStateMachine owner2machine1 = mock(ManagedBoltStateMachine.class);
    ManagedBoltStateMachine owner2machine2 = mock(ManagedBoltStateMachine.class);
    tracker.onRegister(owner1machine1, "owner1");
    tracker.onRegister(owner1machine2, "owner1");
    tracker.onRegister(owner2machine1, "owner2");
    tracker.onRegister(owner2machine2, "owner2");
    // then
    assertEquals(asSet(owner1machine1, owner1machine2, owner2machine1, owner2machine2), tracker.getActiveConnections());
    assertEquals(asSet(owner1machine1, owner1machine2), tracker.getActiveConnections("owner1"));
    assertEquals(asSet(owner2machine1, owner2machine2), tracker.getActiveConnections("owner2"));
}
Also used : ManagedBoltStateMachine(org.neo4j.kernel.api.bolt.ManagedBoltStateMachine) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 ManagedBoltStateMachine (org.neo4j.kernel.api.bolt.ManagedBoltStateMachine)1