Beispiel #1
0
    def test_find_binding(self):
        res = Binding(name="foo")
        obj = Definitions(bindings=[res])

        self.assertEqual(res, obj.find_binding("foo"))

        with self.assertRaises(DefinitionsValueError) as cm:
            obj.find_binding("nope")

        self.assertEqual("Unknown Binding name: nope", str(cm.exception))
Beispiel #2
0
    def map_port(cls, definitions: Definitions, port: ServicePort) -> Iterator[Class]:
        """Step 2: Match a ServicePort to a Binding and PortType object and
        delegate the process to the next entry point."""

        binding = definitions.find_binding(text.suffix(port.binding))
        port_type = definitions.find_port_type(text.suffix(binding.type))

        elements = collections.concat(binding.extended_elements, port.extended_elements)
        config = cls.attributes(elements)

        yield from cls.map_binding(definitions, binding, port_type, config)