Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1454,7 +1454,7 @@ private static OzoneKey toOzoneKey(OzoneFileStatusLight status) {
keyInfo.getModificationTime(),
keyInfo.getReplicationConfig(),
metadata,
keyInfo.isFile(),
status.isFile(),
keyInfo.getOwnerName(),
Collections.emptyMap());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2567,5 +2567,4 @@ private void deleteFiles(Path base, List<String> fileNames) throws IOException {
fs.delete(new Path(base, key));
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -226,5 +226,4 @@ void testLeaseRecoverable() throws Exception {
TestLeaseRecovery.closeIgnoringKeyNotFound(stream);
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_CLIENT_LIST_CACHE_SIZE;
import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_FS_ITERATE_BATCH_SIZE;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.io.InputStream;
import java.nio.charset.StandardCharsets;
Expand All @@ -40,6 +42,7 @@
import org.apache.hadoop.ozone.client.OzoneClientFactory;
import org.apache.hadoop.ozone.client.OzoneKey;
import org.apache.hadoop.ozone.client.OzoneVolume;
import org.apache.hadoop.ozone.client.io.OzoneOutputStream;
import org.apache.hadoop.ozone.om.helpers.BucketLayout;
import org.apache.ozone.test.NonHATests;
import org.junit.jupiter.api.AfterAll;
Expand Down Expand Up @@ -502,6 +505,26 @@ public void testShallowListKeys() throws Exception {
checkKeyShallowList(keyPrefix, startKey, expectedKeys, fsoOzoneBucket);
}

@Test
void testIsFileFalseForDir() throws Exception {
byte[] data = "key-data".getBytes(StandardCharsets.UTF_8);
try (OzoneOutputStream out = emptyFsoOzoneBucket.createKey("dir1/key1", data.length)) {
out.write(data);
}

Iterator<? extends OzoneKey> keyIterator = emptyFsoOzoneBucket.listKeys("");

assertTrue(keyIterator.hasNext(), "Expected dir1, key1 in the bucket");

OzoneKey ozoneKey = keyIterator.next();
assertEquals("dir1/", ozoneKey.getName());
assertFalse(ozoneKey.isFile(), "Expected isFile to be false for directory key");

ozoneKey = keyIterator.next();
assertEquals("dir1/key1", ozoneKey.getName());
assertTrue(ozoneKey.isFile(), "Expected isFile to be true for key");
}

/**
* Verify listKeys at different levels.
*
Expand Down
Loading