Package org.jolokia.request

Examples of org.jolokia.request.JmxExecRequest


     * If a field in the argument is not set it will be set to its default value
     */
    @Test
    public void missingField() throws InstanceNotFoundException, IOException, ReflectionException, AttributeNotFoundException, MBeanException, MalformedObjectNameException, NotChangedException {
      // set a value just for stringField, leave out intField
        JmxExecRequest request = new JmxRequestBuilder(EXEC, oName).
                operation("compositeData").
                arguments("{ \"stringField\":\"aString\" }").
                build();
        CompositeData data  = (CompositeData) handler.handleRequest(getMBeanServer(),request);
        assertEquals(data.get("stringField"),"aString");
View Full Code Here


     * set a non-existing field
     */
    @Test(expectedExceptions={IllegalArgumentException.class})
    public void invalidField() throws MalformedObjectNameException, InstanceNotFoundException, AttributeNotFoundException, ReflectionException, MBeanException, IOException, NotChangedException {
      // set a value just for stringField, leave out intField
        JmxExecRequest request = new JmxRequestBuilder(EXEC, oName).
                operation("compositeData").
                arguments("{ \"nonExistentField\":\"aString\" }").
                build();
        handler.handleRequest(getMBeanServer(),request);     
    }   
View Full Code Here

    /**
     * Give an invalid value (wrong type) for the field
     */
    @Test(expectedExceptions={ NumberFormatException.class })
    public void invalidValueForField() throws MalformedObjectNameException, InstanceNotFoundException, AttributeNotFoundException, ReflectionException, MBeanException, IOException, NotChangedException {
        JmxExecRequest request = new JmxRequestBuilder(EXEC, oName).
            operation("compositeData").
            arguments("{ \"intField\":\"aString\" }").
            build();
        handler.handleRequest(getMBeanServer(),request);     
    }
View Full Code Here

    /**
     * The operation argument is an array
     */
    @Test
    public void arrayOfComposites() throws InstanceNotFoundException, IOException, ReflectionException, AttributeNotFoundException, MBeanException, MalformedObjectNameException, NotChangedException {
        JmxExecRequest request = new JmxRequestBuilder(EXEC, oName).
                operation("arrayData").
                arguments("[ { \"stringField\":\"aString\" } ]").
                build();
        handler.handleRequest(getMBeanServer(),request);
    }
View Full Code Here

    /**
     * The operation argument is a List
     */
    @Test
    public void listOfComposites() throws InstanceNotFoundException, IOException, ReflectionException, AttributeNotFoundException, MBeanException, MalformedObjectNameException, NotChangedException {
        JmxExecRequest request = new JmxRequestBuilder(EXEC, oName).
                operation("listData").
                arguments("[ { \"stringField\":\"aString\" } ]").
                build();
        handler.handleRequest(getMBeanServer(),request);
    }
View Full Code Here

    /**
     * The operation argument is a Set
     */
    @Test
    public void setOfComposites() throws InstanceNotFoundException, IOException, ReflectionException, AttributeNotFoundException, MBeanException, MalformedObjectNameException, NotChangedException {
        JmxExecRequest request = new JmxRequestBuilder(EXEC, oName).
                operation("opSetData").
                arguments("[ { \"stringField\":\"aString\" } ]").
                build();
        handler.handleRequest(getMBeanServer(),request);
    }
View Full Code Here

    /**
     * The operation argument is a Map
     */
    @Test
    public void mapOfComposites() throws InstanceNotFoundException, IOException, ReflectionException, AttributeNotFoundException, MBeanException, MalformedObjectNameException, NotChangedException {
        JmxExecRequest request = new JmxRequestBuilder(EXEC, oName).
                operation("mapData").
                arguments("{ \"aKey\":{ \"stringField\":\"aString\" } }").
                build();
        handler.handleRequest(getMBeanServer(),request);
    }
View Full Code Here

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

    /**
     * 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

     * 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

TOP

Related Classes of org.jolokia.request.JmxExecRequest

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.