Package org.apache.qpid.qmf2.common

Examples of org.apache.qpid.qmf2.common.QmfEvent


        // Create and register schema for this agent.
        String packageName = "com.profitron.gizmo";

        // Declare a schema for a structured exception that can be used in failed method invocations.
        _exceptionSchema = new SchemaObjectClass(packageName, "exception");
        _exceptionSchema.addProperty(new SchemaProperty("whatHappened", QmfType.TYPE_STRING));
        _exceptionSchema.addProperty(new SchemaProperty("howBad", QmfType.TYPE_INT));
        _exceptionSchema.addProperty(new SchemaProperty("details", QmfType.TYPE_MAP));

        // Declare a control object to test methods against.
        _controlSchema = new SchemaObjectClass(packageName, "control");
        _controlSchema.addProperty(new SchemaProperty("state", QmfType.TYPE_STRING));
        _controlSchema.addProperty(new SchemaProperty("methodCount", QmfType.TYPE_INT));
        _controlSchema.addProperty(new SchemaProperty("offset", QmfType.TYPE_INT));
        _controlSchema.setIdNames("state");

        SchemaMethod stopMethod = new SchemaMethod("stop", "Stop Agent");
        stopMethod.addArgument(new SchemaProperty("message", QmfType.TYPE_STRING, "{dir:IN}"));
        _controlSchema.addMethod(stopMethod);

        SchemaMethod echoMethod = new SchemaMethod("echo", "Echo Arguments");
        echoMethod.addArgument(new SchemaProperty("message", QmfType.TYPE_STRING, "{dir:INOUT}"));
        _controlSchema.addMethod(echoMethod);

        SchemaMethod eventMethod = new SchemaMethod("event", "Raise an Event");
        eventMethod.addArgument(new SchemaProperty("text", QmfType.TYPE_STRING, "{dir:IN}"));
        eventMethod.addArgument(new SchemaProperty("severity", QmfType.TYPE_INT, "{dir:IN}"));
        _controlSchema.addMethod(eventMethod);

        SchemaMethod failMethod = new SchemaMethod("fail", "Expected to Fail");
        failMethod.addArgument(new SchemaProperty("useString", QmfType.TYPE_BOOL, "{dir:IN}"));
        failMethod.addArgument(new SchemaProperty("stringVal", QmfType.TYPE_STRING, "{dir:IN}"));
        failMethod.addArgument(new SchemaProperty("details", QmfType.TYPE_MAP, "{dir:IN}"));
        _controlSchema.addMethod(failMethod);

        SchemaMethod createMethod = new SchemaMethod("create_child", "Create Child Object");
        createMethod.addArgument(new SchemaProperty("name", QmfType.TYPE_STRING, "{dir:IN}"));
        createMethod.addArgument(new SchemaProperty("childAddr", QmfType.TYPE_MAP, "{dir:OUT}"));
        _controlSchema.addMethod(createMethod);

        // Declare the child class
        _childSchema = new SchemaObjectClass(packageName, "child");
        _childSchema.addProperty(new SchemaProperty("name", QmfType.TYPE_STRING));
        _childSchema.setIdNames("name");
   
        // Declare the event class
        _eventSchema = new SchemaEventClass(packageName, "event");
        _eventSchema.addProperty(new SchemaProperty("text", QmfType.TYPE_STRING));

        System.out.println("AgentTest Schema classes initialised OK");

        _agent.registerObjectClass(_exceptionSchema);
        _agent.registerObjectClass(_controlSchema);
