Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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 @@ -26,8 +26,8 @@
import org.apache.hadoop.util.StringUtils;
import org.apache.hadoop.util.XMLUtils;

import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -85,7 +85,7 @@
testConfigFile, e);
success = false;
}
assertTrue("Error reading test config file", success);
assertTrue(success, "Error reading test config file");
}
}

Expand Down Expand Up @@ -113,7 +113,7 @@
readTestConfigFile();

conf = new Configuration();
conf.setBoolean(CommonConfigurationKeys.HADOOP_SECURITY_AUTHORIZATION,
conf.setBoolean(CommonConfigurationKeys.HADOOP_SECURITY_AUTHORIZATION,
true);

clitestDataDir = new File(TEST_CACHE_DATA_DIR).
Expand Down Expand Up @@ -161,7 +161,7 @@

ArrayList<CLICommand> testCommands = td.getTestCommands();
for (CLICommand cmd : testCommands) {
LOG.info(" Test Commands: [" +
LOG.info(" Test Commands: [" +
expandCommand(cmd.getCmd()) + "]");
}

Expand All @@ -176,9 +176,9 @@
ArrayList<ComparatorData> compdata = td.getComparatorData();
for (ComparatorData cd : compdata) {
boolean resultBoolean = cd.getTestResult();
LOG.info(" Comparator: [" +
LOG.info(" Comparator: [" +
cd.getComparatorType() + "]");
LOG.info(" Comparision result: [" +
LOG.info(" Comparision result: [" +
(resultBoolean ? "pass" : "fail") + "]");
LOG.info(" Expected output: [" +
expandCommand(cd.getExpectedOutput()) + "]");
Expand Down Expand Up @@ -212,7 +212,7 @@

LOG.info(" Testing mode: " + testMode);
LOG.info("");
LOG.info(" Overall result: " +
LOG.info(" Overall result: " +
(overallResults ? "+++ PASS +++" : "--- FAIL ---"));
if ((totalPass + totalFail) == 0) {
LOG.info(" # Tests pass: " + 0);
Expand All @@ -222,11 +222,11 @@
{
LOG.info(" # Tests pass: " + totalPass +
" (" + (100 * totalPass / (totalPass + totalFail)) + "%)");
LOG.info(" # Tests fail: " + totalFail +
LOG.info(" # Tests fail: " + totalFail +
" (" + (100 * totalFail / (totalPass + totalFail)) + "%)");
}

LOG.info(" # Validations done: " + totalComparators +
LOG.info(" # Validations done: " + totalComparators +
" (each test may do multiple validations)");

LOG.info("");
Expand All @@ -237,7 +237,7 @@
for (i = 0; i < testsFromConfigFile.size(); i++) {
boolean resultBoolean = testsFromConfigFile.get(i).getTestResult();
if (!resultBoolean) {
LOG.info((i + 1) + ": " +
LOG.info((i + 1) + ": " +
testsFromConfigFile.get(i).getTestDesc());
foundTests = true;
}
Expand All @@ -253,7 +253,7 @@
for (i = 0; i < testsFromConfigFile.size(); i++) {
boolean resultBoolean = testsFromConfigFile.get(i).getTestResult();
if (resultBoolean) {
LOG.info((i + 1) + ": " +
LOG.info((i + 1) + ": " +
testsFromConfigFile.get(i).getTestDesc());
foundTests = true;
}
Expand All @@ -262,10 +262,9 @@
LOG.info("NONE");
}

assertTrue("One of the tests failed. " +
"See the Detailed results to identify " +
"the command that failed", overallResults);

assertTrue(overallResults, "One of the tests failed. " +
"See the Detailed results to identify " +

Check failure on line 266 in hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/cli/CLITestHelper.java

View check run for this annotation

ASF Cloudbees Jenkins ci-hadoop / Apache Yetus

hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/cli/CLITestHelper.java#L266

blanks: tabs in line
"the command that failed");

Check failure on line 267 in hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/cli/CLITestHelper.java

View check run for this annotation

ASF Cloudbees Jenkins ci-hadoop / Apache Yetus

hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/cli/CLITestHelper.java#L267

blanks: tabs in line
}

/**
Expand Down Expand Up @@ -310,8 +309,8 @@
*********************************/

public void testAll() {
assertTrue("Number of tests has to be greater then zero",
testsFromConfigFile.size() > 0);
assertTrue(testsFromConfigFile.size() > 0,
"Number of tests has to be greater then zero");
LOG.info("TestAll");
// Run the tests defined in the testConf.xml config file.
for (int index = 0; index < testsFromConfigFile.size(); index++) {
Expand All @@ -337,7 +336,7 @@

boolean compareOutput = false;
boolean compareExitCode = false;

if (! comptype.equalsIgnoreCase("none")) {
compareOutput = compareTestOutput(cd, cmdResult);
if (cd.getExitCode() == -1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,21 @@

import org.apache.hadoop.cli.util.CLICommand;
import org.apache.hadoop.cli.util.CommandExecutor;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

/**
* Tests for the Command Line Interface (CLI)
*/
public class TestCLI extends CLITestHelper {
@Before
@BeforeEach
@Override
public void setUp() throws Exception {
super.setUp();
}

@After
@AfterEach
@Override
public void tearDown() throws Exception {
super.tearDown();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@
import org.apache.hadoop.http.HttpServer2;
import org.apache.hadoop.util.XMLUtils;

import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;

import static org.mockito.Mockito.when;
import static org.mockito.Mockito.mock;
import static org.junit.Assert.*;
import static org.junit.jupiter.api.Assertions.*;

/**
* Basic test case that the ConfServlet can write configuration
Expand All @@ -64,7 +64,7 @@ public class TestConfServlet {
new HashMap<String, String>();
private static final Map<String, String> MASK_PROPERTIES = new HashMap<>();

@BeforeClass
@BeforeAll
public static void initTestProperties() {
TEST_PROPERTIES.put("test.key1", "value1");
TEST_PROPERTIES.put("test.key2", "value2");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

package org.apache.hadoop.conf;

import org.junit.Assert;
import org.junit.jupiter.api.Assertions;
import org.junit.Test;

import java.util.Arrays;
Expand Down Expand Up @@ -75,9 +75,8 @@ private void testRedact(Configuration conf) throws Exception {
);
for (String key : sensitiveKeys) {
processedText = redactor.redact(key, ORIGINAL_VALUE);
Assert.assertEquals(
"Config parameter wasn't redacted and should be: " + key,
REDACTED_TEXT, processedText);
Assertions.assertEquals(REDACTED_TEXT, processedText,
"Config parameter wasn't redacted and should be: " + key);
}

List<String> normalKeys = Arrays.asList(
Expand All @@ -90,9 +89,8 @@ private void testRedact(Configuration conf) throws Exception {
);
for (String key : normalKeys) {
processedText = redactor.redact(key, ORIGINAL_VALUE);
Assert.assertEquals(
"Config parameter was redacted and shouldn't be: " + key,
ORIGINAL_VALUE, processedText);
Assertions.assertEquals(ORIGINAL_VALUE, processedText,
"Config parameter was redacted and shouldn't be: " + key);
}
}
}
Loading