Skip to content

Commit e2ff769

Browse files
committed
comment suggestions
1 parent 37687e1 commit e2ff769

File tree

2 files changed

+19
-24
lines changed

2 files changed

+19
-24
lines changed

hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/AzureBlobFileSystem.java

+2-17
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
package org.apache.hadoop.fs.azurebfs;
2020

21-
import javax.annotation.Nullable;
2221
import java.io.File;
2322
import java.io.FileNotFoundException;
2423
import java.io.IOException;
@@ -42,6 +41,7 @@
4241
import java.util.concurrent.ExecutorService;
4342
import java.util.concurrent.Executors;
4443
import java.util.concurrent.Future;
44+
import javax.annotation.Nullable;
4545

4646
import org.slf4j.Logger;
4747
import org.slf4j.LoggerFactory;
@@ -118,22 +118,7 @@
118118
import static org.apache.hadoop.fs.CommonConfigurationKeys.IOSTATISTICS_LOGGING_LEVEL;
119119
import static org.apache.hadoop.fs.CommonConfigurationKeys.IOSTATISTICS_LOGGING_LEVEL_DEFAULT;
120120
import static org.apache.hadoop.fs.Options.OpenFileOptions.FS_OPTION_OPENFILE_STANDARD_OPTIONS;
121-
import static org.apache.hadoop.fs.azurebfs.AbfsStatistic.CALL_APPEND;
122-
import static org.apache.hadoop.fs.azurebfs.AbfsStatistic.CALL_CREATE;
123-
import static org.apache.hadoop.fs.azurebfs.AbfsStatistic.CALL_CREATE_NON_RECURSIVE;
124-
import static org.apache.hadoop.fs.azurebfs.AbfsStatistic.CALL_DELETE;
125-
import static org.apache.hadoop.fs.azurebfs.AbfsStatistic.CALL_EXIST;
126-
import static org.apache.hadoop.fs.azurebfs.AbfsStatistic.CALL_GET_DELEGATION_TOKEN;
127-
import static org.apache.hadoop.fs.azurebfs.AbfsStatistic.CALL_GET_FILE_STATUS;
128-
import static org.apache.hadoop.fs.azurebfs.AbfsStatistic.CALL_LIST_STATUS;
129-
import static org.apache.hadoop.fs.azurebfs.AbfsStatistic.CALL_MKDIRS;
130-
import static org.apache.hadoop.fs.azurebfs.AbfsStatistic.CALL_OPEN;
131-
import static org.apache.hadoop.fs.azurebfs.AbfsStatistic.CALL_RENAME;
132-
import static org.apache.hadoop.fs.azurebfs.AbfsStatistic.DIRECTORIES_CREATED;
133-
import static org.apache.hadoop.fs.azurebfs.AbfsStatistic.DIRECTORIES_DELETED;
134-
import static org.apache.hadoop.fs.azurebfs.AbfsStatistic.ERROR_IGNORED;
135-
import static org.apache.hadoop.fs.azurebfs.AbfsStatistic.FILES_CREATED;
136-
import static org.apache.hadoop.fs.azurebfs.AbfsStatistic.FILES_DELETED;
121+
import static org.apache.hadoop.fs.azurebfs.AbfsStatistic.*;
137122
import static org.apache.hadoop.fs.azurebfs.constants.AbfsHttpConstants.CPK_IN_NON_HNS_ACCOUNT_ERROR_MESSAGE;
138123
import static org.apache.hadoop.fs.azurebfs.constants.AbfsServiceType.DFS;
139124
import static org.apache.hadoop.fs.azurebfs.constants.ConfigurationKeys.DATA_BLOCKS_BUFFER;

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

+17-7
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,18 @@
2020

2121
import java.util.Hashtable;
2222

23+
import org.assertj.core.api.Assertions;
2324
import org.junit.Test;
2425

2526
import org.apache.hadoop.fs.FSDataInputStream;
2627
import org.apache.hadoop.fs.FSDataOutputStream;
2728
import org.apache.hadoop.fs.FileStatus;
2829
import org.apache.hadoop.fs.Path;
30+
import org.apache.hadoop.fs.azurebfs.services.AbfsInputStream;
2931
import org.apache.hadoop.fs.azurebfs.utils.TracingContext;
3032

33+
import static org.apache.hadoop.fs.azurebfs.constants.FileSystemConfigurations.ONE_MB;
34+
3135
/**
3236
* Test FileSystemProperties.
3337
*/
@@ -141,17 +145,23 @@ public void testSetFileSystemProperties() throws Exception {
141145
public void testBufferSizeSet() throws Exception {
142146
final AzureBlobFileSystem fs = getFileSystem();
143147
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;
146150

147151
Path testPath = path(TEST_PATH);
148152
fs.create(testPath);
149153

150154
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);
156166
}
157167
}

0 commit comments

Comments
 (0)