def setUp(self): yield CodingTestCases.setUp(self) # Start a new http server with long_content_split = 'udh' httpApiConfigInstance = HTTPApiConfig() httpApiConfigInstance.port = 1402 httpApiConfigInstance.long_content_split = 'udh' # Launch the http server httpApi = HTTPApi(self.pbRoot_f, self.clientManager_f, httpApiConfigInstance) self.httpServer_udh = reactor.listenTCP(httpApiConfigInstance.port, server.Site(httpApi)) self.httpPort_udh = httpApiConfigInstance.port
def startHTTPApiService(self): "Start HTTP Api" httpApiConfigInstance = HTTPApiConfig(self.options['config']) httpApi_f = HTTPApi(self.components['router-pb-factory'], self.components['smppcm-pb-factory'], httpApiConfigInstance) self.components['http-api-server'] = reactor.listenTCP( httpApiConfigInstance.port, server.Site(httpApi_f, logPath=httpApiConfigInstance.access_log), interface=httpApiConfigInstance.bind)
def setUp(self): # Instanciate a RouterPB (a requirement for HTTPApi) RouterPBConfigInstance = RouterPBConfig() self.RouterPB_f = RouterPB() self.RouterPB_f.setConfig(RouterPBConfigInstance) # Provision Router with User and Route self.u1 = User(1, Group(1), 'fourat', 'correct') self.RouterPB_f.users.append(self.u1) self.RouterPB_f.mt_routing_table.add(DefaultRoute(SmppClientConnector('abc')), 0) # Instanciate a SMPPClientManagerPB (a requirement for HTTPApi) SMPPClientPBConfigInstance = SMPPClientPBConfig() SMPPClientPBConfigInstance.authentication = False clientManager_f = SMPPClientManagerPB() clientManager_f.setConfig(SMPPClientPBConfigInstance) httpApiConfigInstance = HTTPApiConfig() self.web = DummySite(HTTPApi(self.RouterPB_f, clientManager_f, httpApiConfigInstance))
def setUp(self): RouterPBTestCase.setUp(self) # Initiating config objects without any filename # will lead to setting defaults and that's what we # need to run the tests httpApiConfigInstance = HTTPApiConfig() SMPPClientPBConfigInstance = SMPPClientPBConfig() SMPPClientPBConfigInstance.authentication = False # Smpp client manager is required for HTTPApi instanciation self.clientManager_f = SMPPClientManagerPB() self.clientManager_f.setConfig(SMPPClientPBConfigInstance) # Launch the http server httpApi = HTTPApi(self.pbRoot_f, self.clientManager_f, httpApiConfigInstance) self.httpServer = reactor.listenTCP(httpApiConfigInstance.port, server.Site(httpApi)) self.httpPort = httpApiConfigInstance.port
def startHTTPApiService(self): "Start HTTP Api" httpApiConfigInstance = HTTPApiConfig(self.options['config']) # Add interceptor if enabled: if 'interceptor-pb-client' in self.components: interceptorpb_client = self.components['interceptor-pb-client'] else: interceptorpb_client = None self.components['http-api-factory'] = HTTPApi( self.components['router-pb-factory'], self.components['smppcm-pb-factory'], httpApiConfigInstance, interceptorpb_client) self.components['http-api-server'] = reactor.listenTCP( httpApiConfigInstance.port, server.Site(self.components['http-api-factory'], logPath=httpApiConfigInstance.access_log), interface=httpApiConfigInstance.bind)