MountServer extends mount_protServerStub { public MountServer(ExportTable exports, VirtualFileSystem fs) { super(); _exports = exports; _vfs = fs; } MountServer(ExportTable exports, VirtualFileSystem fs); @Override void MOUNTPROC3_NULL_3(RpcCall call$); @Override mountres3 MOUNTPROC3_MNT_3(RpcCall call$, dirpath arg1); @Override mountlist MOUNTPROC3_DUMP_3(RpcCall call$); @Override void MOUNTPROC3_UMNT_3(RpcCall call$, dirpath arg1); @Override void MOUNTPROC3_UMNTALL_3(RpcCall call$); @Override exports MOUNTPROC3_EXPORT_3(RpcCall call$); @Override void MOUNTPROC_NULL_1(RpcCall call$); @Override fhstatus MOUNTPROC_MNT_1(RpcCall call$, dirpath arg1); @Override mountlist MOUNTPROC_DUMP_1(RpcCall call$); @Override void MOUNTPROC_UMNT_1(RpcCall call$, dirpath arg1); @Override void MOUNTPROC_UMNTALL_1(RpcCall call$); @Override exports MOUNTPROC_EXPORT_1(RpcCall call$); @Override exports MOUNTPROC_EXPORTALL_1(RpcCall call$); final static int RPC_AUTH_GSS_KRB5; final static int RPC_AUTH_GSS_KRB5I; final static int RPC_AUTH_GSS_KRB5P; }
@Test public void testMounFlavors() throws IOException { String path = "/some/export"; mountres3 res = mountServer() .withPath(path) .exportedTo("192.168.178.33") .withSecurity(FsExport.Sec.KRB5). accessedFrom("192.168.178.33"). toMount(path); assertEquals(mountstat3.MNT3_OK, res.fhs_status); assertTrue(contains(res.mountinfo.auth_flavors, MountServer.RPC_AUTH_GSS_KRB5I)); assertTrue(contains(res.mountinfo.auth_flavors, MountServer.RPC_AUTH_GSS_KRB5P)); assertFalse(contains(res.mountinfo.auth_flavors, MountServer.RPC_AUTH_GSS_KRB5)); assertFalse(contains(res.mountinfo.auth_flavors, RpcAuthType.NONE)); assertFalse(contains(res.mountinfo.auth_flavors, RpcAuthType.UNIX)); }
@Test public void testPathWithSlash() throws IOException { String path = "/some/export/with/slash/"; mountres3 res = mountServer() .withPath(path) .exportedTo("192.168.178.33") .withSecurity(FsExport.Sec.SYS). accessedFrom("192.168.178.33"). toMount(path); assertEquals(mountstat3.MNT3_OK, res.fhs_status); }
@Test public void testMountBySymlink() throws IOException { String path = "/some/path"; String symlink = "/path/to/symlink"; mountres3 res = mountServer() .withPath(path) .withSymlink(symlink) .exportedTo("192.168.178.33") .withSecurity(FsExport.Sec.SYS). accessedFrom("192.168.178.33"). toMount(symlink); assertEquals(mountstat3.MNT3_OK, res.fhs_status); }
@Test public void testDumpNoClients() throws IOException { assertFalse(mountServer().hasMounts()); }
@Test public void testMountAddsClient() throws IOException { String path = "/some/export"; mountres3 res = mountServer() .withPath(path) .exportedTo("192.168.178.33") .withSecurity(FsExport.Sec.SYS). accessedFrom("192.168.178.33"). toMount(path); assertTrue(mountServer().hasMounts()); }
@Test public void testUnmountRemovesClient() throws IOException { String path = "/some/export"; mountres3 res = mountServer() .withPath(path) .exportedTo("192.168.178.33") .withSecurity(FsExport.Sec.SYS). accessedFrom("192.168.178.33"). toMount(path); assertTrue(mountServer().hasMounts()); mountServer() .accessedFrom("192.168.178.33") .unmount(path); assertFalse(mountServer().hasMounts()); }