public BusListenerTest() { notifyEvent = new AutoResetEvent(false); bus = new AllJoyn.BusAttachment("BusListenerTest", true); // start the bus attachment status = bus.Start(); Assert.Equal(AllJoyn.QStatus.OK, status); // connect to the bus status = bus.Connect(AllJoynTestCommon.GetConnectSpec()); Assert.Equal(AllJoyn.QStatus.OK, status); busListener = new TestBusListener(this); }
public void EnableConcurrentCallbacks_Not_Used() { callbackStatus = AllJoyn.QStatus.FAIL; listenerRegisteredFlag = false; nameOwnerChangedFlag = false; busListener = new BusListenerWithBlockingCall(this); mbus.RegisterBusListener(busListener); Wait(MaxWaitTime); Assert.True(listenerRegisteredFlag); mbus.RequestName(ObjectName, 0); Wait(MaxWaitTime); Assert.True(nameOwnerChangedFlag); /* * Because of the way that callback functions are defered we can still make * what would be a blocking call in alljoyn_core and it is not a blocking * call in Unity. This is a by product of the alljoyn_c deffered callback class * and its usage. I am still investigating ways to work around issues caused * by the deffered callback class at some point in the future may start to work * as alljoyn_core. * Assert.Equal(AllJoyn.QStatus.BUS_BLOCKING_CALL_NOT_ALLOWED, callbackStatus); */ Assert.Equal(AllJoyn.QStatus.OK, callbackStatus); }
public void EnableConcurrentCallbacks_Used() { callbackStatus = AllJoyn.QStatus.FAIL; listenerRegisteredFlag = false; nameOwnerChangedFlag = false; busListener = new BusListenerEnableConcurrentCallbacks(this); mbus.RegisterBusListener(busListener); Wait(MaxWaitTime); Assert.True(listenerRegisteredFlag); mbus.RequestName(ObjectName, 0); Wait(MaxWaitTime); Assert.True(nameOwnerChangedFlag); Assert.Equal(AllJoyn.QStatus.OK, callbackStatus); }