svn commit: r14374 - trunk/src/app/tests/org/argouml/model/TestActivityGraphStateMachine.java

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: tfmorris
Date: 2008-04-17 14:46:30-0700
New Revision: 14374

Modified:
   trunk/src/app/tests/org/argouml/model/TestActivityGraphStateMachine.java

Log:
buildActivityGraph creates a top state, we don't need another

Modified: trunk/src/app/tests/org/argouml/model/TestActivityGraphStateMachine.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/app/tests/org/argouml/model/TestActivityGraphStateMachine.java?view=diff&rev=14374&p1=trunk/src/app/tests/org/argouml/model/TestActivityGraphStateMachine.java&p2=trunk/src/app/tests/org/argouml/model/TestActivityGraphStateMachine.java&r1=14373&r2=14374
==============================================================================
--- trunk/src/app/tests/org/argouml/model/TestActivityGraphStateMachine.java	(original)
+++ trunk/src/app/tests/org/argouml/model/TestActivityGraphStateMachine.java	2008-04-17 14:46:30-0700
@@ -1,5 +1,5 @@
 // $Id$
-// Copyright (c) 2002-2007 The Regents of the University of California. All
+// Copyright (c) 2008 The Regents of the University of California. All
 // Rights Reserved. Permission to use, copy, modify, and distribute this
 // software and its documentation without fee, and without a written
 // agreement is hereby granted, provided that the above copyright notice
@@ -28,6 +28,8 @@
 
 import junit.framework.TestCase;
 
+import org.apache.log4j.Logger;
+
 
 /**
  * Tests for the state machines in an ActivityGraph.
@@ -36,8 +38,9 @@
  */
 public class TestActivityGraphStateMachine extends TestCase {
 
-
-
+    private static final Logger LOG = 
+        Logger.getLogger(TestActivityGraphStateMachine.class);
+    
     /**
      * The constructor.
      *
@@ -48,9 +51,7 @@
         InitializeModel.initializeDefault();
     }
 
-    /*
-     * @see junit.framework.TestCase#setUp()
-     */
+    @Override
     public void setUp() throws Exception {
 	super.setUp();
     }
@@ -74,20 +75,28 @@
         // Build an activity graph with a single action state 
         // the way the GUI would
         Object model = Model.getModelManagementFactory().createModel();
+        LOG.debug("Created model "  + model);
         Object activityGraph = Model.getActivityGraphsFactory()
                 .buildActivityGraph(model);
-        Object top = Model.getStateMachinesFactory()
-                .buildCompositeStateOnStateMachine(activityGraph);
+        LOG.debug("Created activity graph "  + activityGraph);
+        Object top = Model.getFacade().getTop(activityGraph);
+        assertNotNull("Activity graph got created without a top state", top);
+        LOG.debug("top state "  + top);
+
         Object actionState = Model.getActivityGraphsFactory()
                 .createActionState();
-        Model.getStateMachinesHelper().addSubvertex(top, actionState);
+        LOG.debug("Created action state "  + top);
+        Model.getStateMachinesHelper().setContainer(actionState, top);
+
+        Collection subs = Model.getFacade().getSubvertices(top);
+        assertEquals("setContainer didn't work", actionState, 
+                subs.iterator().next());
 
         Collection roots = Model.getFacade().getRootElements();
         assertEquals("More than one root element", 1, roots.size());
         assertEquals("Wrong root element", model, roots.iterator().next());
         
         // Delete the model and make sure everything inside goes with it
-
         Model.getUmlFactory().delete(model);
         Collection theDregs = Model.getFacade().getRootElements();
         assertTrue("Failed to delete all elements from an activity graph",
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.