@@ -239,8 +239,6 @@ public void shouldNotReadDelegation() throws Exception {
239239 public void shouldReCallReadDelegationOnConflict () throws Exception {
240240
241241 NFS4Client client = createClient (sh );
242- ClientCB mockCallBack = mock (ClientCB .class );
243- client .setCB (mockCallBack );
244242
245243 StateOwner stateOwner1 = client .getOrCreateOwner ("client1" .getBytes (StandardCharsets .UTF_8 ), new seqid4 (0 ));
246244 StateOwner stateOwner2 = client .getOrCreateOwner ("client2" .getBytes (StandardCharsets .UTF_8 ), new seqid4 (0 ));
@@ -257,7 +255,25 @@ public void shouldReCallReadDelegationOnConflict() throws Exception {
257255 // expected
258256 }
259257
260- verify (mockCallBack ).cbDelegationRecall (any (), any (), anyBoolean ());
258+ verify (client . getCB () ).cbDelegationRecall (any (), any (), anyBoolean ());
261259 }
262260
261+ @ Test
262+ public void shouldAllowMultipleReadDelegation () throws Exception {
263+
264+ NFS4Client client1 = createClient (sh );
265+ NFS4Client client2 = createClient (sh );
266+
267+ StateOwner stateOwner1 = client1 .getOrCreateOwner ("client1" .getBytes (StandardCharsets .UTF_8 ), new seqid4 (0 ));
268+ StateOwner stateOwner2 = client2 .getOrCreateOwner ("client2" .getBytes (StandardCharsets .UTF_8 ), new seqid4 (0 ));
269+
270+ nfs_fh4 fh = generateFileHandle ();
271+ Inode inode = Inode .forFile (fh .value );
272+
273+ var openRecord1 = tracker .addOpen (client1 , stateOwner1 , inode , OPEN4_SHARE_ACCESS_READ | nfs4_prot .OPEN4_SHARE_ACCESS_WANT_READ_DELEG , 0 );
274+ var openRecord2 = tracker .addOpen (client2 , stateOwner2 , inode , OPEN4_SHARE_ACCESS_READ | nfs4_prot .OPEN4_SHARE_ACCESS_WANT_READ_DELEG , 0 );
275+
276+ assertTrue ("Read delegation not granted" , openRecord2 .hasDelegation ());
277+
278+ }
263279}
0 commit comments