def test_set_level_info(self):
     with patch("logging.basicConfig") as m_basicConfig:
         Logger.set_level_info()
         m_basicConfig.assert_any_call(
             level=logging.INFO,
             format="%(asctime)s %(levelname)s %(message)s")
         self.assertEqual(m_basicConfig.call_count, 1)
 def test_set_level_trace(self):
     with patch("logging.basicConfig") as m_basicConfig:
         Logger.set_level_trace()
         m_basicConfig.assert_any_call(
             level=logging.DEBUG,
             format="%(asctime)s, %(levelname)s, %(module)s, %(module)s,"
                    + " %(funcName)s, %(message)s")
         self.assertEqual(m_basicConfig.call_count, 1)
 def test_file_config_filename_None(self):
     with nested(
             patch("logging.config.fileConfig"),
             patch("os.environ", {'LOGGING_CONF': "Test_Mock"}
                   )) as(m_ileConfig, Environ):
             Logger.file_config(None)
             self.assertEqual(m_ileConfig.call_count, 1)
             self.assertEqual(m_ileConfig.call_args[0][0], "Test_Mock")
             m_ileConfig.assert_any_call("Test_Mock")
Exemple #4
0
    modules = []
    for fdn in os.listdir(path):
        try:
            if fdn.endswith(".py"):
                m = load(fdn.replace(".py", ""), path)
                modules.append(m)
            elif os.path.isdir(fdn):
                m = load_module(fdn)
                modules.append(m)
        except ImportError:
            pass
    return modules


if __name__ == '__main__':
    Logger.file_config()

    options = Parser().parse()
    logging.info("python ComponentManager options: %s", options)

    dispatcher = MessageDispatcher()
    dispatcher.start()

    component_manager = ComponentManager(options.rid, dispatcher)

    classes = []

    cwd = os.getcwd()
    directory = os.path.join(cwd, options.dir)
    modules = load_modules(directory)
sys.path.append("../../../lib/python")
from org.o3project.odenos.remoteobject.transport.message_dispatcher import MessageDispatcher
from org.o3project.odenos.remoteobject.object_property import ObjectProperty 
from org.o3project.odenos.remoteobject.message.request import Request
from org.o3project.odenos.core.util.system_manager_interface import SystemManagerInterface
from org.o3project.odenos.core.util.logger import Logger
from org.o3project.odenos.core.util.network_interface import NetworkInterface
from org.o3project.odenos.remoteobject.manager.system.component_connection import (
    ComponentConnection
)
from org.o3project.odenos.remoteobject.manager.system.component_connection_logic_and_network import (
    ComponentConnectionLogicAndNetwork
)

if __name__ == '__main__':
    Logger.file_config()

    # Create MessageDispatcher
    dispatcher = MessageDispatcher()
    dispatcher.set_remote_system_manager()
    dispatcher.start()
    time.sleep(1)
    exit_code = 0
  
    try:
        # Create SystemManager Interface
        sysif = SystemManagerInterface(dispatcher)
        
        print "//////////////////////////////////////////////////"
        print "//// (1) Create Original Network."
        print "//////////////////////////////////////////////////"