You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ch...@apache.org on 2014/04/23 21:14:09 UTC
svn commit: r1589496 - in /qpid/trunk/qpid/cpp/bindings/qpid/dotnet:
src/Message.cpp src/Message.h
test/messaging.test/messaging.test.connection.cs
test/messaging.test/messaging.test.message.cs
Author: chug
Date: Wed Apr 23 19:14:09 2014
New Revision: 1589496
URL: http://svn.apache.org/r1589496
Log:
QPID-5716: Messaging C++ .NET binding fails to return GetContentObject data
Changes function signature to: object = message.GetContentObject()
Adds self tests using SetContentObject and GetContentObject.
Modified:
qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Message.cpp
qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Message.h
qpid/trunk/qpid/cpp/bindings/qpid/dotnet/test/messaging.test/messaging.test.connection.cs
qpid/trunk/qpid/cpp/bindings/qpid/dotnet/test/messaging.test/messaging.test.message.cs
Modified: qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Message.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Message.cpp?rev=1589496&r1=1589495&r2=1589496&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Message.cpp (original)
+++ qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Message.cpp Wed Apr 23 19:14:09 2014
@@ -565,7 +565,7 @@ namespace Messaging {
}
- void Message::GetContentObject(System::Object ^ managedObject)
+ System::Object ^ Message::GetContentObject()
{
msclr::lock lk(privateLock);
ThrowIfDisposed();
@@ -576,7 +576,7 @@ namespace Messaging {
{
::qpid::types::Variant nativeObject = nativeObjPtr->getContentObject();
- managedObject = TypeTranslator::NativeToManagedObject(nativeObject);
+ return TypeTranslator::NativeToManagedObject(nativeObject);
}
catch (const ::qpid::types::Exception & error)
{
Modified: qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Message.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Message.h?rev=1589496&r1=1589495&r2=1589496&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Message.h (original)
+++ qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/Message.h Wed Apr 23 19:14:09 2014
@@ -455,7 +455,7 @@ namespace Messaging {
void GetContent(cli::array<System::Byte> ^ arr);
// get content as object
- void GetContentObject(System::Object ^ object);
+ System::Object ^ GetContentObject();
//
// ContentSize
Modified: qpid/trunk/qpid/cpp/bindings/qpid/dotnet/test/messaging.test/messaging.test.connection.cs
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/dotnet/test/messaging.test/messaging.test.connection.cs?rev=1589496&r1=1589495&r2=1589496&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/dotnet/test/messaging.test/messaging.test.connection.cs (original)
+++ qpid/trunk/qpid/cpp/bindings/qpid/dotnet/test/messaging.test/messaging.test.connection.cs Wed Apr 23 19:14:09 2014
@@ -54,9 +54,7 @@ namespace Org.Apache.Qpid.Messaging.Unit
public void ConnectionCreate_2()
{
Dictionary<string, object> options = new Dictionary<string, object>();
- options["id"] = 987654321;
- options["name"] = "Widget";
- options["percent"] = 0.99;
+ options["reconnect"] = true;
Connection myConn = new Connection("url", options);
Assert.IsFalse(myConn.IsOpen);
@@ -73,12 +71,10 @@ namespace Org.Apache.Qpid.Messaging.Unit
public void ConnectionSetOption()
{
Dictionary<string, object> options = new Dictionary<string, object>();
- options["id"] = 987654321;
- options["name"] = "Widget";
- options["percent"] = 0.99;
+ options["reconnect"] = true;
Connection myConn = new Connection("url", options);
- myConn.SetOption("name", "purple");
+ myConn.SetOption("reconnect", false);
Assert.IsFalse(myConn.IsOpen);
}
@@ -87,9 +83,6 @@ namespace Org.Apache.Qpid.Messaging.Unit
public void ConnectionClose()
{
Dictionary<string, object> options = new Dictionary<string, object>();
- options["id"] = 987654321;
- options["name"] = "Widget";
- options["percent"] = 0.99;
Connection myConn = new Connection("url", options);
myConn.Close();
Modified: qpid/trunk/qpid/cpp/bindings/qpid/dotnet/test/messaging.test/messaging.test.message.cs
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/dotnet/test/messaging.test/messaging.test.message.cs?rev=1589496&r1=1589495&r2=1589496&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/dotnet/test/messaging.test/messaging.test.message.cs (original)
+++ qpid/trunk/qpid/cpp/bindings/qpid/dotnet/test/messaging.test/messaging.test.message.cs Wed Apr 23 19:14:09 2014
@@ -240,8 +240,8 @@ namespace Org.Apache.Qpid.Messaging.Unit
StringAssert.IsMatch("System.Boolean", rxContent["mybool"].GetType().ToString());
bool rxbool = (bool)rxContent["mybool"];
- StringAssert.IsMatch("System.SByte", rxContent["mybyte"].GetType().ToString());
- sbyte rxbyte = (sbyte)rxContent["mybyte"];
+ StringAssert.IsMatch("System.Byte", rxContent["mybyte"].GetType().ToString());
+ byte rxbyte = (byte)rxContent["mybyte"];
StringAssert.IsMatch("System.UInt16", rxContent["myUInt16"].GetType().ToString());
UInt16 rxUInt16 = (UInt16)rxContent["myUInt16"];
@@ -252,7 +252,7 @@ namespace Org.Apache.Qpid.Messaging.Unit
StringAssert.IsMatch("System.UInt64", rxContent["myUInt64"].GetType().ToString());
UInt64 rxUInt64 = (UInt64)rxContent["myUInt64"];
- StringAssert.IsMatch("System.Int32", rxContent["mychar"].GetType().ToString());
+ StringAssert.IsMatch("System.SByte", rxContent["mychar"].GetType().ToString());
char rxchar = System.Convert.ToChar(rxContent["mychar"]);
StringAssert.IsMatch("System.Int16", rxContent["myInt16"].GetType().ToString());
@@ -288,7 +288,93 @@ namespace Org.Apache.Qpid.Messaging.Unit
Assert.AreEqual(11, rxInt64);
Assert.AreEqual((Single)12.12, rxSingle);
Assert.AreEqual((Double)13.13, rxDouble);
- StringAssert.IsMatch("00010203-0405-0607-0809-0a0b0c0d0e0f", rxGuid.ToString());
+ StringAssert.IsMatch("03020100-0504-0706-0809-0a0b0c0d0e0f", rxGuid.ToString());
+ }
+
+ [Test]
+ public void MessageContentAsObject()
+ {
+ // Only processes primitive data types
+
+ // Create the message
+ Message message = new Message();
+ Object gotThis = new Object();
+
+
+ // add one of each supported amqp data type
+ bool mybool = true;
+ message.SetContentObject(mybool);
+ gotThis = message.GetContentObject();
+ StringAssert.IsMatch("System.Boolean", gotThis.GetType().ToString());
+ Assert.IsTrue(gotThis.Equals(mybool));
+
+ byte mybyte = 4;
+ message.SetContentObject(mybyte);
+ gotThis = message.GetContentObject();
+ StringAssert.IsMatch("System.Byte", gotThis.GetType().ToString());
+ Assert.IsTrue(gotThis.Equals(mybyte));
+
+ UInt16 myUInt16 = 5;
+ message.SetContentObject(myUInt16);
+ gotThis = message.GetContentObject();
+ StringAssert.IsMatch("System.UInt16", gotThis.GetType().ToString());
+ Assert.IsTrue(gotThis.Equals(myUInt16));
+
+ UInt32 myUInt32 = 6;
+ message.SetContentObject(myUInt32);
+ gotThis = message.GetContentObject();
+ StringAssert.IsMatch("System.UInt32", gotThis.GetType().ToString());
+ Assert.IsTrue(gotThis.Equals(myUInt32));
+
+ UInt64 myUInt64 = 7;
+ message.SetContentObject(myUInt64);
+ gotThis = message.GetContentObject();
+ StringAssert.IsMatch("System.UInt64", gotThis.GetType().ToString());
+ Assert.IsTrue(gotThis.Equals(myUInt64));
+
+ char mychar = 'h';
+ message.SetContentObject(mychar);
+ gotThis = message.GetContentObject();
+ StringAssert.IsMatch("System.SByte", gotThis.GetType().ToString());
+ char result;
+ result = Convert.ToChar(gotThis);
+ Assert.IsTrue(result.Equals(mychar));
+
+ Int16 myInt16 = 9;
+ message.SetContentObject(myInt16);
+ gotThis = message.GetContentObject();
+ StringAssert.IsMatch("System.Int16", gotThis.GetType().ToString());
+ Assert.IsTrue(gotThis.Equals(myInt16));
+
+ Int32 myInt32 = 10;
+ message.SetContentObject(myInt32);
+ gotThis = message.GetContentObject();
+ StringAssert.IsMatch("System.Int32", gotThis.GetType().ToString());
+ Assert.IsTrue(gotThis.Equals(myInt32));
+
+ Int64 myInt64 = 11;
+ message.SetContentObject(myInt64);
+ gotThis = message.GetContentObject();
+ StringAssert.IsMatch("System.Int64", gotThis.GetType().ToString());
+ Assert.IsTrue(gotThis.Equals(myInt64));
+
+ Single mySingle = (Single)12.12;
+ message.SetContentObject(mySingle);
+ gotThis = message.GetContentObject();
+ StringAssert.IsMatch("System.Single", gotThis.GetType().ToString());
+ Assert.IsTrue(gotThis.Equals(mySingle));
+
+ Double myDouble = 13.13;
+ message.SetContentObject(myDouble);
+ gotThis = message.GetContentObject();
+ StringAssert.IsMatch("System.Double", gotThis.GetType().ToString());
+ Assert.IsTrue(gotThis.Equals(myDouble));
+
+ Guid myGuid = new Guid("000102030405060708090a0b0c0d0e0f");
+ message.SetContentObject(myGuid);
+ gotThis = message.GetContentObject();
+ StringAssert.IsMatch("System.Guid", gotThis.GetType().ToString());
+ StringAssert.IsMatch("03020100-0504-0706-0809-0a0b0c0d0e0f", gotThis.ToString());
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org