|
@@ -36,6 +36,7 @@ import org.apache.hadoop.fs.XAttrSetFlag;
|
|
|
import org.apache.hadoop.fs.permission.AclEntry;
|
|
|
import org.apache.hadoop.fs.permission.FsPermission;
|
|
|
import org.apache.hadoop.hdfs.DFSConfigKeys;
|
|
|
+import org.apache.hadoop.test.GenericTestUtils;
|
|
|
import org.apache.hadoop.util.StringUtils;
|
|
|
import org.junit.Assert;
|
|
|
import org.junit.Test;
|
|
@@ -468,4 +469,44 @@ public class TestParam {
|
|
|
p = new StoragePolicyParam("COLD");
|
|
|
Assert.assertEquals("COLD", p.getValue());
|
|
|
}
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void testHttpOpParams() {
|
|
|
+ try {
|
|
|
+ new PostOpParam("TEST");
|
|
|
+ Assert
|
|
|
+ .fail("Construct the PostOpParam with param value 'TEST' should be"
|
|
|
+ + " failed.");
|
|
|
+ } catch (IllegalArgumentException e) {
|
|
|
+ GenericTestUtils.assertExceptionContains(
|
|
|
+ "TEST is not a valid POST operation.", e);
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ new PutOpParam("TEST");
|
|
|
+ Assert
|
|
|
+ .fail("Construct the PutOpParam with param value 'TEST' should be"
|
|
|
+ + " failed.");
|
|
|
+ } catch (IllegalArgumentException e) {
|
|
|
+ GenericTestUtils.assertExceptionContains(
|
|
|
+ "TEST is not a valid PUT operation.", e);
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ new DeleteOpParam("TEST");
|
|
|
+ Assert
|
|
|
+ .fail("Construct the DeleteOpParam with param value 'TEST' should be"
|
|
|
+ + " failed.");
|
|
|
+ } catch (IllegalArgumentException e) {
|
|
|
+ GenericTestUtils.assertExceptionContains(
|
|
|
+ "TEST is not a valid DELETE operation.", e);
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ new GetOpParam("TEST");
|
|
|
+ Assert
|
|
|
+ .fail("Construct the GetOpParam with param value 'TEST' should be"
|
|
|
+ + " failed.");
|
|
|
+ } catch (IllegalArgumentException e) {
|
|
|
+ GenericTestUtils.assertExceptionContains(
|
|
|
+ "TEST is not a valid GET operation.", e);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|