Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/org.eclipse.compare.examples.xml/META-INF/MANIFEST.MF2
-rw-r--r--examples/org.eclipse.compare.examples.xml/pom.xml2
-rw-r--r--examples/org.eclipse.compare.examples.xml/tests/org/eclipse/compare/examples/xml/AllXMLCompareTests.java18
-rw-r--r--examples/org.eclipse.compare.examples.xml/tests/org/eclipse/compare/examples/xml/TestXMLStructureCreator.java239
4 files changed, 170 insertions, 91 deletions
diff --git a/examples/org.eclipse.compare.examples.xml/META-INF/MANIFEST.MF b/examples/org.eclipse.compare.examples.xml/META-INF/MANIFEST.MF
index 9d7bec075..4b6ad4640 100644
--- a/examples/org.eclipse.compare.examples.xml/META-INF/MANIFEST.MF
+++ b/examples/org.eclipse.compare.examples.xml/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.compare.examples.xml; singleton:=true
-Bundle-Version: 3.4.800.qualifier
+Bundle-Version: 3.4.900.qualifier
Bundle-Activator: org.eclipse.compare.examples.xml.XMLPlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/examples/org.eclipse.compare.examples.xml/pom.xml b/examples/org.eclipse.compare.examples.xml/pom.xml
index 1e6cdd67f..4c5e686f4 100644
--- a/examples/org.eclipse.compare.examples.xml/pom.xml
+++ b/examples/org.eclipse.compare.examples.xml/pom.xml
@@ -19,6 +19,6 @@
</parent>
<groupId>org.eclipse.compare</groupId>
<artifactId>org.eclipse.compare.examples.xml</artifactId>
- <version>3.4.800-SNAPSHOT</version>
+ <version>3.4.900-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/examples/org.eclipse.compare.examples.xml/tests/org/eclipse/compare/examples/xml/AllXMLCompareTests.java b/examples/org.eclipse.compare.examples.xml/tests/org/eclipse/compare/examples/xml/AllXMLCompareTests.java
index c3d2002ee..b4f638edd 100644
--- a/examples/org.eclipse.compare.examples.xml/tests/org/eclipse/compare/examples/xml/AllXMLCompareTests.java
+++ b/examples/org.eclipse.compare.examples.xml/tests/org/eclipse/compare/examples/xml/AllXMLCompareTests.java
@@ -13,21 +13,17 @@
*******************************************************************************/
package org.eclipse.compare.examples.xml;
-import junit.framework.*;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
/**
* TestSuite that runs all the XML Compare tests.
*/
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+ TestXMLStructureCreator.class
+})
public class AllXMLCompareTests {
-
- public static void main (String[] args) {
- junit.textui.TestRunner.run (suite());
- }
-
- public static Test suite ( ) {
- TestSuite suite= new TestSuite("All XML Compare Tests"); //$NON-NLS-1$
- suite.addTest(TestXMLStructureCreator.suite());
- return suite;
- }
+ //test suite
}
diff --git a/examples/org.eclipse.compare.examples.xml/tests/org/eclipse/compare/examples/xml/TestXMLStructureCreator.java b/examples/org.eclipse.compare.examples.xml/tests/org/eclipse/compare/examples/xml/TestXMLStructureCreator.java
index d94c686af..05162a0d9 100644
--- a/examples/org.eclipse.compare.examples.xml/tests/org/eclipse/compare/examples/xml/TestXMLStructureCreator.java
+++ b/examples/org.eclipse.compare.examples.xml/tests/org/eclipse/compare/examples/xml/TestXMLStructureCreator.java
@@ -13,203 +13,286 @@
*******************************************************************************/
package org.eclipse.compare.examples.xml;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
import java.io.ByteArrayInputStream;
import java.io.InputStream;
-
-import junit.framework.*;
-
-import org.eclipse.jface.text.Document;
+import java.nio.charset.StandardCharsets;
import org.eclipse.compare.IEncodedStreamContentAccessor;
-import org.eclipse.compare.examples.xml.XMLChildren;
-import org.eclipse.compare.examples.xml.XMLNode;
-import org.eclipse.compare.examples.xml.XMLStructureCreator;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.text.Document;
+import org.junit.Before;
+import org.junit.Test;
+
+public class TestXMLStructureCreator {
-public class TestXMLStructureCreator extends TestCase {
-
Document fdoc;
XMLStructureCreator fsc;
-
+
public class TestStream implements IEncodedStreamContentAccessor {
String fString;
-
+
public TestStream(String string) {
- fString= string;
+ fString = string;
}
-
+
@Override
public InputStream getContents() throws CoreException {
- try {
- return new ByteArrayInputStream(fString.getBytes("UTF-16")); //$NON-NLS-1$
- } catch (Exception e) {
- return new ByteArrayInputStream(fString.getBytes());
- }
+ return new ByteArrayInputStream(fString.getBytes(StandardCharsets.UTF_16));
}
-
+
@Override
public String getCharset() {
return "UTF-16"; //$NON-NLS-1$
}
}
-
- public TestXMLStructureCreator(String name) {
- super(name);
- }
- @Override
- protected void setUp() {
- System.out.println("TestXMLStructureCreator.name()==" + getName()); //$NON-NLS-1$
+ @Before
+ public void setUp() {
fdoc = new Document();
fsc = new XMLStructureCreator();
}
-
- @Override
- protected void tearDown() throws Exception {
- //remove set-up
- }
-
- public static Test suite() {
- return new TestSuite(TestXMLStructureCreator.class);
- }
+ @Test
public void test0() {
- TestStream s= new TestStream("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<a attr1=\"&lt;b&gt;&lt;/b&gt;\"\nattr2=\"he\n ll\n o2\" attr3=\"hello3\"\nattr4=\"hello4\"><b attr=\n\"battr\" attr2=\"battr2\">\n<c/>\n</b>\n<b2/>\n</a>\n"); //$NON-NLS-1$
- XMLChildren Tree= (XMLChildren) fsc.getStructure(s);
+ TestStream s = new TestStream(
+ "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<a attr1=\"&lt;b&gt;&lt;/b&gt;\"\nattr2=\"he\n ll\n o2\" attr3=\"hello3\"\nattr4=\"hello4\"><b attr=\n\"battr\" attr2=\"battr2\">\n<c/>\n</b>\n<b2/>\n</a>\n"); //$NON-NLS-1$
+ XMLChildren Tree = (XMLChildren) fsc.getStructure(s);
- XMLChildren ExpectedTree = new XMLChildren(XMLStructureCreator.TYPE_ELEMENT,XMLStructureCreator.ROOT_ID, "",(XMLStructureCreator.ROOT_ID + XMLStructureCreator.SIGN_SEPARATOR + XMLStructureCreator.SIGN_ELEMENT), fdoc, 0, 0); //$NON-NLS-1$
- //create Expected Tree
- XMLChildren parent = new XMLChildren(XMLStructureCreator.TYPE_ELEMENT,"a<[1]","<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<a attr1=\"&lt;b&gt;&lt;/b&gt;\"\nattr2=\"he\n ll\n o2\" attr3=\"hello3\"\nattr4=\"hello4\"><b attr=\n\"battr\" attr2=\"battr2\">\n<c/>\n</b>\n<b2/>\n</a>\n",(XMLStructureCreator.ROOT_ID + XMLStructureCreator.SIGN_SEPARATOR + "a" + XMLStructureCreator.SIGN_SEPARATOR + XMLStructureCreator.SIGN_ELEMENT), fdoc, 0, 0); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ XMLChildren ExpectedTree = new XMLChildren(XMLStructureCreator.TYPE_ELEMENT, XMLStructureCreator.ROOT_ID, "", //$NON-NLS-1$
+ (XMLStructureCreator.ROOT_ID + XMLStructureCreator.SIGN_SEPARATOR + XMLStructureCreator.SIGN_ELEMENT),
+ fdoc, 0, 0);
+ // create Expected Tree
+ XMLChildren parent = new XMLChildren(XMLStructureCreator.TYPE_ELEMENT, "a<[1]", //$NON-NLS-1$
+ "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<a attr1=\"&lt;b&gt;&lt;/b&gt;\"\nattr2=\"he\n ll\n o2\" attr3=\"hello3\"\nattr4=\"hello4\"><b attr=\n\"battr\" attr2=\"battr2\">\n<c/>\n</b>\n<b2/>\n</a>\n", //$NON-NLS-1$
+ (XMLStructureCreator.ROOT_ID + XMLStructureCreator.SIGN_SEPARATOR + "a" //$NON-NLS-1$
+ + XMLStructureCreator.SIGN_SEPARATOR + XMLStructureCreator.SIGN_ELEMENT),
+ fdoc, 0, 0);
parent.setName("a [1]"); //$NON-NLS-1$
ExpectedTree.addChild(parent);
parent.setParent(ExpectedTree);
- XMLChildren current = new XMLChildren(XMLStructureCreator.TYPE_ATTRIBUTE,"attr1","<b></b>",(XMLStructureCreator.ROOT_ID + XMLStructureCreator.SIGN_SEPARATOR +"a" + XMLStructureCreator.SIGN_SEPARATOR + "attr1" + XMLStructureCreator.SIGN_SEPARATOR + XMLStructureCreator.SIGN_ATTRIBUTE), fdoc, 0, 0); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ XMLChildren current = new XMLChildren(XMLStructureCreator.TYPE_ATTRIBUTE, "attr1", "<b></b>", //$NON-NLS-1$ //$NON-NLS-2$
+ (XMLStructureCreator.ROOT_ID + XMLStructureCreator.SIGN_SEPARATOR + "a" //$NON-NLS-1$
+ + XMLStructureCreator.SIGN_SEPARATOR + "attr1" + XMLStructureCreator.SIGN_SEPARATOR //$NON-NLS-1$
+ + XMLStructureCreator.SIGN_ATTRIBUTE),
+ fdoc, 0, 0);
current.setName("attr1"); //$NON-NLS-1$
parent.addChild(current);
current.setParent(parent);
- current = new XMLChildren(XMLStructureCreator.TYPE_ATTRIBUTE,"attr2","he ll o2",(XMLStructureCreator.ROOT_ID + XMLStructureCreator.SIGN_SEPARATOR +"a" + XMLStructureCreator.SIGN_SEPARATOR + "attr2" + XMLStructureCreator.SIGN_SEPARATOR + XMLStructureCreator.SIGN_ATTRIBUTE), fdoc, 0, 0); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ current = new XMLChildren(XMLStructureCreator.TYPE_ATTRIBUTE, "attr2", "he ll o2", //$NON-NLS-1$ //$NON-NLS-2$
+ (XMLStructureCreator.ROOT_ID + XMLStructureCreator.SIGN_SEPARATOR + "a" //$NON-NLS-1$
+ + XMLStructureCreator.SIGN_SEPARATOR + "attr2" + XMLStructureCreator.SIGN_SEPARATOR //$NON-NLS-1$
+ + XMLStructureCreator.SIGN_ATTRIBUTE),
+ fdoc, 0, 0);
current.setName("attr2"); //$NON-NLS-1$
parent.addChild(current);
current.setParent(parent);
- current = new XMLChildren(XMLStructureCreator.TYPE_ATTRIBUTE,"attr3","hello3",(XMLStructureCreator.ROOT_ID + XMLStructureCreator.SIGN_SEPARATOR +"a" + XMLStructureCreator.SIGN_SEPARATOR + "attr3" + XMLStructureCreator.SIGN_SEPARATOR + XMLStructureCreator.SIGN_ATTRIBUTE), fdoc, 0, 0); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ current = new XMLChildren(XMLStructureCreator.TYPE_ATTRIBUTE, "attr3", "hello3", //$NON-NLS-1$ //$NON-NLS-2$
+ (XMLStructureCreator.ROOT_ID + XMLStructureCreator.SIGN_SEPARATOR + "a" //$NON-NLS-1$
+ + XMLStructureCreator.SIGN_SEPARATOR + "attr3" + XMLStructureCreator.SIGN_SEPARATOR //$NON-NLS-1$
+ + XMLStructureCreator.SIGN_ATTRIBUTE),
+ fdoc, 0, 0);
current.setName("attr3"); //$NON-NLS-1$
parent.addChild(current);
current.setParent(parent);
- current = new XMLChildren(XMLStructureCreator.TYPE_ATTRIBUTE,"attr4","hello4",(XMLStructureCreator.ROOT_ID + XMLStructureCreator.SIGN_SEPARATOR +"a" + XMLStructureCreator.SIGN_SEPARATOR + "attr4" + XMLStructureCreator.SIGN_SEPARATOR + XMLStructureCreator.SIGN_ATTRIBUTE), fdoc, 0, 0); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ current = new XMLChildren(XMLStructureCreator.TYPE_ATTRIBUTE, "attr4", "hello4", //$NON-NLS-1$ //$NON-NLS-2$
+ (XMLStructureCreator.ROOT_ID + XMLStructureCreator.SIGN_SEPARATOR + "a" //$NON-NLS-1$
+ + XMLStructureCreator.SIGN_SEPARATOR + "attr4" + XMLStructureCreator.SIGN_SEPARATOR //$NON-NLS-1$
+ + XMLStructureCreator.SIGN_ATTRIBUTE),
+ fdoc, 0, 0);
current.setName("attr4"); //$NON-NLS-1$
parent.addChild(current);
current.setParent(parent);
- current = new XMLChildren(XMLStructureCreator.TYPE_ELEMENT,"b<[1]","<b attr=\n\"battr\" attr2=\"battr2\">\n<c/>\n</b>\n",(XMLStructureCreator.ROOT_ID + XMLStructureCreator.SIGN_SEPARATOR +"a" + XMLStructureCreator.SIGN_SEPARATOR +"b" + XMLStructureCreator.SIGN_SEPARATOR + XMLStructureCreator.SIGN_ELEMENT), fdoc, 0, 0); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ current = new XMLChildren(XMLStructureCreator.TYPE_ELEMENT, "b<[1]", //$NON-NLS-1$
+ "<b attr=\n\"battr\" attr2=\"battr2\">\n<c/>\n</b>\n", //$NON-NLS-1$
+ (XMLStructureCreator.ROOT_ID + XMLStructureCreator.SIGN_SEPARATOR + "a" //$NON-NLS-1$
+ + XMLStructureCreator.SIGN_SEPARATOR + "b" + XMLStructureCreator.SIGN_SEPARATOR //$NON-NLS-1$
+ + XMLStructureCreator.SIGN_ELEMENT),
+ fdoc, 0, 0);
current.setName("b [1]"); //$NON-NLS-1$
parent.addChild(current);
current.setParent(parent);
parent = current;
- current = new XMLChildren(XMLStructureCreator.TYPE_ATTRIBUTE,"attr","battr",(XMLStructureCreator.ROOT_ID + XMLStructureCreator.SIGN_SEPARATOR +"a" + XMLStructureCreator.SIGN_SEPARATOR + "b" + XMLStructureCreator.SIGN_SEPARATOR + "attr" + XMLStructureCreator.SIGN_SEPARATOR + XMLStructureCreator.SIGN_ATTRIBUTE), fdoc, 0, 0); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ current = new XMLChildren(XMLStructureCreator.TYPE_ATTRIBUTE, "attr", "battr", //$NON-NLS-1$ //$NON-NLS-2$
+ (XMLStructureCreator.ROOT_ID + XMLStructureCreator.SIGN_SEPARATOR + "a" //$NON-NLS-1$
+ + XMLStructureCreator.SIGN_SEPARATOR + "b" + XMLStructureCreator.SIGN_SEPARATOR + "attr" //$NON-NLS-1$ //$NON-NLS-2$
+ + XMLStructureCreator.SIGN_SEPARATOR + XMLStructureCreator.SIGN_ATTRIBUTE),
+ fdoc, 0, 0);
current.setName("attr"); //$NON-NLS-1$
parent.addChild(current);
current.setParent(parent);
- current = new XMLChildren(XMLStructureCreator.TYPE_ATTRIBUTE,"attr2","battr2",(XMLStructureCreator.ROOT_ID + XMLStructureCreator.SIGN_SEPARATOR +"a" + XMLStructureCreator.SIGN_SEPARATOR + "b" + XMLStructureCreator.SIGN_SEPARATOR + "attr2" + XMLStructureCreator.SIGN_SEPARATOR + XMLStructureCreator.SIGN_ATTRIBUTE), fdoc, 0, 0); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ current = new XMLChildren(XMLStructureCreator.TYPE_ATTRIBUTE, "attr2", "battr2", //$NON-NLS-1$ //$NON-NLS-2$
+ (XMLStructureCreator.ROOT_ID + XMLStructureCreator.SIGN_SEPARATOR + "a" //$NON-NLS-1$
+ + XMLStructureCreator.SIGN_SEPARATOR + "b" + XMLStructureCreator.SIGN_SEPARATOR + "attr2" //$NON-NLS-1$ //$NON-NLS-2$
+ + XMLStructureCreator.SIGN_SEPARATOR + XMLStructureCreator.SIGN_ATTRIBUTE),
+ fdoc, 0, 0);
current.setName("attr2"); //$NON-NLS-1$
parent.addChild(current);
current.setParent(parent);
- current = new XMLChildren(XMLStructureCreator.TYPE_ELEMENT,"c<[1]","<c/>",(XMLStructureCreator.ROOT_ID + XMLStructureCreator.SIGN_SEPARATOR + "a" + XMLStructureCreator.SIGN_SEPARATOR + "b" + XMLStructureCreator.SIGN_SEPARATOR + "c" + XMLStructureCreator.SIGN_SEPARATOR + XMLStructureCreator.SIGN_ELEMENT), fdoc, 0, 0); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ current = new XMLChildren(XMLStructureCreator.TYPE_ELEMENT, "c<[1]", "<c/>", //$NON-NLS-1$ //$NON-NLS-2$
+ (XMLStructureCreator.ROOT_ID + XMLStructureCreator.SIGN_SEPARATOR + "a" //$NON-NLS-1$
+ + XMLStructureCreator.SIGN_SEPARATOR + "b" + XMLStructureCreator.SIGN_SEPARATOR + "c" //$NON-NLS-1$ //$NON-NLS-2$
+ + XMLStructureCreator.SIGN_SEPARATOR + XMLStructureCreator.SIGN_ELEMENT),
+ fdoc, 0, 0);
current.setName("c [1]"); //$NON-NLS-1$
parent.addChild(current);
current.setParent(parent);
parent = (XMLChildren) parent.getParent();
- current = new XMLChildren(XMLStructureCreator.TYPE_ELEMENT,"b2<[1]","<b2/>",(XMLStructureCreator.ROOT_ID + XMLStructureCreator.SIGN_SEPARATOR +"a" + XMLStructureCreator.SIGN_SEPARATOR +"b2" + XMLStructureCreator.SIGN_SEPARATOR + XMLStructureCreator.SIGN_ELEMENT), fdoc, 0, 0); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ current = new XMLChildren(XMLStructureCreator.TYPE_ELEMENT, "b2<[1]", "<b2/>", //$NON-NLS-1$ //$NON-NLS-2$
+ (XMLStructureCreator.ROOT_ID + XMLStructureCreator.SIGN_SEPARATOR + "a" //$NON-NLS-1$
+ + XMLStructureCreator.SIGN_SEPARATOR + "b2" + XMLStructureCreator.SIGN_SEPARATOR //$NON-NLS-1$
+ + XMLStructureCreator.SIGN_ELEMENT),
+ fdoc, 0, 0);
current.setName("b2 [1]"); //$NON-NLS-1$
parent.addChild(current);
current.setParent(parent);
-
- checkTrees(Tree,ExpectedTree);
+
+ checkTrees(Tree, ExpectedTree);
}
-
+
+ @Test
public void test1() {
- TestStream s= new TestStream("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<a>body_a_1\n <b>body_b_1\n <c>body_c_1\n <d2>body_d2\n </d2>\nbody_c_2\n </c>\nbody_b_2\n </b>\nbody_a_2\n <b2>\n </b2>\nbody_a_3\n</a>"); //$NON-NLS-1$
- XMLChildren Tree= (XMLChildren) fsc.getStructure(s);
+ TestStream s = new TestStream(
+ "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<a>body_a_1\n <b>body_b_1\n <c>body_c_1\n <d2>body_d2\n </d2>\nbody_c_2\n </c>\nbody_b_2\n </b>\nbody_a_2\n <b2>\n </b2>\nbody_a_3\n</a>"); //$NON-NLS-1$
+ XMLChildren Tree = (XMLChildren) fsc.getStructure(s);
- XMLChildren ExpectedTree = new XMLChildren(XMLStructureCreator.TYPE_ELEMENT,XMLStructureCreator.ROOT_ID, "",(XMLStructureCreator.ROOT_ID + XMLStructureCreator.SIGN_SEPARATOR + XMLStructureCreator.SIGN_ELEMENT), fdoc, 0, 0); //$NON-NLS-1$
- //create Expected Tree
- XMLChildren parent = new XMLChildren(XMLStructureCreator.TYPE_ELEMENT,"a<[1]","<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<a>body_a_1\n <b>body_b_1\n <c>body_c_1\n <d2>body_d2\n </d2>\nbody_c_2\n </c>\nbody_b_2\n </b>\nbody_a_2\n <b2>\n </b2>\nbody_a_3\n</a>",(XMLStructureCreator.ROOT_ID + XMLStructureCreator.SIGN_SEPARATOR + "a" + XMLStructureCreator.SIGN_SEPARATOR + XMLStructureCreator.SIGN_ELEMENT), fdoc, 0, 0); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ XMLChildren ExpectedTree = new XMLChildren(XMLStructureCreator.TYPE_ELEMENT, XMLStructureCreator.ROOT_ID, "", //$NON-NLS-1$
+ (XMLStructureCreator.ROOT_ID + XMLStructureCreator.SIGN_SEPARATOR + XMLStructureCreator.SIGN_ELEMENT),
+ fdoc, 0, 0);
+ // create Expected Tree
+ XMLChildren parent = new XMLChildren(XMLStructureCreator.TYPE_ELEMENT, "a<[1]", //$NON-NLS-1$
+ "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<a>body_a_1\n <b>body_b_1\n <c>body_c_1\n <d2>body_d2\n </d2>\nbody_c_2\n </c>\nbody_b_2\n </b>\nbody_a_2\n <b2>\n </b2>\nbody_a_3\n</a>", //$NON-NLS-1$
+ (XMLStructureCreator.ROOT_ID + XMLStructureCreator.SIGN_SEPARATOR + "a" //$NON-NLS-1$
+ + XMLStructureCreator.SIGN_SEPARATOR + XMLStructureCreator.SIGN_ELEMENT),
+ fdoc, 0, 0);
parent.setName("a [1]"); //$NON-NLS-1$
ExpectedTree.addChild(parent);
parent.setParent(ExpectedTree);
- XMLChildren current = new XMLChildren(XMLStructureCreator.TYPE_TEXT,"body_(1)","body_a_1\n ",(XMLStructureCreator.ROOT_ID + XMLStructureCreator.SIGN_SEPARATOR +"a" + XMLStructureCreator.SIGN_SEPARATOR + XMLStructureCreator.SIGN_TEXT), fdoc, 0, 0); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ XMLChildren current = new XMLChildren(XMLStructureCreator.TYPE_TEXT, "body_(1)", "body_a_1\n ", //$NON-NLS-1$ //$NON-NLS-2$
+ (XMLStructureCreator.ROOT_ID + XMLStructureCreator.SIGN_SEPARATOR + "a" //$NON-NLS-1$
+ + XMLStructureCreator.SIGN_SEPARATOR + XMLStructureCreator.SIGN_TEXT),
+ fdoc, 0, 0);
current.setName("body (1)"); //$NON-NLS-1$
parent.addChild(current);
current.setParent(parent);
- current = new XMLChildren(XMLStructureCreator.TYPE_ELEMENT,"b<[1]","<b>body_b_1\n <c>body_c_1\n <d2>body_d2\n </d2>\nbody_c_2\n </c>\nbody_b_2\n </b>\n",(XMLStructureCreator.ROOT_ID + XMLStructureCreator.SIGN_SEPARATOR +"a" + XMLStructureCreator.SIGN_SEPARATOR + "b" + XMLStructureCreator.SIGN_SEPARATOR + XMLStructureCreator.SIGN_ELEMENT), fdoc, 0, 0); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ current = new XMLChildren(XMLStructureCreator.TYPE_ELEMENT, "b<[1]", //$NON-NLS-1$
+ "<b>body_b_1\n <c>body_c_1\n <d2>body_d2\n </d2>\nbody_c_2\n </c>\nbody_b_2\n </b>\n", //$NON-NLS-1$
+ (XMLStructureCreator.ROOT_ID + XMLStructureCreator.SIGN_SEPARATOR + "a" //$NON-NLS-1$
+ + XMLStructureCreator.SIGN_SEPARATOR + "b" + XMLStructureCreator.SIGN_SEPARATOR //$NON-NLS-1$
+ + XMLStructureCreator.SIGN_ELEMENT),
+ fdoc, 0, 0);
current.setName("b [1]"); //$NON-NLS-1$
parent.addChild(current);
current.setParent(parent);
parent = current;
- current = new XMLChildren(XMLStructureCreator.TYPE_TEXT,"body_(1)","body_b_1\n ",(XMLStructureCreator.ROOT_ID + XMLStructureCreator.SIGN_SEPARATOR +"a" + XMLStructureCreator.SIGN_SEPARATOR + "b" + XMLStructureCreator.SIGN_SEPARATOR + XMLStructureCreator.SIGN_TEXT), fdoc, 0, 0); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ current = new XMLChildren(XMLStructureCreator.TYPE_TEXT, "body_(1)", "body_b_1\n ", //$NON-NLS-1$ //$NON-NLS-2$
+ (XMLStructureCreator.ROOT_ID + XMLStructureCreator.SIGN_SEPARATOR + "a" //$NON-NLS-1$
+ + XMLStructureCreator.SIGN_SEPARATOR + "b" + XMLStructureCreator.SIGN_SEPARATOR //$NON-NLS-1$
+ + XMLStructureCreator.SIGN_TEXT),
+ fdoc, 0, 0);
current.setName("body (1)"); //$NON-NLS-1$
parent.addChild(current);
current.setParent(parent);
- current = new XMLChildren(XMLStructureCreator.TYPE_ELEMENT,"c<[1]","<c>body_c_1\n <d2>body_d2\n </d2>\nbody_c_2\n </c>\n",(XMLStructureCreator.ROOT_ID + XMLStructureCreator.SIGN_SEPARATOR +"a" + XMLStructureCreator.SIGN_SEPARATOR + "b" + XMLStructureCreator.SIGN_SEPARATOR + "c" + XMLStructureCreator.SIGN_SEPARATOR + XMLStructureCreator.SIGN_ELEMENT), fdoc, 0, 0); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ current = new XMLChildren(XMLStructureCreator.TYPE_ELEMENT, "c<[1]", //$NON-NLS-1$
+ "<c>body_c_1\n <d2>body_d2\n </d2>\nbody_c_2\n </c>\n", //$NON-NLS-1$
+ (XMLStructureCreator.ROOT_ID + XMLStructureCreator.SIGN_SEPARATOR + "a" //$NON-NLS-1$
+ + XMLStructureCreator.SIGN_SEPARATOR + "b" + XMLStructureCreator.SIGN_SEPARATOR + "c" //$NON-NLS-1$ //$NON-NLS-2$
+ + XMLStructureCreator.SIGN_SEPARATOR + XMLStructureCreator.SIGN_ELEMENT),
+ fdoc, 0, 0);
current.setName("c [1]"); //$NON-NLS-1$
parent.addChild(current);
current.setParent(parent);
parent = current;
- current = new XMLChildren(XMLStructureCreator.TYPE_TEXT,"body_(1)","body_c_1\n ",(XMLStructureCreator.ROOT_ID + XMLStructureCreator.SIGN_SEPARATOR + "a" + XMLStructureCreator.SIGN_SEPARATOR + "b" + XMLStructureCreator.SIGN_SEPARATOR + "c" + XMLStructureCreator.SIGN_SEPARATOR + XMLStructureCreator.SIGN_TEXT), fdoc, 0, 0); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ current = new XMLChildren(XMLStructureCreator.TYPE_TEXT, "body_(1)", "body_c_1\n ", //$NON-NLS-1$ //$NON-NLS-2$
+ (XMLStructureCreator.ROOT_ID + XMLStructureCreator.SIGN_SEPARATOR + "a" //$NON-NLS-1$
+ + XMLStructureCreator.SIGN_SEPARATOR + "b" + XMLStructureCreator.SIGN_SEPARATOR + "c" //$NON-NLS-1$ //$NON-NLS-2$
+ + XMLStructureCreator.SIGN_SEPARATOR + XMLStructureCreator.SIGN_TEXT),
+ fdoc, 0, 0);
current.setName("body (1)"); //$NON-NLS-1$
parent.addChild(current);
current.setParent(parent);
- current = new XMLChildren(XMLStructureCreator.TYPE_ELEMENT,"d2<[1]","<d2>body_d2\n </d2>\n",(XMLStructureCreator.ROOT_ID + XMLStructureCreator.SIGN_SEPARATOR + "a" + XMLStructureCreator.SIGN_SEPARATOR + "b" + XMLStructureCreator.SIGN_SEPARATOR + "c" + XMLStructureCreator.SIGN_SEPARATOR + "d2" + XMLStructureCreator.SIGN_SEPARATOR + XMLStructureCreator.SIGN_ELEMENT), fdoc, 0, 0); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+ current = new XMLChildren(XMLStructureCreator.TYPE_ELEMENT, "d2<[1]", "<d2>body_d2\n </d2>\n", //$NON-NLS-1$ //$NON-NLS-2$
+ (XMLStructureCreator.ROOT_ID + XMLStructureCreator.SIGN_SEPARATOR + "a" //$NON-NLS-1$
+ + XMLStructureCreator.SIGN_SEPARATOR + "b" + XMLStructureCreator.SIGN_SEPARATOR + "c" //$NON-NLS-1$ //$NON-NLS-2$
+ + XMLStructureCreator.SIGN_SEPARATOR + "d2" + XMLStructureCreator.SIGN_SEPARATOR //$NON-NLS-1$
+ + XMLStructureCreator.SIGN_ELEMENT),
+ fdoc, 0, 0);
current.setName("d2 [1]"); //$NON-NLS-1$
parent.addChild(current);
current.setParent(parent);
parent = current;
- current = new XMLChildren(XMLStructureCreator.TYPE_TEXT,"body_(1)","body_d2\n ",(XMLStructureCreator.ROOT_ID + XMLStructureCreator.SIGN_SEPARATOR + "a" + XMLStructureCreator.SIGN_SEPARATOR + "b" + XMLStructureCreator.SIGN_SEPARATOR + "c" + XMLStructureCreator.SIGN_SEPARATOR + "d2" + XMLStructureCreator.SIGN_SEPARATOR + XMLStructureCreator.SIGN_TEXT), fdoc, 0, 0); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+ current = new XMLChildren(XMLStructureCreator.TYPE_TEXT, "body_(1)", "body_d2\n ", //$NON-NLS-1$ //$NON-NLS-2$
+ (XMLStructureCreator.ROOT_ID + XMLStructureCreator.SIGN_SEPARATOR + "a" //$NON-NLS-1$
+ + XMLStructureCreator.SIGN_SEPARATOR + "b" + XMLStructureCreator.SIGN_SEPARATOR + "c" //$NON-NLS-1$ //$NON-NLS-2$
+ + XMLStructureCreator.SIGN_SEPARATOR + "d2" + XMLStructureCreator.SIGN_SEPARATOR //$NON-NLS-1$
+ + XMLStructureCreator.SIGN_TEXT),
+ fdoc, 0, 0);
current.setName("body (1)"); //$NON-NLS-1$
parent.addChild(current);
current.setParent(parent);
parent = (XMLChildren) parent.getParent();
- current = new XMLChildren(XMLStructureCreator.TYPE_TEXT,"body_(2)","\nbody_c_2\n ",(XMLStructureCreator.ROOT_ID + XMLStructureCreator.SIGN_SEPARATOR + "a" + XMLStructureCreator.SIGN_SEPARATOR + "b" + XMLStructureCreator.SIGN_SEPARATOR + "c" + XMLStructureCreator.SIGN_SEPARATOR + XMLStructureCreator.SIGN_TEXT), fdoc, 0, 0); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ current = new XMLChildren(XMLStructureCreator.TYPE_TEXT, "body_(2)", "\nbody_c_2\n ", //$NON-NLS-1$ //$NON-NLS-2$
+ (XMLStructureCreator.ROOT_ID + XMLStructureCreator.SIGN_SEPARATOR + "a" //$NON-NLS-1$
+ + XMLStructureCreator.SIGN_SEPARATOR + "b" + XMLStructureCreator.SIGN_SEPARATOR + "c" //$NON-NLS-1$ //$NON-NLS-2$
+ + XMLStructureCreator.SIGN_SEPARATOR + XMLStructureCreator.SIGN_TEXT),
+ fdoc, 0, 0);
current.setName("body (2)"); //$NON-NLS-1$
parent.addChild(current);
current.setParent(parent);
parent = (XMLChildren) parent.getParent();
- current = new XMLChildren(XMLStructureCreator.TYPE_TEXT,"body_(2)","\nbody_b_2\n ",(XMLStructureCreator.ROOT_ID + XMLStructureCreator.SIGN_SEPARATOR + "a" + XMLStructureCreator.SIGN_SEPARATOR + "b" + XMLStructureCreator.SIGN_SEPARATOR + XMLStructureCreator.SIGN_TEXT), fdoc, 0, 0); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ current = new XMLChildren(XMLStructureCreator.TYPE_TEXT, "body_(2)", "\nbody_b_2\n ", //$NON-NLS-1$ //$NON-NLS-2$
+ (XMLStructureCreator.ROOT_ID + XMLStructureCreator.SIGN_SEPARATOR + "a" //$NON-NLS-1$
+ + XMLStructureCreator.SIGN_SEPARATOR + "b" + XMLStructureCreator.SIGN_SEPARATOR //$NON-NLS-1$
+ + XMLStructureCreator.SIGN_TEXT),
+ fdoc, 0, 0);
current.setName("body (2)"); //$NON-NLS-1$
parent.addChild(current);
current.setParent(parent);
parent = (XMLChildren) parent.getParent();
- current = new XMLChildren(XMLStructureCreator.TYPE_TEXT,"body_(2)","\nbody_a_2\n ",(XMLStructureCreator.ROOT_ID + XMLStructureCreator.SIGN_SEPARATOR + "a" + XMLStructureCreator.SIGN_SEPARATOR + XMLStructureCreator.SIGN_TEXT), fdoc, 0, 0); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ current = new XMLChildren(XMLStructureCreator.TYPE_TEXT, "body_(2)", "\nbody_a_2\n ", //$NON-NLS-1$ //$NON-NLS-2$
+ (XMLStructureCreator.ROOT_ID + XMLStructureCreator.SIGN_SEPARATOR + "a" //$NON-NLS-1$
+ + XMLStructureCreator.SIGN_SEPARATOR + XMLStructureCreator.SIGN_TEXT),
+ fdoc, 0, 0);
current.setName("body (2)"); //$NON-NLS-1$
parent.addChild(current);
current.setParent(parent);
- current = new XMLChildren(XMLStructureCreator.TYPE_ELEMENT,"b2<[1]","<b2>\n </b2>\n",(XMLStructureCreator.ROOT_ID + XMLStructureCreator.SIGN_SEPARATOR + "a" + XMLStructureCreator.SIGN_SEPARATOR + "b2" + XMLStructureCreator.SIGN_SEPARATOR + XMLStructureCreator.SIGN_ELEMENT), fdoc, 0, 0); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ current = new XMLChildren(XMLStructureCreator.TYPE_ELEMENT, "b2<[1]", "<b2>\n </b2>\n", //$NON-NLS-1$ //$NON-NLS-2$
+ (XMLStructureCreator.ROOT_ID + XMLStructureCreator.SIGN_SEPARATOR + "a" //$NON-NLS-1$
+ + XMLStructureCreator.SIGN_SEPARATOR + "b2" + XMLStructureCreator.SIGN_SEPARATOR //$NON-NLS-1$
+ + XMLStructureCreator.SIGN_ELEMENT),
+ fdoc, 0, 0);
current.setName("b2 [1]"); //$NON-NLS-1$
parent.addChild(current);
current.setParent(parent);
- current = new XMLChildren(XMLStructureCreator.TYPE_TEXT,"body_(3)","\nbody_a_3\n",(XMLStructureCreator.ROOT_ID + XMLStructureCreator.SIGN_SEPARATOR + "a" + XMLStructureCreator.SIGN_SEPARATOR + XMLStructureCreator.SIGN_TEXT), fdoc, 0, 0); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ current = new XMLChildren(XMLStructureCreator.TYPE_TEXT, "body_(3)", "\nbody_a_3\n", //$NON-NLS-1$ //$NON-NLS-2$
+ (XMLStructureCreator.ROOT_ID + XMLStructureCreator.SIGN_SEPARATOR + "a" //$NON-NLS-1$
+ + XMLStructureCreator.SIGN_SEPARATOR + XMLStructureCreator.SIGN_TEXT),
+ fdoc, 0, 0);
current.setName("body (2)"); //$NON-NLS-1$
parent.addChild(current);
current.setParent(parent);
- checkTrees(Tree,ExpectedTree);
+ checkTrees(Tree, ExpectedTree);
}
-
+
protected void checkTrees(XMLNode left, XMLNode right) {
if (left != null && right != null) {
- //System.out.println(left.getName() + ", " + right.getName());
- //System.out.println(">" + left.getValue() + "<\n>" + right.getValue() + "<");
+ // System.out.println(left.getName() + ", " + right.getName());
+ // System.out.println(">" + left.getValue() + "<\n>" + right.getValue() + "<");
assertTrue(left.testEquals(right));
Object[] leftChildren = left.getChildren();
Object[] rightChildren = right.getChildren();
if (leftChildren != null && rightChildren != null) {
if (leftChildren.length == rightChildren.length) {
- for (int i=0; i<leftChildren.length; i++)
+ for (int i = 0; i < leftChildren.length; i++)
checkTrees((XMLNode) leftChildren[i], (XMLNode) rightChildren[i]);
} else
- assertTrue(false);
+ fail();
}
- } else if ( ((left == null) && (right != null)) || ((left != null) && (right == null)) ) {
- assertTrue(false);
+ } else if (((left == null) && (right != null)) || ((left != null) && (right == null))) {
+ fail();
}
}
}
-

Back to the top