Skip to content

Commit 12dab81

Browse files
author
Anuj Modi
committed
Test Code Changes
1 parent 06eef1b commit 12dab81

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAzureBlobFileSystemAttributes.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import java.util.Arrays;
2323
import java.util.EnumSet;
2424

25-
import org.junit.Assume;
2625
import org.junit.Test;
2726

2827
import org.apache.hadoop.fs.Path;
@@ -49,7 +48,7 @@ public void testSetGetXAttr() throws Exception {
4948
AbfsConfiguration conf = fs.getAbfsStore().getAbfsConfiguration();
5049
final Path testPath = path("setGetXAttr");
5150
fs.create(testPath);
52-
testGetSetXAttrHelper(fs, testPath, testPath);
51+
testGetSetXAttrHelper(fs, testPath);
5352
}
5453

5554
@Test
@@ -91,14 +90,12 @@ public void testSetGetXAttrReplace() throws Exception {
9190
@Test
9291
public void testGetSetXAttrOnRoot() throws Exception {
9392
AzureBlobFileSystem fs = getFileSystem();
94-
final Path filePath = new Path("a/b");
9593
final Path testPath = new Path("/");
96-
fs.create(filePath);
97-
testGetSetXAttrHelper(fs, filePath, testPath);
94+
testGetSetXAttrHelper(fs, testPath);
9895
}
9996

10097
private void testGetSetXAttrHelper(final AzureBlobFileSystem fs,
101-
final Path filePath, final Path testPath) throws Exception {
98+
final Path testPath) throws Exception {
10299

103100
String attributeName1 = "user.attribute1";
104101
String attributeName2 = "user.attribute2";
@@ -112,12 +109,18 @@ private void testGetSetXAttrHelper(final AzureBlobFileSystem fs,
112109
assertNull(fs.getXAttr(testPath, attributeName2));
113110

114111
// Set the Attributes
112+
fs.registerListener(
113+
new TracingHeaderValidator(fs.getAbfsStore().getAbfsConfiguration()
114+
.getClientCorrelationId(),
115+
fs.getFileSystemId(), FSOperationType.SET_ATTR, true, 0));
115116
fs.setXAttr(testPath, attributeName1, attributeValue1);
116117

117118
// Check if the attribute is retrievable
119+
fs.setListenerOperation(FSOperationType.GET_ATTR);
118120
byte[] rv = fs.getXAttr(testPath, attributeName1);
119121
assertTrue(Arrays.equals(rv, attributeValue1));
120122
assertEquals(decodedAttributeValue1, fs.getAbfsStore().decodeAttribute(rv));
123+
fs.registerListener(null);
121124

122125
// Set the second Attribute
123126
fs.setXAttr(testPath, attributeName2, attributeValue2);

0 commit comments

Comments
 (0)