Author: mvw
Date: 2008-07-10 12:32:35-0700
New Revision: 15235
Modified:
trunk/src/argouml-app/tests/org/argouml/notation/providers/uml/TestAttributeAndOperationNotationUml.java
Log:
Test for the fix for issue 5229: Attribute types newly created by Notation subsystem not placed in any namespace.
As supplied by Christian - thanks!
Modified: trunk/src/argouml-app/tests/org/argouml/notation/providers/uml/TestAttributeAndOperationNotationUml.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/tests/org/argouml/notation/providers/uml/TestAttributeAndOperationNotationUml.java?view=diff&rev=15235&p1=trunk/src/argouml-app/tests/org/argouml/notation/providers/uml/TestAttributeAndOperationNotationUml.java&p2=trunk/src/argouml-app/tests/org/argouml/notation/providers/uml/TestAttributeAndOperationNotationUml.java&r1=15234&r2=15235
==============================================================================
--- trunk/src/argouml-app/tests/org/argouml/notation/providers/uml/TestAttributeAndOperationNotationUml.java (original)
+++ trunk/src/argouml-app/tests/org/argouml/notation/providers/uml/TestAttributeAndOperationNotationUml.java 2008-07-10 12:32:35-0700
@@ -66,7 +66,8 @@
private static final String ATTR12 = "+ name : String = a << 5";
private static final String ATTR13 =
"<<attrstereo1,attrstereo2>> +name : String = a[15]";
-
+ private static final String ATTR14 = "a : int; b : Foo";
+
private static final String NATTR01 = "too many string in an attribute";
private static final String NATTR02 = "+vis name";
private static final String NATTR03 = "vis name : type : type";
@@ -201,6 +202,44 @@
checkType(attr, ATTR06, "int");
}
+
+ /**
+ * Test the parsing of several attributes with semicolons,
+ * and the correct assignation of the new datatypes to
+ * the same namespace of the owner
+ * See issue 5229 (http://argouml.tigris.org/issues/show_bug.cgi?id=5229)
+ * @throws ParseException
+ */
+ public void testAttributeNewTypeNamespace() throws ParseException {
+ Object attr;
+
+ Project project = ProjectManager.getManager().getCurrentProject();
+ Object ns = project.getModel();
+
+ Object cl = Model.getCoreFactory().buildClass();
+ Model.getCoreHelper().setNamespace(cl, ns);
+
+ Object attrType = project.getDefaultAttributeType();
+ attr = Model.getCoreFactory().buildAttribute2(cl, attrType);
+
+ AttributeNotationUml anu = new AttributeNotationUml();
+ anu.parse(attr, ATTR14);
+
+ List attrs = Model.getFacade().getAttributes(cl);
+ assertEquals("Wrong number of attributes", 2, attrs.size());
+
+ // we want the b: Foo attribute, that is the second in the list
+ attr = attrs.get(1);
+
+ attrType = Model.getFacade().getType(attr);
+ Object namespace = Model.getFacade().getNamespace(attrType);
+
+ assertNotNull("Namespace of the created type for the attribute must not be null",
+ namespace);
+ assertEquals("The namespace of the created type is not the same than" +
+ " the namespace of the original class.", ns, namespace);
+
+ }
/**
* Test the parsing of the attribute's visibility.
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.