}
public void testRemoteRejectionFromInferiorCaller() throws Exception
{
TesteeSet<T> testeeSet = getTesteeSet(node1, 1, 3);
AbstractClusterLockSupport testee = testeeSet.impl;
HAPartition partition = testee.getPartition();
LocalLockHandler handler = testee.getLocalHandler();
resetToStrict(partition);
resetToStrict(handler);
ClusterNode inferior = testee.getCurrentView().get(2);
ArrayList<RemoteLockResponse> rspList = new ArrayList<RemoteLockResponse>();
rspList.add(new RemoteLockResponse(null, RemoteLockResponse.Flag.OK));
rspList.add(new RemoteLockResponse(null, RemoteLockResponse.Flag.REJECT, inferior));
expect(partition.callMethodOnCluster(eq("test"),
eq("remoteLock"),
eqLockParams(node1, 200000),
aryEq(AbstractClusterLockSupport.REMOTE_LOCK_TYPES),
eq(true))).andReturn(rspList);
expect(partition.callMethodOnCluster(eq("test"),
eq("releaseRemoteLock"),
aryEq(new Object[]{"test", node1}),
aryEq(AbstractClusterLockSupport.RELEASE_REMOTE_LOCK_TYPES),
eq(true))).andReturn(rspList);
rspList = new ArrayList<RemoteLockResponse>();
rspList.add(new RemoteLockResponse(null, RemoteLockResponse.Flag.OK));
rspList.add(new RemoteLockResponse(null, RemoteLockResponse.Flag.OK));
expect(partition.callMethodOnCluster(eq("test"),
eq("remoteLock"),
eqLockParams(node1, 200000),
aryEq(AbstractClusterLockSupport.REMOTE_LOCK_TYPES),
eq(true))).andReturn(rspList);
handler.lockFromCluster(eq("test"), eq(node1), anyLong());
expectLastCall().atLeastOnce();
replay(partition);
replay(handler);
assertTrue(testee.lock("test", 50));
verify(partition);
verify(handler);
}