Package de.ailis.jollada.model

Examples of de.ailis.jollada.model.Document


     */

    @Test
    public void testAddChild()
    {
        final Document oldDocument = new Document();
        final Document document = new Document();
        final Node oldParent = new Node();
        oldParent.setDocument(oldDocument);
        final Node parent = new Node();
        parent.setDocument(document);
        final Node child = new Node();
View Full Code Here


     */

    @Test
    public void testSetId()
    {
        final Document document = new Document();
        final Node node = new Node();
        node.setDocument(document);

        assertNull(document.getById("ID"));

        node.setId("ID");
        assertSame(node, document.getById("ID"));
        node.setId("ID");
        assertSame(node, document.getById("ID"));

        node.setId(null);
        assertNull(document.getById("ID"));
        node.setId(null);
        assertNull(document.getById("ID"));
    }
View Full Code Here

        assertFalse(adapter.inserted);
        assertFalse(adapter.insertedIntoDoc);
        assertFalse(adapter.removed);
        assertFalse(adapter.removedFromDoc);

        final Document doc = new Document();
        final Node parent1 = new Node();
        doc.addChild(parent1);
        final Node parent2 = new Node();
        doc.addChild(parent2);

        parent1.addChild(node);
        assertTrue(adapter.inserted);
        assertTrue(adapter.insertedIntoDoc);
        assertFalse(adapter.removed);
View Full Code Here

     */

    @Test
    public void testAddAll()
    {
        final Document oldDocument = new Document();
        final Node oldParent = new Node();
        oldDocument.addChild(oldParent);
        final Elements<Node> oldElements = new Nodes(oldParent);

        final Document document = new Document();

        final Node parent = new Node();
        document.addChild(parent);
        final Elements<Node> elements = new Nodes(parent);

        final Node child = new Node();
        child.setId("ID");
        child.setSid("SID");
        oldElements.add(child);

        elements.addAll(oldElements);
        assertSame(document, child.getDocument());
        assertSame(parent, child.getParent());
        assertSame(child, document.getById("ID"));
        assertSame(child, document.getBySid("SID"));
        assertSame(child, parent.getBySid("SID"));

        // Check if node was correctly detached from old elements
        assertEquals(0, oldElements.size());
        assertNull(oldDocument.getById("ID"));
View Full Code Here

     */

    @Test
    public void testAddAllAtIndex()
    {
        final Document oldDocument = new Document();
        final Node oldParent = new Node();
        oldDocument.addChild(oldParent);
        final Elements<Node> oldElements = new Nodes(oldParent);

        final Document document = new Document();

        final Node parent = new Node();
        document.addChild(parent);
        final Elements<Node> elements = new Nodes(parent);

        final Node child = new Node();
        child.setId("ID");
        child.setSid("SID");
        oldElements.add(child);

        elements.addAll(0, oldElements);
        assertSame(document, child.getDocument());
        assertSame(parent, child.getParent());
        assertSame(child, document.getById("ID"));
        assertSame(child, document.getBySid("SID"));
        assertSame(child, parent.getBySid("SID"));

        // Check if node was correctly detached from old elements
        assertEquals(0, oldElements.size());
        assertNull(oldDocument.getById("ID"));
View Full Code Here

     */

    @Test
    public void testRemoveAll()
    {
        final Document document = new Document();
        final Node parent = new Node();
        document.addChild(parent);
        final Elements<Node> elements = new Nodes(parent);

        final Node child = new Node();
        child.setId("ID");
        child.setSid("SID");

        elements.add(child);
        final List<Object> toDelete = new ArrayList<Object>();
        toDelete.add(new Node());
        toDelete.add("test");
        assertFalse(elements.removeAll(toDelete));
        assertSame(parent, child.getParent());
        toDelete.add(child);
        assertTrue(elements.removeAll(toDelete));

        // Check if node was correctly detached from elements
        assertEquals(0, elements.size());
        assertNull(child.getParent());
        assertNull(child.getDocument());
        assertNull(document.getById("ID"));
        assertNull(document.getBySid("SID"));
        assertNull(parent.getBySid("SID"));
    }
View Full Code Here

     */

    @Test
    public void testRetainAll()
    {
        final Document document = new Document();
        final Node parent = new Node();
        document.addChild(parent);
        final Elements<Node> elements = new Nodes(parent);

        final Node child = new Node();
        child.setId("ID");
        child.setSid("SID");

        elements.add(child);
        final List<Object> toRetain = new ArrayList<Object>();
        toRetain.add(child);
        toRetain.add(new Node());
        toRetain.add("test");
        assertFalse(elements.retainAll(toRetain));
        toRetain.remove(child);
        assertTrue(elements.retainAll(toRetain));

        // Check if node was correctly detached from elements
        assertEquals(0, elements.size());
        assertNull(child.getParent());
        assertNull(child.getDocument());
        assertNull(document.getById("ID"));
        assertNull(document.getBySid("SID"));
        assertNull(parent.getBySid("SID"));
    }
View Full Code Here

     */

    @Test
    public void testAdd()
    {
        final Document oldDocument = new Document();
        final Node oldParent = new Node();
        oldDocument.addChild(oldParent);
        final Elements<Node> oldElements = new Nodes(oldParent);

        final Document document = new Document();

        final Node parent = new Node();
        document.addChild(parent);
        final Elements<Node> elements = new Nodes(parent);

        final Node child = new Node();
        child.setId("ID");
        child.setSid("SID");
        oldElements.add(child);

        elements.add(child);
        assertSame(document, child.getDocument());
        assertSame(parent, child.getParent());
        assertSame(child, document.getById("ID"));
        assertSame(child, document.getBySid("SID"));
        assertSame(child, parent.getBySid("SID"));

        // Check if node was correctly detached from old elements
        assertEquals(0, oldElements.size());
        assertNull(oldDocument.getById("ID"));
View Full Code Here

     */

    @Test
    public void testInsert()
    {
        final Document oldDocument = new Document();
        final Node oldParent = new Node();
        oldDocument.addChild(oldParent);
        final Elements<Node> oldElements = new Nodes(oldParent);

        final Document document = new Document();

        final Node parent = new Node();
        document.addChild(parent);
        final Elements<Node> elements = new Nodes(parent);

        final Node child = new Node();
        child.setId("ID");
        child.setSid("SID");
        oldElements.add(child);

        elements.add(0, child);
        assertSame(document, child.getDocument());
        assertSame(parent, child.getParent());
        assertSame(child, document.getById("ID"));
        assertSame(child, document.getBySid("SID"));
        assertSame(child, parent.getBySid("SID"));

        // Check if node was correctly detached from old elements
        assertEquals(0, oldElements.size());
        assertNull(oldDocument.getById("ID"));
View Full Code Here

     */

    @Test
    public void testSet()
    {
        final Document oldDocument = new Document();
        final Node oldParent = new Node();
        oldDocument.addChild(oldParent);
        final Elements<Node> oldElements = new Nodes(oldParent);

        final Document document = new Document();

        final Node parent = new Node();
        document.addChild(parent);
        final Elements<Node> elements = new Nodes(parent);

        final Node child = new Node();
        child.setId("ID");
        child.setSid("SID");
        oldElements.add(child);

        elements.add(child);
        assertSame(child, elements.set(0, child));
        assertSame(document, child.getDocument());
        assertSame(parent, child.getParent());
        assertSame(child, document.getById("ID"));
        assertSame(child, document.getBySid("SID"));
        assertSame(child, parent.getBySid("SID"));

        // Check if node was correctly detached from old elements
        assertEquals(0, oldElements.size());
        assertNull(oldDocument.getById("ID"));
View Full Code Here

TOP

Related Classes of de.ailis.jollada.model.Document

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.