gump-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From leosim...@apache.org
Subject svn commit: r209880 - in /gump/branches/Gump3: metadata/vmgump.xml pygump/python/gump/engine/objectifier.py pygump/python/gump/model/__init__.py pygump/python/gump/test/testEngineObjectifier.py pygump/python/gump/test/testModel.py
Date Fri, 08 Jul 2005 20:28:26 GMT
Author: leosimons
Date: Fri Jul  8 13:28:25 2005
New Revision: 209880

URL: http://svn.apache.org/viewcvs?rev=209880&view=rev
Log:
100% coverage for the model, and quite a few bugfixes for the objectifier, as well as more
tests. Its becoming more and more robust by the minute :-). Get rid of the dumb <module/>
statement in the vmgump workspace for jaxp, as its no longer needed.

Modified:
    gump/branches/Gump3/metadata/vmgump.xml
    gump/branches/Gump3/pygump/python/gump/engine/objectifier.py
    gump/branches/Gump3/pygump/python/gump/model/__init__.py
    gump/branches/Gump3/pygump/python/gump/test/testEngineObjectifier.py
    gump/branches/Gump3/pygump/python/gump/test/testModel.py

Modified: gump/branches/Gump3/metadata/vmgump.xml
URL: http://svn.apache.org/viewcvs/gump/branches/Gump3/metadata/vmgump.xml?rev=209880&r1=209879&r2=209880&view=diff
==============================================================================
--- gump/branches/Gump3/metadata/vmgump.xml (original)
+++ gump/branches/Gump3/metadata/vmgump.xml Fri Jul  8 13:28:25 2005
@@ -1,43 +1,43 @@
-<?xml version="1.0"?>
-<!--+
-| Copyright 2003-2005 The Apache Software Foundation
-| Licensed under the Apache License, Version 2.0 (the "License");
-| you may not use this file except in compliance with the License.
-| You may obtain a copy of the License at
-|
-|    http://www.apache.org/licenses/LICENSE-2.0
-|
-| Unless required by applicable law or agreed to in writing, software
-| distributed under the License is distributed on an "AS IS" BASIS,
-| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-| See the License for the specific language governing permissions and
-| limitations under the License.
-+-->
-<workspace 
-        version="0.5" 
-        name="gump3-test">
-
-<repositories>
-    <repository name="ant" type="cvs">
-        <title>Ant</title>
-        <home-page>http://ant.apache.org/</home-page>
-        <cvsweb>http://cvs.apache.org/viewcvs/</cvsweb>
-        <redistributable/>
-        
-        <hostname>cvs.apache.org</hostname>
-        <method>pserver</method>
-        <path>/home/cvspublic</path>
-        <user>anoncvs</user>
-        <password>anoncvs</password>
-    </repository>
-
-    <repository name="gump" type="svn">
-        <title>Gump</title>
-        <home-page>http://gump.apache.org/</home-page>
-        <web>http://cvs.apache.org/viewcvs.cgi/gump/?root=Apache-SVN</web>
-        <url>http://svn.apache.org/repos/asf/gump/branches/Gump3</url>
-        <redistributable/>
-    </repository>
+<?xml version="1.0"?>
+<!--+
+| Copyright 2003-2005 The Apache Software Foundation
+| Licensed under the Apache License, Version 2.0 (the "License");
+| you may not use this file except in compliance with the License.
+| You may obtain a copy of the License at
+|
+|    http://www.apache.org/licenses/LICENSE-2.0
+|
+| Unless required by applicable law or agreed to in writing, software
+| distributed under the License is distributed on an "AS IS" BASIS,
+| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+| See the License for the specific language governing permissions and
+| limitations under the License.
++-->
+<workspace 
+        version="0.5" 
+        name="gump3-test">
+
+<repositories>
+    <repository name="ant" type="cvs">
+        <title>Ant</title>
+        <home-page>http://ant.apache.org/</home-page>
+        <cvsweb>http://cvs.apache.org/viewcvs/</cvsweb>
+        <redistributable/>
+        
+        <hostname>cvs.apache.org</hostname>
+        <method>pserver</method>
+        <path>/home/cvspublic</path>
+        <user>anoncvs</user>
+        <password>anoncvs</password>
+    </repository>
+
+    <repository name="gump" type="svn">
+        <title>Gump</title>
+        <home-page>http://gump.apache.org/</home-page>
+        <web>http://cvs.apache.org/viewcvs.cgi/gump/?root=Apache-SVN</web>
+        <url>http://svn.apache.org/repos/asf/gump/branches/Gump3</url>
+        <redistributable/>
+    </repository>
 
     <repository name="xml" type="cvs">
         <title>XML</title>
