use of org.neo4j.kernel.impl.locking.community.CommunityLockManger in project neo4j by neo4j.
the class SlaveLockManagerTest method doesNotCreateClientsAfterShutdown.
@Test
public void doesNotCreateClientsAfterShutdown() throws Throwable {
SlaveLockManager slaveLockManager = newSlaveLockManager(new CommunityLockManger(Config.defaults(), Clocks.systemClock()));
assertNotNull(slaveLockManager.newClient());
slaveLockManager.close();
try {
slaveLockManager.newClient();
fail("Exception expected");
} catch (Exception e) {
assertThat(e, instanceOf(IllegalStateException.class));
}
}
use of org.neo4j.kernel.impl.locking.community.CommunityLockManger in project neo4j by neo4j.
the class SlaveLocksClientTest method setUp.
@Before
public void setUp() throws Exception {
master = mock(Master.class);
availabilityGuard = new AvailabilityGuard(Clocks.fakeClock(), getInstance());
lockManager = new CommunityLockManger(Config.defaults(), Clocks.systemClock());
local = spy(lockManager.newClient());
logProvider = new AssertableLogProvider();
LockResult lockResultOk = new LockResult(LockStatus.OK_LOCKED);
TransactionStreamResponse<LockResult> responseOk = new TransactionStreamResponse<>(lockResultOk, null, TransactionStream.EMPTY, ResourceReleaser.NO_OP);
whenMasterAcquireShared().thenReturn(responseOk);
whenMasterAcquireExclusive().thenReturn(responseOk);
client = new SlaveLocksClient(master, local, lockManager, mock(RequestContextFactory.class), availabilityGuard, logProvider);
}
Aggregations