use of org.apache.hadoop.hdfs.server.common.HdfsServerConstants.StartupOption in project SSM by Intel-bigdata.
the class SmartServer method parseArguments.
@VisibleForTesting
public static StartupOption parseArguments(String[] args) {
int argsLen = (args == null) ? 0 : args.length;
StartupOption startOpt = StartupOption.REGULAR;
for (int i = 0; i < argsLen; i++) {
String cmd = args[i];
if (StartupOption.FORMAT.getName().equalsIgnoreCase(cmd)) {
startOpt = StartupOption.FORMAT;
} else if (StartupOption.CHECKPOINT.getName().equalsIgnoreCase(cmd)) {
startOpt = StartupOption.CHECKPOINT;
} else {
return null;
}
}
return startOpt;
}
use of org.apache.hadoop.hdfs.server.common.HdfsServerConstants.StartupOption in project hadoop by apache.
the class TestDatanodeStartupOptions method checkExpected.
/**
* Process the given arg list as command line arguments to the DataNode
* to make sure we get the expected result. If the expected result is
* success then further validate that the parsed startup option is the
* same as what was expected.
*
* @param expectSuccess
* @param expectedOption
* @param conf
* @param arg
*/
private static void checkExpected(boolean expectSuccess, StartupOption expectedOption, Configuration conf, String... arg) {
String[] args = new String[arg.length];
int i = 0;
for (String currentArg : arg) {
args[i++] = currentArg;
}
boolean returnValue = DataNode.parseArguments(args, conf);
StartupOption option = DataNode.getStartupOption(conf);
assertThat(returnValue, is(expectSuccess));
if (expectSuccess) {
assertThat(option, is(expectedOption));
}
}
use of org.apache.hadoop.hdfs.server.common.HdfsServerConstants.StartupOption in project hadoop by apache.
the class TestHdfsServerConstants method verifyStartupOptionResult.
/**
* Verify that parsing a StartupOption string gives the expected results.
* If a RollingUpgradeStartupOption is specified than it is also checked.
*
* @param value
* @param expectedOption
* @param expectedRollupOption optional, may be null.
*/
private static void verifyStartupOptionResult(String value, StartupOption expectedOption, RollingUpgradeStartupOption expectedRollupOption) {
StartupOption option = StartupOption.getEnum(value);
assertEquals(expectedOption, option);
if (expectedRollupOption != null) {
assertEquals(expectedRollupOption, option.getRollingUpgradeStartupOption());
}
}
Aggregations