Search in sources :

Example 26 with Node

use of org.jboss.as.cli.operation.OperationRequestAddress.Node in project wildfly-core by wildfly.

the class AddressOnlyParsingTestCase method testRootInCombination.

@Test
public void testRootInCombination() throws Exception {
    OperationRequestAddress prefix = new DefaultOperationRequestAddress();
    prefix.toNode("a", "b");
    DefaultCallbackHandler handler = new DefaultCallbackHandler(prefix);
    // parser.parse("c=d,~,e=f", handler);
    parser.parse("/e=f", 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("e", node.getType());
    assertEquals("f", node.getName());
    assertFalse(i.hasNext());
}
Also used : DefaultOperationRequestAddress(org.jboss.as.cli.operation.impl.DefaultOperationRequestAddress) Node(org.jboss.as.cli.operation.OperationRequestAddress.Node) DefaultCallbackHandler(org.jboss.as.cli.operation.impl.DefaultCallbackHandler) DefaultOperationRequestAddress(org.jboss.as.cli.operation.impl.DefaultOperationRequestAddress) OperationRequestAddress(org.jboss.as.cli.operation.OperationRequestAddress) Test(org.junit.Test)

Example 27 with Node

use of org.jboss.as.cli.operation.OperationRequestAddress.Node in project wildfly-core by wildfly.

the class AddressOnlyParsingTestCase method testNodeNameOnlyWithNodeSeparator.

@Test
public void testNodeNameOnlyWithNodeSeparator() throws Exception {
    OperationRequestAddress prefix = new DefaultOperationRequestAddress();
    prefix.toNodeType("a");
    DefaultCallbackHandler handler = new DefaultCallbackHandler(prefix);
    parser.parse("b/", 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();
    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());
    assertFalse(i.hasNext());
}
Also used : DefaultOperationRequestAddress(org.jboss.as.cli.operation.impl.DefaultOperationRequestAddress) Node(org.jboss.as.cli.operation.OperationRequestAddress.Node) DefaultCallbackHandler(org.jboss.as.cli.operation.impl.DefaultCallbackHandler) DefaultOperationRequestAddress(org.jboss.as.cli.operation.impl.DefaultOperationRequestAddress) OperationRequestAddress(org.jboss.as.cli.operation.OperationRequestAddress) Test(org.junit.Test)

Example 28 with Node

use of org.jboss.as.cli.operation.OperationRequestAddress.Node in project wildfly-core by wildfly.

the class AddressOnlyParsingTestCase method testRootNodeTypeOnlyWithPrefixNode.

@Test
public void testRootNodeTypeOnlyWithPrefixNode() 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("subsystem", node.getType());
    assertNull(node.getName());
    assertFalse(i.hasNext());
}
Also used : DefaultOperationRequestAddress(org.jboss.as.cli.operation.impl.DefaultOperationRequestAddress) Node(org.jboss.as.cli.operation.OperationRequestAddress.Node) DefaultCallbackHandler(org.jboss.as.cli.operation.impl.DefaultCallbackHandler) DefaultOperationRequestAddress(org.jboss.as.cli.operation.impl.DefaultOperationRequestAddress) OperationRequestAddress(org.jboss.as.cli.operation.OperationRequestAddress) Test(org.junit.Test)

Example 29 with Node

use of org.jboss.as.cli.operation.OperationRequestAddress.Node in project wildfly-core by wildfly.

the class AddressOnlyParsingTestCase method testEndsOnSlashWhichIsPartOfName.

public void testEndsOnSlashWhichIsPartOfName() throws Exception {
    DefaultCallbackHandler handler = new DefaultCallbackHandler();
    parser.parse("/subsystem=mail/mail-session=java\\:\\/", handler);
    OperationRequestAddress address = handler.getAddress();
    assertNotNull(address);
    Iterator<Node> nodes = address.iterator();
    assertTrue(nodes.hasNext());
    Node node = nodes.next();
    assertEquals("subsystem", node.getType());
    assertEquals("mail", node.getName());
    assertTrue(nodes.hasNext());
    node = nodes.next();
    assertEquals("mail-session", node.getType());
    assertEquals("java:/", node.getName());
    assertFalse(handler.endsOnNodeSeparator());
}
Also used : Node(org.jboss.as.cli.operation.OperationRequestAddress.Node) DefaultCallbackHandler(org.jboss.as.cli.operation.impl.DefaultCallbackHandler) DefaultOperationRequestAddress(org.jboss.as.cli.operation.impl.DefaultOperationRequestAddress) OperationRequestAddress(org.jboss.as.cli.operation.OperationRequestAddress)

Example 30 with Node

use of org.jboss.as.cli.operation.OperationRequestAddress.Node in project wildfly-core by wildfly.

the class AddressOnlyParsingTestCase method testNodeTypeOnlyWithPrefixNode.

@Test
public void testNodeTypeOnlyWithPrefixNode() 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());
}
Also used : DefaultOperationRequestAddress(org.jboss.as.cli.operation.impl.DefaultOperationRequestAddress) Node(org.jboss.as.cli.operation.OperationRequestAddress.Node) DefaultCallbackHandler(org.jboss.as.cli.operation.impl.DefaultCallbackHandler) DefaultOperationRequestAddress(org.jboss.as.cli.operation.impl.DefaultOperationRequestAddress) OperationRequestAddress(org.jboss.as.cli.operation.OperationRequestAddress) Test(org.junit.Test)

Aggregations

Node (org.jboss.as.cli.operation.OperationRequestAddress.Node)36 OperationRequestAddress (org.jboss.as.cli.operation.OperationRequestAddress)35 DefaultOperationRequestAddress (org.jboss.as.cli.operation.impl.DefaultOperationRequestAddress)32 DefaultCallbackHandler (org.jboss.as.cli.operation.impl.DefaultCallbackHandler)29 Test (org.junit.Test)28 ModelNode (org.jboss.dmr.ModelNode)14 OperationFormatException (org.jboss.as.cli.operation.OperationFormatException)4 IOException (java.io.IOException)3 TerminalString (org.aesh.readline.terminal.formatting.TerminalString)1 CommandArgument (org.jboss.as.cli.CommandArgument)1 CommandContext (org.jboss.as.cli.CommandContext)1 CommandFormatException (org.jboss.as.cli.CommandFormatException)1 CommandLineException (org.jboss.as.cli.CommandLineException)1 ArgumentWithoutValue (org.jboss.as.cli.impl.ArgumentWithoutValue)1 ParsedOperationRequestHeader (org.jboss.as.cli.operation.ParsedOperationRequestHeader)1 ModelControllerClient (org.jboss.as.controller.client.ModelControllerClient)1