svn commit: r16664 - trunk/src/argouml-app: src/org/argouml/notation/providers/uml tests/org/argouml/notation/providers/uml
Michiel van der Wulp <[email protected]>
| Newsgroups | gmane.comp.lang.uml.argouml.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: mvw
Date: 2009-01-19 22:26:53-0800
New Revision: 16664
Modified:
trunk/src/argouml-app/src/org/argouml/notation/providers/uml/AbstractMessageNotationUml.java
trunk/src/argouml-app/tests/org/argouml/notation/providers/uml/TestMessageNotationUml.java
Log:
More commenting and refactoring as preparation for issue 5150.
Studying the tests was very interesting...
Modified: trunk/src/argouml-app/src/org/argouml/notation/providers/uml/AbstractMessageNotationUml.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/notation/providers/uml/AbstractMessageNotationUml.java?view=diff&pathrev=16664&r1=16663&r2=16664
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/notation/providers/uml/AbstractMessageNotationUml.java (original)
+++ trunk/src/argouml-app/src/org/argouml/notation/providers/uml/AbstractMessageNotationUml.java 2009-01-19 22:26:53-0800
@@ -105,6 +105,8 @@
* <li>Locating an Operation by name and the number of arguments -
* the operation is hooked to the CallAction of the Message.
* <li>Create an Operation with given name (no arguments).
+ * <li>Change the order of messages (predecessor/successor).
+ * <li>Reverting the direction of a message.
* <li>etc.
* </ul>
*
Modified: trunk/src/argouml-app/tests/org/argouml/notation/providers/uml/TestMessageNotationUml.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/tests/org/argouml/notation/providers/uml/TestMessageNotationUml.java?view=diff&pathrev=16664&r1=16663&r2=16664
==============================================================================
--- trunk/src/argouml-app/tests/org/argouml/notation/providers/uml/TestMessageNotationUml.java (original)
+++ trunk/src/argouml-app/tests/org/argouml/notation/providers/uml/TestMessageNotationUml.java 2009-01-19 22:26:53-0800
@@ -1,5 +1,5 @@
// $Id$
-// Copyright (c) 1996-2008 The Regents of the University of California. All
+// Copyright (c) 1996-2009 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
@@ -44,7 +44,16 @@
*/
public class TestMessageNotationUml extends TestCase {
- /*
+ private Object cl1;
+ private Object cl2;
+ private Object cl3;
+ private Object cl4;
+ private Object cl5;
+
+ /**
+ * The constructor.
+ *
+ * @param str the name
* @see junit.framework.TestCase#TestCase(String)
*/
public TestMessageNotationUml(String str) {
@@ -89,11 +98,11 @@
Object coll = Model.getCollaborationsFactory().createCollaboration();
Object inter = Model.getCollaborationsFactory().buildInteraction(coll);
- Object cl1 = Model.getCollaborationsFactory().createClassifierRole();
- Object cl2 = Model.getCollaborationsFactory().createClassifierRole();
- Object cl3 = Model.getCollaborationsFactory().createClassifierRole();
- Object cl4 = Model.getCollaborationsFactory().createClassifierRole();
- Object cl5 = Model.getCollaborationsFactory().createClassifierRole();
+ cl1 = Model.getCollaborationsFactory().createClassifierRole();
+ cl2 = Model.getCollaborationsFactory().createClassifierRole();
+ cl3 = Model.getCollaborationsFactory().createClassifierRole();
+ cl4 = Model.getCollaborationsFactory().createClassifierRole();
+ cl5 = Model.getCollaborationsFactory().createClassifierRole();
Model.getCoreHelper().setNamespace(cl1, coll);
Model.getCoreHelper().setNamespace(cl2, coll);
Model.getCoreHelper().setNamespace(cl3, coll);
@@ -201,6 +210,18 @@
checkParseException(m6, "1.2.2 :");
+ /* Try Changing the direction of m7 */
+ tryChangingDirection(m1, m6, m7);
+
+ /* TRY PREDECESSORS */
+ tryPredecessors(m1, m3, m4, m5, m7);
+
+ /* TRY SOME PREDECESSOR ERRORS */
+ trySomePredecessorErrors(m2, m3);
+ }
+
+ private void tryChangingDirection(Object m1, Object m6, Object m7)
+ throws ParseException {
parseMessage(m7, "2:");
assertTrue(Model.getFacade().getSender(m7) == cl1);
assertTrue(Model.getFacade().getReceiver(m7) == cl3);
@@ -214,12 +235,6 @@
assertTrue(Model.getFacade().getReceiver(m7) == cl1);
assertTrue(Model.getFacade().getActivator(m7) == m6);
assertTrue(Model.getFacade().getPredecessors(m7).size() == 0);
-
- /* TRY PREDECESSORS */
- tryPredecessors(m1, m3, m4, m5, m7);
-
- /* TRY SOME PREDECESSOR ERRORS */
- trySomePredecessorErrors(m2, m3);
}
/**
@@ -341,8 +356,9 @@
assertEquals("var, var2, var3 := func", body);
parseMessage(m3, "1.2 : load_the_accumulating_taxes");
- //TODO: Why there is not test here ?
- //It's just for resetting the message body ?
+ script = Model.getFacade().getScript(Model.getFacade().getAction(m3));
+ body = Model.getFacade().getBody(script);
+ assertEquals("load_the_accumulating_taxes", body);
}
/**
@@ -406,21 +422,36 @@
*/
private void trySomeMoreComplexMoving(Object m1, Object m2,
Object m3) throws ParseException {
+ assertTrue(Model.getFacade().getSender(m3) == cl2);
+ assertTrue(Model.getFacade().getReceiver(m3) == cl3);
+
+ // This swaps the direction of m3:
parseMessage(m3, " 1.1.1 : ");
assertTrue(Model.getFacade().getActivator(m3) == m2);
assertTrue(Model.getFacade().getPredecessors(m3).size() == 0);
+ assertTrue(Model.getFacade().getSender(m3) == cl3);
+ assertTrue(Model.getFacade().getReceiver(m3) == cl2);
+ // This swaps the direction of m3 back:
+ // the colon is obliged, but the / not and the 2nd dot also not
parseMessage(m3, " / 1..2 : ");
assertTrue(Model.getFacade().getActivator(m3) == m1);
assertTrue(Model.getFacade().getPredecessors(m2).size() == 0);
assertTrue(
Model.getFacade().getPredecessors(m3).iterator().next() == m2
&& Model.getFacade().getPredecessors(m3).size() == 1);
+ assertTrue(Model.getFacade().getSender(m3) == cl2);
+ assertTrue(Model.getFacade().getReceiver(m3) == cl3);
+
+ // Notation allows to add or modify things, not remove.
+ // Hence, this does nothing:
parseMessage(m3, "");
assertTrue(Model.getFacade().getActivator(m3) == m1);
assertTrue(
Model.getFacade().getPredecessors(m3).iterator().next() == m2
&& Model.getFacade().getPredecessors(m3).size() == 1);
+ assertTrue(Model.getFacade().getSender(m3) == cl2);
+ assertTrue(Model.getFacade().getReceiver(m3) == cl3);
}
/**
------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=5905&dsMessageId=1036868
To unsubscribe from this discussion, e-mail: [[email protected]].