Package org.apache.sling.commons.json

Examples of org.apache.sling.commons.json.JSONObject.optJSONObject()


        headers.put("user-agent", "curl/7.25.0");
        mapProps.put("headers", headers);
        Event mapEvent = new Event("my/simple/topic", mapToDictionary(mapProps));
        JSONObject jMapProps = new JSONObject(JsonEventLogger.constructMessage(mapEvent));

        assertNotNull("complex event, map not null", jMapProps.optJSONObject("headers"));
        assertEquals("complex event, map value in props", "curl/7.25.0", jMapProps.getJSONObject("headers").getString("user-agent"));

        Map<String, Object> stringSetProps = new LinkedHashMap<String, Object>();
        stringSetProps.put("resourceChangedAttributes", new LinkedHashSet<String>(Arrays.asList("first", "second")));
        Event stringSetEvent = new Event("my/simple/topic", mapToDictionary(stringSetProps));
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.