/*
 * Licensed to the University of California, Berkeley under one or more contributor license
 * agreements. See the NOTICE file distributed with this work for additional information regarding
 * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance with the License. You may obtain a
 * copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */

package tachyon.shell.command;

import java.io.IOException;

import org.junit.Assert;
import org.junit.Test;

import tachyon.TachyonURI;
import tachyon.client.FileSystemTestUtils;
import tachyon.client.WriteType;
import tachyon.exception.TachyonException;
import tachyon.shell.AbstractTfsShellTest;

/**
 * Tests for chmod command.
 */
public class ChmodCommandTest extends AbstractTfsShellTest {

  @Test
  public void chmodTest() throws IOException, TachyonException {
    clearLoginUser();
    FileSystemTestUtils.createByteFile(mFileSystem, "/testFile", WriteType.MUST_CACHE, 10);
    mFsShell.run("chmod", "777", "/testFile");
    int permission = mFileSystem.getStatus(new TachyonURI("/testFile")).getPermission();
    Assert.assertEquals((short) 0777, permission);
    mFsShell.run("chmod", "755", "/testFile");
    permission = mFileSystem.getStatus(new TachyonURI("/testFile")).getPermission();
    Assert.assertEquals((short) 0755, permission);
  }

}

@@ -1746,10 +1746,932 @@
 );%0A  %7D%0A%0A
+  @Test%0A  public void chmodRecursivelyTest() throws IOException, TachyonException %7B%0A    clearLoginUser();%0A    FileSystemTestUtils.createByteFile(mFileSystem, %22/testDir/testFile%22, WriteType.MUST_CACHE, 10);%0A    mFsShell.run(%22chmod%22, %22-R%22, %22777%22, %22/testDir%22);%0A    int permission = mFileSystem.getStatus(new TachyonURI(%22/testDir%22)).getPermission();%0A    Assert.assertEquals((short) 0777, permission);%0A    permission = mFileSystem.getStatus(new TachyonURI(%22/testDir/testFile%22)).getPermission();%0A    Assert.assertEquals((short) 0777, permission);%0A    mFsShell.run(%22chmod%22, %22-R%22, %22755%22, %22/testDir%22);%0A    permission = mFileSystem.getStatus(new TachyonURI(%22/testFile%22)).getPermission();%0A    Assert.assertEquals((short) 0755, permission);%0A    mFsShell.run(%22chmod%22, %22777%22, %22/testDir%22, %22-R%22);%0A    permission = mFileSystem.getStatus(new TachyonURI(%22/testFile%22)).getPermission();%0A    Assert.assertEquals((short) 0777, permission);%0A  %7D%0A%0A
 %7D%0A

Add unit test for chmod -R.