WTPWizard Change
diff --git a/tests/org.eclipse.wst.common.tests/.classpath b/tests/org.eclipse.wst.common.tests/.classpath
index 40aaabb..5717526 100644
--- a/tests/org.eclipse.wst.common.tests/.classpath
+++ b/tests/org.eclipse.wst.common.tests/.classpath
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" path="commontests"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="output" path="bin"/>
+ <classpathentry kind="src" path="commontests"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="src" path="frameworktests"/>
+ <classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/tests/org.eclipse.wst.common.tests/frameworktests/org/eclipse/wst/common/frameworks/operations/tests/NestingTest.java b/tests/org.eclipse.wst.common.tests/frameworktests/org/eclipse/wst/common/frameworks/operations/tests/NestingTest.java
new file mode 100644
index 0000000..b9b452c
--- /dev/null
+++ b/tests/org.eclipse.wst.common.tests/frameworktests/org/eclipse/wst/common/frameworks/operations/tests/NestingTest.java
@@ -0,0 +1,332 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.common.frameworks.operations.tests;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.eclipse.wst.common.frameworks.operations.WTPOperation;
+import org.eclipse.wst.common.frameworks.operations.WTPOperationDataModel;
+
+/**
+ * @author jsholl
+ *
+ * TODO To change the template for this generated type comment go to Window - Preferences - Java -
+ * Code Style - Code Templates
+ */
+public class NestingTest extends TestCase {
+
+
+ private class A extends WTPOperationDataModel {
+ public static final String P = "A.P";
+
+ public WTPOperation getDefaultOperation() {
+ return null;
+ }
+
+ protected void initValidBaseProperties() {
+ super.initValidBaseProperties();
+ addValidBaseProperty(P);
+ }
+ };
+
+ private class B extends WTPOperationDataModel {
+ public static final String P = "B.P";
+
+ public WTPOperation getDefaultOperation() {
+ return null;
+ }
+
+ protected void initValidBaseProperties() {
+ super.initValidBaseProperties();
+ addValidBaseProperty(P);
+ }
+ };
+
+ private class C extends WTPOperationDataModel {
+ public static final String P = "C.P";
+
+ public WTPOperation getDefaultOperation() {
+ return null;
+ }
+
+ protected void initValidBaseProperties() {
+ super.initValidBaseProperties();
+ addValidBaseProperty(P);
+ }
+ };
+
+ private A a;
+ private B b;
+ private C c;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ a = new A();
+ b = new B();
+ c = new C();
+ }
+
+ /**
+ * <code>
+ * 1 2 3 4 5 6
+ * A | A | A | A | A | A
+ * B | | B | B | B | B
+ * C | | C
+ * </code>
+ */
+ public void testIsPropertySimpleNesting0() {
+ a.addNestedModel("b", b); //1
+ Assert.assertTrue(a.isProperty(B.P));
+
+ a.removeNestedModel("b"); //2
+ Assert.assertFalse(a.isProperty(B.P));
+
+ a.addNestedModel("b", b); //3
+ Assert.assertTrue(a.isProperty(B.P));
+
+ b.addNestedModel("c", c); //4
+ Assert.assertTrue(a.isProperty(C.P));
+
+ b.removeNestedModel("c"); //5
+ Assert.assertFalse(a.isProperty(C.P));
+
+ b.addNestedModel("c", c); //6
+ Assert.assertTrue(a.isProperty(C.P));
+ }
+
+ /**
+ * <code>
+ * 1 2 3 4
+ * A | A | A | A
+ * B | B | B |
+ * C | |
+ * </code>
+ */
+ public void testIsPropertySimpleNesting1() {
+ a.addNestedModel("b", b); //1
+ Assert.assertTrue(a.isProperty(B.P));
+
+ b.addNestedModel("c", c); //2
+ Assert.assertTrue(a.isProperty(C.P));
+ Assert.assertTrue(b.isProperty(C.P));
+
+ b.removeNestedModel("c"); //3
+ Assert.assertFalse(a.isProperty(C.P));
+ Assert.assertFalse(b.isProperty(C.P));
+
+ a.removeNestedModel("b"); //4
+ Assert.assertFalse(a.isProperty(B.P));
+ }
+
+ /**
+ * <code>
+ * 1 2 3 4
+ * A | A | A | A
+ * | B | |
+ * B | C | B | B
+ * C | | C |
+ * | | C
+ * </code>
+ */
+ public void testIsPropertySimpleNesting2() {
+ b.addNestedModel("c", c); //1
+ Assert.assertTrue(b.isProperty(C.P));
+
+ a.addNestedModel("b", b); //2
+ Assert.assertTrue(a.isProperty(B.P));
+ Assert.assertTrue(a.isProperty(C.P));
+
+ a.removeNestedModel("b"); //3
+ Assert.assertFalse(a.isProperty(B.P));
+ Assert.assertFalse(a.isProperty(C.P));
+
+ b.removeNestedModel("c"); //4
+ Assert.assertFalse(b.isProperty(C.P));
+ }
+
+ /**
+ * <code>
+ * 1 2 3 4 5
+ * A | A | A | A | A
+ * B | B | B | B | B
+ * C | C | C |
+ * | C2 |
+ * </code>
+ */
+ public void testIsPropertyComplexNesting1() {
+ a.addNestedModel("b", b); //1
+ b.addNestedModel("c", c); //2
+ Assert.assertTrue(a.isProperty(C.P));
+ C c2 = new C();
+ b.addNestedModel("c2", c2); //3
+ b.removeNestedModel("c2"); //4
+ Assert.assertTrue(b.isProperty(C.P));
+ Assert.assertTrue(a.isProperty(C.P));
+ b.removeNestedModel("c"); //5
+ Assert.assertFalse(b.isProperty(C.P));
+ Assert.assertFalse(a.isProperty(C.P));
+ }
+
+ /**
+ * <code>
+ * 1 2 3 4 5 6 7
+ * A | A | A | A | A | A | A
+ * B | B | B | B | B | B | B
+ * C | C | C | C | C2 |
+ * C2 | C2 |
+ * </code>
+ */
+ public void testIsPropertyComplexNesting2() {
+ a.addNestedModel("b", b); //1
+ b.addNestedModel("c", c); //2
+ Assert.assertTrue(a.isProperty(C.P));
+ C c2 = new C();
+ a.addNestedModel("c2", c2); //3
+ a.removeNestedModel("c2"); //4
+ Assert.assertTrue(a.isProperty(C.P));
+ b.addNestedModel("c2", c2); //5
+ Assert.assertTrue(a.isProperty(C.P));
+ b.removeNestedModel("c"); //6
+ Assert.assertTrue(a.isProperty(C.P));
+ b.removeNestedModel("c2"); //7
+ Assert.assertFalse(a.isProperty(C.P));
+ }
+
+ /**
+ * <code>
+ * 1 2 3 4 5 6
+ * A | A | B | A | C | A
+ * B | B | C | B | A | B
+ * C | C | A | C | B | C
+ * A (loop) | | A(loop)
+ * </code>
+ */
+ public void testIsPropertyComplexNesting3() {
+ a.addNestedModel("b", b);
+ b.addNestedModel("c", c); //1
+ Assert.assertTrue(a.isProperty(B.P));
+ Assert.assertTrue(a.isProperty(C.P));
+ Assert.assertFalse(b.isProperty(A.P));
+ Assert.assertTrue(b.isProperty(C.P));
+ Assert.assertFalse(c.isProperty(A.P));
+ Assert.assertFalse(c.isProperty(B.P));
+ Assert.assertFalse(a.isProperty("foo"));
+ Assert.assertFalse(b.isProperty("foo"));
+ Assert.assertFalse(c.isProperty("foo"));
+ c.addNestedModel("a", a); //2
+ Assert.assertTrue(a.isProperty(B.P));
+ Assert.assertTrue(a.isProperty(C.P));
+ Assert.assertTrue(b.isProperty(A.P));
+ Assert.assertTrue(b.isProperty(C.P));
+ Assert.assertTrue(c.isProperty(A.P));
+ Assert.assertTrue(c.isProperty(B.P));
+ Assert.assertFalse(a.isProperty("foo"));
+ Assert.assertFalse(b.isProperty("foo"));
+ Assert.assertFalse(c.isProperty("foo"));
+ a.removeNestedModel("b"); //3
+ Assert.assertFalse(a.isProperty(B.P));
+ Assert.assertFalse(a.isProperty(C.P));
+ Assert.assertTrue(b.isProperty(A.P));
+ Assert.assertTrue(b.isProperty(C.P));
+ Assert.assertTrue(c.isProperty(A.P));
+ Assert.assertFalse(c.isProperty(B.P));
+ Assert.assertFalse(a.isProperty("foo"));
+ Assert.assertFalse(b.isProperty("foo"));
+ Assert.assertFalse(c.isProperty("foo"));
+ a.addNestedModel("b", b); //4
+ Assert.assertTrue(a.isProperty(B.P));
+ Assert.assertTrue(a.isProperty(C.P));
+ Assert.assertTrue(b.isProperty(A.P));
+ Assert.assertTrue(b.isProperty(C.P));
+ Assert.assertTrue(c.isProperty(A.P));
+ Assert.assertTrue(c.isProperty(B.P));
+ Assert.assertFalse(a.isProperty("foo"));
+ Assert.assertFalse(b.isProperty("foo"));
+ Assert.assertFalse(c.isProperty("foo"));
+ b.removeNestedModel("c"); //5
+ Assert.assertTrue(a.isProperty(B.P));
+ Assert.assertFalse(a.isProperty(C.P));
+ Assert.assertFalse(b.isProperty(A.P));
+ Assert.assertFalse(b.isProperty(C.P));
+ Assert.assertTrue(c.isProperty(A.P));
+ Assert.assertTrue(c.isProperty(B.P));
+ Assert.assertFalse(a.isProperty("foo"));
+ Assert.assertFalse(b.isProperty("foo"));
+ Assert.assertFalse(c.isProperty("foo"));
+ c.removeNestedModel("a");
+ a.removeNestedModel("b");
+ Assert.assertFalse(a.isProperty(B.P));
+ Assert.assertFalse(a.isProperty(C.P));
+ Assert.assertFalse(b.isProperty(A.P));
+ Assert.assertFalse(b.isProperty(C.P));
+ Assert.assertFalse(c.isProperty(A.P));
+ Assert.assertFalse(c.isProperty(B.P));
+ Assert.assertFalse(a.isProperty("foo"));
+ Assert.assertFalse(b.isProperty("foo"));
+ Assert.assertFalse(c.isProperty("foo"));
+ }
+
+ public void testSetGetProperty1(){
+ //cylical
+ a.addNestedModel("b", b);
+ b.addNestedModel("c", c);
+ c.addNestedModel("a", a);
+
+ a.setProperty(A.P, "a");
+ a.setProperty(B.P, "b");
+ a.setProperty(C.P, "c");
+ assertEquals("a", a.getProperty(A.P));
+ assertEquals("a", b.getProperty(A.P));
+ assertEquals("a", c.getProperty(A.P));
+ assertEquals("b", a.getProperty(B.P));
+ assertEquals("b", b.getProperty(B.P));
+ assertEquals("b", c.getProperty(B.P));
+ assertEquals("c", a.getProperty(C.P));
+ assertEquals("c", b.getProperty(C.P));
+ assertEquals("c", c.getProperty(C.P));
+
+ b.setProperty(A.P, "aa");
+ b.setProperty(B.P, "bb");
+ b.setProperty(C.P, "cc");
+ assertEquals("aa", a.getProperty(A.P));
+ assertEquals("aa", b.getProperty(A.P));
+ assertEquals("aa", c.getProperty(A.P));
+ assertEquals("bb", a.getProperty(B.P));
+ assertEquals("bb", b.getProperty(B.P));
+ assertEquals("bb", c.getProperty(B.P));
+ assertEquals("cc", a.getProperty(C.P));
+ assertEquals("cc", b.getProperty(C.P));
+ assertEquals("cc", c.getProperty(C.P));
+
+ c.setProperty(A.P, "aaa");
+ c.setProperty(B.P, "bbb");
+ c.setProperty(C.P, "ccc");
+ assertEquals("aaa", a.getProperty(A.P));
+ assertEquals("aaa", b.getProperty(A.P));
+ assertEquals("aaa", c.getProperty(A.P));
+ assertEquals("bbb", a.getProperty(B.P));
+ assertEquals("bbb", b.getProperty(B.P));
+ assertEquals("bbb", c.getProperty(B.P));
+ assertEquals("ccc", a.getProperty(C.P));
+ assertEquals("ccc", b.getProperty(C.P));
+ assertEquals("ccc", c.getProperty(C.P));
+ }
+
+ public void testListeners1(){
+ //cylical
+ a.addNestedModel("b", b);
+ b.addNestedModel("c", c);
+ c.addNestedModel("a", a);
+
+
+ }
+}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.common.tests/frameworktests/org/eclipse/wst/common/frameworks/operations/tests/WTPOperationAPITests.java b/tests/org.eclipse.wst.common.tests/frameworktests/org/eclipse/wst/common/frameworks/operations/tests/WTPOperationAPITests.java
new file mode 100644
index 0000000..02d21d2
--- /dev/null
+++ b/tests/org.eclipse.wst.common.tests/frameworktests/org/eclipse/wst/common/frameworks/operations/tests/WTPOperationAPITests.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.common.frameworks.operations.tests;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.eclipse.wst.common.tests.SimpleTestSuite;
+
+/**
+ * @author jsholl
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class WTPOperationAPITests extends TestSuite {
+
+ public static Test suite() {
+ return new WTPOperationAPITests();
+ }
+
+ public WTPOperationAPITests() {
+ super();
+ addTest(new SimpleTestSuite(NestingTest.class));
+ }
+}
diff --git a/tests/org.eclipse.wst.common.tests/plugin.xml b/tests/org.eclipse.wst.common.tests/plugin.xml
index 8009b18..42cfec2 100644
--- a/tests/org.eclipse.wst.common.tests/plugin.xml
+++ b/tests/org.eclipse.wst.common.tests/plugin.xml
@@ -26,5 +26,12 @@
</requires>
<extension-point id="DataModelVerifier" name="Data Model Verifier Factory Extension" schema="schema/dataModelVerifier.exsd"/>
+ <extension
+ point="org.eclipse.wst.common.tests.collector.suites">
+ <suite
+ suiteClass="org.eclipse.wst.common.frameworks.operations.tests.WTPOperationAPITests"
+ suiteName="WTP Operation API Tests">
+ </suite>
+ </extension>
</plugin>