Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# Template Setup
import riffle
from riffle import want
riffle.SetFabricLocal()
riffle.SetLogLevelDebug()
class GenericDomain(riffle.Domain):
def onJoin(self):
# End Template Setup
######################################################################################
# Example Test Restart before call - Does restarting before a call work?
import time
# Trying to restart the node before the call happens, but need to insert artificial delay to make this happen!
print "___NODERESTART___"
time.sleep(4.0)
s = backend.call("restartBeforeC", "Restart before call").wait(str)
print(s) # Expects a str, like "Restart before call works"
# End Example Test Restart before call
# Example Test Restart after reg - Does restarting after a register work
import time
time.sleep(2.0)
class GenericDomain(riffle.Domain):
def onJoin(self):
# End Template Setup
######################################################################################
# E-ample Test Reg/Call Big Ints - should be big
i = backend.call("sendBigInt", 9223372036854775807).wait(int)
print("{:d}".format(int(i))) # Expects a str, like "9223372036854775807"
# End E-ample Test Reg/Call Big Ints
print "___SETUPCOMPLETE___"
# Template Setup
app = riffle.Domain("xs.demo.test") # ARBITER $DOMAIN replaces "xs.demo.test"
client = riffle.Domain("client", superdomain=app)
backend = riffle.Domain("backend", superdomain=app)
GenericDomain("client", superdomain=app).join() # ARBITER $SUBDOMAIN replaces "client"
# End Template Setup
# Template Setup
import riffle
from riffle import want
riffle.SetFabricLocal()
riffle.SetLogLevelDebug()
class GenericDomain(riffle.Domain):
def onJoin(self):
# End Template Setup
######################################################################################
# Example Test Restart before call - Does restarting before a call work?
import time
# Trying to restart the node before the call happens, but need to insert artificial delay to make this happen!
print "___NODERESTART___"
time.sleep(4.0)
s = backend.call("restartBeforeC", "Restart before call").wait(str)
print(s) # Expects a str, like "Restart before call works"
# End Example Test Restart before call
# Example Test Restart after reg - Does restarting after a register work
# Template Setup
import riffle
from riffle import want
riffle.SetFabricLocal()
riffle.SetLogLevelDebug()
class GenericDomain(riffle.Domain):
def onJoin(self):
# End Template Setup
######################################################################################
# Example Test Restart before call - Does restarting before a call work?
import time
# Trying to restart the node before the call happens, but need to insert artificial delay to make this happen!
print "___NODERESTART___"
time.sleep(4.0)
s = backend.call("restartBeforeC", "Restart before call").wait(str)
print(s) # Expects a str, like "Restart before call works"
# End Example Test Restart before call
# Template Setup
import riffle
from riffle import want
riffle.SetFabricLocal()
riffle.SetLogLevelDebug()
class GenericDomain(riffle.Domain):
def onJoin(self):
# End Template Setup
######################################################################################
# E-ample Test Reg/Call Big Ints - should be big
i = backend.call("sendBigInt", 9223372036854775807).wait(int)
print("{:d}".format(int(i))) # Expects a str, like "9223372036854775807"
# End E-ample Test Reg/Call Big Ints
print "___SETUPCOMPLETE___"
# Template Setup
app = riffle.Domain("xs.demo.test") # ARBITER $DOMAIN replaces "xs.demo.test"
######################################################################################
# E-ample Test Reg/Call Big Ints - should be big
@want(int)
def sendBigInt(i):
print("{:d}".format(int(i))) # Expects a str, like "9223372036854775807"
return i
self.register("sendBigInt", sendBigInt)
# End E-ample Test Reg/Call Big Ints
print "___SETUPCOMPLETE___"
# Template Setup
app = riffle.Domain("xs.demo.test")
client = riffle.Domain("client", superdomain=app)
backend = riffle.Domain("backend", superdomain=app)
GenericDomain("backend", superdomain=app).join()
# End Template Setup
@want(int)
def sendBigInt(i):
print("{:d}".format(int(i))) # Expects a str, like "9223372036854775807"
return i
self.register("sendBigInt", sendBigInt)
# Template Setup
import riffle
from riffle import want
riffle.SetFabricLocal()
riffle.SetLogLevelDebug()
class GenericDomain(riffle.Domain):
def onJoin(self):
# End Template Setup
######################################################################################
# Example Test Restart before call - Does restarting before a call work?
@want(str)
def restartBeforeC(s):
print(s) # Expects a str, like "Restart before call"
return "{} works".format(s)
self.register("restartBeforeC", restartBeforeC)
# End Example Test Restart before call
# Example Test Restart after reg - Does restarting after a register work
import time
# Template Setup
import riffle
from riffle import want
riffle.SetFabricLocal()
riffle.SetLogLevelDebug()
class GenericDomain(riffle.Domain):
def onJoin(self):
# End Template Setup
######################################################################################
# Example Test Restart before call - Does restarting before a call work?
@want(str)
def restartBeforeC(s):
print(s) # Expects a str, like "Restart before call"
return "{} works".format(s)
self.register("restartBeforeC", restartBeforeC)
# End Example Test Restart before call
# Example Test Restart after reg - Does restarting after a register work
def main(arguments=None):
'''Interactive test of custom filesystem browser.'''
if arguments is None:
arguments = sys.argv
application = QtGui.QApplication(arguments)
browser = riffle.browser.FilesystemBrowser()
screen_size = application.desktop().availableGeometry()
browser.setMinimumSize(screen_size.width() / 2, screen_size.height() / 2)
if browser.exec_():
selected = browser.selected()
print('Selected: {0}'.format(selected))