Examples of TabularTypeAndJson


Examples of org.jolokia.converter.util.TabularTypeAndJson

        assertEquals(result.length,1);
    }

    @Test(expectedExceptions = UnsupportedOperationException.class,expectedExceptionsMessageRegExp = ".*Unsupported.*")
    public void arrayTypeWithWrongElementType() throws OpenDataException {
        TabularTypeAndJson taj = new TabularTypeAndJson(
                new String[] { "verein" },
                new CompositeTypeAndJson(
                   STRING,"verein","fcn",
                   BOOLEAN,"absteiger",false
                )
        );
        JSONArray array = new JSONArray();
        array.add(taj.getJson());
        converter.convertToObject(new ArrayType(2, taj.getType()),array);
    }
View Full Code Here

Examples of org.jolokia.converter.util.TabularTypeAndJson

    }


    @Test
    public void tabularType() throws OpenDataException {
        TabularTypeAndJson taj = getSampleTabularType();
        TabularData data = (TabularData) converter.convertToObject(taj.getType(),taj.getJsonAsString());
        assertEquals(data.get(new String[] { "fcn" }).get("absteiger"),false);
        assertEquals(data.get(new String[] { "fcb" }).get("absteiger"),true);
    }
View Full Code Here

Examples of org.jolokia.converter.util.TabularTypeAndJson

        CompositeTypeAndJson ctj = new CompositeTypeAndJson(
                STRING, "key", null,
                OBJECTNAME, "value", null
        );

        TabularTypeAndJson taj = new TabularTypeAndJson(new String[]{"key"}, ctj);
        TabularData data = new TabularDataSupport(taj.getType());

        CompositeData cd = new CompositeDataSupport(ctj.getType(), new String[]{"key", "value"},
                                                    new Object[]{"key1", new ObjectName("test:type=bla")});
        data.put(cd);
        cd = new CompositeDataSupport(ctj.getType(), new String[]{"key", "value"},
View Full Code Here

Examples of org.jolokia.converter.util.TabularTypeAndJson

        assertEquals(data.get(new String[] { "fcb" }).get("absteiger"),true);
    }

    @Test
    public void tabularTypeForMXBeanMaps() throws OpenDataException {
        TabularTypeAndJson taj = getSampleTabularTypeForMXBeanMap();

        String json = "{ \"keyOne\" : \"valueOne\", \"keyTwo\" : \"valueTwo\"}";
        TabularData data = (TabularData) converter.convertToObject(taj.getType(),json);
        CompositeData col1 = data.get(new String[] { "keyOne" });
        assertEquals(col1.get("key"),"keyOne");
        assertEquals(col1.get("value"),"valueOne");
        CompositeData col2 = data.get(new String[] { "keyTwo" });
        assertEquals(col2.get("key"),"keyTwo");
View Full Code Here

Examples of org.jolokia.converter.util.TabularTypeAndJson

        assertEquals(result.get("male"),true);
    }

    @Test
    void extractGenericTabularDataWithIntegerAndObjectNamePath() throws OpenDataException, AttributeNotFoundException, MalformedObjectNameException {
        TabularTypeAndJson taj = new TabularTypeAndJson(
                new String[] { "bundleId", "oName" },
                new CompositeTypeAndJson(
                        LONG,"bundleId",null,
                        OBJECTNAME,"oName",null,
                        BOOLEAN,"active",null
                ));
        TabularData data = new TabularDataSupport(taj.getType());
        data.put(new CompositeDataSupport(
                taj.getType().getRowType(),
                new String[]{"bundleId", "oName", "active"},
                new Object[]{10L,new ObjectName("test:type=bundle"), false}
        ));
        JSONObject result = (JSONObject) extract(true, data, "10", "test:type=bundle");
        assertEquals(result.size(),3);
View Full Code Here

Examples of org.jolokia.converter.util.TabularTypeAndJson



    @Test(expectedExceptions = IllegalArgumentException.class,expectedExceptionsMessageRegExp = ".*JSONObject.*")
    public void tabularTypeForMXBeanMapsFail() throws OpenDataException {
        TabularTypeAndJson taj = getSampleTabularTypeForMXBeanMap();

        converter.convertToObject(taj.getType(), "[ { \"keyOne\" : \"valueOne\" } ]");
    }
View Full Code Here

Examples of org.jolokia.converter.util.TabularTypeAndJson

        assertEquals(result.get("active"),false);
    }

    @Test
    public void extractWithWildCardPath() throws OpenDataException, MalformedObjectNameException, AttributeNotFoundException {
        TabularTypeAndJson taj = new TabularTypeAndJson(
                new String[] { "id"},
                new CompositeTypeAndJson(
                        LONG,"id",null,
                        OBJECTNAME,"oName",null,
                        BOOLEAN,"flag",null
                ));

        TabularData data = new TabularDataSupport(taj.getType());
        data.put(new CompositeDataSupport(
                taj.getType().getRowType(),
                new String[]{"id","oName","flag" },
                new Object[]{10L,new ObjectName("test:type=bundle"), false}
        ));

        data.put(new CompositeDataSupport(
                taj.getType().getRowType(),
                new String[]{"id","oName","flag" },
                new Object[]{20L,new ObjectName("java.lang:type=Memory"), true}
        ));

        // Path: */*/domain --> 1. Level: 10, 20 -- 2. Level: CD key-value (e.g {id: 10, oName: test=type...}), -- 3. level: Objects
View Full Code Here

Examples of org.jolokia.converter.util.TabularTypeAndJson

        converter.convertToObject(taj.getType(), "[ { \"keyOne\" : \"valueOne\" } ]");
    }

    @Test
    public void tabularTypeForMXBeanMapsComplex() throws OpenDataException {
        TabularTypeAndJson inner = getSampleTabularTypeForMXBeanMap();
        TabularTypeAndJson taj = new TabularTypeAndJson(
                new String[]{"key"},
                new CompositeTypeAndJson(
                        STRING, "key", null,
                        inner.getType(), "value", null
                )
        );

        String json = "{ \"keyOne\" : { \"innerKeyOne\" : \"valueOne\" }, \"keyTwo\" : { \"innerKeyTwo\" : \"valueTwo\"}}";
        TabularData data = (TabularData) converter.convertToObject(taj.getType(),json);
        CompositeData col1 = data.get(new String[] { "keyOne" });
        assertEquals(col1.get("key"),"keyOne");
        TabularData innerCol1 = (TabularData) col1.get("value");
        CompositeData col1inner = innerCol1.get(new String[]{"innerKeyOne"});
        assertEquals(col1inner.get("key"),"innerKeyOne");
View Full Code Here

Examples of org.jolokia.converter.util.TabularTypeAndJson

        assertEquals(inner.get("domain"),"java.lang");
    }

    @Test(expectedExceptions = ValueFaultHandler.AttributeFilteredException.class)
    public void noMatchWithWildcardPattern() throws OpenDataException, MalformedObjectNameException, AttributeNotFoundException {
        TabularTypeAndJson taj = new TabularTypeAndJson(
                new String[] { "oName"},
                new CompositeTypeAndJson(
                        OBJECTNAME,"oName",null
                ));

        TabularData data = new TabularDataSupport(taj.getType());
        data.put(new CompositeDataSupport(
                taj.getType().getRowType(),
                new String[]{"oName" },
                new Object[]{new ObjectName("test:type=bundle")}
        ));

        extract(true, data, null, "oName2");
View Full Code Here

Examples of org.jolokia.converter.util.TabularTypeAndJson

        assertFalse((Boolean) row.get("absteiger"));
    }


    private TabularTypeAndJson getSampleTabularTypeForMXBeanMap() throws OpenDataException {
        return new TabularTypeAndJson(
                    new String[] { "key" },
                    new CompositeTypeAndJson(
                            STRING,"key","dummy",
                            STRING,"value", "dummy"
                    )
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.