View Full Code Here


            String packageName = "com.profitron.gizmo";

            // Declare a schema for a structured exception that can be used in failed method invocations.
            SchemaObjectClass exception = new SchemaObjectClass(packageName, "exception");

            exception.addProperty(new SchemaProperty("whatHappened", QmfType.TYPE_STRING));
            exception.addProperty(new SchemaProperty("howBad", QmfType.TYPE_INT));
            exception.addProperty(new SchemaProperty("details", QmfType.TYPE_MAP));

            // Declare a control object to test methods against.
            SchemaObjectClass control = new SchemaObjectClass(packageName, "control");
            control.addProperty(new SchemaProperty("state", QmfType.TYPE_STRING));
            control.addProperty(new SchemaProperty("methodCount", QmfType.TYPE_INT));

            SchemaMethod stopMethod = new SchemaMethod("stop", "Stop Agent");
            stopMethod.addArgument(new SchemaProperty("message", QmfType.TYPE_STRING));
            control.addMethod(stopMethod);

            SchemaMethod echoMethod = new SchemaMethod("echo", "Echo Arguments");
            echoMethod.addArgument(new SchemaProperty("sequence", QmfType.TYPE_INT, "{dir:INOUT}"));
            echoMethod.addArgument(new SchemaProperty("map", QmfType.TYPE_MAP, "{dir:INOUT}"));
            control.addMethod(echoMethod);

            SchemaMethod eventMethod = new SchemaMethod("event", "Raise an Event");
            eventMethod.addArgument(new SchemaProperty("text", QmfType.TYPE_STRING, "{dir:IN}"));
            eventMethod.addArgument(new SchemaProperty("severity", QmfType.TYPE_INT, "{dir:IN}"));
            control.addMethod(eventMethod);

            SchemaMethod failMethod = new SchemaMethod("fail", "Expected to Fail");
            failMethod.addArgument(new SchemaProperty("useString", QmfType.TYPE_BOOL, "{dir:IN}"));
            failMethod.addArgument(new SchemaProperty("stringVal", QmfType.TYPE_STRING, "{dir:IN}"));
            failMethod.addArgument(new SchemaProperty("details", QmfType.TYPE_MAP, "{dir:IN}"));
            control.addMethod(failMethod);

            SchemaMethod createMethod = new SchemaMethod("create_child", "Create Child Object");
            createMethod.addArgument(new SchemaProperty("name", QmfType.TYPE_STRING, "{dir:IN}"));
            createMethod.addArgument(new SchemaProperty("childAddr", QmfType.TYPE_MAP, "{dir:OUT}"));
            control.addMethod(createMethod);

            // Declare the child class
            SchemaObjectClass child = new SchemaObjectClass(packageName, "child");
            child.addProperty(new SchemaProperty("name", QmfType.TYPE_STRING));
   
            // Declare the event class
            SchemaEventClass event = new SchemaEventClass(packageName, "event");
            event.addProperty(new SchemaProperty("text", QmfType.TYPE_STRING));

            System.out.println("Test3 Schema classes initialised OK");

            // Now we create new instance of each class from the map encodings and list the values
            // to check everything looks OK.
View Full Code Here

        // Create and register schema for this agent.
        String packageName = "com.test.bigagent";

        // Declare a control object to test methods against.
        _controlSchema = new SchemaObjectClass(packageName, "control");
        _controlSchema.addProperty(new SchemaProperty("name", QmfType.TYPE_STRING));
        _controlSchema.setIdNames("name");

        SchemaMethod createMethod = new SchemaMethod("processPayload", "Process a large payload");
        createMethod.addArgument(new SchemaProperty("parameter", QmfType.TYPE_STRING, "{dir:IN}"));
        createMethod.addArgument(new SchemaProperty("return", QmfType.TYPE_STRING, "{dir:OUT}"));
        _controlSchema.addMethod(createMethod);
        System.out.println("BigPayloadAgentTest Schema classes initialised OK");

        _agent.registerObjectClass(_controlSchema);
