Package javax.management

Examples of javax.management.AttributeValueExp


        if (includeProcessors) {
            MBeanServer server = getContext().getManagementStrategy().getManagementAgent().getMBeanServer();
            if (server != null) {
                // get all the processor mbeans and sort them accordingly to their index
                ObjectName query = ObjectName.getInstance("org.apache.camel:context=*/" + getContext().getManagementName() + ",type=processors,*");
                QueryExp queryExp = Query.match(new AttributeValueExp("RouteId"), new StringValueExp(getRouteId()));
                Set<ObjectName> names = server.queryNames(query, queryExp);
                for (ObjectName name : names) {
                    server.invoke(name, "reset", null, null);
                }
            }
View Full Code Here


            MBeanServer server = getContext().getManagementStrategy().getManagementAgent().getMBeanServer();
            if (server != null) {
                // get all the processor mbeans and sort them accordingly to their index
                String prefix = getContext().getManagementStrategy().getManagementAgent().getIncludeHostName() ? "*/" : "";
                ObjectName query = ObjectName.getInstance("org.apache.camel:context=" + prefix + getContext().getManagementName() + ",type=processors,*");
                QueryExp queryExp = Query.match(new AttributeValueExp("RouteId"), new StringValueExp(getRouteId()));
                Set<ObjectName> names = server.queryNames(query, queryExp);
                for (ObjectName name : names) {
                    server.invoke(name, "reset", null, null);
                }
            }
View Full Code Here

      compareOperationsException(o1, o2);
   }

   public void compareAttributeValueExp(Object o1, Object o2)
   {
      AttributeValueExp val1 = (AttributeValueExp)o1;
      AttributeValueExp val2 = (AttributeValueExp)o2;

      if (!val1.getAttributeName().equals(val2.getAttributeName())) throw new RuntimeException();
   }
View Full Code Here

        }

        // get the stats for the route
        MBeanServer mbeanServer = getMBeanServer();

        QueryExp queryExp = Query.match(new AttributeValueExp("RouteId"), new StringValueExp("first"));
        Set<ObjectName> set = mbeanServer.queryNames(new ObjectName("*:type=routes,*"), queryExp);
        assertEquals(1, set.size());
        ObjectName on = set.iterator().next();

        // send in 5 messages
        template.sendBody("direct:start", "A");
        template.sendBody("direct:start", "B");
        template.sendBody("direct:start", "C");
        template.sendBody("direct:start", "D");
        template.sendBody("direct:start", "E");

        // and 1 for the 2nd route
        template.sendBody("direct:baz", "F");

        assertMockEndpointsSatisfied();

        // should be 5 on the route
        Long completed = (Long) mbeanServer.getAttribute(on, "ExchangesCompleted");
        assertEquals(5, completed.longValue());

        // and on the processors as well
        set = mbeanServer.queryNames(new ObjectName("*:type=processors,*"), queryExp);
        assertEquals(3, set.size());
        for (ObjectName name : set) {
            completed = (Long) mbeanServer.getAttribute(name, "ExchangesCompleted");
            assertEquals(5, completed.longValue());
        }

        // reset which should reset all routes also
        ObjectName ctx = ObjectName.getInstance("org.apache.camel:context=camel-1,type=context,name=\"camel-1\"");
        mbeanServer.invoke(ctx, "reset", new Object[]{true}, new String[]{"boolean"});

        // should be 0 on the route
        completed = (Long) mbeanServer.getAttribute(on, "ExchangesCompleted");
        assertEquals(0, completed.longValue());

        // and on the processors as well
        set = mbeanServer.queryNames(new ObjectName("*:type=processors,*"), queryExp);
        assertEquals(3, set.size());
        for (ObjectName name : set) {
            completed = (Long) mbeanServer.getAttribute(name, "ExchangesCompleted");
            assertEquals(0, completed.longValue());
        }

        // test that the 2nd route is also reset
        queryExp = Query.match(new AttributeValueExp("RouteId"), new StringValueExp("second"));
        set = mbeanServer.queryNames(new ObjectName("*:type=routes,*"), queryExp);
        assertEquals(1, set.size());
        on = set.iterator().next();

        completed = (Long) mbeanServer.getAttribute(on, "ExchangesCompleted");
