Examples of DefaultCallbackHandler


Examples of org.jboss.as.cli.operation.impl.DefaultCallbackHandler

    }

    @Test
    public void testPropertyListStart() throws Exception {

        DefaultCallbackHandler cmd = parse("some-command ");
        assertEquals("some-command", cmd.getOperationName());
        assertFalse(cmd.hasProperties());
        assertNull(cmd.getOutputTarget());
        assertTrue(cmd.endsOnSeparator());
        assertTrue(cmd.endsOnPropertyListStart());
        assertFalse(cmd.endsOnPropertySeparator());
        assertFalse(cmd.endsOnPropertyValueSeparator());
        assertEquals(0, cmd.getLastChunkIndex());
    }
View Full Code Here

Examples of org.jboss.as.cli.operation.impl.DefaultCallbackHandler

        String nodePath = this.nodePath.getValue(parsedCmd);

        final OperationRequestAddress address;
        if (nodePath != null) {
            address = new DefaultOperationRequestAddress(ctx.getCurrentNodePath());
            CommandLineParser.CallbackHandler handler = new DefaultCallbackHandler(address);

            // this is for correct parsing of escaped characters
            nodePath = ctx.getArgumentsString();
            if(l.isPresent(parsedCmd)) {
                nodePath = nodePath.trim();
View Full Code Here

Examples of org.jboss.as.cli.operation.impl.DefaultCallbackHandler

    }

    @Test
    public void testSingleArgValue() throws Exception {

        DefaultCallbackHandler cmd = parse("some-command arg-value");
        assertEquals("some-command", cmd.getOperationName());
        assertTrue(cmd.hasProperties());
        assertNull(cmd.getOutputTarget());
        assertFalse(cmd.endsOnSeparator());
        assertFalse(cmd.endsOnPropertyListStart());
        assertFalse(cmd.endsOnPropertySeparator());
        assertFalse(cmd.endsOnPropertyValueSeparator());
        assertTrue(cmd.getPropertyNames().isEmpty());
        assertEquals(1, cmd.getOtherProperties().size());
        assertEquals("arg-value", cmd.getOtherProperties().get(0));
        assertEquals(13, cmd.getLastChunkIndex());
    }
View Full Code Here

Examples of org.jboss.as.cli.operation.impl.DefaultCallbackHandler

    }

    @Test
    public void testSingleArgValueAndSeparator() throws Exception {

        DefaultCallbackHandler cmd = parse("some-command arg-value ");
        assertEquals("some-command", cmd.getOperationName());
        assertTrue(cmd.hasProperties());
        assertNull(cmd.getOutputTarget());
        assertTrue(cmd.endsOnSeparator());
        assertFalse(cmd.endsOnPropertyListStart());
        assertTrue(cmd.endsOnPropertySeparator());
        assertFalse(cmd.endsOnPropertyValueSeparator());
        assertTrue(cmd.getPropertyNames().isEmpty());
        assertEquals(1, cmd.getOtherProperties().size());
        assertEquals("arg-value", cmd.getOtherProperties().get(0));
        assertEquals(13, cmd.getLastChunkIndex());
    }
View Full Code Here

Examples of org.jboss.as.cli.operation.impl.DefaultCallbackHandler

        assertFalse(i.hasNext());
    }

    @Test
    public void testOperationWithArguments() throws Exception {
        DefaultCallbackHandler handler = new DefaultCallbackHandler();

        parse("/subsystem=logging:read-resource(recursive=true)", handler);

        assertTrue(handler.hasAddress());
        assertTrue(handler.hasOperationName());
        assertTrue(handler.hasProperties());
        assertFalse(handler.endsOnAddressOperationNameSeparator());
        assertFalse(handler.endsOnPropertyListStart());
        assertFalse(handler.endsOnPropertySeparator());
        assertFalse(handler.endsOnPropertyValueSeparator());
        assertFalse(handler.endsOnNodeSeparator());
        assertFalse(handler.endsOnNodeTypeNameSeparator());
        assertFalse(handler.isRequestComplete());

        assertEquals("read-resource", handler.getOperationName());

        OperationRequestAddress address = handler.getAddress();
        Iterator<Node> i = address.iterator();
        assertTrue(i.hasNext());
        Node node = i.next();
        assertEquals("subsystem", node.getType());
        assertEquals("logging", node.getName());
        assertFalse(i.hasNext());

        Set<String> args = handler.getPropertyNames();
        assertEquals(1, args.size());
        assertTrue(args.contains("recursive"));
        assertEquals("true", handler.getPropertyValue("recursive"));
    }
View Full Code Here

