Esempio n. 1
0
 def __parse_autowire(self, autowire):
     abstract = autowire.getAttribute("abstract")
     concrete = autowire.getAttribute("concrete")
     return (ConfigTools.fqn_to_pair(abstract), 
             (ConfigTools.fqn_to_pair(concrete), 
              dict(self.__parse_parameter(parameter) 
                   for parameter in autowire.getElementsByTagNameNS(self.NAMESPACE_URI, "parameter"))))
def dump():
    configurator = _ConfiguratorInternal()
    configurator.load_configuration(flavors=[])
    abstracts_to_concrete_map = configurator.get_adapter_map()
    args_map = dict(abstracts_to_concrete_map.itervalues())
    generator = PlainAutoWireConfigGenerator(
        abstracts_to_concrete_map,
        selection_strategy_func=lambda abstract, concretes: concretes[0],
        # select the single concrete adapter for each abstract adapter
        args_func=lambda concrete_name: args_map[ConfigTools.fqn_to_pair(
            concrete_name)],
    )
    for line in generator.get_configuration_lines():
        print line
Esempio n. 3
0
 def test_fqn_to_pair_2(self):
     self.assertEquals(("package.module", "Class"), ConfigTools.fqn_to_pair("package.module.Class"))