This is an automated email from the ASF dual-hosted git repository.
xyao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git
The following commit(s) were added to refs/heads/master by this push:
new 2fc1022 HDDS-4905. Add prefix CLI. (#1995)
2fc1022 is described below
commit 2fc1022be77af9001431625dd0f5246114a97b17
Author: Xiaoyu Yao <[email protected]>
AuthorDate: Wed Mar 10 08:01:07 2021 -0800
HDDS-4905. Add prefix CLI. (#1995)
---
.../src/main/smoketest/basic/ozone-shell-lib.robot | 17 +++++
.../src/main/smoketest/basic/ozone-shell.robot | 3 +
.../key/acl/prefix/OMPrefixAddAclRequest.java | 1 -
.../apache/hadoop/ozone/shell/OzoneAddress.java | 25 +++++++-
.../ozone/shell/prefix/AddAclPrefixHandler.java | 52 +++++++++++++++
.../ozone/shell/prefix/GetAclPrefixHandler.java | 40 ++++++++++++
.../hadoop/ozone/shell/prefix/PrefixCommands.java | 75 ++++++++++++++++++++++
.../hadoop/ozone/shell/prefix/PrefixUri.java | 48 ++++++++++++++
.../ozone/shell/prefix/RemoveAclPrefixHandler.java | 54 ++++++++++++++++
.../ozone/shell/prefix/SetAclPrefixHandler.java | 53 +++++++++++++++
.../hadoop/ozone/shell/prefix/package-info.java | 21 ++++++
.../hadoop/ozone/shell/TestOzoneAddress.java | 11 ++++
12 files changed, 398 insertions(+), 2 deletions(-)
diff --git a/hadoop-ozone/dist/src/main/smoketest/basic/ozone-shell-lib.robot
b/hadoop-ozone/dist/src/main/smoketest/basic/ozone-shell-lib.robot
index de8c7d2..8c9d5e5 100644
--- a/hadoop-ozone/dist/src/main/smoketest/basic/ozone-shell-lib.robot
+++ b/hadoop-ozone/dist/src/main/smoketest/basic/ozone-shell-lib.robot
@@ -167,3 +167,20 @@ Test key Acls
${result} = Execute ozone sh key getacl
${protocol}${server}/${volume}/bb1/key2
Should Match Regexp ${result} \"type\" :
\"USER\",\n.*\"name\" : \"superuser1\",\n.*\"aclScope\" :
\"ACCESS\",\n.*\"aclList\" : . \"READ\", \"WRITE\", \"READ_ACL\", \"WRITE_ACL\"
Should Match Regexp ${result} \"type\" :
\"GROUP\",\n.*\"name\" : \"superuser1\",\n.*\"aclScope\" :
\"ACCESS\",\n.*\"aclList\" : . \"ALL\" .
+
+Test prefix Acls
+ [arguments] ${protocol} ${server} ${volume}
+ Execute ozone sh prefix addacl
${protocol}${server}/${volume}/bb1/prefix1/ -a user:superuser1:rwxy[DEFAULT]
+ ${result} = Execute ozone sh prefix getacl
${protocol}${server}/${volume}/bb1/prefix1/
+ Should Match Regexp ${result} \"type\" :
\"USER\",\n.*\"name\" : \"superuser1\",\n.*\"aclScope\" :
\"DEFAULT\",\n.*\"aclList\" : . \"READ\", \"WRITE\", \"READ_ACL\", \"WRITE_ACL\"
+ ${result} = Execute ozone sh prefix removeacl
${protocol}${server}/${volume}/bb1/prefix1/ -a user:superuser1:xy
+ ${result} = Execute ozone sh prefix getacl
${protocol}${server}/${volume}/bb1/prefix1/
+ Should Match Regexp ${result} \"type\" :
\"USER\",\n.*\"name\" : \"superuser1\",\n.*\"aclScope\" :
\"DEFAULT\",\n.*\"aclList\" : . \"READ\", \"WRITE\"
+ ${result} = Execute ozone sh prefix setacl
${protocol}${server}/${volume}/bb1/prefix1/ -al
user:superuser1:rwxy[DEFAULT],group:superuser1:a[DEFAULT],user:testuser/[email protected]:rwxyc
+ ${result} = Execute ozone sh prefix getacl
${protocol}${server}/${volume}/bb1/prefix1/
+ Should Match Regexp ${result} \"type\" :
\"USER\",\n.*\"name\" : \"superuser1\",\n.*\"aclScope\" :
\"DEFAULT\",\n.*\"aclList\" : . \"READ\", \"WRITE\", \"READ_ACL\", \"WRITE_ACL\"
+ Should Match Regexp ${result} \"type\" :
\"GROUP\",\n.*\"name\" : \"superuser1\",\n.*\"aclScope\" :
\"DEFAULT\",\n.*\"aclList\" : . \"ALL\" .
+ Execute ozone sh key put
${protocol}${server}/${volume}/bb1/prefix1/key1 /opt/hadoop/NOTICE.txt
+ ${result} = Execute ozone sh key getacl
${protocol}${server}/${volume}/bb1/prefix1/key1
+ Should Match Regexp ${result} \"type\" :
\"USER\",\n.*\"name\" : \"superuser1\",\n.*\"aclScope\" :
\"ACCESS\",\n.*\"aclList\" : . \"READ\", \"WRITE\", \"READ_ACL\", \"WRITE_ACL\"
+ Should Match Regexp ${result} \"type\" :
\"GROUP\",\n.*\"name\" : \"superuser1\",\n.*\"aclScope\" :
\"ACCESS\",\n.*\"aclList\" : . \"ALL\" .
\ No newline at end of file
diff --git a/hadoop-ozone/dist/src/main/smoketest/basic/ozone-shell.robot
b/hadoop-ozone/dist/src/main/smoketest/basic/ozone-shell.robot
index fcaa524..d0f319e 100644
--- a/hadoop-ozone/dist/src/main/smoketest/basic/ozone-shell.robot
+++ b/hadoop-ozone/dist/src/main/smoketest/basic/ozone-shell.robot
@@ -35,6 +35,9 @@ RpcClient bucket acls
RpcClient key acls
Test Key Acls o3:// om:9862 ${prefix}-rpcwoport2
+RpcClient prefix acls
+ Test Prefix Acls o3:// om:9862 ${prefix}-rpcwoport2
+
RpcClient without host
Test ozone shell o3:// ${EMPTY} ${prefix}-rpcwport
diff --git
a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/key/acl/prefix/OMPrefixAddAclRequest.java
b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/key/acl/prefix/OMPrefixAddAclRequest.java
index 0c67b70..2f23a3b 100644
---
a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/key/acl/prefix/OMPrefixAddAclRequest.java
+++
b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/key/acl/prefix/OMPrefixAddAclRequest.java
@@ -112,7 +112,6 @@ public class OMPrefixAddAclRequest extends
OMPrefixAclRequest {
}
break;
case FAILURE:
- omMetrics.incNumBucketUpdateFails();
LOG.error("Add acl {} to path {} failed!", ozoneAcls,
ozoneObj.getPath(), exception);
break;
diff --git
a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/OzoneAddress.java
b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/OzoneAddress.java
index 0ddd657..740e667 100644
---
a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/OzoneAddress.java
+++
b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/OzoneAddress.java
@@ -56,6 +56,8 @@ public class OzoneAddress {
private String keyName = "";
+ private boolean isPrefix = false;
+
public OzoneAddress() throws OzoneClientException {
this("o3:///");
}
@@ -295,6 +297,10 @@ public class OzoneAddress {
return keyName;
}
+ public boolean isPrefix() {
+ return isPrefix;
+ }
+
public void ensureBucketAddress() throws OzoneClientException {
if (keyName.length() > 0) {
throw new OzoneClientException(
@@ -308,6 +314,22 @@ public class OzoneAddress {
}
}
+ // Ensure prefix address with a prefix flag
+ // Allow CLI to differentiate key and prefix address
+ public void ensurePrefixAddress() throws OzoneClientException {
+ if (keyName.length() == 0) {
+ throw new OzoneClientException(
+ "prefix name is missing.");
+ } else if (volumeName.length() == 0) {
+ throw new OzoneClientException(
+ "Volume name is missing");
+ } else if (bucketName.length() == 0) {
+ throw new OzoneClientException(
+ "Bucket name is missing");
+ }
+ isPrefix = true;
+ }
+
public void ensureKeyAddress() throws OzoneClientException {
if (keyName.length() == 0) {
throw new OzoneClientException(
@@ -354,7 +376,8 @@ public class OzoneAddress {
private OzoneObj.ResourceType getResourceType() {
if (!keyName.isEmpty()) {
- return OzoneObj.ResourceType.KEY;
+ return isPrefix ? OzoneObj.ResourceType.PREFIX :
+ OzoneObj.ResourceType.KEY;
}
if (!bucketName.isEmpty()) {
return OzoneObj.ResourceType.BUCKET;
diff --git
a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/prefix/AddAclPrefixHandler.java
b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/prefix/AddAclPrefixHandler.java
new file mode 100644
index 0000000..52489ed
--- /dev/null
+++
b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/prefix/AddAclPrefixHandler.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) 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 org.apache.hadoop.ozone.shell.prefix;
+
+import org.apache.hadoop.ozone.client.OzoneClient;
+import org.apache.hadoop.ozone.security.acl.OzoneObj;
+import org.apache.hadoop.ozone.shell.OzoneAddress;
+import org.apache.hadoop.ozone.shell.acl.AclHandler;
+import org.apache.hadoop.ozone.shell.acl.AclOption;
+import picocli.CommandLine;
+
+import java.io.IOException;
+
+/**
+ * Add ACL to prefix.
+ */
[email protected](name = AclHandler.ADD_ACL_NAME,
+ description = AclHandler.ADD_ACL_DESC)
+public class AddAclPrefixHandler extends AclHandler {
+
+ @CommandLine.Mixin
+ private PrefixUri address;
+
+ @CommandLine.Mixin
+ private AclOption acls;
+
+ @Override
+ protected OzoneAddress getAddress() {
+ return address.getValue();
+ }
+
+ @Override
+ protected void execute(OzoneClient client, OzoneObj obj) throws IOException {
+ acls.addTo(obj, client.getObjectStore(), out());
+ }
+
+}
diff --git
a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/prefix/GetAclPrefixHandler.java
b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/prefix/GetAclPrefixHandler.java
new file mode 100644
index 0000000..e244bb6
--- /dev/null
+++
b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/prefix/GetAclPrefixHandler.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) 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 org.apache.hadoop.ozone.shell.prefix;
+
+import org.apache.hadoop.ozone.shell.OzoneAddress;
+import org.apache.hadoop.ozone.shell.acl.AclHandler;
+import org.apache.hadoop.ozone.shell.acl.GetAclHandler;
+import picocli.CommandLine;
+
+/**
+ * Get ACL of prefix.
+ */
[email protected](name = AclHandler.GET_ACL_NAME,
+ description = AclHandler.GET_ACL_DESC)
+public class GetAclPrefixHandler extends GetAclHandler {
+
+ @CommandLine.Mixin
+ private PrefixUri address;
+
+ @Override
+ protected OzoneAddress getAddress() {
+ return address.getValue();
+ }
+
+}
diff --git
a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/prefix/PrefixCommands.java
b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/prefix/PrefixCommands.java
new file mode 100644
index 0000000..e2d703b
--- /dev/null
+++
b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/prefix/PrefixCommands.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) 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 org.apache.hadoop.ozone.shell.prefix;
+
+import java.util.concurrent.Callable;
+
+import org.apache.hadoop.hdds.cli.GenericParentCommand;
+import org.apache.hadoop.hdds.cli.HddsVersionProvider;
+import org.apache.hadoop.hdds.cli.MissingSubcommandException;
+import org.apache.hadoop.hdds.cli.SubcommandWithParent;
+import org.apache.hadoop.hdds.conf.OzoneConfiguration;
+import org.apache.hadoop.ozone.shell.OzoneShell;
+import org.apache.hadoop.ozone.shell.Shell;
+
+import org.kohsuke.MetaInfServices;
+import picocli.CommandLine.Command;
+import picocli.CommandLine.ParentCommand;
+
+/**
+ * Subcommands for the prefix related operations.
+ */
+@Command(name = "prefix",
+ description = "Prefix specific operations",
+ subcommands = {
+ AddAclPrefixHandler.class,
+ RemoveAclPrefixHandler.class,
+ SetAclPrefixHandler.class,
+ GetAclPrefixHandler.class,
+ },
+ mixinStandardHelpOptions = true,
+ versionProvider = HddsVersionProvider.class)
+@MetaInfServices(SubcommandWithParent.class)
+public class PrefixCommands implements GenericParentCommand, Callable<Void>,
+ SubcommandWithParent {
+
+ @ParentCommand
+ private Shell shell;
+
+ @Override
+ public Void call() throws Exception {
+ throw new MissingSubcommandException(
+ this.shell.getCmd().getSubcommands().get("prefix"));
+ }
+
+ @Override
+ public boolean isVerbose() {
+ return shell.isVerbose();
+ }
+
+ @Override
+ public OzoneConfiguration createOzoneConfiguration() {
+ return shell.createOzoneConfiguration();
+ }
+
+ @Override
+ public Class<?> getParentType() {
+ return OzoneShell.class;
+ }
+}
diff --git
a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/prefix/PrefixUri.java
b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/prefix/PrefixUri.java
new file mode 100644
index 0000000..59a8eed
--- /dev/null
+++
b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/prefix/PrefixUri.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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 org.apache.hadoop.ozone.shell.prefix;
+
+import org.apache.hadoop.ozone.client.OzoneClientException;
+import org.apache.hadoop.ozone.shell.Shell;
+import org.apache.hadoop.ozone.shell.OzoneAddress;
+import picocli.CommandLine;
+
+/**
+ * URI parameter for prefix-specific commands.
+ */
+public class PrefixUri implements CommandLine.ITypeConverter<OzoneAddress> {
+
+ private static final String OZONE_PREFIX_URI_DESCRIPTION =
+ "URI of the volume/bucket/prefix.\n" + Shell.OZONE_URI_DESCRIPTION;
+
+ @CommandLine.Parameters(index = "0", arity = "1..1",
+ description = OZONE_PREFIX_URI_DESCRIPTION,
+ converter = org.apache.hadoop.ozone.shell.prefix.PrefixUri.class)
+ private OzoneAddress value;
+
+ public OzoneAddress getValue() {
+ return value;
+ }
+
+ @Override
+ public OzoneAddress convert(String str) throws OzoneClientException {
+ OzoneAddress address = new OzoneAddress(str);
+ address.ensurePrefixAddress();
+ return address;
+ }
+}
diff --git
a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/prefix/RemoveAclPrefixHandler.java
b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/prefix/RemoveAclPrefixHandler.java
new file mode 100644
index 0000000..3ebaae6
--- /dev/null
+++
b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/prefix/RemoveAclPrefixHandler.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) 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 org.apache.hadoop.ozone.shell.prefix;
+
+import org.apache.hadoop.ozone.client.OzoneClient;
+import org.apache.hadoop.ozone.security.acl.OzoneObj;
+import org.apache.hadoop.ozone.shell.OzoneAddress;
+import org.apache.hadoop.ozone.shell.acl.AclHandler;
+import org.apache.hadoop.ozone.shell.acl.AclOption;
+import picocli.CommandLine;
+
+import java.io.IOException;
+
+/**
+ * Remove ACL from prefix.
+ */
[email protected](name = AclHandler.REMOVE_ACL_NAME,
+ description = AclHandler.REMOVE_ACL_DESC)
+public class RemoveAclPrefixHandler extends AclHandler {
+
+ @CommandLine.Mixin
+ private PrefixUri address;
+
+ @CommandLine.Mixin
+ private AclOption acls;
+
+ @Override
+ protected OzoneAddress getAddress() {
+ return address.getValue();
+ }
+
+ @Override
+ protected void execute(OzoneClient client, OzoneObj obj) throws IOException {
+ acls.removeFrom(obj, client.getObjectStore(), out());
+ }
+
+}
diff --git
a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/prefix/SetAclPrefixHandler.java
b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/prefix/SetAclPrefixHandler.java
new file mode 100644
index 0000000..2816b0d
--- /dev/null
+++
b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/prefix/SetAclPrefixHandler.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) 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 org.apache.hadoop.ozone.shell.prefix;
+
+import org.apache.hadoop.ozone.client.OzoneClient;
+import org.apache.hadoop.ozone.security.acl.OzoneObj;
+import org.apache.hadoop.ozone.shell.OzoneAddress;
+import org.apache.hadoop.ozone.shell.acl.AclHandler;
+import org.apache.hadoop.ozone.shell.acl.AclOption;
+import picocli.CommandLine;
+
+import java.io.IOException;
+
+/**
+ * Set ACL on prefix.
+ */
[email protected](name = AclHandler.SET_ACL_NAME,
+ description = AclHandler.SET_ACL_DESC)
+public class SetAclPrefixHandler extends AclHandler {
+
+ @CommandLine.Mixin
+ private PrefixUri address;
+
+ @CommandLine.Mixin
+ private AclOption acls;
+
+ @Override
+ protected OzoneAddress getAddress() {
+ return address.getValue();
+ }
+
+ @Override
+ protected void execute(OzoneClient client, OzoneObj obj)
+ throws IOException {
+ acls.setOn(obj, client.getObjectStore(), out());
+ }
+
+}
diff --git
a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/prefix/package-info.java
b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/prefix/package-info.java
new file mode 100644
index 0000000..09738cc
--- /dev/null
+++
b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/prefix/package-info.java
@@ -0,0 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) 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.
+ */
+/**
+ * Prefix Acl commands for Ozone.
+ */
+package org.apache.hadoop.ozone.shell.prefix;
diff --git
a/hadoop-ozone/tools/src/test/java/org/apache/hadoop/ozone/shell/TestOzoneAddress.java
b/hadoop-ozone/tools/src/test/java/org/apache/hadoop/ozone/shell/TestOzoneAddress.java
index 10ba576..ec651c6 100644
---
a/hadoop-ozone/tools/src/test/java/org/apache/hadoop/ozone/shell/TestOzoneAddress.java
+++
b/hadoop-ozone/tools/src/test/java/org/apache/hadoop/ozone/shell/TestOzoneAddress.java
@@ -94,5 +94,16 @@ public class TestOzoneAddress {
Assert.assertEquals("vol1", address.getVolumeName());
Assert.assertEquals("bucket", address.getBucketName());
Assert.assertEquals("key1/key3/key", address.getKeyName());
+ Assert.assertFalse("this should not be a prefix",
+ address.isPrefix());
+
+ address = new OzoneAddress(prefix + "vol1/bucket/prefix");
+ address.ensurePrefixAddress();
+ Assert.assertEquals("vol1", address.getVolumeName());
+ Assert.assertEquals("bucket", address.getBucketName());
+ Assert.assertEquals("prefix", address.getKeyName());
+ Assert.assertTrue("this should be a prefix",
+ address.isPrefix());
+
}
}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]