Exemplo n.º 1
0
 def test_realization(self):
     """Test automatic dependency: realization
     """
     c = self.factory.create(uml2.Component)
     cls = self.factory.create(uml2.Class)
     dt = modelfactory.dependency_type(c, cls)
     self.assertEquals(uml2.Realization, dt)
Exemplo n.º 2
0
 def test_usage(self):
     """Test automatic dependency: usage
     """
     cls = self.factory.create(uml2.Class)
     iface = self.factory.create(uml2.Interface)
     dt = modelfactory.dependency_type(cls, iface)
     self.assertEquals(uml2.Usage, dt)
Exemplo n.º 3
0
 def test_usage_by_component(self):
     """Test automatic dependency: usage (by component)
     """
     c = self.factory.create(uml2.Component)
     iface = self.factory.create(uml2.Interface)
     dt = modelfactory.dependency_type(c, iface)
     # it should be usage not realization (interface is classifier as
     # well)
     self.assertEquals(uml2.Usage, dt)
Exemplo n.º 4
0
    def connect_subject(self, handle):
        """
        TODO: cleck for existing relationships (use self.relation())
        """
        line = self.line

        if line.auto_dependency:
            canvas = line.canvas
            opposite = line.opposite(handle)

            if handle is line.head:
                client = self.get_connected(opposite).subject
                supplier = self.element.subject
            else:
                client = self.element.subject
                supplier = self.get_connected(opposite).subject
            line.dependency_type = modelfactory.dependency_type(client, supplier)

        relation = self.relationship_or_new(line.dependency_type,
                                            line.dependency_type.supplier,
                                            line.dependency_type.client)
        line.subject = relation