@@ -51,29 +51,29 @@
         <user>anoncvs</user>
         <password>anoncvs</password>
     </repository>
-</repositories>
-    
-<modules>
-    <module name="ant">
-        <repository name="ant"/>
-        
-        <url>http://ant.apache.org/index.html</url>
-        <description>Java based build tool</description>
-    </module>
-    
-    <module name="gump-test" path="test">
-        <repository name="gump"/>
-        
-        <url>http://gump.apache.org/index.html</url>
-        <description>Gump Testing</description>
-    </module>
-
-    <module name="gump">
-        <repository name="gump"/>
-        
-        <url>http://gump.apache.org/index.html</url>
-        <description>Python based integration tool</description>
-    </module>
+</repositories>
+    
+<modules>
+    <module name="ant">
+        <repository name="ant"/>
+        
+        <url>http://ant.apache.org/index.html</url>
+        <description>Java based build tool</description>
+    </module>
+    
+    <module name="gump-test" path="test">
+        <repository name="gump"/>
+        
+        <url>http://gump.apache.org/index.html</url>
+        <description>Gump Testing</description>
+    </module>
+
+    <module name="gump">
+        <repository name="gump"/>
+        
+        <url>http://gump.apache.org/index.html</url>
+        <description>Python based integration tool</description>
+    </module>
 
     <module name="xml-commons">
         <repository name="xml"/>
@@ -82,43 +82,43 @@
         <description>XML commons -- externally defined standards - DOM,SAX,JAXP; plus
xml utilities</description>
     </module>
 
-    <module name="xml-xerces">
-        <repository name="xml"/>
-    
-        <url href="http://xml.apache.org/xerces2-j/index.html"/>
-        <description>Java XML Parser - the sequel with no equal</description>
-    </module>
-</modules>
-
-<projects>
-    <project name="gump-unit-tests">
-        <module name="gump"/>
+    <module name="xml-xerces">
+        <repository name="xml"/>
+    
+        <url href="http://xml.apache.org/xerces2-j/index.html"/>
+        <description>Java XML Parser - the sequel with no equal</description>
+    </module>
+</modules>
+
+<projects>
+    <project name="gump-unit-tests">
+        <module name="gump"/>
         <script name="gump">
             <arg name="" value="test"/>
-        </script> 
-    </project>
-    
-    <project name="bootstrap-ant">
-        <module name="ant"/>
-        
-        <!-- commands -->
-        <script name="bootstrap"/>
-        
-        <!-- outputs -->
-        <home nested="bootstrap"/>
-        <jar name="lib/ant.jar"/>
-        <jar name="lib/ant-launcher.jar" id="ant-launcher"/>
-    </project>
-    
-    <project name="ant">
+        </script> 
+    </project>
+    
+    <project name="bootstrap-ant">
         <module name="ant"/>
         
-        <!-- commands -->
+        <!-- commands -->
+        <script name="bootstrap"/>
+        
+        <!-- outputs -->
+        <home nested="bootstrap"/>
+        <jar name="lib/ant.jar"/>
+        <jar name="lib/ant-launcher.jar" id="ant-launcher"/>
+    </project>
+    
+    <project name="ant">
+        <module name="ant"/>
+        
+        <!-- commands -->
         <ant/>
-        
-        <!-- dependencies -->
-        <depend project="bootstrap-ant"/>
-    </project>
+        
+        <!-- dependencies -->
+        <depend project="bootstrap-ant"/>
+    </project>
 
     <project name="xml-apis">
         <module name="xml-commons"/>
@@ -172,63 +172,62 @@
     </project>
     
     <project name="jaxp">
-        <module name="xml-commons"/>
         <!-- assumed to be provided by JDK -->
     </project>
 
