Package org.apache.sling.jcr.contentloader.internal

Examples of org.apache.sling.jcr.contentloader.internal.NodeDescription


            fail("Expected IOException from empty JSON");
        }
    }

    public void testEmpty() throws IOException {
        NodeDescription node = this.parse("{}");
        assertNotNull("Expecting node", node);
        assertNull("No name expected", node.getName());
    }
View Full Code Here


        assertNull("No name expected", node.getName());
    }

    public void testDefaultPrimaryNodeType() throws IOException {
        String json = "{}";
        NodeDescription node = this.parse(json);
        assertNotNull("Expecting node", node);
        assertNull(node.getPrimaryNodeType());
        assertNull("No mixins expected", node.getMixinNodeTypes());
        assertNull("No properties expected", node.getProperties());
        assertNull("No children expected", node.getChildren());
    }
View Full Code Here

        assertNull("No children expected", node.getChildren());
    }

    public void testDefaultPrimaryNodeTypeWithSurroundWhitespace() throws IOException {
        String json = "     {  }     ";
        NodeDescription node = this.parse(json);
        assertNotNull("Expecting node", node);
        assertNull(node.getPrimaryNodeType());
        assertNull("No mixins expected", node.getMixinNodeTypes());
        assertNull("No properties expected", node.getProperties());
        assertNull("No children expected", node.getChildren());
    }
View Full Code Here

        assertNull("No children expected", node.getChildren());
    }

    public void testDefaultPrimaryNodeTypeWithoutEnclosingBraces() throws IOException {
        String json = "";
        NodeDescription node = this.parse(json);
        assertNotNull("Expecting node", node);
        assertNull(node.getPrimaryNodeType());
        assertNull("No mixins expected", node.getMixinNodeTypes());
        assertNull("No properties expected", node.getProperties());
        assertNull("No children expected", node.getChildren());
    }
View Full Code Here

        assertNull("No children expected", node.getChildren());
    }

    public void testDefaultPrimaryNodeTypeWithoutEnclosingBracesWithSurroundWhitespace() throws IOException {
        String json = "             ";
        NodeDescription node = this.parse(json);
        assertNotNull("Expecting node", node);
        assertNull(node.getPrimaryNodeType());
        assertNull("No mixins expected", node.getMixinNodeTypes());
        assertNull("No properties expected", node.getProperties());
        assertNull("No children expected", node.getChildren());
    }
View Full Code Here

    public void testExplicitePrimaryNodeType() throws IOException {
        String type = "xyz:testType";
        String json = "{ \"jcr:primaryType\": \"" + type + "\" }";

        NodeDescription node = this.parse(json);
        assertNotNull("Expecting node", node);
        assertEquals(type, node.getPrimaryNodeType());
    }
View Full Code Here

    public void testMixinNodeTypes1() throws JSONException, IOException {
        Set<Object> mixins = this.toSet(new Object[]{ "xyz:mix1" });
        String json = "{ \"jcr:mixinTypes\": " + this.toJsonArray(mixins) + "}";

        NodeDescription node = this.parse(json);
        assertNotNull("Expecting node", node);
        assertEquals(mixins, node.getMixinNodeTypes());
    }
View Full Code Here

    public void testMixinNodeTypes2() throws JSONException, IOException {
        Set<Object> mixins = this.toSet(new Object[]{ "xyz:mix1", "abc:mix2" });
        String json = "{ \"jcr:mixinTypes\": " + this.toJsonArray(mixins) + "}";

        NodeDescription node = this.parse(json);
        assertNotNull("Expecting node", node);
        assertEquals(mixins, node.getMixinNodeTypes());
    }
View Full Code Here

    public void testPropertiesNone() throws IOException, JSONException {
        List<PropertyDescription> properties = null;
        String json = "{ \"properties\": " + this.toJsonObject(properties) + "}";

        NodeDescription node = this.parse(json);
        assertNotNull("Expecting node", node);
        assertEquals(properties, node.getProperties());
    }
View Full Code Here

        prop.setValue("v1");
        properties.add(prop);
       
        String json = this.toJsonObject(properties).toString();
       
        NodeDescription node = this.parse(json);
        assertNotNull("Expecting node", node);
        assertEquals(new HashSet<PropertyDescription>(properties), new HashSet<PropertyDescription>(node.getProperties()));
    }
View Full Code Here

TOP

Related Classes of org.apache.sling.jcr.contentloader.internal.NodeDescription

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.