RpcProgramNfs3 extends RpcProgram implements Nfs3Interface { @Override protected boolean isIdempotent(RpcCall call) { final NFSPROC3 nfsproc3 = NFSPROC3.fromValue(call.getProcedure()); return nfsproc3 == null || nfsproc3.isIdempotent(); } RpcProgramNfs3(NfsConfiguration config, DatagramSocket registrationSocket,
      boolean allowInsecurePorts); @Override void startDaemons(); @Override void stopDaemons(); @Override NFS3Response nullProcedure(); @Override GETATTR3Response getattr(XDR xdr, RpcInfo info); @Override SETATTR3Response setattr(XDR xdr, RpcInfo info); @Override LOOKUP3Response lookup(XDR xdr, RpcInfo info); @Override ACCESS3Response access(XDR xdr, RpcInfo info); @Override READLINK3Response readlink(XDR xdr, RpcInfo info); @Override READ3Response read(XDR xdr, RpcInfo info); @Override WRITE3Response write(XDR xdr, RpcInfo info); @Override CREATE3Response create(XDR xdr, RpcInfo info); @Override MKDIR3Response mkdir(XDR xdr, RpcInfo info); @Override READDIR3Response mknod(XDR xdr, RpcInfo info); @Override REMOVE3Response remove(XDR xdr, RpcInfo info); @Override RMDIR3Response rmdir(XDR xdr, RpcInfo info); @Override RENAME3Response rename(XDR xdr, RpcInfo info); @Override SYMLINK3Response symlink(XDR xdr, RpcInfo info); @Override READDIR3Response link(XDR xdr, RpcInfo info); @Override READDIR3Response readdir(XDR xdr, RpcInfo info); READDIR3Response readdir(XDR xdr, SecurityHandler securityHandler,
      SocketAddress remoteAddress); @Override READDIRPLUS3Response readdirplus(XDR xdr, RpcInfo info); @Override FSSTAT3Response fsstat(XDR xdr, RpcInfo info); @Override FSINFO3Response fsinfo(XDR xdr, RpcInfo info); @Override PATHCONF3Response pathconf(XDR xdr, RpcInfo info); @Override COMMIT3Response commit(XDR xdr, RpcInfo info); @Override void handleInternal(ChannelHandlerContext ctx, RpcInfo info); static final int DEFAULT_UMASK; static final FsPermission umask; }
@Test(timeout=1000) public void testIdempotent() { Object[][] procedures = { { Nfs3Constant.NFSPROC3.NULL, 1 }, { Nfs3Constant.NFSPROC3.GETATTR, 1 }, { Nfs3Constant.NFSPROC3.SETATTR, 1 }, { Nfs3Constant.NFSPROC3.LOOKUP, 1 }, { Nfs3Constant.NFSPROC3.ACCESS, 1 }, { Nfs3Constant.NFSPROC3.READLINK, 1 }, { Nfs3Constant.NFSPROC3.READ, 1 }, { Nfs3Constant.NFSPROC3.WRITE, 1 }, { Nfs3Constant.NFSPROC3.CREATE, 0 }, { Nfs3Constant.NFSPROC3.MKDIR, 0 }, { Nfs3Constant.NFSPROC3.SYMLINK, 0 }, { Nfs3Constant.NFSPROC3.MKNOD, 0 }, { Nfs3Constant.NFSPROC3.REMOVE, 0 }, { Nfs3Constant.NFSPROC3.RMDIR, 0 }, { Nfs3Constant.NFSPROC3.RENAME, 0 }, { Nfs3Constant.NFSPROC3.LINK, 0 }, { Nfs3Constant.NFSPROC3.READDIR, 1 }, { Nfs3Constant.NFSPROC3.READDIRPLUS, 1 }, { Nfs3Constant.NFSPROC3.FSSTAT, 1 }, { Nfs3Constant.NFSPROC3.FSINFO, 1 }, { Nfs3Constant.NFSPROC3.PATHCONF, 1 }, { Nfs3Constant.NFSPROC3.COMMIT, 1 } }; for (Object[] procedure : procedures) { boolean idempotent = procedure[1].equals(Integer.valueOf(1)); Nfs3Constant.NFSPROC3 proc = (Nfs3Constant.NFSPROC3)procedure[0]; if (idempotent) { Assert.assertTrue(("Procedure " + proc + " should be idempotent"), proc.isIdempotent()); } else { Assert.assertFalse(("Procedure " + proc + " should be non-idempotent"), proc.isIdempotent()); } } }