Skip to content

Commit

Permalink
HADOOP-19425. Fix CheckStyle.
Browse files Browse the repository at this point in the history
  • Loading branch information
fanshilun committed Feb 18, 2025
1 parent 2321a6f commit 1f27667
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@

import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInfo;

import com.microsoft.azure.storage.Constants;
import com.microsoft.azure.storage.OperationContext;
Expand Down Expand Up @@ -65,21 +64,21 @@ public void tearDown() throws Exception {
* Test that by default we don't store the blob-level MD5.
*/
@Test
public void testBlobMd5StoreOffByDefault(TestInfo testInfo) throws Exception {
public void testBlobMd5StoreOffByDefault() throws Exception {
testAccount = AzureBlobStorageTestAccount.create();
testStoreBlobMd5(false, testInfo);
testStoreBlobMd5(false);
}

/**
* Test that we get blob-level MD5 storage and validation if we specify that
* in the configuration.
*/
@Test
public void testStoreBlobMd5(TestInfo testInfo) throws Exception {
public void testStoreBlobMd5() throws Exception {
Configuration conf = new Configuration();
conf.setBoolean(KEY_STORE_BLOB_MD5, true);
testAccount = AzureBlobStorageTestAccount.create(conf);
testStoreBlobMd5(true, testInfo);
testStoreBlobMd5(true);
}

/**
Expand All @@ -91,12 +90,11 @@ private static String trim(String s, String toTrim) {
toTrim);
}

private void testStoreBlobMd5(boolean expectMd5Stored, TestInfo testInfo) throws Exception {
private void testStoreBlobMd5(boolean expectMd5Stored) throws Exception {
assumeNotNull(testAccount);
// Write a test file.
NativeAzureFileSystem fs = testAccount.getFileSystem();
Path testFilePath = AzureTestUtils.pathForTests(fs,
testInfo.getDisplayName());
Path testFilePath = AzureTestUtils.pathForTests(fs, methodName.getMethodName());
String testFileKey = trim(testFilePath.toUri().getPath(), "/");
OutputStream outStream = fs.create(testFilePath);
outStream.write(new byte[] { 5, 15 });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@

import org.apache.hadoop.fs.StreamCapabilities;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInfo;

import static org.apache.hadoop.fs.contract.ContractTestUtils.assertHasStreamCapabilities;
import static org.apache.hadoop.fs.contract.ContractTestUtils.assertLacksStreamCapabilities;
Expand Down Expand Up @@ -116,8 +115,8 @@ protected AzureBlobStorageTestAccount createTestAccount() throws Exception {

// Verify flush writes data to storage for Page Blobs
@Test
public void testPageBlobFlush(TestInfo testInfo) throws IOException {
Path path = getBlobPathWithTestName(PAGE_BLOB_DIR, testInfo.getDisplayName());
public void testPageBlobFlush() throws IOException {
Path path = getBlobPathWithTestName(PAGE_BLOB_DIR, methodName.getMethodName());

try (FSDataOutputStream stream = fs.create(path)) {
byte[] buffer = getRandomBytes();
Expand All @@ -139,8 +138,8 @@ public void testPageBlobFlush(TestInfo testInfo) throws IOException {

// Verify hflush writes data to storage for Page Blobs
@Test
public void testPageBlobHFlush(TestInfo testInfo) throws IOException {
Path path = getBlobPathWithTestName(PAGE_BLOB_DIR, testInfo.getDisplayName());
public void testPageBlobHFlush() throws IOException {
Path path = getBlobPathWithTestName(PAGE_BLOB_DIR, methodName.getMethodName());

try (FSDataOutputStream stream = fs.create(path)) {
assertTrue(isPageBlobStreamWrapper(stream));
Expand All @@ -153,8 +152,8 @@ public void testPageBlobHFlush(TestInfo testInfo) throws IOException {

// HSync must write data to storage for Page Blobs
@Test
public void testPageBlobHSync(TestInfo testInfo) throws IOException {
Path path = getBlobPathWithTestName(PAGE_BLOB_DIR, testInfo.getDisplayName());
public void testPageBlobHSync() throws IOException {
Path path = getBlobPathWithTestName(PAGE_BLOB_DIR, methodName.getMethodName());

try (FSDataOutputStream stream = fs.create(path)) {
assertTrue(isPageBlobStreamWrapper(stream));
Expand All @@ -167,8 +166,8 @@ public void testPageBlobHSync(TestInfo testInfo) throws IOException {

// Close must write data to storage for Page Blobs
@Test
public void testPageBlobClose(TestInfo testInfo) throws IOException {
Path path = getBlobPathWithTestName(PAGE_BLOB_DIR, testInfo.getDisplayName());
public void testPageBlobClose() throws IOException {
Path path = getBlobPathWithTestName(PAGE_BLOB_DIR, methodName.getMethodName());

try (FSDataOutputStream stream = fs.create(path)) {
assertTrue(isPageBlobStreamWrapper(stream));
Expand All @@ -181,8 +180,8 @@ public void testPageBlobClose(TestInfo testInfo) throws IOException {

// Page Blobs have StreamCapabilities.HFLUSH and StreamCapabilities.HSYNC.
@Test
public void testPageBlobCapabilities(TestInfo testInfo) throws IOException {
Path path = getBlobPathWithTestName(PAGE_BLOB_DIR, testInfo.getDisplayName());
public void testPageBlobCapabilities() throws IOException {
Path path = getBlobPathWithTestName(PAGE_BLOB_DIR, methodName.getMethodName());
try (FSDataOutputStream stream = fs.create(path)) {
assertHasStreamCapabilities(stream,
StreamCapabilities.HFLUSH,
Expand All @@ -197,8 +196,8 @@ public void testPageBlobCapabilities(TestInfo testInfo) throws IOException {

// Verify flush does not write data to storage for Block Blobs
@Test
public void testBlockBlobFlush(TestInfo testInfo) throws Exception {
Path path = getBlobPathWithTestName(BLOCK_BLOB_DIR, testInfo.getDisplayName());
public void testBlockBlobFlush() throws Exception {
Path path = getBlobPathWithTestName(BLOCK_BLOB_DIR, methodName.getMethodName());
byte[] buffer = getRandomBytes();

try (FSDataOutputStream stream = fs.create(path)) {
Expand All @@ -219,8 +218,8 @@ public void testBlockBlobFlush(TestInfo testInfo) throws Exception {

// Verify hflush does not write data to storage for Block Blobs
@Test
public void testBlockBlobHFlush(TestInfo testInfo) throws Exception {
Path path = getBlobPathWithTestName(BLOCK_BLOB_DIR, testInfo.getDisplayName());
public void testBlockBlobHFlush() throws Exception {
Path path = getBlobPathWithTestName(BLOCK_BLOB_DIR, methodName.getMethodName());
byte[] buffer = getRandomBytes();

try (FSDataOutputStream stream = fs.create(path)) {
Expand All @@ -241,8 +240,8 @@ public void testBlockBlobHFlush(TestInfo testInfo) throws Exception {

// Verify hsync does not write data to storage for Block Blobs
@Test
public void testBlockBlobHSync(TestInfo testInfo) throws Exception {
Path path = getBlobPathWithTestName(BLOCK_BLOB_DIR, testInfo.getDisplayName());
public void testBlockBlobHSync() throws Exception {
Path path = getBlobPathWithTestName(BLOCK_BLOB_DIR, methodName.getMethodName());
byte[] buffer = getRandomBytes();

try (FSDataOutputStream stream = fs.create(path)) {
Expand All @@ -263,8 +262,8 @@ public void testBlockBlobHSync(TestInfo testInfo) throws Exception {

// Close must write data to storage for Block Blobs
@Test
public void testBlockBlobClose(TestInfo testInfo) throws IOException {
Path path = getBlobPathWithTestName(BLOCK_BLOB_DIR, testInfo.getDisplayName());
public void testBlockBlobClose() throws IOException {
Path path = getBlobPathWithTestName(BLOCK_BLOB_DIR, methodName.getMethodName());

try (FSDataOutputStream stream = fs.create(path)) {
byte[] buffer = getRandomBytes();
Expand All @@ -276,8 +275,8 @@ public void testBlockBlobClose(TestInfo testInfo) throws IOException {

// Block Blobs do not have any StreamCapabilities.
@Test
public void testBlockBlobCapabilities(TestInfo testInfo) throws IOException {
Path path = getBlobPathWithTestName(BLOCK_BLOB_DIR, testInfo.getDisplayName());
public void testBlockBlobCapabilities() throws IOException {
Path path = getBlobPathWithTestName(BLOCK_BLOB_DIR, methodName.getMethodName());
try (FSDataOutputStream stream = fs.create(path)) {
assertLacksStreamCapabilities(stream,
StreamCapabilities.HFLUSH,
Expand All @@ -291,8 +290,8 @@ public void testBlockBlobCapabilities(TestInfo testInfo) throws IOException {

// Verify flush writes data to storage for Block Blobs with compaction
@Test
public void testBlockBlobCompactionFlush(TestInfo testInfo) throws Exception {
Path path = getBlobPathWithTestName(BLOCK_BLOB_COMPACTION_DIR, testInfo.getDisplayName());
public void testBlockBlobCompactionFlush() throws Exception {
Path path = getBlobPathWithTestName(BLOCK_BLOB_COMPACTION_DIR, methodName.getMethodName());
byte[] buffer = getRandomBytes();

try (FSDataOutputStream stream = fs.create(path)) {
Expand All @@ -314,8 +313,8 @@ public void testBlockBlobCompactionFlush(TestInfo testInfo) throws Exception {

// Verify hflush writes data to storage for Block Blobs with Compaction
@Test
public void testBlockBlobCompactionHFlush(TestInfo testInfo) throws Exception {
Path path = getBlobPathWithTestName(BLOCK_BLOB_COMPACTION_DIR, testInfo.getDisplayName());
public void testBlockBlobCompactionHFlush() throws Exception {
Path path = getBlobPathWithTestName(BLOCK_BLOB_COMPACTION_DIR, methodName.getMethodName());
byte[] buffer = getRandomBytes();

try (FSDataOutputStream stream = fs.create(path)) {
Expand All @@ -337,8 +336,8 @@ public void testBlockBlobCompactionHFlush(TestInfo testInfo) throws Exception {

// Verify hsync writes data to storage for Block Blobs with compaction
@Test
public void testBlockBlobCompactionHSync(TestInfo testInfo) throws Exception {
Path path = getBlobPathWithTestName(BLOCK_BLOB_COMPACTION_DIR, testInfo.getDisplayName());
public void testBlockBlobCompactionHSync() throws Exception {
Path path = getBlobPathWithTestName(BLOCK_BLOB_COMPACTION_DIR, methodName.getMethodName());
byte[] buffer = getRandomBytes();

try (FSDataOutputStream stream = fs.create(path)) {
Expand All @@ -360,8 +359,8 @@ public void testBlockBlobCompactionHSync(TestInfo testInfo) throws Exception {

// Close must write data to storage for Block Blobs with compaction
@Test
public void testBlockBlobCompactionClose(TestInfo testInfo) throws IOException {
Path path = getBlobPathWithTestName(BLOCK_BLOB_COMPACTION_DIR, testInfo.getDisplayName());
public void testBlockBlobCompactionClose() throws IOException {
Path path = getBlobPathWithTestName(BLOCK_BLOB_COMPACTION_DIR, methodName.getMethodName());
try (FSDataOutputStream stream = fs.create(path)) {
assertTrue(isBlockBlobAppendStreamWrapper(stream));
byte[] buffer = getRandomBytes();
Expand All @@ -373,8 +372,8 @@ public void testBlockBlobCompactionClose(TestInfo testInfo) throws IOException {

// Block Blobs with Compaction have StreamCapabilities.HFLUSH and HSYNC.
@Test
public void testBlockBlobCompactionCapabilities(TestInfo testInfo) throws IOException {
Path path = getBlobPathWithTestName(BLOCK_BLOB_COMPACTION_DIR, testInfo.getDisplayName());
public void testBlockBlobCompactionCapabilities() throws IOException {
Path path = getBlobPathWithTestName(BLOCK_BLOB_COMPACTION_DIR, methodName.getMethodName());
try (FSDataOutputStream stream = fs.create(path)) {
assertHasStreamCapabilities(stream,
StreamCapabilities.HFLUSH,
Expand All @@ -389,8 +388,8 @@ public void testBlockBlobCompactionCapabilities(TestInfo testInfo) throws IOExce

// A small write does not write data to storage for Page Blobs
@Test
public void testPageBlobSmallWrite(TestInfo testInfo) throws IOException {
Path path = getBlobPathWithTestName(PAGE_BLOB_DIR, testInfo.getDisplayName());
public void testPageBlobSmallWrite() throws IOException {
Path path = getBlobPathWithTestName(PAGE_BLOB_DIR, methodName.getMethodName());
try (FSDataOutputStream stream = fs.create(path)) {
assertTrue(isPageBlobStreamWrapper(stream));
byte[] buffer = getRandomBytes();
Expand All @@ -401,8 +400,8 @@ public void testPageBlobSmallWrite(TestInfo testInfo) throws IOException {

// A small write does not write data to storage for Block Blobs
@Test
public void testBlockBlobSmallWrite(TestInfo testInfo) throws IOException {
Path path = getBlobPathWithTestName(BLOCK_BLOB_DIR, testInfo.getDisplayName());
public void testBlockBlobSmallWrite() throws IOException {
Path path = getBlobPathWithTestName(BLOCK_BLOB_DIR, methodName.getMethodName());
try (FSDataOutputStream stream = fs.create(path)) {
byte[] buffer = getRandomBytes();
stream.write(buffer);
Expand All @@ -413,8 +412,8 @@ public void testBlockBlobSmallWrite(TestInfo testInfo) throws IOException {
// A small write does not write data to storage for Block Blobs
// with Compaction
@Test
public void testBlockBlobCompactionSmallWrite(TestInfo testInfo) throws IOException {
Path path = getBlobPathWithTestName(BLOCK_BLOB_COMPACTION_DIR, testInfo.getDisplayName());
public void testBlockBlobCompactionSmallWrite() throws IOException {
Path path = getBlobPathWithTestName(BLOCK_BLOB_COMPACTION_DIR, methodName.getMethodName());
try (FSDataOutputStream stream = fs.create(path)) {
assertTrue(isBlockBlobAppendStreamWrapper(stream));
byte[] buffer = getRandomBytes();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ private void logFSState() {
}

@Test
public void test_010_CreateHugeFile(TestInfo testInfo) throws IOException {
public void test_010_CreateHugeFile() throws IOException {
long filesize = getTestPropertyBytes(getConfiguration(),
KEY_HUGE_FILESIZE,
DEFAULT_HUGE_FILESIZE);
Expand Down

0 comments on commit 1f27667

Please sign in to comment.