/** * Test for createSymlink */ @Test public void testCreateSymlink() throws Exception { String target = "/testNamenodeRetryCache/testCreateSymlink/target"; // Two retried symlink calls succeed newCall(); nnRpc.createSymlink(target, "/a/b", perm, true); nnRpc.createSymlink(target, "/a/b", perm, true); nnRpc.createSymlink(target, "/a/b", perm, true); // non-retried call fails newCall(); try { // Second non-retry call should fail with an exception nnRpc.createSymlink(target, "/a/b", perm, true); Assert.fail("testCreateSymlink - expected exception is not thrown"); } catch (IOException e) { // Expected } }
private void testInvalidSymlinkTarget(NamenodeProtocols nnRpc, String invalidTarget, String link) throws IOException { try { FsPermission perm = FsPermission.createImmutable((short)0755); nnRpc.createSymlink(invalidTarget, link, perm, false); fail("Symbolic link creation of target " + invalidTarget + " should fail"); } catch (InvalidPathException expected) { // Expected } }
private void testValidSymlinkTarget(NamenodeProtocols nnRpc, String target, String link) throws IOException { FsPermission perm = FsPermission.createImmutable((short)0755); nnRpc.createSymlink(target, link, perm, false); assertEquals(target, nnRpc.getLinkTarget(link)); }
np.createSymlink(destination.getValue(), fullpath, PermissionParam.getDefaultFsPermission(), createParent.getValue()); return Response.ok().type(MediaType.APPLICATION_OCTET_STREAM).build();
np.createSymlink(destination.getValue(), fullpath, PermissionParam.getDefaultFsPermission(), createParent.getValue()); return Response.ok().type(MediaType.APPLICATION_OCTET_STREAM).build();