Examples of org.jboss.as.cli.operation.impl.DefaultCallbackHandler

        final String op = "composite";
        final String propName = "steps";
        final String propValue = "[{\"operation\"=>\"add-system-property\",\"name\"=>\"test\",\"value\"=\"newValue\"},{\"operation\"=>\"add-system-property\",\"name\"=>\"test2\",\"value\"=>\"test2\"}]";

        DefaultCallbackHandler handler = new DefaultCallbackHandler();

        parse(':' + op + '(' + propName + '=' + propValue + ')', handler);

        assertFalse(handler.hasAddress());
        assertTrue(handler.hasOperationName());
        assertTrue(handler.hasProperties());
        assertFalse(handler.endsOnAddressOperationNameSeparator());
        assertFalse(handler.endsOnPropertyListStart());
        assertFalse(handler.endsOnPropertySeparator());
        assertFalse(handler.endsOnPropertyValueSeparator());
        assertFalse(handler.endsOnNodeSeparator());
        assertFalse(handler.endsOnNodeTypeNameSeparator());
        assertFalse(handler.isRequestComplete());

        assertEquals("composite", handler.getOperationName());

        Set<String> args = handler.getPropertyNames();
        assertEquals(1, args.size());
        assertTrue(args.contains(propName));
        assertEquals(propValue, handler.getPropertyValue(propName));
    }
View Full Code Here

Examples of org.jboss.as.cli.operation.impl.DefaultCallbackHandler

        assertEquals(propValue, handler.getPropertyValue(propName));
    }

    @Test
    public void testOperationWithArgumentsAndWhitespaces() throws Exception {
        DefaultCallbackHandler handler = new DefaultCallbackHandler();

        parse("   / subsystem  =  logging  :  read-resource  ( recursive = true , another = \"   \" )   ", handler);

        assertTrue(handler.hasAddress());
        assertTrue(handler.hasOperationName());
        assertTrue(handler.hasProperties());
        assertFalse(handler.endsOnAddressOperationNameSeparator());
        assertFalse(handler.endsOnPropertyListStart());
        assertFalse(handler.endsOnPropertySeparator());
        assertFalse(handler.endsOnPropertyValueSeparator());
        assertFalse(handler.endsOnNodeSeparator());
        assertFalse(handler.endsOnNodeTypeNameSeparator());
        assertFalse(handler.isRequestComplete());

        assertEquals("read-resource", handler.getOperationName());

        OperationRequestAddress address = handler.getAddress();
        Iterator<Node> i = address.iterator();
        assertTrue(i.hasNext());
        Node node = i.next();
        assertEquals("subsystem", node.getType());
        assertEquals("logging", node.getName());
        assertFalse(i.hasNext());

        Set<String> args = handler.getPropertyNames();
        assertEquals(2, args.size());
        assertTrue(args.contains("recursive"));
        assertEquals("true", handler.getPropertyValue("recursive"));
        assertTrue(args.contains("another"));
        assertEquals("\"   \"", handler.getPropertyValue("another"));
    }
View Full Code Here

Examples of org.jboss.as.cli.operation.impl.DefaultCallbackHandler

    private CommandLineParser parser = DefaultOperationRequestParser.INSTANCE;

    @Test
    public void testOperationNameOnly() throws Exception {
        DefaultCallbackHandler handler = new DefaultCallbackHandler();

        parseOperation(":  read-resource > cli.log", handler);

        assertFalse(handler.hasAddress());
        assertTrue(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());

        assertEquals("read-resource", handler.getOperationName());
        assertEquals("cli.log", handler.getOutputTarget());
    }
View Full Code Here

Examples of org.jboss.as.cli.operation.impl.DefaultCallbackHandler

        assertEquals("cli.log", handler.getOutputTarget());
    }

    @Test
    public void testOperationWithProps() throws Exception {
        DefaultCallbackHandler handler = new DefaultCallbackHandler();

        parseOperation(":  read-resource (recursive=true) > cli.log", handler);

        assertFalse(handler.hasAddress());
        assertTrue(handler.hasOperationName());
        assertTrue(handler.hasProperties());
        assertFalse(handler.endsOnAddressOperationNameSeparator());
        assertFalse(handler.endsOnPropertyListStart());
        assertFalse(handler.endsOnPropertySeparator());
        assertFalse(handler.endsOnPropertyValueSeparator());
        assertFalse(handler.endsOnNodeSeparator());
        assertFalse(handler.endsOnNodeTypeNameSeparator());
        assertFalse(handler.hasHeaders());
        assertFalse(handler.isRequestComplete());

        assertEquals("read-resource", handler.getOperationName());
        assertEquals("cli.log", handler.getOutputTarget());
    }
View Full Code Here

Examples of org.jboss.as.cli.operation.impl.DefaultCallbackHandler

        assertEquals("cli.log", handler.getOutputTarget());
    }

    @Test
    public void testOperationWithHeaders() throws Exception {
        DefaultCallbackHandler handler = new DefaultCallbackHandler();

        parseOperation(":  read-resource (recursive=true) {header_name=header_value} > cli.log", handler);

        assertFalse(handler.hasAddress());
        assertTrue(handler.hasOperationName());
        assertTrue(handler.hasProperties());
        assertFalse(handler.endsOnAddressOperationNameSeparator());
        assertFalse(handler.endsOnPropertyListStart());
        assertFalse(handler.endsOnPropertySeparator());
        assertFalse(handler.endsOnPropertyValueSeparator());
        assertFalse(handler.endsOnNodeSeparator());
        assertFalse(handler.endsOnNodeTypeNameSeparator());
        assertTrue(handler.hasHeaders());
        assertTrue(handler.isRequestComplete());

        assertEquals("read-resource", handler.getOperationName());
        assertEquals("cli.log", handler.getOutputTarget());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.