|
20 | 20 |
|
21 | 21 | import java.util.Hashtable;
|
22 | 22 |
|
| 23 | +import org.assertj.core.api.Assertions; |
23 | 24 | import org.junit.Test;
|
24 | 25 |
|
25 | 26 | import org.apache.hadoop.fs.FSDataInputStream;
|
26 | 27 | import org.apache.hadoop.fs.FSDataOutputStream;
|
27 | 28 | import org.apache.hadoop.fs.FileStatus;
|
28 | 29 | import org.apache.hadoop.fs.Path;
|
| 30 | +import org.apache.hadoop.fs.azurebfs.services.AbfsInputStream; |
29 | 31 | import org.apache.hadoop.fs.azurebfs.utils.TracingContext;
|
30 | 32 |
|
| 33 | +import static org.apache.hadoop.fs.azurebfs.constants.FileSystemConfigurations.ONE_MB; |
| 34 | + |
31 | 35 | /**
|
32 | 36 | * Test FileSystemProperties.
|
33 | 37 | */
|
@@ -141,17 +145,23 @@ public void testSetFileSystemProperties() throws Exception {
|
141 | 145 | public void testBufferSizeSet() throws Exception {
|
142 | 146 | final AzureBlobFileSystem fs = getFileSystem();
|
143 | 147 | AbfsConfiguration abfsConfig = fs.getAbfsStore().getAbfsConfiguration();
|
144 |
| - int bufferSizeConfig = 5 * 1024 * 1024; |
145 |
| - int bufferSizeArg = 10 * 1024 * 1024; |
| 148 | + int bufferSizeConfig = 6 * ONE_MB; |
| 149 | + int bufferSizeArg = 10 * ONE_MB; |
146 | 150 |
|
147 | 151 | Path testPath = path(TEST_PATH);
|
148 | 152 | fs.create(testPath);
|
149 | 153 |
|
150 | 154 | abfsConfig.setReadBufferSize(bufferSizeConfig);
|
151 |
| - fs.open(testPath, bufferSizeArg); |
152 |
| - int actualBufferSize = abfsConfig.getReadBufferSize(); |
153 |
| - |
154 |
| - assertEquals(bufferSizeConfig, actualBufferSize); |
155 |
| - assertNotEquals(bufferSizeArg, actualBufferSize); |
| 155 | + FSDataInputStream inputStream = fs.open(testPath, bufferSizeArg); |
| 156 | + AbfsInputStream abfsInputStream |
| 157 | + = (AbfsInputStream) inputStream.getWrappedStream(); |
| 158 | + int actualBufferSize = abfsInputStream.getBufferSize(); |
| 159 | + |
| 160 | + Assertions.assertThat(actualBufferSize) |
| 161 | + .describedAs("Buffer size should be set to the value in the configuration") |
| 162 | + .isEqualTo(bufferSizeConfig); |
| 163 | + Assertions.assertThat(actualBufferSize) |
| 164 | + .describedAs("Buffer size should not be set to the value passed as argument") |
| 165 | + .isNotEqualTo(bufferSizeArg); |
156 | 166 | }
|
157 | 167 | }
|
0 commit comments