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 SignalsTest() { // create+start+connect bus attachment bus = new AllJoyn.BusAttachment("SignalsTest", true); Assert.NotNull(bus); status = bus.Start(); Assert.Equal(AllJoyn.QStatus.OK, status); status = bus.Connect(AllJoynTestCommon.GetConnectSpec()); Assert.Equal(AllJoyn.QStatus.OK, status); }
public ConcurrentCallbackTest() { mbus = new AllJoyn.BusAttachment("BusListenerTest", true); // start the bus attachment status = mbus.Start(); Assert.Equal(AllJoyn.QStatus.OK, status); // connect to the bus status = mbus.Connect(AllJoynTestCommon.GetConnectSpec()); Assert.Equal(AllJoyn.QStatus.OK, status); }
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 AddMember() { // create the interface AllJoyn.InterfaceDescription testIntf = null; status = bus.CreateInterface(INTERFACE_NAME, out testIntf); Assert.Equal(AllJoyn.QStatus.OK, status); Assert.NotNull(testIntf); // Test adding a MethodCall status = testIntf.AddMember(AllJoyn.Message.Type.MethodCall, "ping", "s", "s", "in,out", AllJoyn.InterfaceDescription.AnnotationFlags.Default); Assert.Equal(AllJoyn.QStatus.OK, status); // Test adding a Signal status = testIntf.AddMember(AllJoyn.Message.Type.Signal, "chirp", "", "s", "chirp", AllJoyn.InterfaceDescription.AnnotationFlags.Default); Assert.Equal(AllJoyn.QStatus.OK, status); }
public BusObjectTest() { notifyEvent = new AutoResetEvent(false); // create+start+connect bus attachment bus = new AllJoyn.BusAttachment("BusObjectTest", true); Assert.NotNull(bus); status = bus.Start(); Assert.Equal(AllJoyn.QStatus.OK, status); status = bus.Connect(AllJoynTestCommon.GetConnectSpec()); Assert.Equal(AllJoyn.QStatus.OK, status); // create+start+connect bus attachment servicebus = new AllJoyn.BusAttachment("BusObjectTestService", true); Assert.NotNull(servicebus); status = servicebus.Start(); Assert.Equal(AllJoyn.QStatus.OK, status); status = servicebus.Connect(AllJoynTestCommon.GetConnectSpec()); Assert.Equal(AllJoyn.QStatus.OK, status); }
public void TestNameOwnerChanged() { listenerRegistered = false; nameOwnerChanged = false; // register the bus listener bus.RegisterBusListener(busListener); Wait(MaxWaitTime); Assert.Equal(true, listenerRegistered); // test name owner changed status = bus.RequestName(ObjectName, 0); Assert.Equal(AllJoyn.QStatus.OK, status); Wait(MaxWaitTime); Assert.Equal(true, nameOwnerChanged); }
public void GetMember() { // create the interface AllJoyn.InterfaceDescription testIntf = null; status = bus.CreateInterface(INTERFACE_NAME, out testIntf); Assert.Equal(AllJoyn.QStatus.OK, status); Assert.NotNull(testIntf); // Test adding a MethodCall status = testIntf.AddMember(AllJoyn.Message.Type.MethodCall, "ping", "s", "s", "in,out", AllJoyn.InterfaceDescription.AnnotationFlags.Default); Assert.Equal(AllJoyn.QStatus.OK, status); // Test adding a Signal status = testIntf.AddMember(AllJoyn.Message.Type.Signal, "chirp", "", "s", "chirp", AllJoyn.InterfaceDescription.AnnotationFlags.Default); Assert.Equal(AllJoyn.QStatus.OK, status); // Verify the ping member AllJoyn.InterfaceDescription.Member pingMember = null; pingMember = testIntf.GetMember("ping"); Assert.NotNull(pingMember); Assert.Equal(testIntf, pingMember.Iface); Assert.Equal(AllJoyn.Message.Type.MethodCall, pingMember.MemberType); Assert.Equal("ping", pingMember.Name); Assert.Equal("s", pingMember.Signature); Assert.Equal("s", pingMember.ReturnSignature); Assert.Equal("in,out", pingMember.ArgNames); //TODO add in code to use new annotation methods //Assert.Equal(AllJoyn.InterfaceDescription.AnnotationFlags.Default, pingMember.Annotation); // Verify the chirp member AllJoyn.InterfaceDescription.Member chirpMember = null; chirpMember = testIntf.GetMember("chirp"); Assert.NotNull(chirpMember); Assert.Equal(testIntf, chirpMember.Iface); Assert.Equal(AllJoyn.Message.Type.Signal, chirpMember.MemberType); Assert.Equal("chirp", chirpMember.Name); Assert.Equal("", chirpMember.Signature); Assert.Equal("s", chirpMember.ReturnSignature); Assert.Equal("chirp", chirpMember.ArgNames); //TODO add in code to use new annotation methods //Assert.Equal(AllJoyn.InterfaceDescription.AnnotationFlags.Default, chirpMember.Annotation); }
public void IsSecure() { // create an insecure interface AllJoyn.InterfaceDescription testIntf = null; status = bus.CreateInterface(INTERFACE_NAME, out testIntf); Assert.Equal(AllJoyn.QStatus.OK, status); Assert.NotNull(testIntf); Assert.Equal(false, testIntf.IsSecure); bus.DeleteInterface(testIntf); // create a secure interface status = bus.CreateInterface(INTERFACE_NAME, AllJoyn.InterfaceDescription.SecurityPolicy.Inherit, out testIntf); Assert.Equal(AllJoyn.QStatus.OK, status); Assert.NotNull(testIntf); Assert.Equal(false, testIntf.IsSecure); Assert.Equal(AllJoyn.InterfaceDescription.SecurityPolicy.Inherit, testIntf.GetSecurityPolicy); bus.DeleteInterface(testIntf); // create a secure interface status = bus.CreateInterface(INTERFACE_NAME, AllJoyn.InterfaceDescription.SecurityPolicy.Off, out testIntf); Assert.Equal(AllJoyn.QStatus.OK, status); Assert.NotNull(testIntf); Assert.Equal(false, testIntf.IsSecure); Assert.Equal(AllJoyn.InterfaceDescription.SecurityPolicy.Off, testIntf.GetSecurityPolicy); bus.DeleteInterface(testIntf); // create a secure interface status = bus.CreateInterface(INTERFACE_NAME, AllJoyn.InterfaceDescription.SecurityPolicy.Required, out testIntf); Assert.Equal(AllJoyn.QStatus.OK, status); Assert.NotNull(testIntf); Assert.Equal(true, testIntf.IsSecure); Assert.Equal(AllJoyn.InterfaceDescription.SecurityPolicy.Required, testIntf.GetSecurityPolicy); }
public void Activate() { // create the interface AllJoyn.InterfaceDescription testIntf = null; status = bus.CreateInterface(INTERFACE_NAME, out testIntf); Assert.Equal(AllJoyn.QStatus.OK, status); Assert.NotNull(testIntf); // Test adding a MethodCall status = testIntf.AddMember(AllJoyn.Message.Type.MethodCall, "ping", "s", "s", "in,out", AllJoyn.InterfaceDescription.AnnotationFlags.Default); Assert.Equal(AllJoyn.QStatus.OK, status); // Test adding a Signal status = testIntf.AddMember(AllJoyn.Message.Type.Signal, "chirp", "", "s", "chirp", AllJoyn.InterfaceDescription.AnnotationFlags.Default); Assert.Equal(AllJoyn.QStatus.OK, status); // activate the interface testIntf.Activate(); /* once the interface has been activated we should not be able to add new members */ status = testIntf.AddMember(AllJoyn.Message.Type.MethodCall, "pong", "s", "s", "in,out", AllJoyn.InterfaceDescription.AnnotationFlags.Default); Assert.Equal(AllJoyn.QStatus.BUS_INTERFACE_ACTIVATED, status); }
public void HasMember() { // create the interface AllJoyn.InterfaceDescription testIntf = null; status = bus.CreateInterface(INTERFACE_NAME, out testIntf); Assert.Equal(AllJoyn.QStatus.OK, status); Assert.NotNull(testIntf); // Test adding a MethodCall status = testIntf.AddMember(AllJoyn.Message.Type.MethodCall, "ping", "s", "s", "in,out", AllJoyn.InterfaceDescription.AnnotationFlags.Default); Assert.Equal(AllJoyn.QStatus.OK, status); // Test adding a Signal status = testIntf.AddMember(AllJoyn.Message.Type.Signal, "chirp", "", "s", "chirp", AllJoyn.InterfaceDescription.AnnotationFlags.Default); Assert.Equal(AllJoyn.QStatus.OK, status); Assert.Equal(true, testIntf.HasMember("ping", "s", "s")); Assert.Equal(true, testIntf.HasMember("chirp", "", "s")); /* * expected to be false even though the members exist the signatures do not * match what is expected. */ Assert.Equal(false, testIntf.HasMember("ping", "i", "s")); Assert.Equal(false, testIntf.HasMember("chirp", "b", null)); Assert.Equal(false, testIntf.HasMember("invalid", "s", null)); }
public void GetMethod() { // create the interface AllJoyn.InterfaceDescription testIntf = null; status = bus.CreateInterface(INTERFACE_NAME, out testIntf); Assert.Equal(AllJoyn.QStatus.OK, status); Assert.NotNull(testIntf); // Test adding a MethodCall Assert.Equal(AllJoyn.QStatus.OK, testIntf.AddMethod("ping", "s", "s", "in,out")); Assert.Equal(AllJoyn.QStatus.OK, testIntf.AddSignal("foo", "", "")); // Verify the ping member AllJoyn.InterfaceDescription.Member pingMember = null; pingMember = testIntf.GetMethod("ping"); Assert.NotNull(pingMember); Assert.Equal(testIntf, pingMember.Iface); Assert.Equal(AllJoyn.Message.Type.MethodCall, pingMember.MemberType); Assert.Equal("ping", pingMember.Name); Assert.Equal("s", pingMember.Signature); Assert.Equal("s", pingMember.ReturnSignature); Assert.Equal("in,out", pingMember.ArgNames); AllJoyn.InterfaceDescription.Member fooMember = null; fooMember = testIntf.GetMethod("foo"); // since "foo" is a signal is should return null when using GetMethod Assert.Null(fooMember); fooMember = testIntf.GetMethod("bar"); // since "bar" is not a member of the interface it should be null Assert.Null(fooMember); }
public void AddMethod() { // create the interface AllJoyn.InterfaceDescription testIntf = null; Assert.Equal(AllJoyn.QStatus.OK, bus.CreateInterface(INTERFACE_NAME, out testIntf)); Assert.NotNull(testIntf); // Test adding a MethodCall Assert.Equal(AllJoyn.QStatus.OK, testIntf.AddMethod("ping", "s", "s", "in,out")); // Test adding a Signal status = testIntf.AddMethod("pong", "", "s", "pong-in", AllJoyn.InterfaceDescription.AnnotationFlags.Deprecated | AllJoyn.InterfaceDescription.AnnotationFlags.NoReply); Assert.Equal(AllJoyn.QStatus.OK, status); string expectedIntrospect = "<interface name=\"org.alljoyn.test.InterfaceDescriptionTest\">\n" + " <method name=\"ping\">\n" + " <arg name=\"in\" type=\"s\" direction=\"in\"/>\n" + " <arg name=\"out\" type=\"s\" direction=\"out\"/>\n" + " </method>\n" + " <method name=\"pong\">\n" + " <arg name=\"pong-in\" type=\"s\" direction=\"out\"/>\n" + " <annotation name=\"org.freedesktop.DBus.Deprecated\" value=\"true\"/>\n" + " <annotation name=\"org.freedesktop.DBus.Method.NoReply\" value=\"true\"/>\n" + " </method>\n" + "</interface>\n"; Assert.Equal(expectedIntrospect, testIntf.Introspect()); }
public void GetMembers() { // create the interface AllJoyn.InterfaceDescription testIntf = null; status = bus.CreateInterface(INTERFACE_NAME, out testIntf); Assert.Equal(AllJoyn.QStatus.OK, status); Assert.NotNull(testIntf); // Test adding a MethodCall Assert.Equal(AllJoyn.QStatus.OK, testIntf.AddMethod("one", "", "", "")); Assert.Equal(AllJoyn.QStatus.OK, testIntf.AddMethod("two", "", "", "")); Assert.Equal(AllJoyn.QStatus.OK, testIntf.AddMethod("three", "", "", "")); Assert.Equal(AllJoyn.QStatus.OK, testIntf.AddMethod("four", "", "", "")); Assert.Equal(AllJoyn.QStatus.OK, testIntf.AddMethod("five", "", "", "")); Assert.Equal(AllJoyn.QStatus.OK, testIntf.AddMethod("six", "", "", "")); Assert.Equal(AllJoyn.QStatus.OK, testIntf.AddMethod("seven", "", "", "")); Assert.Equal(AllJoyn.QStatus.OK, testIntf.AddSignal("eight", "", "")); Assert.Equal(AllJoyn.QStatus.OK, testIntf.AddSignal("nine", "", "")); Assert.Equal(AllJoyn.QStatus.OK, testIntf.AddSignal("ten", "", "")); AllJoyn.InterfaceDescription.Member[] members = testIntf.GetMembers(); Assert.Equal(10, members.Length); // This test assumes that the members are returned in alphabetic order // nothing states that the changes must be returned this way. Assert.Equal("eight", members[0].Name); Assert.Equal("five", members[1].Name); Assert.Equal("four", members[2].Name); Assert.Equal("nine", members[3].Name); Assert.Equal("one", members[4].Name); Assert.Equal("seven", members[5].Name); Assert.Equal("six", members[6].Name); Assert.Equal("ten", members[7].Name); Assert.Equal("three", members[8].Name); Assert.Equal("two", members[9].Name); }
public void AddMethodHandler() { AllJoyn.QStatus status = AllJoyn.QStatus.FAIL; // create+activate the interface AllJoyn.InterfaceDescription testIntf = null; status = servicebus.CreateInterface(INTERFACE_NAME, out testIntf); Assert.Equal(AllJoyn.QStatus.OK, status); Assert.NotNull(testIntf); status = testIntf.AddMember(AllJoyn.Message.Type.MethodCall, "ping", "s", "s", "in,out"); Assert.Equal(AllJoyn.QStatus.OK, status); testIntf.Activate(); // register bus listener AllJoyn.BusListener testBusListener = new TestBusListener(this); servicebus.RegisterBusListener(testBusListener); // create the bus object // the MethodTestBusObject constructor adds the interface & a handler for the ping method MethodTestBusObject methodTestBusObject = new MethodTestBusObject(servicebus, OBJECT_PATH); // register the bus object status = servicebus.RegisterBusObject(methodTestBusObject); Assert.Equal(AllJoyn.QStatus.OK, status); // request name nameOwnerChangedFlag = false; status = servicebus.RequestName(OBJECT_NAME, AllJoyn.DBus.NameFlags.ReplaceExisting | AllJoyn.DBus.NameFlags.DoNotQueue); Assert.Equal(AllJoyn.QStatus.OK, status); Wait(MaxWaitTime); Assert.Equal(true, nameOwnerChangedFlag); // create+activate the interface AllJoyn.InterfaceDescription iFace = null; status = bus.CreateInterface(INTERFACE_NAME, out iFace); Assert.Equal(AllJoyn.QStatus.OK, status); Assert.NotNull(iFace); status = iFace.AddMember(AllJoyn.Message.Type.MethodCall, "ping", "s", "s", "in,out"); Assert.Equal(AllJoyn.QStatus.OK, status); iFace.Activate(); proxyBusObject = new AllJoyn.ProxyBusObject(bus, OBJECT_NAME, OBJECT_PATH, 0); status = proxyBusObject.AddInterface(iFace); Assert.Equal(AllJoyn.QStatus.OK, status); AllJoyn.MsgArg input = new AllJoyn.MsgArg(); input.Set("AllJoyn"); AllJoyn.Message replyMsg = new AllJoyn.Message(bus); status = proxyBusObject.MethodCall(INTERFACE_NAME, "ping", input, replyMsg, 5000, 0); Assert.Equal(AllJoyn.QStatus.OK, status); Assert.Equal("AllJoyn", (string)replyMsg[0]); //continue testing obsolete method calls till they are removed. #pragma warning disable 618 AllJoyn.MsgArg input1 = new AllJoyn.MsgArg(); input1.Set("AllJoyn"); AllJoyn.Message replyMsg1 = new AllJoyn.Message(bus); status = proxyBusObject.MethodCallSynch(INTERFACE_NAME, "ping", input1, replyMsg1, 5000, 0); Assert.Equal(AllJoyn.QStatus.OK, status); Assert.Equal("AllJoyn", (string)replyMsg1[0]); AllJoyn.MsgArgs input2 = new AllJoyn.MsgArgs(1); input2[0].Set("AllJoyn"); AllJoyn.Message replyMsg2 = new AllJoyn.Message(bus); status = proxyBusObject.MethodCallSynch(INTERFACE_NAME, "ping", input2, replyMsg2, 5000, 0); Assert.Equal(AllJoyn.QStatus.OK, status); Assert.Equal("AllJoyn", (string)replyMsg2[0]); #pragma warning restore 618 methodTestBusObject.Dispose(); }
public void GetSignal() { // create the interface AllJoyn.InterfaceDescription testIntf = null; status = bus.CreateInterface(INTERFACE_NAME, out testIntf); Assert.Equal(AllJoyn.QStatus.OK, status); Assert.NotNull(testIntf); Assert.Equal(AllJoyn.QStatus.OK, testIntf.AddMethod("foo", "", "", "")); status = testIntf.AddSignal("chirp", "s", "data", AllJoyn.InterfaceDescription.AnnotationFlags.Default); Assert.Equal(AllJoyn.QStatus.OK, status); // Verify the signal AllJoyn.InterfaceDescription.Member signalMember = null; signalMember = testIntf.GetSignal("chirp"); Assert.NotNull(signalMember); Assert.Equal(testIntf, signalMember.Iface); Assert.Equal(AllJoyn.Message.Type.Signal, signalMember.MemberType); Assert.Equal("chirp", signalMember.Name); Assert.Equal("s", signalMember.Signature); Assert.Equal("", signalMember.ReturnSignature); Assert.Equal("data", signalMember.ArgNames); AllJoyn.InterfaceDescription.Member methodMember = null; methodMember = testIntf.GetSignal("foo"); //since "foo" is a method GetSignal should return null Assert.Null(methodMember); methodMember = testIntf.GetSignal("bar"); // "bar" is not a member of the interface it should return null Assert.Null(methodMember); }
public void SignalAnnotations() { // create the interface AllJoyn.InterfaceDescription testIntf = null; status = bus.CreateInterface(INTERFACE_NAME, out testIntf); Assert.Equal(AllJoyn.QStatus.OK, status); Assert.NotNull(testIntf); // Test adding a Signal status = testIntf.AddMember(AllJoyn.Message.Type.Signal, "chirp", "", "s", "chirp", AllJoyn.InterfaceDescription.AnnotationFlags.Default); Assert.Equal(AllJoyn.QStatus.OK, status); status = testIntf.AddMemberAnnotation("chirp", "org.alljoyn.test.annotation.one", "here"); Assert.Equal(AllJoyn.QStatus.OK, status); status = testIntf.AddMemberAnnotation("chirp", "org.alljoyn.test.annotation.two", "lies"); Assert.Equal(AllJoyn.QStatus.OK, status); status = testIntf.AddMemberAnnotation("chirp", "org.alljoyn.test.annotation.three", "some"); Assert.Equal(AllJoyn.QStatus.OK, status); status = testIntf.AddMemberAnnotation("chirp", "org.alljoyn.test.annotation.four", "amazing"); Assert.Equal(AllJoyn.QStatus.OK, status); status = testIntf.AddMemberAnnotation("chirp", "org.alljoyn.test.annotation.five", "treasure"); Assert.Equal(AllJoyn.QStatus.OK, status); // activate the interface testIntf.Activate(); string value = ""; testIntf.GetMemberAnnotation("chirp", "org.alljoyn.test.annotation.one", ref value); Assert.Equal("here", value); AllJoyn.InterfaceDescription.Member signal = testIntf.GetMember("chirp"); Assert.True(signal.GetAnnotation("org.alljoyn.test.annotation.two", ref value)); Assert.Equal("lies", value); Dictionary<string, string> annotations = signal.GetAnnotations(); Assert.Equal(5, annotations.Count); Assert.True(annotations.TryGetValue("org.alljoyn.test.annotation.one", out value)); Assert.Equal("here", value); Assert.True(annotations.TryGetValue("org.alljoyn.test.annotation.two", out value)); Assert.Equal("lies", value); Assert.True(annotations.TryGetValue("org.alljoyn.test.annotation.three", out value)); Assert.Equal("some", value); Assert.True(annotations.TryGetValue("org.alljoyn.test.annotation.four", out value)); Assert.Equal("amazing", value); Assert.True(annotations.TryGetValue("org.alljoyn.test.annotation.five", out value)); Assert.Equal("treasure", value); }
public void IsSecure_DepricatedCreateInterface() { // create an insecure interface AllJoyn.InterfaceDescription testIntf = null; status = bus.CreateInterface(INTERFACE_NAME, false, out testIntf); Assert.Equal(AllJoyn.QStatus.OK, status); Assert.NotNull(testIntf); Assert.Equal(false, testIntf.IsSecure); bus.DeleteInterface(testIntf); // create a secure interface status = bus.CreateInterface(INTERFACE_NAME, true, out testIntf); Assert.Equal(AllJoyn.QStatus.OK, status); Assert.NotNull(testIntf); Assert.Equal(true, testIntf.IsSecure); }
public void PropertyAnnotations() { // create the interface AllJoyn.InterfaceDescription testIntf = null; status = bus.CreateInterface(INTERFACE_NAME, out testIntf); Assert.Equal(AllJoyn.QStatus.OK, status); Assert.NotNull(testIntf); status = testIntf.AddProperty("prop", "s", AllJoyn.InterfaceDescription.AccessFlags.Read); Assert.Equal(AllJoyn.QStatus.OK, status); status = testIntf.AddPropertyAnnotation("prop", "org.alljoyn.test.annotation.one", "here"); Assert.Equal(AllJoyn.QStatus.OK, status); status = testIntf.AddPropertyAnnotation("prop", "org.alljoyn.test.annotation.two", "lies"); Assert.Equal(AllJoyn.QStatus.OK, status); status = testIntf.AddPropertyAnnotation("prop", "org.alljoyn.test.annotation.three", "some"); Assert.Equal(AllJoyn.QStatus.OK, status); status = testIntf.AddPropertyAnnotation("prop", "org.alljoyn.test.annotation.four", "amazing"); Assert.Equal(AllJoyn.QStatus.OK, status); status = testIntf.AddPropertyAnnotation("prop", "org.alljoyn.test.annotation.five", "treasure"); Assert.Equal(AllJoyn.QStatus.OK, status); // activate the interface testIntf.Activate(); AllJoyn.InterfaceDescription.Property property = testIntf.GetProperty("prop"); Assert.Equal("prop", property.Name); Assert.Equal("s", property.Signature); Assert.Equal(AllJoyn.InterfaceDescription.AccessFlags.Read, property.Access); string value = ""; Assert.True(testIntf.GetPropertyAnnotation("prop", "org.alljoyn.test.annotation.one", ref value)); Assert.Equal("here", value); Assert.True(property.GetAnnotation("org.alljoyn.test.annotation.two", ref value)); Assert.Equal("lies", value); Dictionary<string, string> annotations = property.GetAnnotations(); Assert.Equal(5, annotations.Count); Assert.True(annotations.TryGetValue("org.alljoyn.test.annotation.one", out value)); Assert.Equal("here", value); Assert.True(annotations.TryGetValue("org.alljoyn.test.annotation.two", out value)); Assert.Equal("lies", value); Assert.True(annotations.TryGetValue("org.alljoyn.test.annotation.three", out value)); Assert.Equal("some", value); Assert.True(annotations.TryGetValue("org.alljoyn.test.annotation.four", out value)); Assert.Equal("amazing", value); Assert.True(annotations.TryGetValue("org.alljoyn.test.annotation.five", out value)); Assert.Equal("treasure", value); }
public void AddProperty() { // create the interface AllJoyn.InterfaceDescription testIntf = null; status = bus.CreateInterface(INTERFACE_NAME, out testIntf); Assert.Equal(AllJoyn.QStatus.OK, status); Assert.NotNull(testIntf); status = testIntf.AddProperty("prop1", "s", AllJoyn.InterfaceDescription.AccessFlags.Read); Assert.Equal(AllJoyn.QStatus.OK, status); status = testIntf.AddProperty("prop2", "i", AllJoyn.InterfaceDescription.AccessFlags.Write); Assert.Equal(AllJoyn.QStatus.OK, status); status = testIntf.AddProperty("prop3", "u", AllJoyn.InterfaceDescription.AccessFlags.ReadWrite); Assert.Equal(AllJoyn.QStatus.OK, status); }
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); }
public void HasProperty() { // create the interface AllJoyn.InterfaceDescription testIntf = null; status = bus.CreateInterface(INTERFACE_NAME, out testIntf); Assert.Equal(AllJoyn.QStatus.OK, status); Assert.NotNull(testIntf); status = testIntf.AddProperty("prop1", "s", AllJoyn.InterfaceDescription.AccessFlags.Read); Assert.Equal(AllJoyn.QStatus.OK, status); status = testIntf.AddProperty("prop2", "i", AllJoyn.InterfaceDescription.AccessFlags.Write); Assert.Equal(AllJoyn.QStatus.OK, status); status = testIntf.AddProperty("prop3", "u", AllJoyn.InterfaceDescription.AccessFlags.ReadWrite); Assert.Equal(AllJoyn.QStatus.OK, status); // check for the properties Assert.Equal(true, testIntf.HasProperty("prop1")); Assert.Equal(true, testIntf.HasProperty("prop2")); Assert.Equal(true, testIntf.HasProperty("prop3")); Assert.Equal(false, testIntf.HasProperty("invalid_prop")); }
public void HasProperties() { // create the interface AllJoyn.InterfaceDescription testIntf = null; status = bus.CreateInterface(INTERFACE_NAME, out testIntf); Assert.Equal(AllJoyn.QStatus.OK, status); Assert.NotNull(testIntf); /* * At this point this is an empty interface the call to hasproperties should * return false. */ Assert.False(testIntf.HasProperties); status = testIntf.AddMember(AllJoyn.Message.Type.MethodCall, "ping", "s", "s", "in,out", AllJoyn.InterfaceDescription.AnnotationFlags.Default); Assert.Equal(AllJoyn.QStatus.OK, status); /* * At this point the interface only contains a method call the call to * hasproperties should return false. */ Assert.False(testIntf.HasProperties); status = testIntf.AddProperty("prop1", "s", AllJoyn.InterfaceDescription.AccessFlags.Read); Assert.Equal(AllJoyn.QStatus.OK, status); /* * At this point the interface only contains a property the call to * hasproperties should return true. */ Assert.True(testIntf.HasProperties); status = testIntf.AddProperty("prop2", "i", AllJoyn.InterfaceDescription.AccessFlags.Write); Assert.Equal(AllJoyn.QStatus.OK, status); status = testIntf.AddProperty("prop3", "u", AllJoyn.InterfaceDescription.AccessFlags.ReadWrite); Assert.Equal(AllJoyn.QStatus.OK, status); /* * At this point the interface only contains multiple properties the call to * hasproperties should return true. */ Assert.True(testIntf.HasProperties); }
public void GetProperty() { // create the interface AllJoyn.InterfaceDescription testIntf = null; status = bus.CreateInterface(INTERFACE_NAME, out testIntf); Assert.Equal(AllJoyn.QStatus.OK, status); Assert.NotNull(testIntf); status = testIntf.AddProperty("prop1", "s", AllJoyn.InterfaceDescription.AccessFlags.Read); Assert.Equal(AllJoyn.QStatus.OK, status); status = testIntf.AddProperty("prop2", "i", AllJoyn.InterfaceDescription.AccessFlags.Write); Assert.Equal(AllJoyn.QStatus.OK, status); status = testIntf.AddProperty("prop3", "u", AllJoyn.InterfaceDescription.AccessFlags.ReadWrite); Assert.Equal(AllJoyn.QStatus.OK, status); AllJoyn.InterfaceDescription.Property prop1 = testIntf.GetProperty("prop1"); Assert.Equal("prop1", prop1.Name); Assert.Equal("s", prop1.Signature); Assert.Equal(AllJoyn.InterfaceDescription.AccessFlags.Read, prop1.Access); AllJoyn.InterfaceDescription.Property prop2 = testIntf.GetProperty("prop2"); Assert.Equal("prop2", prop2.Name); Assert.Equal("i", prop2.Signature); Assert.Equal(AllJoyn.InterfaceDescription.AccessFlags.Write, prop2.Access); AllJoyn.InterfaceDescription.Property prop3 = testIntf.GetProperty("prop3"); Assert.Equal("prop3", prop3.Name); Assert.Equal("u", prop3.Signature); Assert.Equal(AllJoyn.InterfaceDescription.AccessFlags.ReadWrite, prop3.Access); }
public void TestFoundNameByTransport() { listenerRegistered = false; foundAdvertisedName = false; nameOwnerChanged = false; transportFound = AllJoyn.TransportMask.None; // register the bus listener bus.RegisterBusListener(busListener); Wait(MaxWaitTime); Assert.Equal(true, listenerRegistered); AllJoyn.SessionOpts sessionOpts = new AllJoyn.SessionOpts( AllJoyn.SessionOpts.TrafficType.Messages, false, AllJoyn.SessionOpts.ProximityType.Any, AllJoyn.TransportMask.Any); // advertise the name, & see if we find it status = bus.FindAdvertisedNameByTransport(ObjectName, AllJoyn.TransportMask.Local); Assert.Equal(AllJoyn.QStatus.OK, status); status = bus.AdvertiseName(ObjectName, sessionOpts.Transports); Assert.Equal(AllJoyn.QStatus.OK, status); Wait(MaxWaitTime); Assert.Equal(true, foundAdvertisedName); Assert.Equal(AllJoyn.TransportMask.Local, transportFound); status = bus.CancelAdvertisedName(ObjectName, sessionOpts.Transports); Assert.Equal(AllJoyn.QStatus.OK, status); status = bus.CancelFindAdvertisedNameByTransport(ObjectName, AllJoyn.TransportMask.Local); Assert.Equal(AllJoyn.QStatus.OK, status); foundAdvertisedName = false; status = bus.AdvertiseName(ObjectName, sessionOpts.Transports); Assert.Equal(AllJoyn.QStatus.OK, status); Wait(TimeSpan.FromSeconds(1)); Assert.Equal(false, foundAdvertisedName); }
public void GetName() { // create the interface AllJoyn.InterfaceDescription testIntf = null; status = bus.CreateInterface(INTERFACE_NAME, out testIntf); Assert.Equal(AllJoyn.QStatus.OK, status); Assert.NotNull(testIntf); Assert.Equal(INTERFACE_NAME, testIntf.Name); }
public void TestStopDisconnected() { listenerRegistered = false; busDisconnected = false; busStopping = false; // register the bus listener bus.RegisterBusListener(busListener); Wait(MaxWaitTime); Assert.Equal(true, listenerRegistered); // test disconnecting from the bus status = bus.Disconnect(AllJoynTestCommon.GetConnectSpec()); Assert.Equal(AllJoyn.QStatus.OK, status); Wait(MaxWaitTime); Assert.Equal(true, busDisconnected); // test stopping the bus status = bus.Stop(); Assert.Equal(AllJoyn.QStatus.OK, status); Wait(MaxWaitTime); Assert.Equal(true, busStopping); status = bus.Join(); }
public void AddSignal() { // create the interface AllJoyn.InterfaceDescription testIntf = null; status = bus.CreateInterface(INTERFACE_NAME, out testIntf); Assert.Equal(AllJoyn.QStatus.OK, status); Assert.NotNull(testIntf); status = testIntf.AddSignal("signal1", "s", "data", AllJoyn.InterfaceDescription.AnnotationFlags.Default); Assert.Equal(AllJoyn.QStatus.OK, status); // Verify the signal AllJoyn.InterfaceDescription.Member signalMember = null; signalMember = testIntf.GetMember("signal1"); Assert.NotNull(signalMember); Assert.Equal(testIntf, signalMember.Iface); Assert.Equal(AllJoyn.Message.Type.Signal, signalMember.MemberType); Assert.Equal("signal1", signalMember.Name); Assert.Equal("s", signalMember.Signature); Assert.Equal("", signalMember.ReturnSignature); Assert.Equal("data", signalMember.ArgNames); //TODO add in code to use new annotation methods }
public void TestFoundLostAdvertisedName() { listenerRegistered = false; foundAdvertisedName = false; lostAdvertisedName = false; // register the bus listener bus.RegisterBusListener(busListener); Wait(MaxWaitTime); Assert.Equal(true, listenerRegistered); // advertise the name, & see if we find it status = bus.FindAdvertisedName(ObjectName); Assert.Equal(AllJoyn.QStatus.OK, status); AllJoyn.SessionOpts sessionOpts = new AllJoyn.SessionOpts( AllJoyn.SessionOpts.TrafficType.Messages, false, AllJoyn.SessionOpts.ProximityType.Any, AllJoyn.TransportMask.Any); status = bus.AdvertiseName(ObjectName, sessionOpts.Transports); Assert.Equal(AllJoyn.QStatus.OK, status); Wait(MaxWaitTime); Assert.Equal(true, foundAdvertisedName); // stop advertising the name, & see if we lose it status = bus.CancelAdvertisedName(ObjectName, sessionOpts.Transports); Assert.Equal(AllJoyn.QStatus.OK, status); Wait(MaxWaitTime); Assert.Equal(true, lostAdvertisedName); }
public void ObjectRegisteredUnregistered() { // create the bus object TestBusObject testBusObject = new TestBusObject(bus, OBJECT_PATH, this); objectRegistered = false; objectUnregistered = false; // test registering the bus object status = bus.RegisterBusObject(testBusObject); Assert.Equal(AllJoyn.QStatus.OK, status); Wait(MaxWaitTime); Assert.Equal(true, objectRegistered); // test unregistering the bus object bus.UnregisterBusObject(testBusObject); Wait(MaxWaitTime); Assert.Equal(true, objectUnregistered); }