Examples of JmxRequestBuilder


Examples of org.jolokia.request.JmxRequestBuilder

    /**
     * Set an array field inside the composite argument
     */
    @Test
    public void compositeWithArrayField() throws MalformedObjectNameException, InstanceNotFoundException, AttributeNotFoundException, ReflectionException, MBeanException, IOException, NotChangedException {
        JmxExecRequest request = new JmxRequestBuilder(EXEC, oName).
            operation("compositeData").
            arguments("{ \"array\":[\"one\", \"two\"] }").
            build();
        handler.handleRequest(getMBeanServer(),request);     
    }
View Full Code Here

Examples of org.jolokia.request.JmxRequestBuilder

     * Set a List field inside the composite argument with values that can't be converted to
     * the list element type
     */
    @Test(expectedExceptions={NumberFormatException.class})
    public void invalidTypeCompositeWithListField() throws MalformedObjectNameException, InstanceNotFoundException, AttributeNotFoundException, ReflectionException, MBeanException, IOException, NotChangedException {
        JmxExecRequest request = new JmxRequestBuilder(EXEC, oName).
            operation("compositeData").
            arguments("{ \"list\":[\"one\", \"two\"] }").
            build();
        handler.handleRequest(getMBeanServer(),request);     
    }
View Full Code Here

Examples of org.jolokia.request.JmxRequestBuilder

    /**
     * Set a List field inside the composite argument
     */
    @Test
    public void compositeWithListField() throws MalformedObjectNameException, InstanceNotFoundException, AttributeNotFoundException, ReflectionException, MBeanException, IOException, NotChangedException {
        JmxExecRequest request = new JmxRequestBuilder(EXEC, oName).
            operation("compositeData").
            arguments("{ \"list\":[\"1\", \"2\"] }").
            build();
        handler.handleRequest(getMBeanServer(),request);     
    }   
View Full Code Here

Examples of org.jolokia.request.JmxRequestBuilder

    /**
     * Set a Map field inside the composite argument
     */
    @Test
    public void compositeWithMapField() throws MalformedObjectNameException, InstanceNotFoundException, AttributeNotFoundException, ReflectionException, MBeanException, IOException, NotChangedException {
        JmxExecRequest request = new JmxRequestBuilder(EXEC, oName).
            operation("compositeData").
            arguments("{ \"map\":{ \"5\":{\"nestedField\":\"value1\"}, \"7\":{\"nestedField\":\"value2\"} } }").
            build();
        handler.handleRequest(getMBeanServer(),request);     
    }
View Full Code Here

Examples of org.jolokia.request.JmxRequestBuilder

    /**
     * Set a Set field inside the composite argument
     */
    @Test
    public void compositeWithSetField() throws MalformedObjectNameException, InstanceNotFoundException, AttributeNotFoundException, ReflectionException, MBeanException, IOException, NotChangedException {
        JmxExecRequest request = new JmxRequestBuilder(EXEC, oName).
            operation("compositeData").
            arguments("{ \"set\": [\"value1\",\"value2\"] }").
            build();
        handler.handleRequest(getMBeanServer(),request);     
    }
View Full Code Here

Examples of org.jolokia.request.JmxRequestBuilder

    }
   
   
    @Test
    public void overloaded() throws MalformedObjectNameException, InstanceNotFoundException, AttributeNotFoundException, ReflectionException, MBeanException, IOException, NotChangedException {
        JmxExecRequest request = new JmxRequestBuilder(EXEC, oName).
        operation("overloaded(javax.management.openmbean.CompositeData)").
        arguments("{ \"stringField\": \"aString\" }").
        build();
        handler.handleRequest(getMBeanServer(),request);           
    }
View Full Code Here

Examples of org.jolokia.request.JmxRequestBuilder

    @BeforeMethod
    public void setup() throws MalformedObjectNameException {
        TestDetector.reset();
        Configuration config = new Configuration(ConfigKey.MBEAN_QUALIFIER,"qualifier=test");
        handler = new MBeanServerHandler(config,getEmptyLogHandler());
        request = new JmxRequestBuilder(RequestType.READ,"java.lang:type=Memory").attribute("HeapMemoryUsage").build();
    }
View Full Code Here

Examples of org.jolokia.request.JmxRequestBuilder

        testBeanName = new ObjectName("jolokia:type=test");
    }

    @Test
    public void singleBeanSingleAttribute() throws Exception {
        JmxReadRequest request = new JmxRequestBuilder(READ, testBeanName.getCanonicalName()).
                attribute("testAttribute").
                build();

        MBeanServerConnection connection = createMock(MBeanServerConnection.class);
        expect(connection.getAttribute(testBeanName,"testAttribute")).andReturn("testValue");
View Full Code Here

Examples of org.jolokia.request.JmxRequestBuilder

    @Test
    public void simpleRead() throws MalformedObjectNameException, InstanceNotFoundException, IOException, ReflectionException, AttributeNotFoundException, MBeanException {
        Configuration config = new Configuration(ConfigKey.DEBUG,"true",ConfigKey.AGENT_ID,"test");

        BackendManager backendManager = new BackendManager(config, log);
        JmxRequest req = new JmxRequestBuilder(RequestType.READ,"java.lang:type=Memory")
                .attribute("HeapMemoryUsage")
                .build();
        JSONObject ret = backendManager.handleRequest(req);
        assertTrue((Long) ((Map) ret.get("value")).get("used") > 0);
        backendManager.destroy();
View Full Code Here

Examples of org.jolokia.request.JmxRequestBuilder

        assertEquals("testValue",res);
    }

    @Test
    public void singleBeanNoAttributes() throws Exception {
        JmxReadRequest request = new JmxRequestBuilder(READ, testBeanName.getCanonicalName()).
                attribute(null).
                build();


        MBeanServer server = createMock(MBeanServer.class);
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.