use of org.jboss.as.cli.operation.OperationRequestAddress.Node in project wildfly-core by wildfly.
the class AddressOnlyParsingTestCase method testChildNodeTypeOnlyWithPrefixNode.
@Test
public void testChildNodeTypeOnlyWithPrefixNode() throws Exception {
OperationRequestAddress prefix = new DefaultOperationRequestAddress();
prefix.toNode("a", "b");
DefaultCallbackHandler handler = new DefaultCallbackHandler(prefix);
parser.parse("./subsystem", handler);
assertTrue(handler.hasAddress());
assertFalse(handler.hasOperationName());
assertFalse(handler.hasProperties());
assertFalse(handler.endsOnAddressOperationNameSeparator());
assertFalse(handler.endsOnPropertyListStart());
assertFalse(handler.endsOnPropertySeparator());
assertFalse(handler.endsOnPropertyValueSeparator());
assertFalse(handler.endsOnNodeSeparator());
assertFalse(handler.endsOnNodeTypeNameSeparator());
assertFalse(handler.isRequestComplete());
OperationRequestAddress address = handler.getAddress();
assertTrue(address.endsOnType());
Iterator<Node> i = address.iterator();
assertTrue(i.hasNext());
Node node = i.next();
assertNotNull(node);
assertEquals("a", node.getType());
assertEquals("b", node.getName());
assertTrue(i.hasNext());
node = i.next();
assertNotNull(node);
assertEquals("subsystem", node.getType());
assertNull(node.getName());
assertFalse(i.hasNext());
}
use of org.jboss.as.cli.operation.OperationRequestAddress.Node in project wildfly-core by wildfly.
the class AddressOnlyParsingTestCase method testOneNode.
@Test
public void testOneNode() throws Exception {
DefaultCallbackHandler handler = new DefaultCallbackHandler();
parser.parse("subsystem=logging", handler);
assertTrue(handler.hasAddress());
assertFalse(handler.hasOperationName());
assertFalse(handler.hasProperties());
assertFalse(handler.endsOnAddressOperationNameSeparator());
assertFalse(handler.endsOnPropertyListStart());
assertFalse(handler.endsOnPropertySeparator());
assertFalse(handler.endsOnPropertyValueSeparator());
assertFalse(handler.endsOnNodeSeparator());
assertFalse(handler.endsOnNodeTypeNameSeparator());
assertFalse(handler.isRequestComplete());
OperationRequestAddress address = handler.getAddress();
assertFalse(address.endsOnType());
Iterator<Node> i = address.iterator();
assertTrue(i.hasNext());
Node node = i.next();
assertNotNull(node);
assertEquals("subsystem", node.getType());
assertEquals("logging", node.getName());
assertFalse(i.hasNext());
}
use of org.jboss.as.cli.operation.OperationRequestAddress.Node in project wildfly-core by wildfly.
the class AddressOnlyParsingTestCase method testColonAndSlashInTheNodeName.
@Test
public void testColonAndSlashInTheNodeName() throws Exception {
DefaultCallbackHandler handler = new DefaultCallbackHandler();
parser.parse("data-source=\"java:/H2DS\"", handler);
assertTrue(handler.hasAddress());
assertFalse(handler.hasOperationName());
assertFalse(handler.hasProperties());
assertFalse(handler.endsOnAddressOperationNameSeparator());
assertFalse(handler.endsOnPropertyListStart());
assertFalse(handler.endsOnPropertySeparator());
assertFalse(handler.endsOnPropertyValueSeparator());
assertFalse(handler.endsOnNodeSeparator());
assertFalse(handler.endsOnNodeTypeNameSeparator());
assertFalse(handler.isRequestComplete());
OperationRequestAddress address = handler.getAddress();
assertFalse(address.endsOnType());
Iterator<Node> i = address.iterator();
assertTrue(i.hasNext());
Node node = i.next();
assertNotNull(node);
assertEquals("data-source", node.getType());
assertEquals("java:/H2DS", node.getName());
assertFalse(i.hasNext());
}
use of org.jboss.as.cli.operation.OperationRequestAddress.Node in project wildfly-core by wildfly.
the class AddressOnlyParsingTestCase method testNodeWithPrefix.
@Test
public void testNodeWithPrefix() throws Exception {
OperationRequestAddress prefix = new DefaultOperationRequestAddress();
prefix.toNode("a", "b");
DefaultCallbackHandler handler = new DefaultCallbackHandler(prefix);
parser.parse("c=d", handler);
assertTrue(handler.hasAddress());
assertFalse(handler.hasOperationName());
assertFalse(handler.hasProperties());
assertFalse(handler.endsOnAddressOperationNameSeparator());
assertFalse(handler.endsOnPropertyListStart());
assertFalse(handler.endsOnPropertySeparator());
assertFalse(handler.endsOnPropertyValueSeparator());
assertFalse(handler.endsOnNodeSeparator());
assertFalse(handler.endsOnNodeTypeNameSeparator());
assertFalse(handler.isRequestComplete());
OperationRequestAddress address = handler.getAddress();
assertFalse(address.endsOnType());
Iterator<Node> i = address.iterator();
assertTrue(i.hasNext());
Node node = i.next();
assertNotNull(node);
assertEquals("a", node.getType());
assertEquals("b", node.getName());
assertTrue(i.hasNext());
node = i.next();
assertNotNull(node);
assertEquals("c", node.getType());
assertEquals("d", node.getName());
assertFalse(i.hasNext());
}
use of org.jboss.as.cli.operation.OperationRequestAddress.Node in project wildfly-core by wildfly.
the class AddressOnlyParsingTestCase method testNodeTypeOnly.
@Test
public void testNodeTypeOnly() throws Exception {
DefaultCallbackHandler handler = new DefaultCallbackHandler();
parser.parse("subsystem", handler);
assertTrue(handler.hasAddress());
assertFalse(handler.hasOperationName());
assertFalse(handler.hasProperties());
assertFalse(handler.endsOnAddressOperationNameSeparator());
assertFalse(handler.endsOnPropertyListStart());
assertFalse(handler.endsOnPropertySeparator());
assertFalse(handler.endsOnPropertyValueSeparator());
assertFalse(handler.endsOnNodeSeparator());
assertFalse(handler.endsOnNodeTypeNameSeparator());
assertFalse(handler.isRequestComplete());
OperationRequestAddress address = handler.getAddress();
assertTrue(address.endsOnType());
Iterator<Node> i = address.iterator();
assertTrue(i.hasNext());
Node node = i.next();
assertNotNull(node);
assertEquals("subsystem", node.getType());
assertNull(node.getName());
assertFalse(i.hasNext());
}
Aggregations