private void basicClusterLockFailsAgainstLocalLockTest(int viewSize) throws Exception
{
int viewPos = viewSize == 1 ? 0 : 1;
TesteeSet<NonGloballyExclusiveClusterLockSupport> testeeSet = getTesteeSet(node1, viewPos, viewSize);
NonGloballyExclusiveClusterLockSupport testee = testeeSet.impl;
HAPartition partition = testee.getPartition();
LocalLockHandler handler = testee.getLocalHandler();
resetToNice(partition);
resetToStrict(handler);
ArrayList<RemoteLockResponse> rspList = new ArrayList<RemoteLockResponse>();
for (int i = 0; i < viewSize - 1; i++)
{
rspList.add(new RemoteLockResponse(null, RemoteLockResponse.Flag.OK));
}
expect(partition.callMethodOnCluster(eq("test"),
eq("remoteLock"),
eqLockParams(node1, 2000000),
aryEq(AbstractClusterLockSupport.REMOTE_LOCK_TYPES),
eq(true))).andReturn(rspList).atLeastOnce();
handler.lockFromCluster(eq("test"), eq(node1), anyLong());
expectLastCall().andThrow(new TimeoutException(node1)).atLeastOnce();
expect(partition.callMethodOnCluster(eq("test"),
eq("releaseRemoteLock"),
aryEq(new Object[]{"test", node1}),
aryEq(AbstractClusterLockSupport.RELEASE_REMOTE_LOCK_TYPES),
eq(true))).andReturn(new ArrayList<Object>()).atLeastOnce();
replay(partition);
replay(handler);
assertFalse(testee.lock("test", 10));
verify(partition);
verify(handler);
}