hadoop/hadoop-hdfs-project/hadoop-hdfs/src/test/resources/testXAttrConf.xml

465 lines
17 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="testConf.xsl"?>
<!--
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.
-->
<configuration>
<!-- Normal mode is test. To run just the commands and dump the output
to the log, set it to nocompare -->
<mode>test</mode>
<!-- Comparator types:
ExactComparator
SubstringComparator
RegexpComparator
TokenComparator
-->
<tests>
<test>
<description>setfattr : Add an xattr</description>
<test-commands>
<command>-fs NAMENODE -touchz /file1</command>
<command>-fs NAMENODE -setfattr -n user.a1 -v 123456 /file1</command>
<command>-fs NAMENODE -getfattr -d /file1</command>
</test-commands>
<cleanup-commands>
<command>-fs NAMENODE -rm /file1</command>
</cleanup-commands>
<comparators>
<comparator>
<type>SubstringComparator</type>
<expected-output># file: /file1</expected-output>
</comparator>
<comparator>
<type>SubstringComparator</type>
<expected-output>user.a1="123456"</expected-output>
</comparator>
</comparators>
</test>
<test>
<description>setfattr : Add an xattr which has wrong prefix</description>
<test-commands>
<command>-fs NAMENODE -touchz /file1</command>
<command>-fs NAMENODE -setfattr -n uuu.a1 -v 123456 /file1</command>
</test-commands>
<cleanup-commands>
<command>-fs NAMENODE -rm /file1</command>
</cleanup-commands>
<comparators>
<comparator>
<type>SubstringComparator</type>
<expected-output>name must be prefixed with user/trusted/security/system/raw, followed by a '.'</expected-output>
</comparator>
</comparators>
</test>
<test>
<description>setfattr : Add an xattr of trusted namespace</description>
<test-commands>
<command>-fs NAMENODE -touchz /file1</command>
<command>-fs NAMENODE -setfattr -n trusted.a1 -v 123456 /file1</command>
<command>-fs NAMENODE -getfattr -d /file1</command>
</test-commands>
<cleanup-commands>
<command>-fs NAMENODE -rm /file1</command>
</cleanup-commands>
<comparators>
<comparator>
<type>SubstringComparator</type>
<expected-output># file: /file1</expected-output>
</comparator>
<comparator>
<type>SubstringComparator</type>
<expected-output>trusted.a1="123456"</expected-output>
</comparator>
</comparators>
</test>
<test>
<description>setfattr : Add an xattr of system namespace</description>
<test-commands>
<command>-fs NAMENODE -touchz /file1</command>
<command>-fs NAMENODE -setfattr -n system.a1 -v 123456 /file1</command>
</test-commands>
<cleanup-commands>
<command>-fs NAMENODE -rm /file1</command>
</cleanup-commands>
<comparators>
<comparator>
<type>SubstringComparator</type>
<expected-output>setfattr: User doesn't have permission for xattr: system.a1</expected-output>
</comparator>
</comparators>
</test>
<test>
<description>setfattr : Add an xattr of security namespace</description>
<test-commands>
<command>-fs NAMENODE -touchz /file1</command>
<command>-fs NAMENODE -setfattr -n security.a1 -v 123456 /file1</command>
</test-commands>
<cleanup-commands>
<command>-fs NAMENODE -rm /file1</command>
</cleanup-commands>
<comparators>
<comparator>
<type>SubstringComparator</type>
<expected-output>setfattr: User doesn't have permission for xattr: security.a1</expected-output>
</comparator>
</comparators>
</test>
<test>
<description>setfattr : Add an xattr of raw namespace</description>
<test-commands>
<command>-fs NAMENODE -touchz /file1</command>
<command>-fs NAMENODE -setfattr -n raw.a1 -v 123456 /file1</command>
</test-commands>
<cleanup-commands>
<command>-fs NAMENODE -rm /file1</command>
</cleanup-commands>
<comparators>
<comparator>
<type>SubstringComparator</type>
<expected-output>setfattr: User doesn't have permission for xattr: raw.a1</expected-output>
</comparator>
</comparators>
</test>
<test>
<description>setfattr : Add an xattr of raw namespace</description>
<test-commands>
<command>-fs NAMENODE -touchz /file1</command>
<command>-fs NAMENODE -setfattr -n raw.a1 -v 123456 /.reserved/raw/file1</command>
<command>-fs NAMENODE -getfattr -n raw.a1 /.reserved/raw/file1</command>
</test-commands>
<cleanup-commands>
<command>-fs NAMENODE -rm /file1</command>
</cleanup-commands>
<comparators>
<comparator>
<type>SubstringComparator</type>
<expected-output>raw.a1="123456"</expected-output>
</comparator>
</comparators>
</test>
<test>
<description>setfattr : Add an xattr, and encode is text</description>
<test-commands>
<command>-fs NAMENODE -touchz /file1</command>
<command>-fs NAMENODE -setfattr -n user.a1 -v "123456" /file1</command>
<command>-fs NAMENODE -getfattr -d /file1</command>
</test-commands>
<cleanup-commands>
<command>-fs NAMENODE -rm /file1</command>
</cleanup-commands>
<comparators>
<comparator>
<type>SubstringComparator</type>
<expected-output># file: /file1</expected-output>
</comparator>
<comparator>
<type>SubstringComparator</type>
<expected-output>user.a1="123456"</expected-output>
</comparator>
</comparators>
</test>
<test>
<description>setfattr : Add an xattr, and encode is hex</description>
<test-commands>
<command>-fs NAMENODE -touchz /file1</command>
<command>-fs NAMENODE -setfattr -n user.a1 -v 0x313233343536 /file1</command>
<command>-fs NAMENODE -getfattr -d /file1</command>
</test-commands>
<cleanup-commands>
<command>-fs NAMENODE -rm /file1</command>
</cleanup-commands>
<comparators>
<comparator>
<type>SubstringComparator</type>
<expected-output># file: /file1</expected-output>
</comparator>
<comparator>
<type>SubstringComparator</type>
<expected-output>user.a1="123456"</expected-output>
</comparator>
</comparators>
</test>
<test>
<description>setfattr : Add an xattr, and encode is base64</description>
<test-commands>
<command>-fs NAMENODE -touchz /file1</command>
<command>-fs NAMENODE -setfattr -n user.a1 -v 0sMTIzNDU2 /file1</command>
<command>-fs NAMENODE -getfattr -d /file1</command>
</test-commands>
<cleanup-commands>
<command>-fs NAMENODE -rm /file1</command>
</cleanup-commands>
<comparators>
<comparator>
<type>SubstringComparator</type>
<expected-output># file: /file1</expected-output>
</comparator>
<comparator>
<type>SubstringComparator</type>
<expected-output>user.a1="123456"</expected-output>
</comparator>
</comparators>
</test>
<test>
<description>setfattr : Add multiple xattrs</description>
<test-commands>
<command>-fs NAMENODE -touchz /file1</command>
<command>-fs NAMENODE -setfattr -n user.a1 -v 123456 /file1</command>
<command>-fs NAMENODE -setfattr -n user.a2 -v abc /file1</command>
<command>-fs NAMENODE -getfattr -d /file1</command>
</test-commands>
<cleanup-commands>
<command>-fs NAMENODE -rm /file1</command>
</cleanup-commands>
<comparators>
<comparator>
<type>SubstringComparator</type>
<expected-output># file: /file1</expected-output>
</comparator>
<comparator>
<type>SubstringComparator</type>
<expected-output>user.a1="123456"</expected-output>
</comparator>
<comparator>
<type>SubstringComparator</type>
<expected-output>user.a2="abc"</expected-output>
</comparator>
</comparators>
</test>
<test>
<description>setfattr : Remove an xattr</description>
<test-commands>
<command>-fs NAMENODE -touchz /file1</command>
<command>-fs NAMENODE -setfattr -n user.a1 -v 123456 /file1</command>
<command>-fs NAMENODE -setfattr -n user.a2 -v abc /file1</command>
<command>-fs NAMENODE -setfattr -x user.a1 /file1</command>
<command>-fs NAMENODE -getfattr -d /file1</command>
</test-commands>
<cleanup-commands>
<command>-fs NAMENODE -rm /file1</command>
</cleanup-commands>
<comparators>
<comparator>
<type>ExactComparator</type>
<expected-output># file: /file1#LF#user.a2="abc"#LF#</expected-output>
</comparator>
</comparators>
</test>
<test>
<description>setfattr : Remove an xattr which doesn't exist</description>
<test-commands>
<command>-fs NAMENODE -touchz /file1</command>
<command>-fs NAMENODE -setfattr -n user.a1 -v 123456 /file1</command>
<command>-fs NAMENODE -setfattr -x user.a2 /file1</command>
<command>-fs NAMENODE -getfattr -d /file1</command>
</test-commands>
<cleanup-commands>
<command>-fs NAMENODE -rm /file1</command>
</cleanup-commands>
<comparators>
<comparator>
<type>ExactComparator</type>
<expected-output># file: /file1#LF#user.a1="123456"#LF#</expected-output>
</comparator>
</comparators>
</test>
<test>
<description>setfattr : Remove an xattr of raw namespace</description>
<test-commands>
<command>-fs NAMENODE -touchz /file1</command>
<command>-fs NAMENODE -setfattr -n raw.a1 -v 123456 /.reserved/raw/file1</command>
<command>-fs NAMENODE -setfattr -n raw.a2 -v 123456 /.reserved/raw/file1</command>
<command>-fs NAMENODE -setfattr -x raw.a2 /.reserved/raw/file1</command>
<command>-fs NAMENODE -getfattr -d /.reserved/raw/file1</command>
</test-commands>
<cleanup-commands>
<command>-fs NAMENODE -rm /file1</command>
</cleanup-commands>
<comparators>
<comparator>
<type>SubstringComparator</type>
<expected-output># file: /.reserved/raw/file1#LF#raw.a1="123456"#LF#</expected-output>
</comparator>
</comparators>
</test>
<test>
<description>getfattr : Get an xattr</description>
<test-commands>
<command>-fs NAMENODE -touchz /file1</command>
<command>-fs NAMENODE -setfattr -n user.a1 -v 123456 /file1</command>
<command>-fs NAMENODE -setfattr -n user.a2 -v abc /file1</command>
<command>-fs NAMENODE -getfattr -n user.a1 /file1</command>
</test-commands>
<cleanup-commands>
<command>-fs NAMENODE -rm /file1</command>
</cleanup-commands>
<comparators>
<comparator>
<type>SubstringComparator</type>
<expected-output># file: /file1</expected-output>
</comparator>
<comparator>
<type>SubstringComparator</type>
<expected-output>user.a1="123456"</expected-output>
</comparator>
</comparators>
</test>
<test>
<description>getfattr : Get an xattr which doesn't exist</description>
<test-commands>
<command>-fs NAMENODE -touchz /file1</command>
<command>-fs NAMENODE -getfattr -n user.a1 /file1</command>
</test-commands>
<cleanup-commands>
<command>-fs NAMENODE -rm /file1</command>
</cleanup-commands>
<comparators>
<comparator>
<type>ExactComparator</type>
<expected-output># file: /file1#LF#</expected-output>
</comparator>
</comparators>
</test>
<test>
<description>getfattr : Get an xattr, and encode is text</description>
<test-commands>
<command>-fs NAMENODE -touchz /file1</command>
<command>-fs NAMENODE -setfattr -n user.a1 -v 123456 /file1</command>
<command>-fs NAMENODE -setfattr -n user.a2 -v abc /file1</command>
<command>-fs NAMENODE -getfattr -n user.a1 -e text /file1</command>
</test-commands>
<cleanup-commands>
<command>-fs NAMENODE -rm /file1</command>
</cleanup-commands>
<comparators>
<comparator>
<type>SubstringComparator</type>
<expected-output># file: /file1</expected-output>
</comparator>
<comparator>
<type>SubstringComparator</type>
<expected-output>user.a1="123456"</expected-output>
</comparator>
</comparators>
</test>
<test>
<description>getfattr : Get an xattr, and encode is hex</description>
<test-commands>
<command>-fs NAMENODE -touchz /file1</command>
<command>-fs NAMENODE -setfattr -n user.a1 -v 123456 /file1</command>
<command>-fs NAMENODE -setfattr -n user.a2 -v abc /file1</command>
<command>-fs NAMENODE -getfattr -n user.a1 -e hex /file1</command>
</test-commands>
<cleanup-commands>
<command>-fs NAMENODE -rm /file1</command>
</cleanup-commands>
<comparators>
<comparator>
<type>SubstringComparator</type>
<expected-output># file: /file1</expected-output>
</comparator>
<comparator>
<type>SubstringComparator</type>
<expected-output>user.a1=0x313233343536</expected-output>
</comparator>
</comparators>
</test>
<test>
<description>getfattr : Get an xattr, and encode is base64</description>
<test-commands>
<command>-fs NAMENODE -touchz /file1</command>
<command>-fs NAMENODE -setfattr -n user.a1 -v 123456 /file1</command>
<command>-fs NAMENODE -setfattr -n user.a2 -v abc /file1</command>
<command>-fs NAMENODE -getfattr -n user.a1 -e base64 /file1</command>
</test-commands>
<cleanup-commands>
<command>-fs NAMENODE -rm /file1</command>
</cleanup-commands>
<comparators>
<comparator>
<type>SubstringComparator</type>
<expected-output># file: /file1</expected-output>
</comparator>
<comparator>
<type>SubstringComparator</type>
<expected-output>user.a1=0sMTIzNDU2</expected-output>
</comparator>
</comparators>
</test>
<test>
<description>getfattr : Get an xattr, and encode is invalid</description>
<test-commands>
<command>-fs NAMENODE -touchz /file1</command>
<command>-fs NAMENODE -setfattr -n user.a1 -v 123456 /file1</command>
<command>-fs NAMENODE -setfattr -n user.a2 -v abc /file1</command>
<command>-fs NAMENODE -getfattr -n user.a1 -e invalid /file1</command>
</test-commands>
<cleanup-commands>
<command>-fs NAMENODE -rm /file1</command>
</cleanup-commands>
<comparators>
<comparator>
<type>SubstringComparator</type>
<expected-output>Invalid/unsupported encoding option specified: invalid</expected-output>
</comparator>
</comparators>
</test>
<test>
<description>getfattr -R : recursive</description>
<test-commands>
<command>-fs NAMENODE -mkdir /dir1</command>
<command>-fs NAMENODE -setfattr -n user.a1 -v 123456 /dir1</command>
<command>-fs NAMENODE -mkdir /dir1/dir2</command>
<command>-fs NAMENODE -setfattr -n user.a2 -v abc /dir1/dir2</command>
<command>-fs NAMENODE -getfattr -R -d /dir1</command>
</test-commands>
<cleanup-commands>
<command>-fs NAMENODE -rm -R /dir1</command>
</cleanup-commands>
<comparators>
<comparator>
<type>ExactComparator</type>
<expected-output># file: /dir1#LF#user.a1="123456"#LF## file: /dir1/dir2#LF#user.a2="abc"#LF#</expected-output>
</comparator>
</comparators>
</test>
</tests>
</configuration>