svn commit: r17140 - trunk/src/argouml-core-diagrams-sequence2: . tests tests/org/argouml/persistence

Linus Tolke <[email protected]>
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: linus
Date: 2009-05-04 21:56:19-0700
New Revision: 17140

Added:
   trunk/src/argouml-core-diagrams-sequence2/tests/org/argouml/persistence/
   trunk/src/argouml-core-diagrams-sequence2/tests/org/argouml/persistence/TestDiagramUpdateAtLoad.java   (contents, props changed)
Modified:
   trunk/src/argouml-core-diagrams-sequence2/build.xml
   trunk/src/argouml-core-diagrams-sequence2/tests/   (props changed)

Log:
First attempt at creating a test case that loads old models using
the upgrade mechanism and the new sequence diagrams.

Issue: 5793.

Modified: trunk/src/argouml-core-diagrams-sequence2/build.xml
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-sequence2/build.xml?view=diff&pathrev=17140&r1=17139&r2=17140
==============================================================================
--- trunk/src/argouml-core-diagrams-sequence2/build.xml	(original)
+++ trunk/src/argouml-core-diagrams-sequence2/build.xml	2009-05-04 21:56:19-0700
@@ -179,7 +179,6 @@
     <!-- create directories -->
     <mkdir dir="build/tests/classes"/>
 
-
     <javac debug="true" 
            deprecation="on"
            optimize="false" 
@@ -193,6 +192,10 @@
       </classpath>
     </javac>
 
+    <!-- copy test files -->
+    <copy todir="build/tests/classes/testmodels">
+      <fileset dir="tests/testmodels" includes="**/**"/>
+    </copy>
   </target>
 
   <!-- =================================================================== -->
@@ -202,14 +205,14 @@
           description="Run all tests that don't require any GUI components in headleass mode.">
 
     <mkdir dir="build/tests/reports"/>
-    <mkdir dir="build/tests/reports/html"/>
       
     <junit errorproperty="junit.failure" failureproperty="junit.failure" 
-           fork="yes"  dir="${basedir}" forkmode="perTest"
+           fork="yes" dir="${basedir}" forkmode="perTest"
            haltonfailure="false"
            maxmemory="48M" printsummary="true">
       <sysproperty key="log4j.configuration" value="org/argouml/resource/default.lcf"/>
       <sysproperty key="java.awt.headless" value="true"/>
+      <sysproperty key="argouml.tests.dir" value="tests"/>
       <assertions>
         <enable/>
       </assertions>

Added: trunk/src/argouml-core-diagrams-sequence2/tests/org/argouml/persistence/TestDiagramUpdateAtLoad.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-sequence2/tests/org/argouml/persistence/TestDiagramUpdateAtLoad.java?view=markup&pathrev=17140
==============================================================================
--- (empty file)
+++ trunk/src/argouml-core-diagrams-sequence2/tests/org/argouml/persistence/TestDiagramUpdateAtLoad.java	2009-05-04 21:56:19-0700
@@ -0,0 +1,132 @@
+// $Id$
+// Copyright (c) 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
+// and this paragraph appear in all copies.  This software program and
+// documentation are copyrighted by The Regents of the University of
+// California. The software program and documentation are supplied "AS
+// IS", without any accompanying services from The Regents. The Regents
+// does not warrant that the operation of the program will be
+// uninterrupted or error-free. The end-user understands that the program
+// was developed for research purposes and is advised not to rely
+// exclusively on the program for any reason.  IN NO EVENT SHALL THE
+// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
+// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
+// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
+// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
+// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+package org.argouml.persistence;
+
+import java.io.File;
+import java.net.URL;
+import java.util.Collection;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+import org.argouml.kernel.Project;
+import org.argouml.model.Facade;
+import org.argouml.model.InitializeModel;
+import org.argouml.model.Model;
+import org.argouml.notation.InitNotation;
+import org.argouml.notation.providers.java.InitNotationJava;
+import org.argouml.notation.providers.uml.InitNotationUml;
+import org.argouml.profile.init.InitProfileSubsystem;
+import org.argouml.uml.diagram.activity.ui.InitActivityDiagram;
+import org.argouml.uml.diagram.collaboration.ui.InitCollaborationDiagram;
+import org.argouml.uml.diagram.deployment.ui.InitDeploymentDiagram;
+import org.argouml.uml.diagram.sequence.ui.InitSequenceDiagram;
+import org.argouml.uml.diagram.state.ui.InitStateDiagram;
+import org.argouml.uml.diagram.static_structure.ui.InitClassDiagram;
+import org.argouml.uml.diagram.ui.InitDiagramAppearanceUI;
+import org.argouml.uml.diagram.use_case.ui.InitUseCaseDiagram;
+
+/**
+ * Testcase to load projects without exception.
+ */
+public class TestDiagramUpdateAtLoad extends TestCase {
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        (new InitNotation()).init();
+        (new InitNotationUml()).init();
+        (new InitNotationJava()).init();
+        (new InitDiagramAppearanceUI()).init();
+        (new InitActivityDiagram()).init();
+        (new InitCollaborationDiagram()).init();
+        (new InitDeploymentDiagram()).init();
+	// Init the sequence diagrams from the module
+        (new InitStateDiagram()).init();
+        (new InitClassDiagram()).init();
+        (new InitUseCaseDiagram()).init();
+        (new InitProfileSubsystem()).init();
+    }
+
+    /**
+     * The constructor.
+     *
+     * @param name the name
+     */
+    public TestDiagramUpdateAtLoad(String name) {
+        super(name);
+        InitializeModel.initializeDefault();
+    }
+
+    /**
+     * @param args the arguments given on the commandline
+     */
+    public static void main(java.lang.String[] args) {
+        junit.textui.TestRunner.run(suite());
+    }
+
+    /**
+     * @return the test suite
+     */
+    public static Test suite() {
+        TestSuite suite = new TestSuite(TestDiagramUpdateAtLoad.class);
+
+        return suite;
+    }
+
+    /**
+     * Tests that a project is loadable.
+     *
+     * @param filename of the project file to load
+     * @throws OpenException if something goes wrong.
+     */
+    private Project doLoad(String filename) 
+        throws OpenException, InterruptedException {
+        URL url = getClass().getResource(filename);
+        assertNotNull("Resource to be tested is not found: " + filename, url);
+
+        ZargoFilePersister persister = new ZargoFilePersister();
+        String name = url.getFile();
+        Project p = persister.doLoad(new File(name));
+        return p;
+    }
+
+    /**
+     * Test loading a native UML 1.4 zargo.
+     *
+     * @throws Exception when e.g. the file is not found
+     */
+    public void testDoLoadUml14() throws Exception {
+        Project p = doLoad("/testmodels/uml14/Alittlebitofeverything.zargo");
+        p.remove();
+
+        p = doLoad("/testmodels/uml14/SequenceDiagram.zargo");
+        p.remove();
+    }
+}
+
+
+

------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=5905&dsMessageId=2064769

To unsubscribe from this discussion, e-mail: [[email protected]].
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.