Examples of VoltXMLDiff


Examples of org.hsqldb_voltpatches.VoltXMLElement.VoltXMLDiff

                    // avoid embedded newlines so we can delimit statements
                    // with newline.
                    m_fullDDL += Encoder.hexEncode(stmt.statement) + "\n";
                    // Get the diff that results from applying this statement and apply it
                    // to our local tree (with Volt-specific additions)
                    VoltXMLDiff thisStmtDiff = m_hsql.runDDLCommandAndDiff(stmt.statement);
                    applyDiff(thisStmtDiff);
                } catch (HSQLParseException e) {
                    String msg = "DDL Error: \"" + e.getMessage() + "\" in statement starting on lineno: " + stmt.lineNo;
                    throw m_compiler.new VoltCompilerException(msg, stmt.lineNo);
                }
View Full Code Here

Examples of org.hsqldb_voltpatches.VoltXMLElement.VoltXMLDiff

        if (stmtDiff.getChangedNodes().isEmpty()) {
            return;
        }
        assert(stmtDiff.getChangedNodes().size() == 1);
        Entry<String, VoltXMLDiff> tableEntry = stmtDiff.getChangedNodes().entrySet().iterator().next();
        VoltXMLDiff tableDiff = tableEntry.getValue();
        // need columns to be changed
        if (tableDiff.getChangedNodes().isEmpty() ||
            !tableDiff.getChangedNodes().containsKey("columnscolumns"))
        {
            return;
        }
        VoltXMLDiff columnsDiff = tableDiff.getChangedNodes().get("columnscolumns");
        assert(columnsDiff != null);
        // Need to have deleted columns
        if (columnsDiff.getRemovedNodes().isEmpty()) {
            return;
        }
        // Okay, get a list of deleted column names
        Set<String> removedColumns = new HashSet<String>();
        for (VoltXMLElement e : columnsDiff.getRemovedNodes()) {
            assert(e.attributes.get("name") != null);
            removedColumns.add(e.attributes.get("name"));
        }
        // go back and get our table name.  Use the uniquename ("table" + name) to get the element
        // from the schema
View Full Code Here

Examples of org.hsqldb_voltpatches.VoltXMLElement.VoltXMLDiff

        second.findChild("child", "changedchild1").attributes.remove("deleteme");
        VoltXMLElement temp = second.findChild("child", "changedchild2").findChild("child", "changedgrandchild");
        temp.children.remove(temp.findChild("child", "doomeddescendent"));


        VoltXMLDiff diff = VoltXMLElement.computeDiff(first, second);

        Map<String, String> addedAtt = diff.getAddedAttributes();
        assertEquals(1, addedAtt.size());
        assertTrue(addedAtt.keySet().contains("added"));
        assertEquals("addedval", addedAtt.get("added"));

        Map<String, String> changedAtt = diff.getChangedAttributes();
        assertEquals(1, changedAtt.size());
        assertTrue(changedAtt.keySet().contains("changes"));
        assertEquals("newvalue", changedAtt.get("changes"));

        Set<String> removedAtt = diff.getRemovedAttributes();
        assertEquals(1, removedAtt.size());
        assertTrue(removedAtt.contains("deleted"));

        List<VoltXMLElement> added = diff.getAddedNodes();
        assertEquals(1, added.size());
        assertTrue(findNamedNode(added, "addedchild") != null);

        List<VoltXMLElement> removed = diff.getRemovedNodes();
        assertEquals(1, removed.size());
        assertTrue(findNamedNode(removed, "deletedchild") != null);

        Map<String, VoltXMLDiff> changed = diff.getChangedNodes();
        assertEquals(2, changed.size());
        assertTrue(changed.containsKey("childchangedchild1"));
        VoltXMLDiff child1 = changed.get("childchangedchild1");
        assertTrue(child1.getRemovedAttributes().contains("deleteme"));
        assertTrue(changed.containsKey("childchangedchild2"));
        VoltXMLDiff child2 = changed.get("childchangedchild2");
        assertTrue(child2.getChangedNodes().containsKey("childchangedgrandchild"));
        VoltXMLDiff grandchild = child2.getChangedNodes().get("childchangedgrandchild");
        assertTrue(findNamedNode(grandchild.getRemovedNodes(), "doomeddescendent") != null);

        VoltXMLElement third = first.duplicate();
        third.applyDiff(diff);
        System.out.println(first.toMinString());
        System.out.println(second.toMinString());
View Full Code Here

Examples of org.hsqldb_voltpatches.VoltXMLElement.VoltXMLDiff

        // Same element name, no attribute "name"
        VoltXMLElement child2s = new VoltXMLElement("child");
        child2s.attributes.put("value", "6");
        second.children.add(child2s);

        VoltXMLDiff diff = VoltXMLElement.computeDiff(first, second);
        System.out.println("diff: " + diff.toString());

        VoltXMLElement third = first.duplicate();
        third.applyDiff(diff);
        System.out.println(first.toMinString());
        System.out.println(second.toMinString());
View Full Code Here

Examples of org.hsqldb_voltpatches.VoltXMLElement.VoltXMLDiff

        second.children.add(makeNamedElement("first", "first"));
        second.children.add(makeNamedElement("second", "second"));
        second.children.add(makeNamedElement("third", "third"));
        second.children.add(makeNamedElement("fourth", "fourth"));

        VoltXMLDiff diff = VoltXMLElement.computeDiff(first, second);
        System.out.println("diff: " + diff.toString());

        VoltXMLElement third = first.duplicate();
        third.applyDiff(diff);
        System.out.println(first.toMinString());
        System.out.println(second.toMinString());
View Full Code Here

Examples of org.hsqldb_voltpatches.VoltXMLElement.VoltXMLDiff

        first.children.add(makeNamedElement("child", "deletedchild"));
        first.children.add(makeNamedElement("child", "unchangedchild"));

        VoltXMLElement second = first.duplicate();

        VoltXMLDiff diff = VoltXMLElement.computeDiff(first, second);
        System.out.println("diff: " + diff.toString());

        VoltXMLElement third = first.duplicate();
        third.applyDiff(diff);
        System.out.println(first.toMinString());
        System.out.println(second.toMinString());
View Full Code Here

Examples of org.hsqldb_voltpatches.VoltXMLElement.VoltXMLDiff

     * encountered.
     */
    public VoltXMLDiff runDDLCommandAndDiff(String ddl) throws HSQLParseException {
        runDDLCommand(ddl);
        VoltXMLElement thisSchema = getXMLFromCatalog();
        VoltXMLDiff diff = VoltXMLElement.computeDiff(lastSchema, thisSchema);
        lastSchema = thisSchema.duplicate();
        return diff;
    }
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.