def demo_manual_calls_simple_userclass(appserver_hostname, connection_mode, w4gl_image): print '' print '=' * 65 print 'demo_manual_calls_simple_userclass' func_sig = 'p1=USERCLASS; p1.attr_int=INTEGER; p1.attr_str=STRING; p1.vc_int=STRING; p1.vc_str=STRING' # declare OpenROAD RemoteServer and Helper objects rso = or_connect(w4gl_image, appserver_hostname, connection_mode=connection_mode) test_value_int = 1 test_value_str = 'test' p1 = { u'attr_int': test_value_int, u'attr_str': test_value_str, u'vc_int': None, u'vc_str': None, } print 'call 1 - with signature' print 'p1' pprint(p1) result = callproc(rso, 'echo_ucsimple', func_sig=func_sig, p1=p1) print 'result' pprint(result) rso.disconnect()
def setUp(self): # NOTE using Python unittest, setUp() is called before EACH and every # test. There is no single setup routine hook (other than hacking init, # module main, etc.) self.rso = or_connect(self.w4gl_image, self.appserver_hostname, connection_mode=self.connection_mode) self.server = SimpleDispatcher(self.rso, lookup_meta=self.lookup_meta)
def demo_app_does_not_exist(appserver_hostname, connection_mode, w4gl_image): print '=' * 65 try: rso = or_connect(w4gl_image, appserver_hostname, connection_mode=connection_mode) except ApplicationNotFound as info: print 'oh dear' print info
def demo_simple_dispatcher(appserver_hostname, connection_mode, w4gl_image): print '=' * 65 rso = or_connect(w4gl_image, appserver_hostname, connection_mode=connection_mode) comtest = SimpleDispatcher(rso) print 'comtest.__app_metadata', type(comtest) print 'comtest.__app_metadata', repr(comtest.__class__.__name__) #print 'comtest.__app_metadata', dir(comtest) print 'comtest.__app_metadata' # Same tests as earlier but no explict signature passing print 'call 1- with signature' result = comtest.helloworld(hellostring='COMTEST', counter=99) print result print '' print 'call 2 - withOUT signature and all params provided' result = comtest.helloworld(hellostring='COMTEST', counter=99) print result print '' print 'call 3 - withOUT signature and missing param' result = comtest.helloworld(hellostring='COMTEST') print result print '' print 'call 4 - withOUT signature and all params provided' result = comtest.helloworld(hellostring='COMTEST', counter=99) print result print '' print 'call 5 - with signature and missing param' result = comtest.helloworld(hellostring='COMTEST') print result print '' print 'call 6 - method that does not exist' try: result = comtest.method_does_not_exist(hellostring='COMTEST') except MethodNotFound as info: print 'oh dear' print info rso.disconnect()
def doit(appserver_hostname=APPSERVER_HOSTNAME): w4gl_image = 'ASA_ns' connection_mode = None connection_mode = '' #connection_mode = 'unauthenticated' #connection_mode = 'compressed' #connection_mode = 'unauthenticated-compressed' # declare OpenROAD RemoteServer and Helper objects rso = orserver.or_connect(w4gl_image, appserver_hostname, connection_mode=connection_mode) aso = orserver.get_aso_and_attach_rso(rso) func_sig = 'b_arr_UCAkaDetail=UCARRAY; b_arr_UCAkaDetail.i_aka_detail_id=INTEGER; b_arr_UCAkaDetail.i_asolib=INTEGER; b_arr_UCAkaDetail.i_servertype=INTEGER; b_arr_UCAkaDetail.v_aka_name=STRING; b_arr_UCAkaDetail.v_cmdflags=STRING; b_arr_UCAkaDetail.v_imagefile=STRING; b_arr_UCAkaDetail.v_serverlocation=STRING; b_UCSPOConfig=USERCLASS; b_UCSPOConfig.i_MaxDispatchers=INTEGER; b_UCSPOConfig.i_MaxTotalSlaves=INTEGER; b_UCSPOConfig.i_PrfMonInterval=INTEGER; b_UCSPOConfig.i_PrfMonLevel=INTEGER; b_UCSPOConfig.i_PurgeInterval=INTEGER; b_UCSPOConfig.i_TraceFileAppend=INTEGER; b_UCSPOConfig.i_TraceInterval=INTEGER; b_UCSPOConfig.i_TraceLevel=INTEGER; b_UCSPOConfig.v_TraceFileName=STRING' result = orserver.callproc(aso, 'GetAllNameServerData', func_sig=func_sig) print result print '' pprint(result) rso.disconnect()
def demo_manual_calls(appserver_hostname, connection_mode, w4gl_image): func_sig = 'hellostring=STRING; counter=INTEGER' # declare OpenROAD RemoteServer and Helper objects rso = or_connect(w4gl_image, appserver_hostname, connection_mode=connection_mode) print 'call 1- with signature' result = callproc(rso, 'helloworld', func_sig=func_sig, hellostring='COMTEST', counter=99) print result print '' print 'call 2 - withOUT signature and all params provided' result = callproc(rso, 'helloworld', func_sig=None, hellostring='COMTEST', counter=99) print result print '' print 'call 3 - withOUT signature and missing param' result = callproc(rso, 'helloworld', func_sig=None, hellostring='COMTEST') print result print '' print 'call 4 - withOUT signature and all params provided' result = callproc(rso, 'helloworld', func_sig=None, hellostring='COMTEST', counter=99) print result print '' print 'call 5 - with signature and missing param' result = callproc(rso, 'helloworld', func_sig=func_sig, hellostring='COMTEST') print result print '' print 'call 6 - method that does not exist' try: result = callproc(rso, 'method_does_not_exist', hellostring='COMTEST') except MethodNotFound as info: print 'oh dear' print info # TODO method does not exist rso.disconnect()