#NEWLINE# def test06_removingColorCapabilitiesPreventsNewColorActors( self ) : #NEWLINE# #INDENT# self . startSystems ( 90 ) #NEWLINE# self . systems [ 'One' ] . updateCapability ( 'Red' , True ) #NEWLINE# self . systems [ 'Two' ] . updateCapability ( 'Green' , True ) #NEWLINE# self . systems [ 'Three' ] . updateCapability ( 'Blue' , True ) #NEWLINE# reasonableActorResponseTime = 0.3 #NEWLINE# time . sleep ( ( reasonableActorResponseTime * 6 ) ) #NEWLINE# red = self . systems [ 'One' ] . createActor ( RedActor ) #NEWLINE# green = self . systems [ 'One' ] . createActor ( GreenActor ) #NEWLINE# blue = self . systems [ 'One' ] . createActor ( BlueActor ) #NEWLINE# self . assertIsNotNone ( red ) #NEWLINE# self . assertIsNotNone ( green ) #NEWLINE# self . assertIsNotNone ( blue ) #NEWLINE# self . assertIsInstance ( red , ActorAddress ) #NEWLINE# self . assertIsInstance ( green , ActorAddress ) #NEWLINE# self . assertIsInstance ( blue , ActorAddress ) #NEWLINE# self . assertEqual ( 'Got: hello' , self . systems [ 'One' ] . ask ( red , 'hello' , reasonableActorResponseTime ) ) #NEWLINE# self . assertEqual ( 'Got: howdy' , self . systems [ 'One' ] . ask ( green , 'howdy' , reasonableActorResponseTime ) ) #NEWLINE# self . assertEqual ( 'Got: greetings' , self . systems [ 'One' ] . ask ( blue , 'greetings' , reasonableActorResponseTime ) ) #NEWLINE# self . systems [ 'Three' ] . updateCapability ( 'Blue' , None ) #NEWLINE# time . sleep ( 0.1 ) #NEWLINE# self . assertIsNone ( self . systems [ 'One' ] . ask ( blue , 'yono' , reasonableActorResponseTime ) ) #NEWLINE# self . assertEqual ( 'Got: hellono' , self . systems [ 'One' ] . ask ( red , 'hellono' , reasonableActorResponseTime ) ) #NEWLINE# self . assertEqual ( 'Got: hino' , self . systems [ 'One' ] . ask ( green , 'hino' , reasonableActorResponseTime ) ) #NEWLINE# self . systems [ 'One' ] . updateCapability ( 'Red' , None ) #NEWLINE# time . sleep ( 0.1 ) #NEWLINE# self . assertIsNone ( self . systems [ 'One' ] . ask ( red , 'hello' , reasonableActorResponseTime ) ) #NEWLINE# self . assertEqual ( 'Got: hi' , self . systems [ 'One' ] . ask ( green , 'hi' , reasonableActorResponseTime ) ) #NEWLINE# self . assertIsNone ( self . systems [ 'One' ] . ask ( blue , 'yo' , reasonableActorResponseTime ) ) #NEWLINE# self . assertRaises ( NoCompatibleSystemForActor , self . systems [ 'One' ] . createActor , RedActor ) #NEWLINE# red = None #NEWLINE# green = self . systems [ 'One' ] . createActor ( GreenActor ) #NEWLINE# self . assertRaises ( NoCompatibleSystemForActor , self . systems [ 'One' ] . createActor , BlueActor ) #NEWLINE# self . systems [ 'Three' ] . updateCapability ( 'Blue' , True ) #NEWLINE# time . sleep ( 0.25 ) #NEWLINE# blue = self . systems [ 'One' ] . createActor ( BlueActor ) #NEWLINE# self . assertIsNone ( red ) #NEWLINE# self . assertIsNotNone ( green ) #NEWLINE# self . assertIsNotNone ( blue ) #NEWLINE# self . assertIsInstance ( green , ActorAddress ) #NEWLINE# self . assertIsInstance ( blue , ActorAddress ) #NEWLINE# self . assertEqual ( 'Got: howdy howdy' , self . systems [ 'One' ] . ask ( reasonableActorResponseTime , 'howdy howdy' , reasonableActorResponseTime ) ) #NEWLINE# self . assertEqual ( 'Got: greetings all' , self . systems [ 'One' ] . ask ( blue , 'greetings all' , reasonableActorResponseTime ) ) #NEWLINE# self . assertIsNone ( self . systems [ 'One' ] . ask ( blue , ( RedActor , 'hey, red' ) , reasonableActorResponseTime ) ) #NEWLINE# self . assertEqual ( 'hey, blue' , self . systems [ 'One' ] . ask ( green , ( BlueActor , 'hey, blue' ) , ( reasonableActorResponseTime * 10 ) ) ) #NEWLINE# self . assertEqual ( 'hey, green' , self . systems [ 'One' ] . ask ( blue , ( GreenActor , 'hey, green' ) , ( reasonableActorResponseTime * 10 ) ) ) #NEWLINE# self . systems [ 'Two' ] . updateCapability ( 'Green' , None ) #NEWLINE# self . systems [ 'One' ] . tell ( blue , SetCap ( 'Blue' , None ) ) #NEWLINE# time . sleep ( 0.1 ) #NEWLINE# self . assertRaises ( NoCompatibleSystemForActor , self . systems [ 'One' ] . createActor , RedActor ) #NEWLINE# self . assertRaises ( NoCompatibleSystemForActor , self . systems [ 'One' ] . createActor , BlueActor ) #NEWLINE# self . assertRaises ( NoCompatibleSystemForActor , self . systems [ 'One' ] . createActor , GreenActor )