def testFailConnectionWithWrongProtocol(self): try: ws=sConn.connect_service_socket(tUtils.get_servername(),"INVALID_PROTOCOL") ws.close() self.fail() except Exception, e: pass
def testEstablishRequestSessionBinary(self): try: logging.debug("Serializing request data to avro binary without schema") tUtils.serializeRequestSessionToBinaryFile() dataToSend=fUtils.readFileToString(tUtils.get_test_storage()+"/"+tUtils.getRequestSessionAvroFileNameBinary()) ws=sConn.connect_service_socket(tUtils.get_servername(),"binary") ws.send_binary(dataToSend) result=ws.recv() decoded=tUtils.getHeaderAndSessionFromBinary(result) header=decoded['header'] data=decoded['data'] logging.debug("Got header:"+str(header)) logging.debug("Got data:"+str(data)) logging.debug("Sending close session") tUtils.serializeCloseSessionToBinaryFile() dataToSend=fUtils.readFileToString(tUtils.get_test_storage()+"/"+tUtils.getCloseSessionAvroFileNameBinary()) ws.send_binary(dataToSend) result=ws.recv() ws.close() pass except Exception, e: self.fail("Error:"+str(e))
def testEstablishRequestSessionBinary(self): try: logging.debug( "Serializing request data to avro binary without schema") tUtils.serializeRequestSessionToBinaryFile() dataToSend = fUtils.readFileToString( tUtils.get_test_storage() + "/" + tUtils.getRequestSessionAvroFileNameBinary()) ws = sConn.connect_service_socket(tUtils.get_servername(), "binary") ws.send_binary(dataToSend) result = ws.recv() decoded = tUtils.getHeaderAndSessionFromBinary(result) header = decoded['header'] data = decoded['data'] logging.debug("Got header:" + str(header)) logging.debug("Got data:" + str(data)) logging.debug("Sending close session") tUtils.serializeCloseSessionToBinaryFile() dataToSend = fUtils.readFileToString( tUtils.get_test_storage() + "/" + tUtils.getCloseSessionAvroFileNameBinary()) ws.send_binary(dataToSend) result = ws.recv() ws.close() pass except Exception, e: self.fail("Error:" + str(e))
def testPingETPSocketService(self): ws=sConn.connect_ping_socket(tUtils.get_servername()) logging.debug("Connected sending data") result=sConn.socket_send_and_recieve(ws,"PING") logging.info("Recieved message:"+result) ws.close() pass
def testFailConnectionWithWrongProtocol(self): try: ws = sConn.connect_service_socket(tUtils.get_servername(), "INVALID_PROTOCOL") ws.close() self.fail() except Exception, e: pass
def testEstablishConnection(self): try: logging.debug("Testing establishin connection") ws = sConn.connect_service_socket(tUtils.get_servername()) ws.close() pass except Exception, e: self.fail("Error:" + str(e))
def testEstablishConnection(self): try: logging.debug("Testing establishin connection") ws=sConn.connect_service_socket(tUtils.get_servername()) ws.close() pass except Exception, e: self.fail("Error:"+str(e))
def testUpdateProtocol(self): try: requestSessionSchema=tUtils.get_requestsession_protocol() logging.debug("Reading request session schema from:"+requestSessionSchema) mEtp.update_protocol("http://"+tUtils.get_servername(),requestSessionSchema) #mEtp.get_protocol("http://"+tUtils.get_servername(),"TEST") pass except Exception, e: self.fail("Failed in update protocol:"+str(e))
def testCreateProtocol(self): try: requestSessionSchema = tUtils.get_requestsession_protocol() logging.debug("Reading request session schema from:" + requestSessionSchema) mEtp.store_protocol("http://" + tUtils.get_servername(), requestSessionSchema) #mEtp.get_protocol("http://"+tUtils.get_servername(),"TEST") pass except Exception, e: raise e
def testGetInValidSchema(self): try: schemaName="NOT_EXISTING" result=mEtp.get_protocol("http://"+tUtils.get_servername(),schemaName) if result==None: pass else: self.fail("Failed in getting schema:") except Exception, e: self.fail("Failed in getting schema:"+str(e))
def testGetValidSchema(self): try: schemaName="RequestSession" result=mEtp.get_protocol("http://"+tUtils.get_servername(),schemaName) if result!=None: logging.debug("Got result:"+str(result)) pass else: self.fail("Failed in getting schema:") except Exception, e: self.fail("Failed in getting schema:"+str(e))
def testGetInValidSchema(self): try: schemaName = "NOT_EXISTING" result = mEtp.get_protocol("http://" + tUtils.get_servername(), schemaName) if result == None: pass else: self.fail("Failed in getting schema:") except Exception, e: self.fail("Failed in getting schema:" + str(e))
def testGetValidSchema(self): try: schemaName = "RequestSession" result = mEtp.get_protocol("http://" + tUtils.get_servername(), schemaName) if result != None: logging.debug("Got result:" + str(result)) pass else: self.fail("Failed in getting schema:") except Exception, e: self.fail("Failed in getting schema:" + str(e))
def testEstablishRequestSessionWithFaultyReqSessionData(self): try: logging.debug("Testing failure of send binary and not correct request session") dataToSend=bytearray(b"Hello World") ws=sConn.connect_service_socket(tUtils.get_servername(),"binary") ws.send_binary(dataToSend) ws.recv() pass except Exception, e: self.fail("Error:"+str(e))
def testEstablishRequestSessionWithFaultyReqSessionData(self): try: logging.debug( "Testing failure of send binary and not correct request session" ) dataToSend = bytearray(b"Hello World") ws = sConn.connect_service_socket(tUtils.get_servername(), "binary") ws.send_binary(dataToSend) ws.recv() pass except Exception, e: self.fail("Error:" + str(e))