View Full Code Here

        }

        // get the stats for the route
        MBeanServer mbeanServer = getMBeanServer();

        QueryExp queryExp = Query.match(new AttributeValueExp("RouteId"), new StringValueExp("first"));
        Set<ObjectName> set = mbeanServer.queryNames(new ObjectName("*:type=routes,*"), queryExp);
        assertEquals(1, set.size());
        ObjectName on = set.iterator().next();

        // send in 5 messages
        template.sendBody("direct:start", "A");
        template.sendBody("direct:start", "B");
        template.sendBody("direct:start", "C");
        template.sendBody("direct:start", "D");
        template.sendBody("direct:start", "E");

        // and 1 for the 2nd route
        template.sendBody("direct:baz", "F");

        assertMockEndpointsSatisfied();
       
        // should be 5 on the route
        Long completed = (Long) mbeanServer.getAttribute(on, "ExchangesCompleted");
        assertEquals(5, completed.longValue());

        // and on the processors as well
        set = mbeanServer.queryNames(new ObjectName("*:type=processors,*"), queryExp);
        assertEquals(3, set.size());
        for (ObjectName name : set) {
            completed = (Long) mbeanServer.getAttribute(name, "ExchangesCompleted");
            assertEquals(5, completed.longValue());
        }

        // reset which should reset all processors also
        mbeanServer.invoke(on, "reset", new Object[]{true}, new String[]{"boolean"});

        // should be 0 on the route
        completed = (Long) mbeanServer.getAttribute(on, "ExchangesCompleted");
        assertEquals(0, completed.longValue());

        // and on the processors as well
        set = mbeanServer.queryNames(new ObjectName("*:type=processors,*"), queryExp);
        assertEquals(3, set.size());
        for (ObjectName name : set) {
            completed = (Long) mbeanServer.getAttribute(name, "ExchangesCompleted");
            assertEquals(0, completed.longValue());
        }

        // test that the 2nd route is untouched, as we only reset the first route
        queryExp = Query.match(new AttributeValueExp("RouteId"), new StringValueExp("second"));
        set = mbeanServer.queryNames(new ObjectName("*:type=routes,*"), queryExp);
        assertEquals(1, set.size());
        on = set.iterator().next();

        completed = (Long) mbeanServer.getAttribute(on, "ExchangesCompleted");