-    <project name="xml-xerces">
-        <module name="xml-xerces"/>
-        
+    <project name="xml-xerces">
+        <module name="xml-xerces"/>
+        
         <!-- commands -->
-        <ant basedir="java" target="jar"/>
+        <ant basedir="java" target="jar"/>
         
         <!-- outputs -->
-        <home nested="java/build"/>
-        <jar name="xercesImpl.jar" id="xml-parser" type="boot"/>
-        
+        <home nested="java/build"/>
+        <jar name="xercesImpl.jar" id="xml-parser" type="boot"/>
+        
         <!-- dependencies -->
-        <depend project="bootstrap-ant"/>
-        <depend project="xjavac"/>
-        <depend project="xml-commons-resolver"/>
-        <option project="jaxp" ids="jaxp-api dom sax"/>
-    </project>
-    
-    <project name="xml-xercesImpl">
-        <module name="xml-xerces"/>
+        <depend project="bootstrap-ant"/>
+        <depend project="xjavac"/>
+        <depend project="xml-commons-resolver"/>
+        <option project="jaxp" ids="jaxp-api dom sax"/>
+    </project>
+    
+    <project name="xml-xercesImpl">
+        <module name="xml-xerces"/>
 
         <!-- outputs -->
-        <home nested="java/build"/>
-        <jar name="xercesImpl.jar" id="xercesImpl"/>
-        <license name="java/LICENSE"/>
+        <home nested="java/build"/>
+        <jar name="xercesImpl.jar" id="xercesImpl"/>
+        <license name="java/LICENSE"/>
 
         <!-- dependencies -->
-        <depend project="xml-xerces"/>
-    </project>
-    
-    <project name="dist-xerces">
-        <module name="xml-xerces"/>
+        <depend project="xml-xerces"/>
+    </project>
+    
+    <project name="dist-xerces">
+        <module name="xml-xerces"/>
 
         <!-- commands -->
-        <ant basedir="java" target="pack-bin">
-            <sysproperty name="build.clonevm" value="true"/>
+        <ant basedir="java" target="pack-bin">
+            <sysproperty name="build.clonevm" value="true"/>
         </ant>
         
-        <!-- dependencies -->
-        <depend project="ant" inherit="runtime"/>
-        <depend project="xjavac"/>
-        <depend project="xalan"/>
-        <depend project="xml-xerces"/>
-        <depend project="xml-stylebook2"/>
-        <depend project="xml-site"/>
-    </project>
-        
-    <project name="xjavac">
+        <!-- dependencies -->
+        <depend project="ant" inherit="runtime"/>
+        <depend project="xjavac"/>
+        <depend project="xalan"/>
+        <depend project="xml-xerces"/>
+        <depend project="xml-stylebook2"/>
+        <depend project="xml-site"/>
+    </project>
+        
+    <project name="xjavac">
         <module name="xml-xerces"/>
         
-        <!-- outputs -->
-        <home nested="java/tools"/>
-        <jar name="bin/xjavac.jar"/>
-    </project>
+        <!-- outputs -->
+        <home nested="java/tools"/>
+        <jar name="bin/xjavac.jar"/>
+    </project>
 
-</projects>
-</workspace>
+</projects>
+</workspace>
\ No newline at end of file

Modified: gump/branches/Gump3/pygump/python/gump/engine/objectifier.py
URL: http://svn.apache.org/viewcvs/gump/branches/Gump3/pygump/python/gump/engine/objectifier.py?rev=209880&r1=209879&r2=209880&view=diff
==============================================================================
--- gump/branches/Gump3/pygump/python/gump/engine/objectifier.py (original)
+++ gump/branches/Gump3/pygump/python/gump/engine/objectifier.py Fri Jul  8 13:28:25 2005
@@ -198,6 +198,7 @@
         name = cmd.getAttribute("name")
         args = []
         for arg in cmd.getElementsByTagName("arg"):
+            # TODO parse "-", "--", etc
             argname = arg.getAttribute("name")
             argvalue = arg.getAttribute("value")
             if argname:
@@ -211,11 +212,10 @@
 def _create_ant_commands(project, project_definition):
     ants = project_definition.getElementsByTagName("ant")
     for cmd in ants:
-        name = cmd.getAttribute("name")
         buildfile = cmd.getAttribute("buildfile")
         target = cmd.getAttribute("target")
             
