use of org.jboss.as.cli.operation.impl.DefaultCallbackHandler in project eap-additional-testsuite by jboss-set.
the class AddressOnlyParsingTestCase method testRootCharInTheMiddle.
@Test
public void testRootCharInTheMiddle() throws Exception {
OperationRequestAddress prefix = new DefaultOperationRequestAddress();
prefix.toNode("a", "b");
DefaultCallbackHandler handler = new DefaultCallbackHandler(prefix);
parser.parse("/", handler);
assertTrue(handler.hasAddress());
assertFalse(handler.hasOperationName());
assertFalse(handler.hasProperties());
assertFalse(handler.endsOnAddressOperationNameSeparator());
assertFalse(handler.endsOnPropertyListStart());
assertFalse(handler.endsOnPropertySeparator());
assertFalse(handler.endsOnPropertyValueSeparator());
assertTrue(handler.endsOnNodeSeparator());
assertFalse(handler.endsOnNodeTypeNameSeparator());
assertFalse(handler.isRequestComplete());
OperationRequestAddress address = handler.getAddress();
address.isEmpty();
try {
handler.reset();
parser.parse("//", handler);
Assert.fail("Shouldn't allow root character in the middle of the path");
} catch (CommandFormatException e) {
// expected
}
try {
handler.reset();
parser.parse("./a/", handler);
Assert.fail("Shouldn't allow root character in the middle of the path");
} catch (CommandFormatException e) {
// expected
}
handler.reset();
parser.parse("./a=b/", handler);
try {
handler.reset();
parser.parse("./a=b//", handler);
Assert.fail("Shouldn't allow root character in the middle of the path");
} catch (CommandFormatException e) {
// expected
}
try {
handler.reset();
parser.parse("./a=b//a=b", handler);
Assert.fail("Shouldn't allow root character in the middle of the path");
} catch (CommandFormatException e) {
// expected
}
}
Aggregations