View Full Code Here

        if (includeProcessors) {
            MBeanServer server = getContext().getManagementStrategy().getManagementAgent().getMBeanServer();
            if (server != null) {
                // get all the processor mbeans and sort them accordingly to their index
                ObjectName query = ObjectName.getInstance("org.apache.camel:context=*/" + getContext().getManagementName() + ",type=processors,*");
                QueryExp queryExp = Query.match(new AttributeValueExp("RouteId"), new StringValueExp(getRouteId()));
                Set<ObjectName> names = server.queryNames(query, queryExp);
                for (ObjectName name : names) {
                    server.invoke(name, "reset", null, null);
                }
            }
View Full Code Here

            MBeanServer server = getContext().getManagementStrategy().getManagementAgent().getMBeanServer();
            if (server != null) {
                // get all the processor mbeans and sort them accordingly to their index
                String prefix = getContext().getManagementStrategy().getManagementAgent().getIncludeHostName() ? "*/" : "";
                ObjectName query = ObjectName.getInstance("org.apache.camel:context=" + prefix + getContext().getManagementName() + ",type=processors,*");
                QueryExp queryExp = Query.match(new AttributeValueExp("RouteId"), new StringValueExp(getRouteId()));
                Set<ObjectName> names = server.queryNames(query, queryExp);
                for (ObjectName name : names) {
                    server.invoke(name, "reset", null, null);
                }
            }
View Full Code Here

    public void testReset() throws Exception {
        // get the stats for the route
        MBeanServer mbeanServer = getMBeanServer();

        QueryExp queryExp = Query.match(new AttributeValueExp("RouteId"), new StringValueExp("first"));
        Set<ObjectName> set = mbeanServer.queryNames(new ObjectName("*:type=routes,*"), queryExp);
        assertEquals(1, set.size());
        ObjectName on = set.iterator().next();

        // send in 5 messages
        template.sendBody("direct:start", "A");
        template.sendBody("direct:start", "B");
        template.sendBody("direct:start", "C");
        template.sendBody("direct:start", "D");
        template.sendBody("direct:start", "E");

        // and 1 for the 2nd route
        template.sendBody("direct:baz", "F");

        assertMockEndpointsSatisfied();
       
        // should be 5 on the route
        Long completed = (Long) mbeanServer.getAttribute(on, "ExchangesCompleted");
        assertEquals(5, completed.longValue());

        // and on the processors as well
        set = mbeanServer.queryNames(new ObjectName("*:type=processors,*"), queryExp);
        assertEquals(3, set.size());
        for (ObjectName name : set) {
            completed = (Long) mbeanServer.getAttribute(name, "ExchangesCompleted");
            assertEquals(5, completed.longValue());
        }

        // reset which should reset all processors also
        mbeanServer.invoke(on, "reset", new Object[]{true}, new String[]{"boolean"});

        // should be 0 on the route
        completed = (Long) mbeanServer.getAttribute(on, "ExchangesCompleted");
        assertEquals(0, completed.longValue());

        // and on the processors as well
        set = mbeanServer.queryNames(new ObjectName("*:type=processors,*"), queryExp);
        assertEquals(3, set.size());
        for (ObjectName name : set) {
            completed = (Long) mbeanServer.getAttribute(name, "ExchangesCompleted");
            assertEquals(0, completed.longValue());
        }

        // test that the 2nd route is untouched, as we only reset the first route
        queryExp = Query.match(new AttributeValueExp("RouteId"), new StringValueExp("second"));
        set = mbeanServer.queryNames(new ObjectName("*:type=routes,*"), queryExp);
        assertEquals(1, set.size());
        on = set.iterator().next();

        completed = (Long) mbeanServer.getAttribute(on, "ExchangesCompleted");
View Full Code Here

    public void testReset() throws Exception {
        // get the stats for the route
        MBeanServer mbeanServer = getMBeanServer();

        QueryExp queryExp = Query.match(new AttributeValueExp("RouteId"), new StringValueExp("first"));
        Set<ObjectName> set = mbeanServer.queryNames(new ObjectName("*:type=routes,*"), queryExp);
        assertEquals(1, set.size());
        ObjectName on = set.iterator().next();

        // send in 5 messages
        template.sendBody("direct:start", "A");
        template.sendBody("direct:start", "B");
        template.sendBody("direct:start", "C");
        template.sendBody("direct:start", "D");
        template.sendBody("direct:start", "E");

        // and 1 for the 2nd route
        template.sendBody("direct:baz", "F");

        assertMockEndpointsSatisfied();

        // should be 5 on the route
        Long completed = (Long) mbeanServer.getAttribute(on, "ExchangesCompleted");
        assertEquals(5, completed.longValue());

        // and on the processors as well
        set = mbeanServer.queryNames(new ObjectName("*:type=processors,*"), queryExp);
        assertEquals(3, set.size());
        for (ObjectName name : set) {
            completed = (Long) mbeanServer.getAttribute(name, "ExchangesCompleted");
            assertEquals(5, completed.longValue());
        }

        // reset which should reset all routes also
        ObjectName ctx = ObjectName.getInstance("org.apache.camel:context=localhost/camel-1,type=context,name=\"camel-1\"");
        mbeanServer.invoke(ctx, "reset", new Object[]{true}, new String[]{"boolean"});

        // should be 0 on the route
        completed = (Long) mbeanServer.getAttribute(on, "ExchangesCompleted");
        assertEquals(0, completed.longValue());

        // and on the processors as well
        set = mbeanServer.queryNames(new ObjectName("*:type=processors,*"), queryExp);
        assertEquals(3, set.size());
        for (ObjectName name : set) {
            completed = (Long) mbeanServer.getAttribute(name, "ExchangesCompleted");
            assertEquals(0, completed.longValue());
        }

        // test that the 2nd route is also reset
        queryExp = Query.match(new AttributeValueExp("RouteId"), new StringValueExp("second"));
        set = mbeanServer.queryNames(new ObjectName("*:type=routes,*"), queryExp);
        assertEquals(1, set.size());
        on = set.iterator().next();

        completed = (Long) mbeanServer.getAttribute(on, "ExchangesCompleted");
View Full Code Here

        if (includeProcessors) {
            MBeanServer server = getContext().getManagementStrategy().getManagementAgent().getMBeanServer();
            if (server != null) {
                // get all the processor mbeans and sort them accordingly to their index
                ObjectName query = ObjectName.getInstance("org.apache.camel:context=*/" + getContext().getManagementName() + ",type=processors,*");
                QueryExp queryExp = Query.match(new AttributeValueExp("RouteId"), new StringValueExp(getRouteId()));
                Set<ObjectName> names = server.queryNames(query, queryExp);
                for (ObjectName name : names) {
                    server.invoke(name, "reset", null, null);
                }
            }
View Full Code Here

TOP

Related Classes of javax.management.AttributeValueExp

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.