-        project.add_command(Ant(project, name, target, buildfile))
+        project.add_command(Ant(project, target, buildfile))
 
 def _create_outputs(project, project_definition, workdir):    
     # Working directories for this project (containing java classes)
@@ -406,28 +406,31 @@
     def _create_projects(self, workspace, project_definitions):
         project_definitions = [p for p in project_definitions \
                 if p.nodeType == dom.Node.ELEMENT_NODE]
+        failures = []
         
         for project_definition in project_definitions:
             name = project_definition.getAttribute("name")
             if not name:
                 self.log.error("Can't convert project definition because it does not have
a name!")
-                project_definitions.remove(project_definition)
+                failures.append(project_definition)
                 continue
             self.log.debug("Converting project definition '%s' into object form." % name)
             try:
                 module = self._find_module_for_project(workspace, project_definition)
                 project = _create_project(module, project_definition, self.workdir)
                 project.module.projects[project.name] = project
+                self.log.debug("Adding %s to workspace project list" % project.name)
                 workspace.projects[project.name] = project
     
                 _create_commands(project, project_definition)
                 _create_outputs(project, project_definition, self.workdir)
             except:
                 self.log.exception("Failed to convert project definition '%s' into object
form." % name)
-                project_definitions.remove(project_definition)
-
+                failures.append(project_definition)
+        
         # wire up dependencies only after projects have been created
-        for project_definition in project_definitions:
+        for project_definition in [p for p in project_definitions \
+                if not p in failures]:
             try:
                 _create_dependencies(project_definition, workspace.projects)
             except:
@@ -437,5 +440,6 @@
                 cause = ExceptionInfo(type, value, traceback)
                 self.log.error(cause)
                 name = project_definition.getAttribute("name")
+                #self.log.exception("Failed to set up dependencies for project %s" % name)
                 project = workspace.projects[name]
                 mark_failure(project, cause)

Modified: gump/branches/Gump3/pygump/python/gump/model/__init__.py
URL: http://svn.apache.org/viewcvs/gump/branches/Gump3/pygump/python/gump/model/__init__.py?rev=209880&r1=209879&r2=209880&view=diff
==============================================================================
--- gump/branches/Gump3/pygump/python/gump/model/__init__.py (original)
+++ gump/branches/Gump3/pygump/python/gump/model/__init__.py Fri Jul  8 13:28:25 2005
@@ -463,8 +463,8 @@
         self.specific_output_ids = specific_output_ids
     
     def __str__(self):
-        return "<DependencyInfo:optional=%s,runtime=%s,inherit=%s,specific_output_ids=%s>"
% \
-               (self.optional, self.runtime, self.inherit, self.specific_output_ids)
+        return "<DependencyInfo:%s:optional=%s,runtime=%s,inherit=%s,specific_output_ids=%s>"
% \
+               (self.dependency, self.optional, self.runtime, self.inherit, self.specific_output_ids)
 
 class Command(ModelObject):
     """Model a command.
@@ -479,6 +479,9 @@
         assert isinstance(project, Project)
         self.project = project
         
+    def __str__(self):
+        return "<Command:%s>" % self.project
+        
 class Mkdir(Command):
     """Model a mkdir command.
     
@@ -528,14 +531,21 @@
                   where each element is a (name, value)
                   tuple
     """
-    def __init__(self, project, name, args=[]):
+    def __init__(self, project, name, args=None):
         assert isinstance(name, basestring)
-        assert isinstance(args, list)
-        for arg in args:
-            assert isinstance(arg, basestring)
+        if args != None:
+            assert isinstance(args, list)
+            for arg in args:
+                assert isinstance(arg, basestring)
+            self.args = args
+        else:
+            self.args = []
+            
         Command.__init__(self, project)
         self.name = name
-        self.args = args
+
+    def __str__(self):
+        return "<Script:%s,args=%s>" % (self.name, " ".join(self.args))
 
 class Ant(Command):
     """Command to run an Ant build.
@@ -543,21 +553,18 @@
     Has the following properties:
         
         - all the properties a Command has
-        - name -- the name of the script to run
         - target -- the Ant target
         - buildfile -- the Ant build file
     """
-    def __init__(self, project, name, target, buildfile="build.xml"):
-        assert isinstance(name, basestring)
+    def __init__(self, project, target, buildfile="build.xml"):
         assert isinstance(target, basestring)
         assert isinstance(buildfile, basestring)
         Command.__init__(self, project)
-        self.name = name
         self.target = target
         self.buildfile = buildfile
 
     def __str__(self):
-        return "<Ant:%s,target=%s,buildfile=%s>" % (self.name, self.target, self.buildfile)
+        return "<Ant:target=%s,buildfile=%s>" % (self.target, self.buildfile)
 
 #TODO: more Commands
 

Modified: gump/branches/Gump3/pygump/python/gump/test/testEngineObjectifier.py
URL: http://svn.apache.org/viewcvs/gump/branches/Gump3/pygump/python/gump/test/testEngineObjectifier.py?rev=209880&r1=209879&r2=209880&view=diff
==============================================================================
--- gump/branches/Gump3/pygump/python/gump/test/testEngineObjectifier.py (original)
+++ gump/branches/Gump3/pygump/python/gump/test/testEngineObjectifier.py Fri Jul  8 13:28:25
2005
@@ -37,6 +37,10 @@
 
 class EngineObjectifierTestCase(MockTestCase):
     def setUp(self):
+        import logging
+        #logging.basicConfig()
+        #self.log = logging.getLogger("objectifier")
+        #self.log.level = logging.DEBUG
         self.log = self.mock()
         self.log.stubs().method("debug")
         self.log.stubs().method("info")
@@ -130,6 +134,14 @@
         <url href="http://xml.apache.org/xerces2-j/index.html"/>
         <description>Java XML Parser - the sequel with no equal</description>
     </module>
+
+    <module>
+        <repository name="xml"/>
+        <!-- will be dropped because of the lacking name -->
+    </module>
+    <module name="demo">
+        <!-- will not be dropped despite lacking repository -->
+    </module>
 </modules>
 
 <projects>
@@ -270,6 +282,20 @@
         <!-- outputs -->
         <home nested="java/tools"/>
         <jar name="bin/xjavac.jar"/>
+    </project>
+    
+    <project>
+        <module name="demo"/>
+        <!-- will be dropped because of the lacking name -->
+    </project>
+
+    <project name="demoproject">
+        <!-- will not be dropped despite lacking module -->
+    </project>
+
+    <project name="badworkdir">
+        <!-- will be dropped because of bad work directive -->
+        <work/>
     </project>
 
 </projects>

Modified: gump/branches/Gump3/pygump/python/gump/test/testModel.py
URL: http://svn.apache.org/viewcvs/gump/branches/Gump3/pygump/python/gump/test/testModel.py?rev=209880&r1=209879&r2=209880&view=diff
==============================================================================
--- gump/branches/Gump3/pygump/python/gump/test/testModel.py (original)
+++ gump/branches/Gump3/pygump/python/gump/test/testModel.py Fri Jul  8 13:28:25 2005
@@ -22,6 +22,7 @@
 
 from gump.model import Error
 from gump.model import ModelObject
+from gump.model import ExceptionInfo
 from gump.model import Workspace
 from gump.model import Repository
 from gump.model import Module
@@ -39,7 +40,9 @@
 from gump.model import Mkdir
 from gump.model import Rmdir
 from gump.model import Script
+from gump.model import Ant
 from gump.model import Jar
+from gump.model import Classdir
 
 class ModelTestCase(TestCase):
     def test_error(self):
@@ -51,6 +54,27 @@
     
     def test_model_object(self):
         m = ModelObject()
+        
+        string = m.__str__()
+        self.failUnless(string.find("ModelObject"))
+        
+        m.name = "blah"
+        string = m.__str__()
+        self.failUnless(string.find("blah") > 0)
+        
+    def test_exception_info(self):
+        type = "sometype"
+        value = "somevalue"
+        traceback = "tr"
+        
+        e = ExceptionInfo(type, value, traceback)
+        self.assertEqual(type, e.type)
+        self.assertEqual(value, e.value)
+        self.assertEqual(traceback, e.traceback)
+        
+        string = e.__str__()
+        self.failUnless(string.index(type) >= 0)
+        self.failUnless(string.index(value) >= 0)
     
     def test_workspace(self):
         name = "blah"
@@ -197,7 +221,11 @@
         self.assertEqual(password, r.password)
         
         self.assertRaises(AssertionError, SvnRepository, w, name, w)
-    
+
+        url2 = url + "/"
+        r = SvnRepository(w,name,url2,title,home_page,cvsweb,redistributable,user,password)
+        self.assertEqual(r.url, url)
+
     def test_module(self):
         wname = "blah"
         w = Workspace(wname)
@@ -419,6 +447,7 @@
         self.assertRaises(AssertionError, c.add_dependency, None)
         self.assertRaises(AssertionError, c.add_dependency, "blaaaa")
         self.assertRaises(AssertionError, c.add_dependency, b)
+        self.assertRaises(AssertionError, c.add_dependency, c)
         self.assertEqual(2,len(c.dependencies))
         self.assertEqual(0,len(c.dependees))
         
@@ -426,6 +455,41 @@
         self.assertRaises(AssertionError,Dependency,c,None)
         self.assertRaises(AssertionError,Dependency,"B",c)
         self.assertRaises(AssertionError,Dependency,c,"B")
+        
+        # reset these vars
+        a = Project(m,"A")
+        b = Project(m,"B")
+        c = Project(m,"C")
+        
+        d1 = c.get_dependency_on_project(b) # c -> b
+        self.assertEqual(c, d1.dependee)
+        self.assertEqual(b, d1.dependency)
+        self.assertEqual(1, len(c.dependencies))
+        self.assertEqual(0, len(c.dependees))
+        self.assertEqual(0, len(b.dependencies))
+        self.assertEqual(1, len(b.dependees))
+        
+        d2 = c.get_dependency_on_project(a) # c -> a
+        d3 = b.get_dependency_on_project(a) # b -> a
+        
+        d4 = c.get_dependency_on_project(b)
+        self.assertEqual(c, d4.dependee)
+        self.assertEqual(b, d4.dependency)
+        self.assertEqual(2, len(c.dependencies))
+        self.assertEqual(0, len(c.dependees))
+        self.assertEqual(1, len(b.dependencies))
+        self.assertEqual(1, len(b.dependees))
+        self.assertEqual(d1, d4)
+        
+        c.add_dependency(d1) # c -> b
+        
+        x = Project(m,"someprojectname")
+        y = Project(m,"someotherprojectname")
+        d = Dependency(x,y)
+        string = d.__str__()
+        self.failUnless(string.find(x.name) >= 0)
+        self.failUnless(string.find(y.name) >= 0)
+        self.failUnless(string.find(y.name) < string.find(x.name))
     
     def test_dependency_info(self):
         wname = "blah"
@@ -479,7 +543,27 @@
         self.assertEqual(di2,d1.dependencyInfo[1])
         
         self.assertRaises(AssertionError, d2.add_dependency_info, di2)  
-    
+
+        x = Project(m,"someproject")
+        y = Project(m,"someotherproject")
+        d = Dependency(x,y)
+        optional = True
+        runtime = True
+        inherit = DEPENDENCY_INHERIT_ALL
+        specific_output_id1 = "some-sub-project-jar"
+        di = DependencyInfo(d,optional,runtime,inherit,specific_output_id1)
+        
+        string = di.__str__()
+        xstring = x.__str__()
+        ystring = y.__str__()
+        
+        self.failUnless(string.find(xstring) >= 0)
+        self.failUnless(string.find(ystring) >= 0)
+        self.failUnless(string.find("True") >= 0)
+        self.failUnless(string.find("True") >= 0)
+        self.failUnless(string.find(DEPENDENCY_INHERIT_ALL) >= 0)
+        self.failUnless(string.find(specific_output_id1) >= 0)
+        
     def test_command(self):
         wname = "blah"
         w = Workspace(wname)
@@ -495,6 +579,9 @@
         self.assertRaises(AssertionError,Command,None)
         self.assertRaises(AssertionError,Command,"someproject")
         
+        string = c.__str__()
+        self.failUnless(string.find(pname) >= 0)
+
     def test_mkdir(self):
         wname = "blah"
         w = Workspace(wname)
@@ -513,6 +600,9 @@
         self.assertRaises(AssertionError,Mkdir,"someproject",c)
         self.assertRaises(AssertionError,Mkdir,p,None)
         self.assertRaises(AssertionError,Mkdir,p,p)
+        
+        string = c.__str__()
+        self.failUnless(string.find(dir) >= 0)
 
     def test_rmdir(self):
         wname = "blah"
@@ -533,6 +623,9 @@
         self.assertRaises(AssertionError,Rmdir,p,None)
         self.assertRaises(AssertionError,Rmdir,p,p)
 
+        string = c.__str__()
+        self.failUnless(string.find(dir) >= 0)
+
     def test_script(self):
         wname = "blah"
         w = Workspace(wname)
@@ -551,14 +644,49 @@
         c = Script(p,name)
         self.assertEqual(name,c.name)
         self.assertEqual([],c.args)
+        c = Script(p,name,None)
         
         self.assertRaises(AssertionError,Script,None,c)
         self.assertRaises(AssertionError,Script,"someproject",c)
         self.assertRaises(AssertionError,Script,p,None)
-        self.assertRaises(AssertionError,Script,p,name,None)
         self.assertRaises(AssertionError,Script,p,name,"blah")
         self.assertRaises(AssertionError,Script,p,name,[p])
 
+        c = Script(p,name, args)
+        self.assertEqual(args,c.args)
+
+        string = c.__str__()
+        self.failUnless(string.find(name) >= 0)
+        self.failUnless(string.find(args[0]) >= 0)
+        self.failUnless(string.find(args[1]) >= 0)
+
+    def test_ant(self):
+        wname = "blah"
+        w = Workspace(wname)
+        rname = "booh"
+        r = Repository(w,rname)
+        mname = "bweh"
+        m = Module(r,mname)
+        pname = "bwop"
+        p = Project(m,pname)
+        
+        target = "build"
+        buildfile = "build-gump.xml"
+        a = Ant(p, target, buildfile)
+        self.assertEqual(target, a.target)
+        self.assertEqual(buildfile, a.buildfile)
+        self.assertEqual(p, a.project)
+        
+        self.assertRaises(AssertionError,Ant,None,target)
+        self.assertRaises(AssertionError,Ant,"someproject",a)
+        self.assertRaises(AssertionError,Ant,p,None)
+        self.assertRaises(AssertionError,Ant,p,target,None)
+
+        a = Ant(p, target, buildfile)
+        string = a.__str__()
+        self.failUnless(string.find(target) >= 0)
+        self.failUnless(string.find(buildfile) >= 0)
+
     def test_output(self):
         wname = "blah"
         w = Workspace(wname)
@@ -574,6 +702,10 @@
         self.assertRaises(AssertionError,Output,None)
         self.assertRaises(AssertionError,Output,"someproject")           
         
+        o = Output(p,"blah")
+        string = o.__str__()
+        self.failUnless(string.find("blah") >= 0)
+
     def test_jar(self):
         wname = "blah"
         w = Workspace(wname)
@@ -605,3 +737,30 @@
         self.assertEqual(id,o.id)
         o = Jar(p, jar, add_to_bootclass_path=bootclass)
         self.assertEqual(bootclass,o.add_to_bootclass_path)
+
+        o = Jar(p, jar, id=id)
+        string = o.__str__()
+        self.failUnless(string.find(jar) >= 0)
+        self.failUnless(string.find(id) >= 0)
+
+    def test_classdir(self):
+        wname = "blah"
+        w = Workspace(wname)
+        rname = "booh"
+        r = Repository(w,rname)
+        mname = "bweh"
+        m = Module(r,mname)
+        pname = "bwop"
+        p = Project(m,pname)
+        
+        path = "my/path"
+        o = Classdir(p,path)
+        self.assertEqual(p,o.project)
+        self.assertEqual(path,o.path)
+        self.assertRaises(AssertionError,Classdir,None,path)
+        self.assertRaises(AssertionError,Classdir,"someproject",path)
+        self.assertRaises(AssertionError,Classdir,p,None)
+        self.assertRaises(AssertionError,Classdir,p,p)
+        
+        string = o.__str__()
+        self.failUnless(string.find(path) >= 0)



Mime
View raw message