svn commit: r15643 - trunk/src/argouml-app/tests/org/argouml/uml/ui/foundation/core/TestUMLStructuralFeatureTypeComboBoxModel.java

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: tfmorris
Date: 2008-08-28 22:54:46-0700
New Revision: 15643

Modified:
   trunk/src/argouml-app/tests/org/argouml/uml/ui/foundation/core/TestUMLStructuralFeatureTypeComboBoxModel.java

Log:
Issue 5182: Fix test to work with lazy loaded combobox.  Clean up warnings.

Modified: trunk/src/argouml-app/tests/org/argouml/uml/ui/foundation/core/TestUMLStructuralFeatureTypeComboBoxModel.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/tests/org/argouml/uml/ui/foundation/core/TestUMLStructuralFeatureTypeComboBoxModel.java?view=diff&rev=15643&p1=trunk/src/argouml-app/tests/org/argouml/uml/ui/foundation/core/TestUMLStructuralFeatureTypeComboBoxModel.java&p2=trunk/src/argouml-app/tests/org/argouml/uml/ui/foundation/core/TestUMLStructuralFeatureTypeComboBoxModel.java&r1=15642&r2=15643
==============================================================================
--- trunk/src/argouml-app/tests/org/argouml/uml/ui/foundation/core/TestUMLStructuralFeatureTypeComboBoxModel.java	(original)
+++ trunk/src/argouml-app/tests/org/argouml/uml/ui/foundation/core/TestUMLStructuralFeatureTypeComboBoxModel.java	2008-08-28 22:54:46-0700
@@ -24,10 +24,13 @@
 
 package org.argouml.uml.ui.foundation.core;
 
+import java.util.ArrayList;
+import java.util.Collection;
+
 import junit.framework.TestCase;
-import org.argouml.model.InitializeModel;
 
 import org.argouml.kernel.ProjectManager;
+import org.argouml.model.InitializeModel;
 import org.argouml.model.Model;
 import org.argouml.profile.init.InitProfileSubsystem;
 import org.argouml.ui.targetmanager.TargetEvent;
@@ -78,21 +81,21 @@
         Object mmodel =
             Model.getModelManagementFactory().createModel();
         Model.getCoreHelper().setName(mmodel, "untitledModel");
-        Model.getModelManagementFactory().setRootModel(mmodel);
         elem = Model.getCoreFactory().createAttribute();
         dummy = Model.getCoreFactory().createAttribute();
         model = new UMLStructuralFeatureTypeComboBoxModel();
         model.targetSet(new TargetEvent(this, "set", new Object[0],
                 new Object[] {elem}));
         types = new Object[NO_OF_ELEMENTS];
-        Object m = Model.getModelManagementFactory().createModel();
-        ProjectManager.getManager().getCurrentProject().setRoot(m);
-        Model.getCoreHelper().setNamespace(elem, m);
+        Collection roots = new ArrayList();
+        roots.add(mmodel);
+        ProjectManager.getManager().getCurrentProject().setRoots(roots);
+        Model.getCoreHelper().setNamespace(elem, mmodel);
         for (int i = 0; i < NO_OF_ELEMENTS; i++) {
             types[i] = Model.getCoreFactory().createClass();
             // give them unique names so they don't get merged
             Model.getCoreHelper().setName(types[i], "type" + i);
-            Model.getCoreHelper().addOwnedElement(m, types[i]);
+            Model.getCoreHelper().addOwnedElement(mmodel, types[i]);
         }
         Model.getCoreHelper().setType(elem, types[0]);
         Model.getPump().flushModelEvents();
@@ -101,6 +104,7 @@
     /*
      * @see junit.framework.TestCase#tearDown()
      */
+    @Override
     protected void tearDown() throws Exception {
         super.tearDown();
         Model.getUmlFactory().delete(elem);
@@ -118,6 +122,7 @@
         // One can only do this by changing target,
         // so let's simulate that:
         changeTarget();
+        model.buildModelList();
         assertTrue(model.contains(types[NO_OF_ELEMENTS / 2]));
         assertTrue(model.contains(types[0]));
         assertTrue(model.contains(types[NO_OF_ELEMENTS - 1]));
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.