@@ -239,8 +239,6 @@ public void shouldNotReadDelegation() throws Exception {
239
239
public void shouldReCallReadDelegationOnConflict () throws Exception {
240
240
241
241
NFS4Client client = createClient (sh );
242
- ClientCB mockCallBack = mock (ClientCB .class );
243
- client .setCB (mockCallBack );
244
242
245
243
StateOwner stateOwner1 = client .getOrCreateOwner ("client1" .getBytes (StandardCharsets .UTF_8 ), new seqid4 (0 ));
246
244
StateOwner stateOwner2 = client .getOrCreateOwner ("client2" .getBytes (StandardCharsets .UTF_8 ), new seqid4 (0 ));
@@ -257,7 +255,25 @@ public void shouldReCallReadDelegationOnConflict() throws Exception {
257
255
// expected
258
256
}
259
257
260
- verify (mockCallBack ).cbDelegationRecall (any (), any (), anyBoolean ());
258
+ verify (client . getCB () ).cbDelegationRecall (any (), any (), anyBoolean ());
261
259
}
262
260
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
+ }
263
279
}
0 commit comments