[nobug] JS drop patch for 112367 for peter
diff --git a/tests/org.eclipse.wst.common.tests.ui/plugin.xml b/tests/org.eclipse.wst.common.tests.ui/plugin.xml
index a338c26..b0e4e7b 100644
--- a/tests/org.eclipse.wst.common.tests.ui/plugin.xml
+++ b/tests/org.eclipse.wst.common.tests.ui/plugin.xml
@@ -18,6 +18,7 @@
<import plugin="org.eclipse.core.runtime"/>
<import plugin="org.eclipse.wst.common.frameworks.ui"/>
<import plugin="org.eclipse.wst.common.tests"/>
+ <import plugin="org.eclipse.wst.common.environment"/>
</requires>
<extension
diff --git a/tests/org.eclipse.wst.common.tests.ui/src/org/eclipse/wst/common/tests/ui/manager/TestGroupManager.java b/tests/org.eclipse.wst.common.tests.ui/src/org/eclipse/wst/common/tests/ui/manager/TestGroupManager.java
index fa703a4..9556121 100644
--- a/tests/org.eclipse.wst.common.tests.ui/src/org/eclipse/wst/common/tests/ui/manager/TestGroupManager.java
+++ b/tests/org.eclipse.wst.common.tests.ui/src/org/eclipse/wst/common/tests/ui/manager/TestGroupManager.java
@@ -15,6 +15,7 @@
import junit.framework.TestCase;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.wst.common.environment.EnvironmentService;
import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelProvider;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
@@ -92,12 +93,12 @@
// Operations are organized as follows:
//
- // D
- // / \
- // B F
- // / \ / \
- // A C E G
- operationManager = new OperationManager(dataModelManager, opD);
+ // D
+ // / \
+ // B F
+ // / \ / \
+ // A C E G
+ operationManager = new OperationManager(dataModelManager, opD, EnvironmentService.getEclipseConsoleEnvironment() );
operationManager.addPreOperation(opD.getID(), opB);
operationManager.addPostOperation(opD.getID(), opF);
operationManager.addPreOperation(opB.getID(), opA);
@@ -107,12 +108,12 @@
// Page groups are organized as follows:
//
- // B - C
- // / \
- // Root - A - D \ G
- // \ \ /
- // ------ E - F - H
- // \ null
+ // B - C
+ // / \
+ // Root - A - D \ G
+ // \ \ /
+ // ------ E - F - H
+ // \ null
//
// The page group handler for A will return either B and then E or D and
// then E. The group handler for F will return either G or H and then null or
@@ -198,6 +199,10 @@
}
public void testSimpleRun() throws Exception {
+ HashSet ids = new HashSet();
+ ids.add( "testprovider1" );
+ ids.add( "testprovider2" );
+ pgA.setDataModelIDs( ids );
assertTrue("There should be a next page", pageGroupManager.hasNextPage()); //$NON-NLS-1$
assertTrue("The root page should be null", pageGroupManager.getCurrentPage() == null); //$NON-NLS-1$
pageGroupManager.moveBackOnePage(); // Should do nothing.
@@ -208,6 +213,7 @@
assertTrue("There should be a next page", pageGroupManager.hasNextPage()); //$NON-NLS-1$
assertTrue("The page should be r1", pageGroupManager.getCurrentPage() == r1); //$NON-NLS-1$
checkResults();
+ assertTrue("Data models not Ok for page group A", checkDataModels() ); //$NON-NLS-1$
pageGroupManager.moveForwardOnePage();
assertTrue("There should be a next page", pageGroupManager.hasNextPage()); //$NON-NLS-1$
@@ -382,6 +388,34 @@
expectedUndoOps.removeAllElements();
}
+ private boolean checkDataModels()
+ {
+ IDataModel model = dataModel;
+
+ boolean containsModel1 = model.isNestedModel( "testprovider1" );
+ boolean containsModel2 = model.isNestedModel( "testprovider2" );
+ boolean prop1 = model.isPropertySet( "provider1Prop1" );
+ boolean prop2 = model.isPropertySet( "provider1Prop2" );
+ boolean prop3 = model.isPropertySet( "provider1Prop3" );
+ boolean prop4 = model.isPropertySet( "provider1Prop4" );
+ boolean prop5 = model.isPropertySet( "provider2Prop1" );
+ boolean prop6 = model.isPropertySet( "provider2Prop2" );
+ boolean prop7 = model.isPropertySet( "provider2Prop3" );
+ boolean prop8 = model.isPropertySet( "provider2Prop4" );
+ boolean value1 = model.getProperty( "provider1Prop1" ).equals( "11" );
+ boolean value2 = model.getProperty( "provider1Prop2" ).equals( "22" );
+ boolean value3 = model.getProperty( "provider1Prop3" ).equals( "33" );
+ boolean value4 = model.getProperty( "provider1Prop4" ).equals( "44" );
+ boolean value5 = model.getProperty( "provider2Prop1" ).equals( "1111" );
+ boolean value6 = model.getProperty( "provider2Prop2" ).equals( "2222" );
+ boolean value7 = model.getProperty( "provider2Prop3" ).equals( "3333" );
+ boolean value8 = model.getProperty( "provider2Prop4" ).equals( "4444" );
+
+ return containsModel1 && containsModel2 &&
+ prop1 && prop2 && prop3 && prop4 && prop5 && prop6 && prop7 && prop8 &&
+ value1 && value2 && value3 && value4 && value5 && value6 && value7 && value8;
+ }
+
private class AGroupHandler implements IDMPageGroupHandler {
private String groupID_;
diff --git a/tests/org.eclipse.wst.common.tests/frameworktests/org/eclipse/wst/common/frameworks/operations/tests/manager/BaseOperation.java b/tests/org.eclipse.wst.common.tests/frameworktests/org/eclipse/wst/common/frameworks/operations/tests/manager/BaseOperation.java
index 6af06a2..d8bfddf 100644
--- a/tests/org.eclipse.wst.common.tests/frameworktests/org/eclipse/wst/common/frameworks/operations/tests/manager/BaseOperation.java
+++ b/tests/org.eclipse.wst.common.tests/frameworktests/org/eclipse/wst/common/frameworks/operations/tests/manager/BaseOperation.java
@@ -10,6 +10,8 @@
*******************************************************************************/
package org.eclipse.wst.common.frameworks.operations.tests.manager;
+import java.util.HashSet;
+import java.util.Set;
import java.util.Vector;
import org.eclipse.core.commands.ExecutionException;
@@ -17,17 +19,22 @@
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
+import org.eclipse.wst.common.environment.Log;
import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
public class BaseOperation extends AbstractDataModelOperation {
private Vector resultList;
private Vector undoList;
private IStatus status;
+ private boolean checkModels;
+ private boolean modelsOK = false;
public BaseOperation(String id, Vector resultList, Vector undoList) {
setID(id);
this.resultList = resultList;
this.undoList = undoList;
+
status = Status.OK_STATUS;
}
@@ -37,6 +44,11 @@
public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
resultList.add(this);
+
+ if( checkModels ) modelsOK = checkModels();
+
+ getEnvironment().getLog().log( Log.OK, 1234, this, "BaseOperation", (Throwable)null );
+
return status;
}
@@ -49,4 +61,52 @@
undoList.add(this);
return Status.OK_STATUS;
}
+
+ public void setCheckModels( boolean checkModels )
+ {
+ this.checkModels = checkModels;
+ }
+
+ public boolean getModelsOK()
+ {
+ return modelsOK;
+ }
+
+ public Set getDataModelIDs()
+ {
+ HashSet ids = new HashSet();
+
+ ids.add( "testprovider1" );
+ ids.add( "testprovider2" );
+
+ return ids;
+ }
+
+ private boolean checkModels()
+ {
+ IDataModel model = getDataModel();
+
+ boolean containsModel1 = model.isNestedModel( "testprovider1" );
+ boolean containsModel2 = model.isNestedModel( "testprovider2" );
+ boolean prop1 = model.isPropertySet( "provider1Prop1" );
+ boolean prop2 = model.isPropertySet( "provider1Prop2" );
+ boolean prop3 = model.isPropertySet( "provider1Prop3" );
+ boolean prop4 = model.isPropertySet( "provider1Prop4" );
+ boolean prop5 = model.isPropertySet( "provider2Prop1" );
+ boolean prop6 = model.isPropertySet( "provider2Prop2" );
+ boolean prop7 = model.isPropertySet( "provider2Prop3" );
+ boolean prop8 = model.isPropertySet( "provider2Prop4" );
+ boolean value1 = model.getProperty( "provider1Prop1" ).equals( "11" );
+ boolean value2 = model.getProperty( "provider1Prop2" ).equals( "22" );
+ boolean value3 = model.getProperty( "provider1Prop3" ).equals( "33" );
+ boolean value4 = model.getProperty( "provider1Prop4" ).equals( "44" );
+ boolean value5 = model.getProperty( "provider2Prop1" ).equals( "1111" );
+ boolean value6 = model.getProperty( "provider2Prop2" ).equals( "2222" );
+ boolean value7 = model.getProperty( "provider2Prop3" ).equals( "3333" );
+ boolean value8 = model.getProperty( "provider2Prop4" ).equals( "4444" );
+
+ return containsModel1 && containsModel2 &&
+ prop1 && prop2 && prop3 && prop4 && prop5 && prop6 && prop7 && prop8 &&
+ value1 && value2 && value3 && value4 && value5 && value6 && value7 && value8;
+ }
}
diff --git a/tests/org.eclipse.wst.common.tests/frameworktests/org/eclipse/wst/common/frameworks/operations/tests/manager/TestOperationManager.java b/tests/org.eclipse.wst.common.tests/frameworktests/org/eclipse/wst/common/frameworks/operations/tests/manager/TestOperationManager.java
index 60ff387..6d4bff5 100644
--- a/tests/org.eclipse.wst.common.tests/frameworktests/org/eclipse/wst/common/frameworks/operations/tests/manager/TestOperationManager.java
+++ b/tests/org.eclipse.wst.common.tests/frameworktests/org/eclipse/wst/common/frameworks/operations/tests/manager/TestOperationManager.java
@@ -14,6 +14,7 @@
import junit.framework.TestCase;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
+import org.eclipse.wst.common.environment.EnvironmentService;
import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelProvider;
import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
import org.eclipse.wst.common.frameworks.internal.DataModelManager;
@@ -62,7 +63,7 @@
// B F
// / \ / \
// A C E G
- manager = new OperationManager(dataModelManager, opD);
+ manager = new OperationManager(dataModelManager, opD, EnvironmentService.getEclipseConsoleEnvironment() );
manager.addPreOperation(opD.getID(), opB);
manager.addPostOperation(opD.getID(), opF);
manager.addPreOperation(opB.getID(), opA);
@@ -83,6 +84,25 @@
checkResults();
}
+ public void testDataModelsAreSet() throws Exception {
+ expectedOps.add(opA);
+ expectedOps.add(opB);
+ expectedOps.add(opC);
+ expectedOps.add(opD);
+ expectedOps.add(opE);
+ expectedOps.add(opF);
+ expectedOps.add(opG);
+
+ opA.setCheckModels( true );
+ opG.setCheckModels( true );
+ manager.runOperations();
+ checkResults();
+
+ assertTrue("Expected opA models to be OK", opA.getModelsOK() );
+ assertTrue("Expected opG models to be OK", opG.getModelsOK() );
+
+ }
+
public void testRunWithErrors() throws Exception {
BaseOperation[] operations = new BaseOperation[]{opA, opB, opC, opD, opE, opF, opG};
diff --git a/tests/org.eclipse.wst.common.tests/frameworktests/org/eclipse/wst/common/frameworks/operations/tests/manager/TestProvider1.java b/tests/org.eclipse.wst.common.tests/frameworktests/org/eclipse/wst/common/frameworks/operations/tests/manager/TestProvider1.java
new file mode 100644
index 0000000..b42075c
--- /dev/null
+++ b/tests/org.eclipse.wst.common.tests/frameworktests/org/eclipse/wst/common/frameworks/operations/tests/manager/TestProvider1.java
@@ -0,0 +1,40 @@
+/***************************************************************************************************
+ * 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.manager;
+
+import java.util.Set;
+import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelProvider;
+
+public class TestProvider1 extends AbstractDataModelProvider
+{
+ public Set getPropertyNames(){
+ Set propertyNames = super.getPropertyNames();
+ propertyNames.add("provider1Prop1");
+ propertyNames.add("provider1Prop2");
+ propertyNames.add("provider1Prop3");
+ propertyNames.add("provider1Prop4");
+
+ return propertyNames;
+ }
+
+ public void init()
+ {
+ setProperty( "provider1Prop1", "11" );
+ setProperty( "provider1Prop2", "22" );
+ setProperty( "provider1Prop3", "33" );
+ setProperty( "provider1Prop4", "44" );
+ }
+
+ public String getID()
+ {
+ return "testprovider1";
+ }
+
+
+}
diff --git a/tests/org.eclipse.wst.common.tests/frameworktests/org/eclipse/wst/common/frameworks/operations/tests/manager/TestProvider2.java b/tests/org.eclipse.wst.common.tests/frameworktests/org/eclipse/wst/common/frameworks/operations/tests/manager/TestProvider2.java
new file mode 100644
index 0000000..4e134dd
--- /dev/null
+++ b/tests/org.eclipse.wst.common.tests/frameworktests/org/eclipse/wst/common/frameworks/operations/tests/manager/TestProvider2.java
@@ -0,0 +1,39 @@
+/***************************************************************************************************
+ * 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.manager;
+
+import java.util.Set;
+import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelProvider;
+
+public class TestProvider2 extends AbstractDataModelProvider
+{
+ public Set getPropertyNames(){
+ Set propertyNames = super.getPropertyNames();
+ propertyNames.add("provider2Prop1");
+ propertyNames.add("provider2Prop2");
+ propertyNames.add("provider2Prop3");
+ propertyNames.add("provider2Prop4");
+
+ return propertyNames;
+ }
+
+ public void init()
+ {
+ setProperty( "provider2Prop1", "1111" );
+ setProperty( "provider2Prop2", "2222" );
+ setProperty( "provider2Prop3", "3333" );
+ setProperty( "provider2Prop4", "4444" );
+ }
+
+ public String getID()
+ {
+ return "testprovider2";
+ }
+
+}
diff --git a/tests/org.eclipse.wst.common.tests/plugin.xml b/tests/org.eclipse.wst.common.tests/plugin.xml
index b73056e..7fbae56 100644
--- a/tests/org.eclipse.wst.common.tests/plugin.xml
+++ b/tests/org.eclipse.wst.common.tests/plugin.xml
@@ -24,6 +24,7 @@
<import plugin="org.eclipse.wst.common.modulecore"/>
<import plugin="org.eclipse.wst.common.tests.collector" export="true"/>
<import plugin="org.eclipse.jem.util" />
+ <import plugin="org.eclipse.wst.common.environment"/>
</requires>
<extension-point id="DataModelVerifier" name="Data Model Verifier Factory Extension" schema="schema/dataModelVerifier.exsd"/>
@@ -40,6 +41,12 @@
class="org.eclipse.wst.common.frameworks.datamodel.tests.TestDataModelProvider"
id="org.eclipse.wst.common.frameworks.datamodel.tests.ITestDataModel"/>
<DataModelProvider
+ class="org.eclipse.wst.common.frameworks.operations.tests.manager.TestProvider1"
+ id="testprovider1"/>
+ <DataModelProvider
+ class="org.eclipse.wst.common.frameworks.operations.tests.manager.TestProvider2"
+ id="testprovider2"/>
+ <DataModelProvider
class="bogusClass"
id="bogus"/>
<ProviderDefinesType