use of alluxio.exception.status.InvalidArgumentException in project alluxio by Alluxio.
the class QuorumRemoveCommand method run.
@Override
public int run(CommandLine cl) throws IOException {
JournalMasterClient jmClient = mMasterJournalMasterClient;
String domainVal = cl.getOptionValue(DOMAIN_OPTION_NAME);
try {
JournalDomain domain = JournalDomain.valueOf(domainVal);
if (domain == JournalDomain.JOB_MASTER) {
jmClient = mJobMasterJournalMasterClient;
}
} catch (IllegalArgumentException e) {
throw new InvalidArgumentException(ExceptionMessage.INVALID_OPTION_VALUE.getMessage(DOMAIN_OPTION_NAME, Arrays.toString(JournalDomain.values())));
}
String serverAddress = cl.getOptionValue(ADDRESS_OPTION_NAME);
jmClient.removeQuorumServer(QuorumCommand.stringToAddress(serverAddress));
mPrintStream.println(String.format(OUTPUT_RESULT, serverAddress, domainVal));
return 0;
}
use of alluxio.exception.status.InvalidArgumentException in project alluxio by Alluxio.
the class TestCase method run.
/**
* Runs the test case.
*/
public void run() throws Exception {
String expected = "";
if (mExpectedResult != null) {
switch(mOptions.getContentType()) {
case TestCaseOptions.JSON_CONTENT_TYPE:
{
ObjectMapper mapper = new ObjectMapper();
if (mOptions.isPrettyPrint()) {
expected = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(mExpectedResult);
} else {
expected = mapper.writeValueAsString(mExpectedResult);
}
break;
}
case TestCaseOptions.XML_CONTENT_TYPE:
{
XmlMapper mapper = new XmlMapper();
if (mOptions.isPrettyPrint()) {
expected = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(mExpectedResult);
} else {
expected = mapper.writeValueAsString(mExpectedResult);
}
break;
}
default:
throw new InvalidArgumentException("Invalid content type in TestCaseOptions!");
}
}
String result = call();
Assert.assertEquals(mEndpoint, expected, result);
}
Aggregations