View Full Code Here

            while (true)
            {
                notifier.waitForWorkItem();
                System.out.println("WorkItem available, WorkItem count = " + _console.getWorkitemCount());

                WorkItem wi;
                while ((wi = _console.getNextWorkitem(0)) != null)
                {
                    System.out.println("WorkItem type: " + wi.getType());
                    if (wi.getType() == AGENT_HEARTBEAT || wi.getType() == AGENT_ADDED ||
                        wi.getType() == AGENT_DELETED || wi.getType() == AGENT_RESTARTED ||
                        wi.getType() == EVENT_RECEIVED)
                    {
                        Map<String, Object> p = wi.<Map<String, Object>>getParams();
                        Agent agent = (Agent)p.get("agent");
                        System.out.println(agent.getName());
                    }
                }
View Full Code Here

                    if (wi.getType() == AGENT_HEARTBEAT || wi.getType() == AGENT_ADDED ||
                        wi.getType() == AGENT_DELETED || wi.getType() == AGENT_RESTARTED ||
                        wi.getType() == EVENT_RECEIVED)
                    {
                        Map<String, Object> p = wi.<Map<String, Object>>getParams();
                        Agent agent = (Agent)p.get("agent");
                        System.out.println(agent.getName());
                    }
                }

                count++;
                if (count == 10)
View Full Code Here

            {
                agent.listValues();
            }

            System.out.println("*** Test1 testing _console.getAgent(\"broker\"): ***");
            Agent agent = _console.getAgent("broker");
            agent.listValues();

            System.out.println("*** Test1 testing _console.findAgent(\"broker\"): ***");
            agent = _console.findAgent("broker");
            if (agent == null)
            {
                System.out.println("*** Test1 _console.findAgent(\"broker\") returned null : Test1 failed ***");
                System.exit(1);
            }
            else
            {
                agent.listValues();
            }


            System.out.println("*** Test1 testing _console.findAgent(\"monkey\"): ***");
            agent = _console.findAgent("monkey");
            if (agent == null)
            {
                System.out.println("*** Test1 _console.findAgent(\"monkey\") correctly returned null ***");
            }
            else
            {
                agent.listValues();
            }


            System.out.println("*** Test1 testing _console.getObjects(\"broker\"): ***");
            List<QmfConsoleData> brokers = _console.getObjects("broker");
View Full Code Here

            System.out.println("*** Starting Test2 asynchronous Agent discovery using WorkQueue API ***");
               
            BlockingNotifier notifier = new BlockingNotifier();

            Connection connection = ConnectionHelper.createConnection(url, "{reconnect: true}");
            _console = new Console(notifier);
//console.disableAgentDiscovery(); // To miss all notifications this needs done before addConnection()
            _console.addConnection(connection);

            int count = 0;
            while (true)
View Full Code Here

    {
        try
        {
            System.out.println("*** Starting Test1 synchronous Agent discovery ***");
            Connection connection = ConnectionHelper.createConnection(url, "{reconnect: true}");
            _console = new Console();
            _console.addConnection(connection);

            System.out.println("*** Test1 testing _console.getAgents(): ***");
            List<Agent> agents = _console.getAgents();

View Full Code Here

        try
        {
            System.out.println("*** Starting PartialGetObjectsTest used to test schema retrieval ***");
               
            Connection connection = ConnectionHelper.createConnection(url, "{reconnect: true}");
            _console = new Console(this);
            _console.addConnection(connection);

            // First we create a large number of queues using the QMF2 create method on the broker object
            List<QmfConsoleData> brokers = _console.getObjects("org.apache.qpid.broker", "broker");
            if (brokers.isEmpty())
View Full Code Here

            {
                System.out.println("No broker QmfConsoleData returned");
                System.exit(1);
            }

            QmfConsoleData broker = brokers.get(0);
            QmfData arguments = new QmfData();
            arguments.setValue("type", "queue");

            for (int i = 0; i < 300; i++)
            {
                arguments.setValue("name", "test " + i);

                try
                {
                    broker.invokeMethod("create", arguments);
                }
                catch (QmfException e)
                { // This may be throw if we've already added the queues, we just catch and ignore for this test.
                    //System.out.println(e.getMessage());
                }
View Full Code Here

TOP

Related Classes of org.apache.qpid.qmf2.common.QmfEvent

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.