Package org.apache.sling.commons.json

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


    JSONObject aceObject2 = jsonObject2.optJSONObject(testUserId);
    assertNotNull(aceObject2);
   
    assertEquals(testUserId, aceObject.optString("principal"));
   
    JSONArray grantedArray2 = aceObject2.optJSONArray("granted");
    assertNotNull(grantedArray2);
    assertEquals(1, grantedArray2.length());
    Set<String> grantedPrivilegeNames2 = new HashSet<String>();
    for (int i=0; i < grantedArray2.length(); i++) {
      grantedPrivilegeNames2.add(grantedArray2.getString(i));
View Full Code Here


    for (int i=0; i < grantedArray2.length(); i++) {
      grantedPrivilegeNames2.add(grantedArray2.getString(i));
    }
    H.assertPrivilege(grantedPrivilegeNames2, true, "jcr:read");

    JSONArray deniedArray2 = aceObject2.optJSONArray("denied");
    assertNotNull(deniedArray2);
    assertEquals(1, deniedArray2.length());
    Set<String> deniedPrivilegeNames2 = new HashSet<String>();
    for (int i=0; i < deniedArray2.length(); i++) {
      deniedPrivilegeNames2.add(deniedArray2.getString(i));
View Full Code Here

    JSONObject aceObject = jsonObject.optJSONObject(testUserId);
    assertNotNull(aceObject);
   
    assertEquals(testUserId, aceObject.optString("principal"));
   
    JSONArray grantedArray = aceObject.optJSONArray("granted");
    assertNotNull(grantedArray);
    assertEquals(1, grantedArray.length());
    Set<String> grantedPrivilegeNames = new HashSet<String>();
    for (int i=0; i < grantedArray.length(); i++) {
      grantedPrivilegeNames.add(grantedArray.getString(i));
View Full Code Here

    JSONObject aceObject2 = jsonObject2.optJSONObject(testUserId);
    assertNotNull(aceObject2);
   
    assertEquals(testUserId, aceObject2.optString("principal"));
   
    JSONArray grantedArray2 = aceObject2.optJSONArray("granted");
    assertNotNull(grantedArray2);
    assertEquals(1, grantedArray2.length());
    Set<String> grantedPrivilegeNames2 = new HashSet<String>();
    for (int i=0; i < grantedArray2.length(); i++) {
      grantedPrivilegeNames2.add(grantedArray2.getString(i));
View Full Code Here

    for (int i=0; i < grantedArray2.length(); i++) {
      grantedPrivilegeNames2.add(grantedArray2.getString(i));
    }
    H.assertPrivilege(grantedPrivilegeNames2, true, "jcr:write");

    JSONArray deniedArray2 = aceObject2.optJSONArray("denied");
    assertNotNull(deniedArray2);
    assertEquals(1, deniedArray2.length());
    Set<String> deniedPrivilegeNames2 = new HashSet<String>();
    for (int i=0; i < deniedArray2.length(); i++) {
      deniedPrivilegeNames2.add(deniedArray2.getString(i));
View Full Code Here

    H.assertPrivilege(grantedPrivilegeNames, true, "jcr:modifyAccessControl");
    H.assertPrivilege(grantedPrivilegeNames, true, "rep:write"); //jcr:nodeTypeManagement + jcr:write
        assertEquals("Expecting the correct number of privileges in " + grantedPrivilegeNames, 4, grantedPrivilegeNames.size());

    //should be nothing left in the denied set.
    JSONArray deniedArray = aceObject.optJSONArray("denied");
    assertNull(deniedArray);
  }
 
}
View Full Code Here

    assertEquals(0, aceObject.getInt("order"));

    String principalString = aceObject.optString("principal");
    assertEquals(testUserId, principalString);
   
    JSONArray grantedArray = aceObject.optJSONArray("granted");
    assertNotNull(grantedArray);
    assertEquals("jcr:read", grantedArray.getString(0));

    JSONArray deniedArray = aceObject.optJSONArray("denied");
    assertNotNull(deniedArray);
View Full Code Here

   
    JSONArray grantedArray = aceObject.optJSONArray("granted");
    assertNotNull(grantedArray);
    assertEquals("jcr:read", grantedArray.getString(0));

    JSONArray deniedArray = aceObject.optJSONArray("denied");
    assertNotNull(deniedArray);
    assertEquals("jcr:write", deniedArray.getString(0));

    if (addGroupAce) {
      aceObject = jsonObject.optJSONObject(testGroupId);
View Full Code Here

      principalString = aceObject.optString("principal");
      assertEquals(testGroupId, principalString);

            assertEquals(1, aceObject.getInt("order"));

      grantedArray = aceObject.optJSONArray("granted");
      assertNotNull(grantedArray);
      assertEquals("jcr:read", grantedArray.getString(0));
    }
   
    return testFolderUrl;
View Full Code Here

        Map<String, Object> stringArrayProps = new LinkedHashMap<String, Object>();
        stringArrayProps.put("resourceChangedAttributes", new String[]{"first", "second"});
        Event stringArrayEvent = new Event("my/simple/topic", mapToDictionary(stringArrayProps));
        JSONObject jStringArray = new JSONObject(JsonEventLogger.constructMessage(stringArrayEvent));

        assertNotNull("complex event, string array not null", jStringArray.optJSONArray("resourceChangedAttributes"));
        assertEquals("complex event, string array props", "first", jStringArray.getJSONArray("resourceChangedAttributes").getString(0));
        assertEquals("complex event, string array props", "second", jStringArray.getJSONArray("resourceChangedAttributes").getString(1));

        Map<String, Object> intArrayProps = new LinkedHashMap<String, Object>();
        intArrayProps.put("numbers", new Integer[]{0, 1, 2});
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.