Package org.jboss.as.cli.operation

Examples of org.jboss.as.cli.operation.OperationRequestAddress$Node


 
  @Test
  public void addClientSubscriptionInfo() {
    ClientSubscriptionInfo clientSubscriptionInfo = new ClientSubscriptionInfo();
   
    Node node = new Node();
    node.setSecurityUrl("http://localhost:8080/services/securityUrl");
    node.setCustodyTransferUrl("http://localhost:8080/services/securityUrl");
    node.setDescription("description");
    node.setInquiryUrl("http://localhost:8080/services/securityUrl");
    node.setPublishUrl("http://localhost:8080/services/securityUrl");
    node.setProxyTransport("class");
    node.setSubscriptionUrl("http://localhost:8080/services/securityUrl");
    node.setName("default");
    node.setManagerName("defaultManager");
    SaveNode saveNode = new SaveNode();
    saveNode.setAuthInfo(authInfoJoe);
    saveNode.getNode().add(node);
   
    Clerk clerk = new Clerk();
    clerk.setName("clerkName");
    clerk.setPublisher("root");
    clerk.setNode(node);
    SaveClerk saveClerk = new SaveClerk();
    saveClerk.setAuthInfo(authInfoJoe);
    saveClerk.getClerk().add(clerk);
   
    clientSubscriptionInfo.setFromClerk(clerk);
   
    Node node2 = new Node();
    node2.setSecurityUrl("http://localhost:8080/services/securityUrl2");
    node2.setCustodyTransferUrl("https://localhost:8080/services/securityUrl2");
    node2.setDescription("description2");
    node2.setInquiryUrl("http://localhost:8080/services/securityUrl2");
    node2.setPublishUrl("http://localhost:8080/services/securityUrl2");
    node2.setProxyTransport("class2");
    node2.setSubscriptionUrl("http://localhost:8080/services/securityUrl2");
    node2.setName("default2");
    node2.setManagerName("default2Manager");
    saveNode.getNode().add(node2);
   
    Clerk clerk2 = new Clerk();
    clerk2.setName("clerkName2");
    clerk2.setPublisher("root");
View Full Code Here


        if (obj == null)
            return false;
        if (!(obj instanceof OperationRequestAddress))
            return false;

        OperationRequestAddress other = (OperationRequestAddress) obj;

        if(isEmpty() != other.isEmpty())
            return false;

        Iterator<Node> thisIterator = iterator();
        Iterator<Node> otherIterator = other.iterator();
        boolean result = true;
        while(result) {
            if(!thisIterator.next().equals(otherIterator.next())) {
                result = false;
            } else {
View Full Code Here

        super.init();
        initModel();

        int prefixLevel = getPrefixLevel();
        if(prefixLevel > 0) {
            OperationRequestAddress prefix = ctx.getCurrentNodePath();
            for(int i = 1; i <= prefixLevel; ++i) {
                if(i % 2 == 0) {
                    prefix.toNode("link" + i);
                } else {
                    prefix.toNodeType("link" + i);
                }
            }
        }
    }
View Full Code Here

    protected void doHandle(CommandContext ctx) throws CommandFormatException {

        final ParsedCommandLine parsedCmd = ctx.getParsedCommandLine();
        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();
                if(nodePath.startsWith("-l ")) {
                    nodePath = nodePath.substring(3);
                } else {
                    nodePath = nodePath.substring(0, nodePath.length() - 3);
                }
            }
            ctx.getCommandLineParser().parse(nodePath, handler);
        } else {
            address = new DefaultOperationRequestAddress(ctx.getCurrentNodePath());
        }

        List<String> names = null;
        if(address.endsOnType()) {
            final String type = address.getNodeType();
            address.toParentNode();
            names = Util.getNodeNames(ctx.getModelControllerClient(), address, type);
            printList(ctx, names, l.isPresent(parsedCmd));
            return;
        }

        final ModelNode composite = new ModelNode();
        composite.get(Util.OPERATION).set(Util.COMPOSITE);
        composite.get(Util.ADDRESS).setEmptyList();
        final ModelNode steps = composite.get(Util.STEPS);

        {
            final ModelNode typesRequest = new ModelNode();
            typesRequest.get(Util.OPERATION).set(Util.READ_CHILDREN_TYPES);
            final ModelNode addressNode = typesRequest.get(Util.ADDRESS);
            if (address.isEmpty()) {
                addressNode.setEmptyList();
            } else {
                Iterator<Node> iterator = address.iterator();
                while (iterator.hasNext()) {
                    OperationRequestAddress.Node node = iterator.next();
                    if (node.getName() != null) {
                        addressNode.add(node.getType(), node.getName());
                    } else if (iterator.hasNext()) {
                        throw new OperationFormatException(
                                "Expected a node name for type '"
                                        + node.getType()
                                        + "' in path '"
                                        + ctx.getNodePathFormatter().format(
                                                address) + "'");
                    }
                }
            }
            steps.add(typesRequest);
        }

        {
            final ModelNode resourceRequest = new ModelNode();
            resourceRequest.get(Util.OPERATION).set(Util.READ_RESOURCE);
            final ModelNode addressNode = resourceRequest.get(Util.ADDRESS);
            if (address.isEmpty()) {
                addressNode.setEmptyList();
            } else {
                Iterator<Node> iterator = address.iterator();
                while (iterator.hasNext()) {
                    OperationRequestAddress.Node node = iterator.next();
                    if (node.getName() != null) {
                        addressNode.add(node.getType(), node.getName());
                    } else if (iterator.hasNext()) {
View Full Code Here

        assertFalse(handler.endsOnNodeTypeNameSeparator());
        assertFalse(handler.isRequestComplete());

        assertEquals("validate-", 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());
View Full Code Here

        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());
View Full Code Here

    }

    @Test
    public void testOperationNameWithPrefix() throws Exception {

        OperationRequestAddress prefix = new DefaultOperationRequestAddress();
        prefix.toNodeType("subsystem");
        DefaultCallbackHandler handler = new DefaultCallbackHandler(prefix);

        parse("./logging:read-resource", handler);

        assertTrue(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());

        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());
View Full Code Here

        assertFalse(handler.endsOnPropertyValueSeparator());
        assertFalse(handler.endsOnNodeSeparator());
        assertFalse(handler.endsOnNodeTypeNameSeparator());
        assertFalse(handler.isRequestComplete());

        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());
View Full Code Here

        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());
View Full Code Here

        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());
View Full Code Here

TOP

Related Classes of org.jboss.as.cli.operation.OperationRequestAddress$Node

Copyright © 2018 www.massapicom. 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.