def start(self): try: self.R1 = EventRouter("R1") self.R2 = EventRouterHTTPS("R2S","localhost",8082) self.R3 = EventRouterHTTPS("R3S","localhost",8083) except Exception, e: print_exc() try: self.tearDown() except Exception: pass raise e
def setUp(self): self.R1 = EventRouter("R1") self.R2 = EventRouter("R2") self.R3 = EventRouter("R3") # Configure event routers with R1 as hub: # # R1 # / \ # R2 R3 # # Wildcard event source self.R1.routeEventFrom(evtype="R2Events/ev1",router=self.R2) self.R1.routeEventFrom(evtype="R3Events/ev1",router=self.R3) self.R2.routeEventFrom(evtype="R1Events/ev1",router=self.R1) self.R2.routeEventFrom(evtype="R3Events/ev1",router=self.R1) self.R3.routeEventFrom(evtype="R1Events/ev1",router=self.R1) self.R3.routeEventFrom(evtype="R2Events/ev1",router=self.R1) # Wildcard event type self.R1.routeEventFrom(source="R2Source/src1",router=self.R2) self.R1.routeEventFrom(source="R3Source/src1",router=self.R3) self.R2.routeEventFrom(source="R1Source/src1",router=self.R1) self.R2.routeEventFrom(source="R3Source/src1",router=self.R1) self.R3.routeEventFrom(source="R1Source/src1",router=self.R1) self.R3.routeEventFrom(source="R2Source/src1",router=self.R1) # Wildcard none self.R1.routeEventFrom(evtype="R2Events1/ev1",source="R2Source1/src1",router=self.R2) self.R1.routeEventFrom(evtype="R3Events1/ev1",source="R3Source1/src1",router=self.R3) self.R2.routeEventFrom(evtype="R1Events1/ev1",source="R1Source1/src1",router=self.R1) self.R2.routeEventFrom(evtype="R3Events1/ev1",source="R3Source1/src1",router=self.R1) self.R3.routeEventFrom(evtype="R1Events1/ev1",source="R1Source1/src1",router=self.R1) self.R3.routeEventFrom(evtype="R2Events1/ev1",source="R2Source1/src1",router=self.R1) # Cross routing event self.R1.routeEventFrom(evtype="RREvents2/ev1",source="RRSource2/src1",router=self.R2) self.R2.routeEventFrom(evtype="RREvents2/ev1",source="RRSource2/src1",router=self.R1) # 3-way loop routing event self.R1.routeEventFrom(evtype="RREvents3/ev1",source="RRSource3/src1",router=self.R2) self.R2.routeEventFrom(evtype="RREvents3/ev1",source="RRSource3/src1",router=self.R3) self.R3.routeEventFrom(evtype="RREvents3/ev1",source="RRSource3/src1",router=self.R1) return