Esempio n. 1
0
    def testOrderOnlyDependency( self ):
        artifact1 = AtomicArtifact( "TestArtefact1", [ os.path.join( "tmp", "file1" ), os.path.join( "tmp", "file2" ) ], [], [], [], False )
        compound = CompoundArtifact( "TestArtefact3", [ artifact1 ], False )
        artifact2 = AtomicArtifact( "TestArtefact2", [ os.path.join( "tmp", "file3" ), os.path.join( "tmp", "file4" ) ], [], [ artifact1 ], [], False )
        
        g1 = Graph( "project" )
        cluster1 = Cluster( "TestArtefact1" )
        cluster1.add( Node( os.path.join( "tmp", "file1" ) ) )
        cluster1.add( Node( os.path.join( "tmp", "file2" ) ) )
        cluster = Cluster( "TestArtefact3" )
        cluster.add( cluster1 )
        g1.add( cluster )
        cluster2 = Cluster( "TestArtefact2" )
        cluster2.add( Node( os.path.join( "tmp", "file3" ) ) )
        cluster2.add( Node( os.path.join( "tmp", "file4" ) ) )
        g1.add( cluster2 )
        link = Link( cluster2, cluster1 )
        link.attr[ "style" ] = "dashed"
        g1.add( link )
        
        g2 = Graph( "project" )
        g2.add( artifact2.getGraphNode() )
        g2.add( compound.getGraphNode() )
        for l in artifact2.getGraphLinks():
            g2.add( l )
        for l in compound.getGraphLinks():
            g2.add( l )

        self.assertTrue( Graph.areSame( g1, g2 ) )
Esempio n. 2
0
    def testWide( self ):
        self.a1.addPredecessor( self.a2 )
        self.a1.addPredecessor( self.a3 )

        with self.m.unorderedGroup():
            self.a1.computePreview().returns( "a1's preview" )
            self.a3.computePreview().returns( "a3's preview" )
            self.a2.computePreview().returns( "a2's preview" )
        
        self.m.startTest()
        
        g1 = Graph( "action" )
        g1.nodeAttr[ "shape" ] = "box"
        n1 = Node( "a1's preview" )
        g1.add( n1 )
        n2 = Node( "a2's preview" )
        g1.add( n2 )
        n3 = Node( "a3's preview" )
        g1.add( n3 )
        g1.add( Link( n1, n2 ) )
        g1.add( Link( n1, n3 ) )
        
        g2 = self.a1.getGraph()
        
        self.assertTrue( Graph.areSame( g1, g2 ) )
Esempio n. 3
0
    def testSimple( self ):
        self.a1.computePreview().returns( "a1's preview" )

        self.m.startTest()
        
        g1 = Graph( "action" )
        g1.nodeAttr[ "shape" ] = "box"
        g1.add( Node( "a1's preview" ) )
        
        g2 = self.a1.getGraph()
        
        self.assertTrue( Graph.areSame( g1, g2 ) )
Esempio n. 4
0
 def testAtomic( self ):
     artifact = AtomicArtifact( "TestArtefact", [ os.path.join( "tmp", "file1" ), os.path.join( "tmp", "file2" ) ], [], [], [], False )
     
     g1 = Graph( "project" )
     cluster = Cluster( "TestArtefact" )
     cluster.add( Node( os.path.join( "tmp", "file1" ) ) )
     cluster.add( Node( os.path.join( "tmp", "file2" ) ) )
     g1.add( cluster )
     
     g2 = Graph( "project" )
     g2.add( artifact.getGraphNode() )
     
     self.assertTrue( Graph.areSame( g1, g2 ) )
Esempio n. 5
0
 def testCompound( self ):
     atomic1 = AtomicArtifact( "TestArtefact1", [ os.path.join( "tmp", "file1" ), os.path.join( "tmp", "file2" ) ], [], [], [], False )
     atomic2 = AtomicArtifact( "TestArtefact2", [ os.path.join( "tmp", "file3" ), os.path.join( "tmp", "file4" ) ], [], [], [], False )
     artifact = CompoundArtifact( "TestArtefact3", [ atomic1, atomic2 ], False )
     
     g1 = Graph( "project" )
     mainCluster = Cluster( "TestArtefact3" )
     cluster = Cluster( "TestArtefact1" )
     cluster.add( Node( os.path.join( "tmp", "file1" ) ) )
     cluster.add( Node( os.path.join( "tmp", "file2" ) ) )
     mainCluster.add( cluster )
     cluster = Cluster( "TestArtefact2" )
     cluster.add( Node( os.path.join( "tmp", "file3" ) ) )
     cluster.add( Node( os.path.join( "tmp", "file4" ) ) )
     mainCluster.add( cluster )
     g1.add( mainCluster )
     
     g2 = Graph( "project" )
     g2.add( artifact.getGraphNode() )
     
     self.assertTrue( Graph.areSame( g1, g2 ) )
Esempio n. 6
0
def actionHasGraph( a, g ):
    return Graph.areSame( a.getGraph(), g )