Return-Path: Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: (qmail 70657 invoked from network); 26 Aug 2009 23:42:55 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 26 Aug 2009 23:42:55 -0000 Received: (qmail 50989 invoked by uid 500); 26 Aug 2009 23:42:54 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 50928 invoked by uid 500); 26 Aug 2009 23:42:54 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 50917 invoked by uid 99); 26 Aug 2009 23:42:54 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 Aug 2009 23:42:54 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 Aug 2009 23:42:50 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id A70EF23888DC; Wed, 26 Aug 2009 23:42:30 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r808223 [2/2] - in /activemq/activemq-dotnet: Apache.NMS.ActiveMQ/trunk/ Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/ Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Tcp/ Apache... Date: Wed, 26 Aug 2009 23:42:29 -0000 To: commits@activemq.apache.org From: jgomes@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090826234230.A70EF23888DC@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Copied: activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/EndianBinaryReader.cs (from r806651, activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/OpenWireBinaryReader.cs) URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/EndianBinaryReader.cs?p2=activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/EndianBinaryReader.cs&p1=activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/OpenWireBinaryReader.cs&r1=806651&r2=808223&rev=808223&view=diff ============================================================================== --- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/OpenWireBinaryReader.cs (original) +++ activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/EndianBinaryReader.cs Wed Aug 26 23:42:27 2009 @@ -14,24 +14,25 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + using System; using System.IO; using System.Text; -namespace Apache.NMS.ActiveMQ.OpenWire +namespace Apache.NMS.Util { - /// - /// A BinaryWriter that switches the endian orientation of the read opperations so that they - /// are compatible with marshalling used by OpenWire. - /// + /// + /// A BinaryWriter that switches the endian orientation of the read operations so that they + /// are compatible across platforms. + /// [CLSCompliant(false)] - public class OpenWireBinaryReader : BinaryReader - { - - public OpenWireBinaryReader(Stream input) : base(input) + public class EndianBinaryReader : BinaryReader + { + public EndianBinaryReader(Stream input) + : base(input) { } - + /// /// Method Read /// @@ -42,12 +43,13 @@ public override int Read(char[] buffer, int index, int count) { int size = base.Read(buffer, index, count); - for( int i=0; i < size; i++ ) { - buffer[index+i] = EndianSupport.SwitchEndian(buffer[index+i]); + for(int i = 0; i < size; i++) + { + buffer[index + i] = EndianSupport.SwitchEndian(buffer[index + i]); } return size; } - + /// /// Method ReadChars /// @@ -56,14 +58,16 @@ public override char[] ReadChars(int count) { char[] rc = base.ReadChars(count); - if( rc!=null ) { - for( int i=0; i < rc.Length; i++ ) { + if(rc != null) + { + for(int i = 0; i < rc.Length; i++) + { rc[i] = EndianSupport.SwitchEndian(rc[i]); } } return rc; } - + /// /// Method ReadInt16 /// @@ -72,7 +76,7 @@ { return EndianSupport.SwitchEndian(base.ReadInt16()); } - + /// /// Method ReadChar /// @@ -80,13 +84,13 @@ public override char ReadChar() { return (char) ( - (((char)( (byte)(base.ReadByte()) )) << 8 ) | - (((char)( (byte)(base.ReadByte()) )) ) + (((char) ((byte) (base.ReadByte()))) << 8) | + (((char) ((byte) (base.ReadByte())))) ); - -// return EndianSupport.SwitchEndian(base.ReadChar()); + + // return EndianSupport.SwitchEndian(base.ReadChar()); } - + /// /// Method ReadInt64 /// @@ -95,7 +99,7 @@ { return EndianSupport.SwitchEndian(base.ReadInt64()); } - + /// /// Method ReadUInt64 /// @@ -104,7 +108,7 @@ { return EndianSupport.SwitchEndian(base.ReadUInt64()); } - + /// /// Method ReadUInt32 /// @@ -113,7 +117,7 @@ { return EndianSupport.SwitchEndian(base.ReadUInt32()); } - + /// /// Method ReadUInt16 /// @@ -122,7 +126,7 @@ { return EndianSupport.SwitchEndian(base.ReadUInt16()); } - + /// /// Method ReadInt32 /// @@ -133,260 +137,274 @@ int y = EndianSupport.SwitchEndian(x); return y; } - + /// /// Method ReadString /// /// A string public override String ReadString() { - short utflen = ReadInt16(); - if (utflen > -1) - { - StringBuilder str = new StringBuilder(utflen); - - byte[] bytearr = new byte[utflen]; - int bytesRead = 0; - while (bytesRead < utflen) - { - int rc = Read(bytearr, bytesRead, utflen-bytesRead); - if (rc == 0) - throw new IOException("premature end of stream"); - bytesRead += rc; - } - - int c, char2, char3; - int count = 0; - - while (count < utflen) - { - c = bytearr[count] & 0xff; - switch (c >> 4) - { - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - /* 0xxxxxxx */ - count++; - str.Append((char) c); - break; - case 12: - case 13: - /* 110x xxxx 10xx xxxx */ - count += 2; - if (count > utflen) - { - throw CreateDataFormatException(); - } - char2 = bytearr[count - 1]; - if ((char2 & 0xC0) != 0x80) - { - throw CreateDataFormatException(); - } - str.Append((char) (((c & 0x1F) << 6) | (char2 & 0x3F))); - break; - case 14: - /* 1110 xxxx 10xx xxxx 10xx xxxx */ - count += 3; - if (count > utflen) - { - throw CreateDataFormatException(); - } - char2 = bytearr[count - 2]; - char3 = bytearr[count - 1]; - if (((char2 & 0xC0) != 0x80) || ((char3 & 0xC0) != 0x80)) - { - throw CreateDataFormatException(); - } - str.Append((char) (((c & 0x0F) << 12) | ((char2 & 0x3F) << 6) | ((char3 & 0x3F) << 0))); - break; - default : - /* 10xx xxxx, 1111 xxxx */ - throw CreateDataFormatException(); - } - } + short utflen = ReadInt16(); + if(utflen > -1) + { + StringBuilder str = new StringBuilder(utflen); + + byte[] bytearr = new byte[utflen]; + int bytesRead = 0; + while(bytesRead < utflen) + { + int rc = Read(bytearr, bytesRead, utflen - bytesRead); + if(rc == 0) + { + throw new IOException("premature end of stream"); + } + + bytesRead += rc; + } + + int c, char2, char3; + int count = 0; + + while(count < utflen) + { + c = bytearr[count] & 0xff; + switch(c >> 4) + { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + /* 0xxxxxxx */ + count++; + str.Append((char) c); + break; + case 12: + case 13: + /* 110x xxxx 10xx xxxx */ + count += 2; + if(count > utflen) + { + throw CreateDataFormatException(); + } + + char2 = bytearr[count - 1]; + if((char2 & 0xC0) != 0x80) + { + throw CreateDataFormatException(); + } + + str.Append((char) (((c & 0x1F) << 6) | (char2 & 0x3F))); + break; + case 14: + /* 1110 xxxx 10xx xxxx 10xx xxxx */ + count += 3; + if(count > utflen) + { + throw CreateDataFormatException(); + } + + char2 = bytearr[count - 2]; + char3 = bytearr[count - 1]; + if(((char2 & 0xC0) != 0x80) || ((char3 & 0xC0) != 0x80)) + { + throw CreateDataFormatException(); + } + + str.Append((char) (((c & 0x0F) << 12) | ((char2 & 0x3F) << 6) | ((char3 & 0x3F) << 0))); + break; + default: + /* 10xx xxxx, 1111 xxxx */ + throw CreateDataFormatException(); + } + } // The number of chars produced may be less than utflen - return str.ToString(); - } - else - { - return null; - } - } - - /// - /// Method ReadString16, reads a String value encoded in the Java modified - /// UTF-8 format with a length index encoded as a 16bit unsigned short. - /// - /// A string - public String ReadString16() - { - int utfLength = ReadUInt16(); - - if (utfLength <= 0) - { - return ""; - } - - char[] result = new char[utfLength]; - byte[] buffer = new byte[utfLength]; - - int bytesRead = 0; - while (bytesRead < utfLength) - { - int rc = Read(buffer, bytesRead, utfLength - bytesRead); - if (rc == 0) - throw new IOException("premature end of stream"); - bytesRead += rc; - } - - int count = 0; - int index = 0; - byte a = 0; - - while (count < utfLength) - { - if ((result[index] = (char)buffer[count++]) < 0x80) - { - index++; - } - else if (((a = (byte)result[index]) & 0xE0) == 0xC0) - { - if (count >= utfLength) - { - throw new IOException("Invalid UTF-8 encoding found, start of two byte char found at end."); - } - - byte b = buffer[count++]; - if ((b & 0xC0) != 0x80) - { - throw new IOException( - "Invalid UTF-8 encoding found, byte two does not start with 0x80."); - } - - result[index++] = (char)(((a & 0x1F) << 6) | (b & 0x3F)); - - } - else if ((a & 0xF0) == 0xE0) - { - - if (count + 1 >= utfLength) - { - throw new IOException( - "Invalid UTF-8 encoding found, start of three byte char found at end."); - } - - byte b = buffer[count++]; - byte c = buffer[count++]; - if (((b & 0xC0) != 0x80) || ((c & 0xC0) != 0x80)) - { - throw new IOException( - "Invalid UTF-8 encoding found, byte two does not start with 0x80."); - } - - result[index++] = (char)(((a & 0x0F) << 12) | - ((b & 0x3F) << 6) | (c & 0x3F)); - - } - else - { - throw new IOException("Invalid UTF-8 encoding found, aborting."); - } - } - - return new String(result, 0, index); - } - - /// - /// Method ReadString32, reads a String value encoded in the Java modified - /// UTF-8 format with a length index encoded as a singed integer value. - /// - /// A string - public String ReadString32() - { - int utfLength = ReadInt32(); - - if( utfLength <= 0 ) { - return ""; - } - - char[] result = new char[utfLength]; - byte[] buffer = new byte[utfLength]; - - int bytesRead = 0; - while (bytesRead < utfLength) - { - int rc = Read(buffer, bytesRead, utfLength - bytesRead); - if (rc == 0) - throw new IOException("premature end of stream"); - bytesRead += rc; - } - - int count = 0; - int index = 0; - byte a = 0; - - while( count < utfLength ) { - if( ( result[index] = (char)buffer[count++] ) < 0x80 ) { - index++; - } else if( ( ( a = (byte)result[index] ) & 0xE0 ) == 0xC0 ) { - if( count >= utfLength ) { - throw new IOException("Invalid UTF-8 encoding found, start of two byte char found at end."); - } - - byte b = buffer[count++]; - if( ( b & 0xC0 ) != 0x80 ) { - throw new IOException( - "Invalid UTF-8 encoding found, byte two does not start with 0x80." ); - } - - result[index++] = (char)( ( ( a & 0x1F ) << 6 ) | ( b & 0x3F ) ); - - } else if( ( a & 0xF0 ) == 0xE0 ) { - - if( count + 1 >= utfLength ) { - throw new IOException( - "Invalid UTF-8 encoding found, start of three byte char found at end."); - } - - byte b = buffer[count++]; - byte c = buffer[count++]; - if( ( ( b & 0xC0 ) != 0x80 ) || ( ( c & 0xC0 ) != 0x80 ) ) { - throw new IOException( - "Invalid UTF-8 encoding found, byte two does not start with 0x80." ); - } - - result[index++] = (char)( ( ( a & 0x0F ) << 12 ) | - ( ( b & 0x3F ) << 6 ) | ( c & 0x3F ) ); - - } else { - throw new IOException( "Invalid UTF-8 encoding found, aborting." ); - } - } - - return new String( result, 0, index ); - } - - public override float ReadSingle() - { - return EndianSupport.SwitchEndian(base.ReadSingle()); - } - - public override double ReadDouble() - { - return EndianSupport.SwitchEndian(base.ReadDouble()); - } - + return str.ToString(); + } + else + { + return null; + } + } + + /// + /// Method ReadString16, reads a String value encoded in the Java modified + /// UTF-8 format with a length index encoded as a 16bit unsigned short. + /// + /// A string + public String ReadString16() + { + int utfLength = ReadUInt16(); + + if(utfLength <= 0) + { + return ""; + } + + char[] result = new char[utfLength]; + byte[] buffer = new byte[utfLength]; + + int bytesRead = 0; + while(bytesRead < utfLength) + { + int rc = Read(buffer, bytesRead, utfLength - bytesRead); + if(rc == 0) + { + throw new IOException("premature end of stream"); + } + + bytesRead += rc; + } + + int count = 0; + int index = 0; + byte a = 0; + + while(count < utfLength) + { + if((result[index] = (char) buffer[count++]) < 0x80) + { + index++; + } + else if(((a = (byte) result[index]) & 0xE0) == 0xC0) + { + if(count >= utfLength) + { + throw new IOException("Invalid UTF-8 encoding found, start of two byte char found at end."); + } + + byte b = buffer[count++]; + if((b & 0xC0) != 0x80) + { + throw new IOException("Invalid UTF-8 encoding found, byte two does not start with 0x80."); + } + + result[index++] = (char) (((a & 0x1F) << 6) | (b & 0x3F)); + } + else if((a & 0xF0) == 0xE0) + { + if(count + 1 >= utfLength) + { + throw new IOException("Invalid UTF-8 encoding found, start of three byte char found at end."); + } + + byte b = buffer[count++]; + byte c = buffer[count++]; + if(((b & 0xC0) != 0x80) || ((c & 0xC0) != 0x80)) + { + throw new IOException("Invalid UTF-8 encoding found, byte two does not start with 0x80."); + } + + result[index++] = (char) (((a & 0x0F) << 12) | + ((b & 0x3F) << 6) | (c & 0x3F)); + } + else + { + throw new IOException("Invalid UTF-8 encoding found, aborting."); + } + } + + return new String(result, 0, index); + } + + /// + /// Method ReadString32, reads a String value encoded in the Java modified + /// UTF-8 format with a length index encoded as a singed integer value. + /// + /// A string + public String ReadString32() + { + int utfLength = ReadInt32(); + + if(utfLength <= 0) + { + return ""; + } + + char[] result = new char[utfLength]; + byte[] buffer = new byte[utfLength]; + + int bytesRead = 0; + while(bytesRead < utfLength) + { + int rc = Read(buffer, bytesRead, utfLength - bytesRead); + if(rc == 0) + { + throw new IOException("premature end of stream"); + } + + bytesRead += rc; + } + + int count = 0; + int index = 0; + byte a = 0; + + while(count < utfLength) + { + if((result[index] = (char) buffer[count++]) < 0x80) + { + index++; + } + else if(((a = (byte) result[index]) & 0xE0) == 0xC0) + { + if(count >= utfLength) + { + throw new IOException("Invalid UTF-8 encoding found, start of two byte char found at end."); + } + + byte b = buffer[count++]; + if((b & 0xC0) != 0x80) + { + throw new IOException("Invalid UTF-8 encoding found, byte two does not start with 0x80."); + } + + result[index++] = (char) (((a & 0x1F) << 6) | (b & 0x3F)); + } + else if((a & 0xF0) == 0xE0) + { + + if(count + 1 >= utfLength) + { + throw new IOException("Invalid UTF-8 encoding found, start of three byte char found at end."); + } + + byte b = buffer[count++]; + byte c = buffer[count++]; + if(((b & 0xC0) != 0x80) || ((c & 0xC0) != 0x80)) + { + throw new IOException("Invalid UTF-8 encoding found, byte two does not start with 0x80."); + } + + result[index++] = (char) (((a & 0x0F) << 12) | + ((b & 0x3F) << 6) | (c & 0x3F)); + } + else + { + throw new IOException("Invalid UTF-8 encoding found, aborting."); + } + } + + return new String(result, 0, index); + } + + public override float ReadSingle() + { + return EndianSupport.SwitchEndian(base.ReadSingle()); + } + + public override double ReadDouble() + { + return EndianSupport.SwitchEndian(base.ReadDouble()); + } + protected static Exception CreateDataFormatException() - { - // TODO: implement a better exception - return new IOException("Data format error!"); - } + { + // TODO: implement a better exception + return new IOException("Data format error!"); + } } } - Copied: activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/EndianBinaryWriter.cs (from r806651, activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/OpenWireBinaryWriter.cs) URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/EndianBinaryWriter.cs?p2=activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/EndianBinaryWriter.cs&p1=activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/OpenWireBinaryWriter.cs&r1=806651&r2=808223&rev=808223&view=diff ============================================================================== --- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/OpenWireBinaryWriter.cs (original) +++ activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/EndianBinaryWriter.cs Wed Aug 26 23:42:27 2009 @@ -14,22 +14,22 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + using System; -using System.Collections; using System.IO; -namespace Apache.NMS.ActiveMQ.OpenWire +namespace Apache.NMS.Util { /// - /// A BinaryWriter that switches the endian orientation of the write opperations so that they - /// are compatible with marshalling used by OpenWire. + /// A BinaryWriter that switches the endian orientation of the write operations so that they + /// are compatible across platforms. /// [CLSCompliant(false)] - public class OpenWireBinaryWriter : BinaryWriter + public class EndianBinaryWriter : BinaryWriter { public const int MAXSTRINGLEN = short.MaxValue; - public OpenWireBinaryWriter(Stream output) + public EndianBinaryWriter(Stream output) : base(output) { } @@ -96,7 +96,6 @@ base.Write(EndianSupport.SwitchEndian(value)); } - /// /// Method Write /// @@ -127,102 +126,102 @@ /// /// Method Write, writes a string to the output using the WriteString16 - /// method. + /// method. /// /// A string - public override void Write(String text) + public override void Write(String text) { - WriteString16(text); + WriteString16(text); } /// - /// Method WriteString16, writes a string to the output using the Java - /// standard modified UTF-8 encoding with an unsigned short value written first to - /// indicate the length of the encoded data, the short is read as an unsigned - /// value so the max amount of data this method can write is 65535 encoded bytes. - /// - /// Unlike the WriteString32 method this method does not encode the length - /// value to -1 if the string is null, this is to match the behaviour of - /// the Java DataOuputStream class's writeUTF method. - /// - /// Because modified UTF-8 encding can result in a number of bytes greater that - /// the size of the String this method must first check that the encoding proces - /// will not result in a value that cannot be written becuase it is greater than - /// the max value of an unsigned short. - /// + /// Method WriteString16, writes a string to the output using the Java + /// standard modified UTF-8 encoding with an unsigned short value written first to + /// indicate the length of the encoded data, the short is read as an unsigned + /// value so the max amount of data this method can write is 65535 encoded bytes. + /// + /// Unlike the WriteString32 method this method does not encode the length + /// value to -1 if the string is null, this is to match the behaviour of + /// the Java DataOuputStream class's writeUTF method. + /// + /// Because modified UTF-8 encding can result in a number of bytes greater that + /// the size of the String this method must first check that the encoding proces + /// will not result in a value that cannot be written becuase it is greater than + /// the max value of an unsigned short. + /// /// A string public void WriteString16(String text) { - if (text != null) - { - if (text.Length > ushort.MaxValue) - { - throw new IOException( - String.Format( - "Cannot marshall string longer than: {0} characters, supplied string was: " + - "{1} characters", ushort.MaxValue, text.Length)); - } - - char[] charr = text.ToCharArray(); - uint utfLength = CountUtf8Bytes(charr); - - if (utfLength > ushort.MaxValue) - { - throw new IOException( - String.Format( - "Cannot marshall an encoded string longer than: {0} bytes, supplied" + - "string requires: {1} characters to encode", ushort.MaxValue, utfLength)); - } - - byte[] bytearr = new byte[utfLength]; - encodeUTF8toBuffer(charr, bytearr); - - Write( (ushort)utfLength); - Write(bytearr); - } - } - - /// - /// Method WriteString32, writes a string to the output using the Openwire - /// standard modified UTF-8 encoding which an int value written first to - /// indicate the length of the encoded data, the int is read as an signed - /// value so the max amount of data this method can write is 2^31 encoded bytes. - /// - /// In the case of a null value being passed this method writes a -1 to the - /// stream to indicate that the string is null. - /// - /// Because modified UTF-8 encding can result in a number of bytes greater that - /// the size of the String this method must first check that the encoding proces - /// will not result in a value that cannot be written becuase it is greater than - /// the max value of an int. - /// - /// A string - public void WriteString32(String text) - { - if( text != null ) { + if(text != null) + { + if(text.Length > ushort.MaxValue) + { + throw new IOException( + String.Format( + "Cannot marshall string longer than: {0} characters, supplied string was: " + + "{1} characters", ushort.MaxValue, text.Length)); + } char[] charr = text.ToCharArray(); - uint utfLength = CountUtf8Bytes(charr); + uint utfLength = CountUtf8Bytes(charr); - if( utfLength > int.MaxValue ) - { + if(utfLength > ushort.MaxValue) + { throw new IOException( - String.Format( - "Cannot marshall an encoded string longer than: {0} bytes, supplied" + - "string requires: {1} characters to encode", int.MaxValue, utfLength ) ); - } - - byte[] bytearr = new byte[utfLength]; - encodeUTF8toBuffer(charr, bytearr); - - Write(utfLength); - Write(bytearr); - } - else - { - Write((int)-1); - } - } + String.Format( + "Cannot marshall an encoded string longer than: {0} bytes, supplied" + + "string requires: {1} characters to encode", ushort.MaxValue, utfLength)); + } + + byte[] bytearr = new byte[utfLength]; + encodeUTF8toBuffer(charr, bytearr); + + Write((ushort) utfLength); + Write(bytearr); + } + } + + /// + /// Method WriteString32, writes a string to the output using the Openwire + /// standard modified UTF-8 encoding which an int value written first to + /// indicate the length of the encoded data, the int is read as an signed + /// value so the max amount of data this method can write is 2^31 encoded bytes. + /// + /// In the case of a null value being passed this method writes a -1 to the + /// stream to indicate that the string is null. + /// + /// Because modified UTF-8 encding can result in a number of bytes greater that + /// the size of the String this method must first check that the encoding proces + /// will not result in a value that cannot be written becuase it is greater than + /// the max value of an int. + /// + /// A string + public void WriteString32(String text) + { + if(text != null) + { + char[] charr = text.ToCharArray(); + uint utfLength = CountUtf8Bytes(charr); + + if(utfLength > int.MaxValue) + { + throw new IOException( + String.Format( + "Cannot marshall an encoded string longer than: {0} bytes, supplied" + + "string requires: {1} characters to encode", int.MaxValue, utfLength)); + } + + byte[] bytearr = new byte[utfLength]; + encodeUTF8toBuffer(charr, bytearr); + + Write(utfLength); + Write(bytearr); + } + else + { + Write((int) -1); + } + } /// /// Method Write @@ -242,56 +241,55 @@ base.Write(EndianSupport.SwitchEndian(value)); } - private uint CountUtf8Bytes(char[] chars) - { - uint utfLength = 0; - int c = 0; - - for (int i = 0; i < chars.Length; i++) - { - c = chars[i]; - if ((c >= 0x0001) && (c <= 0x007F)) - { - utfLength++; - } - else if (c > 0x07FF) - { - utfLength += 3; - } - else - { - utfLength += 2; - } - } - - return utfLength; - } - - private void encodeUTF8toBuffer(char[] chars, byte[] buffer ) - { - int c = 0; - int count = 0; - - for (int i = 0; i < chars.Length; i++) - { - c = chars[i]; - if ((c >= 0x0001) && (c <= 0x007F)) - { - buffer[count++] = (byte)c; - } - else if (c > 0x07FF) - { - buffer[count++] = (byte)(0xE0 | ((c >> 12) & 0x0F)); - buffer[count++] = (byte)(0x80 | ((c >> 6) & 0x3F)); - buffer[count++] = (byte)(0x80 | ((c >> 0) & 0x3F)); - } - else - { - buffer[count++] = (byte)(0xC0 | ((c >> 6) & 0x1F)); - buffer[count++] = (byte)(0x80 | ((c >> 0) & 0x3F)); - } - } - } + private uint CountUtf8Bytes(char[] chars) + { + uint utfLength = 0; + int c = 0; + + for(int i = 0; i < chars.Length; i++) + { + c = chars[i]; + if((c >= 0x0001) && (c <= 0x007F)) + { + utfLength++; + } + else if(c > 0x07FF) + { + utfLength += 3; + } + else + { + utfLength += 2; + } + } + + return utfLength; + } + + private void encodeUTF8toBuffer(char[] chars, byte[] buffer) + { + int c = 0; + int count = 0; + + for(int i = 0; i < chars.Length; i++) + { + c = chars[i]; + if((c >= 0x0001) && (c <= 0x007F)) + { + buffer[count++] = (byte) c; + } + else if(c > 0x07FF) + { + buffer[count++] = (byte) (0xE0 | ((c >> 12) & 0x0F)); + buffer[count++] = (byte) (0x80 | ((c >> 6) & 0x3F)); + buffer[count++] = (byte) (0x80 | ((c >> 0) & 0x3F)); + } + else + { + buffer[count++] = (byte) (0xC0 | ((c >> 6) & 0x1F)); + buffer[count++] = (byte) (0x80 | ((c >> 0) & 0x3F)); + } + } + } } } - Copied: activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/EndianSupport.cs (from r806651, activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/EndianSupport.cs) URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/EndianSupport.cs?p2=activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/EndianSupport.cs&p1=activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/EndianSupport.cs&r1=806651&r2=808223&rev=808223&view=diff ============================================================================== --- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/EndianSupport.cs (original) +++ activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/EndianSupport.cs Wed Aug 26 23:42:27 2009 @@ -17,7 +17,7 @@ using System.IO; using System; -namespace Apache.NMS.ActiveMQ.OpenWire +namespace Apache.NMS.Util { /// /// Support class that switches from one endian to the other. Copied: activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/MessagePropertyHelper.cs (from r806651, activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/MessagePropertyHelper.cs) URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/MessagePropertyHelper.cs?p2=activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/MessagePropertyHelper.cs&p1=activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/MessagePropertyHelper.cs&r1=806651&r2=808223&rev=808223&view=diff ============================================================================== --- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/MessagePropertyHelper.cs (original) +++ activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/MessagePropertyHelper.cs Wed Aug 26 23:42:27 2009 @@ -1,5 +1,3 @@ -using System; -using System.Reflection; /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -16,19 +14,21 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -using Apache.NMS.ActiveMQ.Commands; -namespace Apache.NMS.ActiveMQ.OpenWire +using System; +using System.Reflection; + +namespace Apache.NMS.Util { // Set NMS properties via introspection public class MessagePropertyHelper : IPrimitiveMap { private static BindingFlags publicBinding = BindingFlags.Public | BindingFlags.Instance; - private ActiveMQMessage message; + private IMessage message; private IPrimitiveMap properties; private Type messageType; - public MessagePropertyHelper(ActiveMQMessage _message, IPrimitiveMap _properties) + public MessagePropertyHelper(IMessage _message, IPrimitiveMap _properties) { this.message = _message; this.properties = _properties; Copied: activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/PrimitiveMap.cs (from r806651, activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/PrimitiveMap.cs) URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/PrimitiveMap.cs?p2=activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/PrimitiveMap.cs&p1=activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/PrimitiveMap.cs&r1=806651&r2=808223&rev=808223&view=diff ============================================================================== --- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/PrimitiveMap.cs (original) +++ activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/PrimitiveMap.cs Wed Aug 26 23:42:27 2009 @@ -14,32 +14,32 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -using Apache.NMS; + using System; using System.Collections; using System.IO; -namespace Apache.NMS.ActiveMQ.OpenWire +namespace Apache.NMS.Util { /// /// A default implementation of IPrimitiveMap /// public class PrimitiveMap : IPrimitiveMap { - public const byte NULL = 0; - public const byte BOOLEAN_TYPE = 1; - public const byte BYTE_TYPE = 2; - public const byte CHAR_TYPE = 3; - public const byte SHORT_TYPE = 4; - public const byte INTEGER_TYPE = 5; - public const byte LONG_TYPE = 6; - public const byte DOUBLE_TYPE = 7; - public const byte FLOAT_TYPE = 8; - public const byte STRING_TYPE = 9; - public const byte BYTE_ARRAY_TYPE = 10; - public const byte MAP_TYPE = 11; - public const byte LIST_TYPE = 12; - public const byte BIG_STRING_TYPE = 13; + public const byte NULL = 0; + public const byte BOOLEAN_TYPE = 1; + public const byte BYTE_TYPE = 2; + public const byte CHAR_TYPE = 3; + public const byte SHORT_TYPE = 4; + public const byte INTEGER_TYPE = 5; + public const byte LONG_TYPE = 6; + public const byte DOUBLE_TYPE = 7; + public const byte FLOAT_TYPE = 8; + public const byte STRING_TYPE = 9; + public const byte BYTE_ARRAY_TYPE = 10; + public const byte MAP_TYPE = 11; + public const byte LIST_TYPE = 12; + public const byte BIG_STRING_TYPE = 13; private IDictionary dictionary = Hashtable.Synchronized(new Hashtable()); @@ -86,7 +86,7 @@ public string GetString(string key) { Object value = GetValue(key); - if( value == null ) + if(value == null) { return null; } @@ -198,7 +198,7 @@ public IList GetList(String key) { Object value = GetValue(key); - if (value != null && !(value is IList)) + if(value != null && !(value is IList)) { throw new NMSException("Property: " + key + " is not an IList but is: " + value); } @@ -213,7 +213,7 @@ public IDictionary GetDictionary(String key) { Object value = GetValue(key); - if (value != null && !(value is IDictionary)) + if(value != null && !(value is IDictionary)) { throw new NMSException("Property: " + key + " is not an IDictionary but is: " + value); } @@ -237,7 +237,7 @@ protected virtual void CheckValueType(Object value, Type type) { - if (! type.IsInstanceOfType(value)) + if(!type.IsInstanceOfType(value)) { throw new NMSException("Expected type: " + type.Name + " but was: " + value); } @@ -245,10 +245,10 @@ protected virtual void CheckValidType(Object value) { - if (value != null && !(value is IList) && !(value is IDictionary)) + if(value != null && !(value is IList) && !(value is IDictionary)) { Type type = value.GetType(); - if (! type.IsPrimitive && !type.IsValueType && !type.IsAssignableFrom(typeof(string))) + if(!type.IsPrimitive && !type.IsValueType && !type.IsAssignableFrom(typeof(string))) { throw new NMSException("Invalid type: " + type.Name + " for value: " + value); } @@ -261,17 +261,17 @@ /// A string public override String ToString() { - String s="{"; - bool first=true; + String s = "{"; + bool first = true; lock(dictionary.SyncRoot) { foreach(DictionaryEntry entry in dictionary) { if(!first) { - s+=", "; + s += ", "; } - first=false; + first = false; String name = (String) entry.Key; Object value = entry.Value; s += name + "=" + value; @@ -313,7 +313,7 @@ MemoryStream memoryStream = new MemoryStream(); lock(map.SyncRoot) { - MarshalPrimitiveMap(map, new OpenWireBinaryWriter(memoryStream)); + MarshalPrimitiveMap(map, new EndianBinaryWriter(memoryStream)); } return memoryStream.GetBuffer(); @@ -323,7 +323,7 @@ { if(map == null) { - dataOut.Write((int)-1); + dataOut.Write((int) -1); } else { @@ -344,7 +344,7 @@ /// /// Unmarshals the primitive type map from the given byte array /// - public static IDictionary UnmarshalPrimitiveMap(byte[] data) + public static IDictionary UnmarshalPrimitiveMap(byte[] data) { if(data == null) { @@ -352,14 +352,14 @@ } else { - return UnmarshalPrimitiveMap(new OpenWireBinaryReader(new MemoryStream(data))); + return UnmarshalPrimitiveMap(new EndianBinaryReader(new MemoryStream(data))); } } - public static IDictionary UnmarshalPrimitiveMap(BinaryReader dataIn) + public static IDictionary UnmarshalPrimitiveMap(BinaryReader dataIn) { int size = dataIn.ReadInt32(); - if (size < 0) + if(size < 0) { return null; } @@ -377,7 +377,7 @@ public static void MarshalPrimitiveList(IList list, BinaryWriter dataOut) { dataOut.Write((int) list.Count); - foreach (Object element in list) + foreach(Object element in list) { MarshalPrimitive(dataOut, element); } @@ -387,7 +387,7 @@ { int size = dataIn.ReadInt32(); IList answer = new ArrayList(size); - while (size-- > 0) + while(size-- > 0) { answer.Add(UnmarshalPrimitive(dataIn)); } @@ -397,78 +397,78 @@ public static void MarshalPrimitive(BinaryWriter dataOut, Object value) { - if (value == null) + if(value == null) { dataOut.Write(NULL); } - else if (value is bool) + else if(value is bool) { dataOut.Write(BOOLEAN_TYPE); dataOut.Write((bool) value); } - else if (value is byte) + else if(value is byte) { dataOut.Write(BYTE_TYPE); - dataOut.Write(((byte)value)); + dataOut.Write(((byte) value)); } - else if (value is char) + else if(value is char) { dataOut.Write(CHAR_TYPE); dataOut.Write((char) value); } - else if (value is short) + else if(value is short) { dataOut.Write(SHORT_TYPE); dataOut.Write((short) value); } - else if (value is int) + else if(value is int) { dataOut.Write(INTEGER_TYPE); dataOut.Write((int) value); } - else if (value is long) + else if(value is long) { dataOut.Write(LONG_TYPE); dataOut.Write((long) value); } - else if (value is float) + else if(value is float) { dataOut.Write(FLOAT_TYPE); dataOut.Write((float) value); } - else if (value is double) + else if(value is double) { dataOut.Write(DOUBLE_TYPE); dataOut.Write((double) value); } - else if (value is byte[]) + else if(value is byte[]) { byte[] data = (byte[]) value; dataOut.Write(BYTE_ARRAY_TYPE); dataOut.Write(data.Length); dataOut.Write(data); } - else if (value is string) + else if(value is string) { string s = (string) value; // is the string big?? - if (s.Length > 8191) + if(s.Length > 8191) { dataOut.Write(BIG_STRING_TYPE); - ((OpenWireBinaryWriter)dataOut).WriteString32(s); + ((EndianBinaryWriter) dataOut).WriteString32(s); } else { dataOut.Write(STRING_TYPE); - ((OpenWireBinaryWriter)dataOut).WriteString16(s); + ((EndianBinaryWriter) dataOut).WriteString16(s); } } - else if (value is IDictionary) + else if(value is IDictionary) { dataOut.Write(MAP_TYPE); MarshalPrimitiveMap((IDictionary) value, dataOut); } - else if (value is IList) + else if(value is IList) { dataOut.Write(LIST_TYPE); MarshalPrimitiveList((IList) value, dataOut); @@ -481,58 +481,58 @@ public static Object UnmarshalPrimitive(BinaryReader dataIn) { - Object value=null; + Object value = null; byte type = dataIn.ReadByte(); - switch (type) + switch(type) { - case NULL: - value = null; - break; - case BYTE_TYPE: - value = dataIn.ReadByte(); - break; - case BOOLEAN_TYPE: - value = dataIn.ReadBoolean(); - break; - case CHAR_TYPE: - value = dataIn.ReadChar(); - break; - case SHORT_TYPE: - value = dataIn.ReadInt16(); - break; - case INTEGER_TYPE: - value = dataIn.ReadInt32(); - break; - case LONG_TYPE: - value = dataIn.ReadInt64(); - break; - case FLOAT_TYPE: - value = dataIn.ReadSingle(); - break; - case DOUBLE_TYPE: - value = dataIn.ReadDouble(); - break; - case BYTE_ARRAY_TYPE: - int size = dataIn.ReadInt32(); - byte[] data = new byte[size]; - dataIn.Read(data, 0, size); - value = data; - break; - case STRING_TYPE: - value = ((OpenWireBinaryReader)dataIn).ReadString16(); - break; - case BIG_STRING_TYPE: - value = ((OpenWireBinaryReader)dataIn).ReadString32(); - break; - case MAP_TYPE: - value = UnmarshalPrimitiveMap(dataIn); - break; - case LIST_TYPE: - value = UnmarshalPrimitiveList(dataIn); - break; + case NULL: + value = null; + break; + case BYTE_TYPE: + value = dataIn.ReadByte(); + break; + case BOOLEAN_TYPE: + value = dataIn.ReadBoolean(); + break; + case CHAR_TYPE: + value = dataIn.ReadChar(); + break; + case SHORT_TYPE: + value = dataIn.ReadInt16(); + break; + case INTEGER_TYPE: + value = dataIn.ReadInt32(); + break; + case LONG_TYPE: + value = dataIn.ReadInt64(); + break; + case FLOAT_TYPE: + value = dataIn.ReadSingle(); + break; + case DOUBLE_TYPE: + value = dataIn.ReadDouble(); + break; + case BYTE_ARRAY_TYPE: + int size = dataIn.ReadInt32(); + byte[] data = new byte[size]; + dataIn.Read(data, 0, size); + value = data; + break; + case STRING_TYPE: + value = ((EndianBinaryReader) dataIn).ReadString16(); + break; + case BIG_STRING_TYPE: + value = ((EndianBinaryReader) dataIn).ReadString32(); + break; + case MAP_TYPE: + value = UnmarshalPrimitiveMap(dataIn); + break; + case LIST_TYPE: + value = UnmarshalPrimitiveList(dataIn); + break; - default: - throw new Exception("Unsupported data type: " + type); + default: + throw new Exception("Unsupported data type: " + type); } return value; } Copied: activemq/activemq-dotnet/Apache.NMS/trunk/src/test/csharp/EndianBinaryReaderTest.cs (from r806651, activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/OpenWire/OpenWireBinaryReaderTest.cs) URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS/trunk/src/test/csharp/EndianBinaryReaderTest.cs?p2=activemq/activemq-dotnet/Apache.NMS/trunk/src/test/csharp/EndianBinaryReaderTest.cs&p1=activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/OpenWire/OpenWireBinaryReaderTest.cs&r1=806651&r2=808223&rev=808223&view=diff ============================================================================== --- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/OpenWire/OpenWireBinaryReaderTest.cs (original) +++ activemq/activemq-dotnet/Apache.NMS/trunk/src/test/csharp/EndianBinaryReaderTest.cs Wed Aug 26 23:42:27 2009 @@ -15,166 +15,149 @@ * limitations under the License. */ -using System; -using System.Collections.Generic; -using System.Text; using System.IO; -using Apache.NMS.ActiveMQ; -using Apache.NMS.ActiveMQ.OpenWire; +using Apache.NMS.Util; using NUnit.Framework; -namespace Apache.NMS.ActiveMQ.Test.OpenWire +namespace Apache.NMS.Test { - [TestFixture] - public class OpenWireBinaryReaderTest - { - public void readString16Helper( byte[] input, char[] expect ) - { - MemoryStream stream = new MemoryStream(input); - OpenWireBinaryReader reader = new OpenWireBinaryReader(stream); - - char[] result = reader.ReadString16().ToCharArray(); - - for (int i = 0; i < expect.Length; ++i) - { - Assert.AreEqual(expect[i], result[i]); - } - } - - [Test] - public void testReadString16() - { - // Test data with 1-byte UTF8 encoding. - { - char[] expect = { '\u0000', '\u000B', '\u0048', '\u0065', '\u006C', '\u006C', '\u006F', '\u0020', '\u0057', '\u006F', '\u0072', '\u006C', '\u0064' }; - byte[] input = { 0x00, 0x0E, 0xC0, 0x80, 0x0B, 0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x57, 0x6F, 0x72, 0x6C, 0x64 }; - - readString16Helper(input, expect); - } - - // Test data with 2-byte UT8 encoding. - { - char[] expect = { '\u0000', '\u00C2', '\u00A9', '\u00C3', '\u00A6' }; - byte[] input = { 0x00, 0x0A, 0xC0, 0x80, 0xC3, 0x82, 0xC2, 0xA9, 0xC3, 0x83, 0xC2, 0xA6 }; - readString16Helper(input, expect); - } - - // Test data with 1-byte and 2-byte encoding with embedded NULL's. - { - char[] expect = { '\u0000', '\u0004', '\u00C2', '\u00A9', '\u00C3', '\u0000', '\u00A6' }; - byte[] input = { 0x00, 0x0D, 0xC0, 0x80, 0x04, 0xC3, 0x82, 0xC2, 0xA9, 0xC3, 0x83, 0xC0, 0x80, 0xC2, 0xA6 }; - - readString16Helper(input, expect); - } - - // Test with bad UTF-8 encoding, missing 2nd byte of two byte value - { - byte[] input = { 0x00, 0x0D, 0xC0, 0x80, 0x04, 0xC3, 0x82, 0xC2, 0xC2, 0xC3, 0x83, 0xC0, 0x80, 0xC2, 0xA6 }; - - MemoryStream stream = new MemoryStream(input); - OpenWireBinaryReader reader = new OpenWireBinaryReader(stream); - - try - { - reader.ReadString16(); - Assert.Fail("Should Throw an IOException"); - } - catch (NMSException) - { - } - } - - // Test with three byte encode that's missing a last byte. - { - byte[] input = { 0x00, 0x02, 0xE8, 0xA8 }; - - MemoryStream stream = new MemoryStream(input); - OpenWireBinaryReader reader = new OpenWireBinaryReader(stream); - - try - { - reader.ReadString16(); - Assert.Fail("Should Throw an IOException"); - } - catch (NMSException) - { - } - } - } - - public void readString32Helper(byte[] input, char[] expect) - { - MemoryStream stream = new MemoryStream(input); - OpenWireBinaryReader reader = new OpenWireBinaryReader(stream); - - char[] result = reader.ReadString32().ToCharArray(); - - for (int i = 0; i < expect.Length; ++i) - { - Assert.AreEqual(expect[i], result[i]); - } - } - - [Test] - public void testReadString32() - { - // Test data with 1-byte UTF8 encoding. - { - char[] expect = { '\u0000', '\u000B', '\u0048', '\u0065', '\u006C', '\u006C', '\u006F', '\u0020', '\u0057', '\u006F', '\u0072', '\u006C', '\u0064' }; - byte[] input = { 0x00, 0x00, 0x00, 0x0E, 0xC0, 0x80, 0x0B, 0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x57, 0x6F, 0x72, 0x6C, 0x64 }; - - readString32Helper(input, expect); - } - - // Test data with 2-byte UT8 encoding. - { - char[] expect = { '\u0000', '\u00C2', '\u00A9', '\u00C3', '\u00A6' }; - byte[] input = { 0x00, 0x00, 0x00, 0x0A, 0xC0, 0x80, 0xC3, 0x82, 0xC2, 0xA9, 0xC3, 0x83, 0xC2, 0xA6 }; - readString32Helper(input, expect); - } - - // Test data with 1-byte and 2-byte encoding with embedded NULL's. - { - char[] expect = { '\u0000', '\u0004', '\u00C2', '\u00A9', '\u00C3', '\u0000', '\u00A6' }; - byte[] input = { 0x00, 0x00, 0x00, 0x0D, 0xC0, 0x80, 0x04, 0xC3, 0x82, 0xC2, 0xA9, 0xC3, 0x83, 0xC0, 0x80, 0xC2, 0xA6 }; - - readString32Helper(input, expect); - } - - // Test with bad UTF-8 encoding, missing 2nd byte of two byte value - { - byte[] input = { 0x00, 0x00, 0x00, 0x0D, 0xC0, 0x80, 0x04, 0xC3, 0x82, 0xC2, 0xC2, 0xC3, 0x83, 0xC0, 0x80, 0xC2, 0xA6 }; - - MemoryStream stream = new MemoryStream(input); - OpenWireBinaryReader reader = new OpenWireBinaryReader(stream); - - try - { - reader.ReadString32(); - Assert.Fail("Should Throw an IOException"); - } - catch (NMSException) - { - } - } - - // Test with three byte encode that's missing a last byte. - { - byte[] input = { 0x00, 0x00, 0x00, 0x02, 0xE8, 0xA8 }; - - MemoryStream stream = new MemoryStream(input); - OpenWireBinaryReader reader = new OpenWireBinaryReader(stream); - - try - { - reader.ReadString32(); - Assert.Fail("Should Throw an IOException"); - } - catch (NMSException) - { - } - } - } - - } + [TestFixture] + public class EndianBinaryReaderTest + { + public void readString16Helper(byte[] input, char[] expect) + { + MemoryStream stream = new MemoryStream(input); + EndianBinaryReader reader = new EndianBinaryReader(stream); + + char[] result = reader.ReadString16().ToCharArray(); + + for(int i = 0; i < expect.Length; ++i) + { + Assert.AreEqual(expect[i], result[i]); + } + } + + [Test] + public void testReadString16_1byteUTF8encoding() + { + // Test data with 1-byte UTF8 encoding. + char[] expect = { '\u0000', '\u000B', '\u0048', '\u0065', '\u006C', '\u006C', '\u006F', '\u0020', '\u0057', '\u006F', '\u0072', '\u006C', '\u0064' }; + byte[] input = { 0x00, 0x0E, 0xC0, 0x80, 0x0B, 0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x57, 0x6F, 0x72, 0x6C, 0x64 }; + + readString16Helper(input, expect); + } + + [Test] + public void testReadString16_2byteUTF8encoding() + { + // Test data with 2-byte UT8 encoding. + char[] expect = { '\u0000', '\u00C2', '\u00A9', '\u00C3', '\u00A6' }; + byte[] input = { 0x00, 0x0A, 0xC0, 0x80, 0xC3, 0x82, 0xC2, 0xA9, 0xC3, 0x83, 0xC2, 0xA6 }; + readString16Helper(input, expect); + } + + [Test] + public void testReadString16_1byteAnd2byteEmbeddedNULLs() + { + // Test data with 1-byte and 2-byte encoding with embedded NULL's. + char[] expect = { '\u0000', '\u0004', '\u00C2', '\u00A9', '\u00C3', '\u0000', '\u00A6' }; + byte[] input = { 0x00, 0x0D, 0xC0, 0x80, 0x04, 0xC3, 0x82, 0xC2, 0xA9, 0xC3, 0x83, 0xC0, 0x80, 0xC2, 0xA6 }; + + readString16Helper(input, expect); + } + + [Test] + [ExpectedException(typeof(IOException))] + public void testReadString16_UTF8Missing2ndByte() + { + // Test with bad UTF-8 encoding, missing 2nd byte of two byte value + byte[] input = { 0x00, 0x0D, 0xC0, 0x80, 0x04, 0xC3, 0x82, 0xC2, 0xC2, 0xC3, 0x83, 0xC0, 0x80, 0xC2, 0xA6 }; + + MemoryStream stream = new MemoryStream(input); + EndianBinaryReader reader = new EndianBinaryReader(stream); + + reader.ReadString16(); + } + + [Test] + [ExpectedException(typeof(IOException))] + public void testReadString16_3byteEncodingMissingLastByte() + { + // Test with three byte encode that's missing a last byte. + byte[] input = { 0x00, 0x02, 0xE8, 0xA8 }; + + MemoryStream stream = new MemoryStream(input); + EndianBinaryReader reader = new EndianBinaryReader(stream); + + reader.ReadString16(); + } + + public void readString32Helper(byte[] input, char[] expect) + { + MemoryStream stream = new MemoryStream(input); + EndianBinaryReader reader = new EndianBinaryReader(stream); + + char[] result = reader.ReadString32().ToCharArray(); + + for(int i = 0; i < expect.Length; ++i) + { + Assert.AreEqual(expect[i], result[i]); + } + } + + [Test] + public void testReadString32_1byteUTF8encoding() + { + // Test data with 1-byte UTF8 encoding. + char[] expect = { '\u0000', '\u000B', '\u0048', '\u0065', '\u006C', '\u006C', '\u006F', '\u0020', '\u0057', '\u006F', '\u0072', '\u006C', '\u0064' }; + byte[] input = { 0x00, 0x00, 0x00, 0x0E, 0xC0, 0x80, 0x0B, 0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x57, 0x6F, 0x72, 0x6C, 0x64 }; + + readString32Helper(input, expect); + } + + [Test] + public void testReadString32_2byteUTF8encoding() + { + // Test data with 2-byte UT8 encoding. + char[] expect = { '\u0000', '\u00C2', '\u00A9', '\u00C3', '\u00A6' }; + byte[] input = { 0x00, 0x00, 0x00, 0x0A, 0xC0, 0x80, 0xC3, 0x82, 0xC2, 0xA9, 0xC3, 0x83, 0xC2, 0xA6 }; + readString32Helper(input, expect); + } + + [Test] + public void testReadString32_1byteAnd2byteEmbeddedNULLs() + { + // Test data with 1-byte and 2-byte encoding with embedded NULL's. + char[] expect = { '\u0000', '\u0004', '\u00C2', '\u00A9', '\u00C3', '\u0000', '\u00A6' }; + byte[] input = { 0x00, 0x00, 0x00, 0x0D, 0xC0, 0x80, 0x04, 0xC3, 0x82, 0xC2, 0xA9, 0xC3, 0x83, 0xC0, 0x80, 0xC2, 0xA6 }; + + readString32Helper(input, expect); + } + + [Test] + [ExpectedException(typeof(IOException))] + public void testReadString32_UTF8Missing2ndByte() + { + // Test with bad UTF-8 encoding, missing 2nd byte of two byte value + byte[] input = { 0x00, 0x00, 0x00, 0x0D, 0xC0, 0x80, 0x04, 0xC3, 0x82, 0xC2, 0xC2, 0xC3, 0x83, 0xC0, 0x80, 0xC2, 0xA6 }; + + MemoryStream stream = new MemoryStream(input); + EndianBinaryReader reader = new EndianBinaryReader(stream); + + reader.ReadString32(); + } + + [Test] + [ExpectedException(typeof(IOException))] + public void testReadString32_3byteEncodingMissingLastByte() + { + // Test with three byte encode that's missing a last byte. + byte[] input = { 0x00, 0x00, 0x00, 0x02, 0xE8, 0xA8 }; + + MemoryStream stream = new MemoryStream(input); + EndianBinaryReader reader = new EndianBinaryReader(stream); + + reader.ReadString32(); + } + } } Copied: activemq/activemq-dotnet/Apache.NMS/trunk/src/test/csharp/EndianBinaryWriterTest.cs (from r806651, activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/OpenWire/OpenWireBinaryWriterTest.cs) URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS/trunk/src/test/csharp/EndianBinaryWriterTest.cs?p2=activemq/activemq-dotnet/Apache.NMS/trunk/src/test/csharp/EndianBinaryWriterTest.cs&p1=activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/OpenWire/OpenWireBinaryWriterTest.cs&r1=806651&r2=808223&rev=808223&view=diff ============================================================================== --- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/OpenWire/OpenWireBinaryWriterTest.cs (original) +++ activemq/activemq-dotnet/Apache.NMS/trunk/src/test/csharp/EndianBinaryWriterTest.cs Wed Aug 26 23:42:27 2009 @@ -16,191 +16,187 @@ */ using System; -using System.Collections.Generic; -using System.Text; using System.IO; -using Apache.NMS.ActiveMQ.OpenWire; +using Apache.NMS.Util; using NUnit.Framework; -namespace Apache.NMS.ActiveMQ.Test.OpenWire +namespace Apache.NMS.Test { - [TestFixture] - public class OpenWireBinaryWriterTest - { - void writeString16TestHelper(char[] input, byte[] expect) - { - MemoryStream stream = new MemoryStream(); - OpenWireBinaryWriter writer = new OpenWireBinaryWriter(stream); - - String str = new String(input); - - writer.WriteString16(str); - - byte[] result = stream.GetBuffer(); - - Assert.AreEqual(result[0], 0x00); - Assert.AreEqual(result[1], expect.Length); - - for (int i = 4; i < expect.Length; ++i) - { - Assert.AreEqual(result[i], expect[i - 2]); - } - } - [Test] - public void testWriteString16() - { - // Test data with 1-byte UTF8 encoding. - { - char[] input = { '\u0000', '\u000B', '\u0048', '\u0065', '\u006C', '\u006C', '\u006F', '\u0020', '\u0057', '\u006F', '\u0072', '\u006C', '\u0064' }; - byte[] expect = { 0xC0, 0x80, 0x0B, 0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x57, 0x6F, 0x72, 0x6C, 0x64 }; - - writeString16TestHelper(input, expect); - } - - // Test data with 2-byte UT8 encoding. - { - char[] input = { '\u0000', '\u00C2', '\u00A9', '\u00C3', '\u00A6' }; - byte[] expect = { 0xC0, 0x80, 0xC3, 0x82, 0xC2, 0xA9, 0xC3, 0x83, 0xC2, 0xA6 }; - - writeString16TestHelper(input, expect); - } - - // Test data with 1-byte and 2-byte encoding with embedded NULL's. - { - char[] input = { '\u0000', '\u0004', '\u00C2', '\u00A9', '\u00C3', '\u0000', '\u00A6' }; - byte[] expect = { 0xC0, 0x80, 0x04, 0xC3, 0x82, 0xC2, 0xA9, 0xC3, 0x83, 0xC0, 0x80, 0xC2, 0xA6 }; - - writeString16TestHelper(input, expect); - } - - // test that a null string writes no output. - { - MemoryStream stream = new MemoryStream(); - OpenWireBinaryWriter writer = new OpenWireBinaryWriter(stream); - writer.WriteString16(null); - Assert.AreEqual(0, stream.Length); - } - - // test that a null string writes no output. - { - MemoryStream stream = new MemoryStream(); - OpenWireBinaryWriter writer = new OpenWireBinaryWriter(stream); - writer.WriteString16(""); - - stream.Seek(0, SeekOrigin.Begin); - OpenWireBinaryReader reader = new OpenWireBinaryReader(stream); - Assert.AreEqual(0, reader.ReadInt16()); - } - - // String of length 65536 of Null Characters. - { - MemoryStream stream = new MemoryStream(); - OpenWireBinaryWriter writer = new OpenWireBinaryWriter(stream); - String testStr = new String( 'a', 65536 ); - try{ - writer.Write(testStr); - Assert.Fail( "Should throw an Exception" ); - } - catch( Exception ) - { - } - } - - // String of length 65535 of non Null Characters since Null encodes as UTF-8. - { - MemoryStream stream = new MemoryStream(); - OpenWireBinaryWriter writer = new OpenWireBinaryWriter(stream); - String testStr = new String( 'a', 65535 ); - try{ - writer.Write(testStr); - } - catch( Exception ) - { - Assert.Fail( "Should not throw an Exception" ); - } - } - - // Set one of the 65535 bytes to a value that will result in a 2 byte UTF8 encoded sequence. - // This will cause the string of length 65535 to have a utf length of 65536. - { - MemoryStream stream = new MemoryStream(); - OpenWireBinaryWriter writer = new OpenWireBinaryWriter(stream); - String testStr = new String( 'a', 65535 ); - char[] array = testStr.ToCharArray(); - array[0] = '\u0000'; - testStr = new String(array); - - try{ - writer.Write(testStr); - Assert.Fail( "Should throw an Exception" ); - } - catch( Exception ) - { - } - } - - } - - void writeString32TestHelper(char[] input, byte[] expect) { - - MemoryStream stream = new MemoryStream(); - OpenWireBinaryWriter writer = new OpenWireBinaryWriter(stream); - - String str = new String(input); - - writer.WriteString32( str ); - - byte[] result = stream.GetBuffer(); - - Assert.AreEqual( result[0], 0x00 ); - Assert.AreEqual( result[1], 0x00 ); - Assert.AreEqual( result[2], 0x00 ); - Assert.AreEqual( result[3], expect.Length ); - - for (int i = 4; i < expect.Length; ++i) - { - Assert.AreEqual( result[i], expect[i-4] ); - } - } - - [Test] - public void testWriteString32() - { - // Test data with 1-byte UTF8 encoding. - { - char[] input = { '\u0000', '\u000B', '\u0048', '\u0065', '\u006C', '\u006C', '\u006F', '\u0020', '\u0057', '\u006F', '\u0072', '\u006C', '\u0064'}; - byte[] expect = {0xC0, 0x80, 0x0B, 0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x57, 0x6F, 0x72, 0x6C, 0x64}; - - writeString32TestHelper(input, expect); - } - - // Test data with 2-byte UT8 encoding. - { - char[] input = { '\u0000', '\u00C2', '\u00A9', '\u00C3', '\u00A6' }; - byte[] expect = { 0xC0, 0x80, 0xC3, 0x82, 0xC2, 0xA9, 0xC3, 0x83, 0xC2, 0xA6 }; - - writeString32TestHelper(input, expect); - } - - // Test data with 1-byte and 2-byte encoding with embedded NULL's. - { - char[] input = { '\u0000', '\u0004', '\u00C2', '\u00A9', '\u00C3', '\u0000', '\u00A6' }; - byte[] expect = { 0xC0, 0x80, 0x04, 0xC3, 0x82, 0xC2, 0xA9, 0xC3, 0x83, 0xC0, 0x80, 0xC2, 0xA6 }; - - writeString32TestHelper(input, expect); - } - - // test that a null strings writes a -1 - { - MemoryStream stream = new MemoryStream(); - OpenWireBinaryWriter writer = new OpenWireBinaryWriter(stream); - writer.WriteString32(null); - - stream.Seek(0, SeekOrigin.Begin); - OpenWireBinaryReader reader = new OpenWireBinaryReader(stream); - Assert.AreEqual(-1, reader.ReadInt32()); - } - } - - } + [TestFixture] + public class EndianBinaryWriterTest + { + void writeString16TestHelper(char[] input, byte[] expect) + { + MemoryStream stream = new MemoryStream(); + EndianBinaryWriter writer = new EndianBinaryWriter(stream); + + String str = new String(input); + + writer.WriteString16(str); + + byte[] result = stream.GetBuffer(); + + Assert.AreEqual(result[0], 0x00); + Assert.AreEqual(result[1], expect.Length); + + for(int i = 4; i < expect.Length; ++i) + { + Assert.AreEqual(result[i], expect[i - 2]); + } + } + + [Test] + public void testWriteString16_1byteUTF8encoding() + { + // Test data with 1-byte UTF8 encoding. + char[] input = { '\u0000', '\u000B', '\u0048', '\u0065', '\u006C', '\u006C', '\u006F', '\u0020', '\u0057', '\u006F', '\u0072', '\u006C', '\u0064' }; + byte[] expect = { 0xC0, 0x80, 0x0B, 0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x57, 0x6F, 0x72, 0x6C, 0x64 }; + + writeString16TestHelper(input, expect); + } + + [Test] + public void testWriteString16_2byteUTF8encoding() + { + // Test data with 2-byte UT8 encoding. + char[] input = { '\u0000', '\u00C2', '\u00A9', '\u00C3', '\u00A6' }; + byte[] expect = { 0xC0, 0x80, 0xC3, 0x82, 0xC2, 0xA9, 0xC3, 0x83, 0xC2, 0xA6 }; + + writeString16TestHelper(input, expect); + } + + [Test] + public void testWriteString16_1byteAnd2byteEmbeddedNULLs() + { + // Test data with 1-byte and 2-byte encoding with embedded NULL's. + char[] input = { '\u0000', '\u0004', '\u00C2', '\u00A9', '\u00C3', '\u0000', '\u00A6' }; + byte[] expect = { 0xC0, 0x80, 0x04, 0xC3, 0x82, 0xC2, 0xA9, 0xC3, 0x83, 0xC0, 0x80, 0xC2, 0xA6 }; + + writeString16TestHelper(input, expect); + } + + [Test] + public void testWriteString16_nullstring() + { + // test that a null string writes no output. + MemoryStream stream = new MemoryStream(); + EndianBinaryWriter writer = new EndianBinaryWriter(stream); + writer.WriteString16(null); + Assert.AreEqual(0, stream.Length); + } + + [Test] + public void testWriteString16_emptystring() + { + // test that a null string writes no output. + MemoryStream stream = new MemoryStream(); + EndianBinaryWriter writer = new EndianBinaryWriter(stream); + writer.WriteString16(""); + + stream.Seek(0, SeekOrigin.Begin); + EndianBinaryReader reader = new EndianBinaryReader(stream); + Assert.AreEqual(0, reader.ReadInt16()); + } + + [Test] + [ExpectedException(typeof(IOException))] + public void testWriteString16_stringTooLong() + { + // String of length 65536 of Null Characters. + MemoryStream stream = new MemoryStream(); + EndianBinaryWriter writer = new EndianBinaryWriter(stream); + String testStr = new String('a', 65536); + writer.Write(testStr); + } + + [Test] + public void testWriteString16_maxStringLength() + { + // String of length 65535 of non Null Characters since Null encodes as UTF-8. + MemoryStream stream = new MemoryStream(); + EndianBinaryWriter writer = new EndianBinaryWriter(stream); + String testStr = new String('a', 65535); + writer.Write(testStr); + } + + [Test] + [ExpectedException(typeof(IOException))] + public void testWriteString16_invalidEncodingHeader() + { + // Set one of the 65535 bytes to a value that will result in a 2 byte UTF8 encoded sequence. + // This will cause the string of length 65535 to have a utf length of 65536. + MemoryStream stream = new MemoryStream(); + EndianBinaryWriter writer = new EndianBinaryWriter(stream); + String testStr = new String('a', 65535); + char[] array = testStr.ToCharArray(); + array[0] = '\u0000'; + testStr = new String(array); + writer.Write(testStr); + } + + void writeString32TestHelper(char[] input, byte[] expect) + { + MemoryStream stream = new MemoryStream(); + EndianBinaryWriter writer = new EndianBinaryWriter(stream); + + String str = new String(input); + + writer.WriteString32(str); + + byte[] result = stream.GetBuffer(); + + Assert.AreEqual(result[0], 0x00); + Assert.AreEqual(result[1], 0x00); + Assert.AreEqual(result[2], 0x00); + Assert.AreEqual(result[3], expect.Length); + + for(int i = 4; i < expect.Length; ++i) + { + Assert.AreEqual(result[i], expect[i - 4]); + } + } + + [Test] + public void testWriteString32_1byteUTF8encoding() + { + // Test data with 1-byte UTF8 encoding. + char[] input = { '\u0000', '\u000B', '\u0048', '\u0065', '\u006C', '\u006C', '\u006F', '\u0020', '\u0057', '\u006F', '\u0072', '\u006C', '\u0064' }; + byte[] expect = { 0xC0, 0x80, 0x0B, 0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x57, 0x6F, 0x72, 0x6C, 0x64 }; + + writeString32TestHelper(input, expect); + } + + [Test] + public void testWriteString32_2byteUTF8encoding() + { + // Test data with 2-byte UT8 encoding. + char[] input = { '\u0000', '\u00C2', '\u00A9', '\u00C3', '\u00A6' }; + byte[] expect = { 0xC0, 0x80, 0xC3, 0x82, 0xC2, 0xA9, 0xC3, 0x83, 0xC2, 0xA6 }; + + writeString32TestHelper(input, expect); + } + + [Test] + public void testWriteString32_1byteAnd2byteEmbeddedNULLs() + { + // Test data with 1-byte and 2-byte encoding with embedded NULL's. + char[] input = { '\u0000', '\u0004', '\u00C2', '\u00A9', '\u00C3', '\u0000', '\u00A6' }; + byte[] expect = { 0xC0, 0x80, 0x04, 0xC3, 0x82, 0xC2, 0xA9, 0xC3, 0x83, 0xC0, 0x80, 0xC2, 0xA6 }; + + writeString32TestHelper(input, expect); + } + + [Test] + public void testWriteString32_nullstring() + { + // test that a null strings writes a -1 + MemoryStream stream = new MemoryStream(); + EndianBinaryWriter writer = new EndianBinaryWriter(stream); + writer.WriteString32(null); + + stream.Seek(0, SeekOrigin.Begin); + EndianBinaryReader reader = new EndianBinaryReader(stream); + Assert.AreEqual(-1, reader.ReadInt32()); + } + } } Copied: activemq/activemq-dotnet/Apache.NMS/trunk/src/test/csharp/EndianTest.cs (from r806651, activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/OpenWire/EndianTest.cs) URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS/trunk/src/test/csharp/EndianTest.cs?p2=activemq/activemq-dotnet/Apache.NMS/trunk/src/test/csharp/EndianTest.cs&p1=activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/OpenWire/EndianTest.cs&r1=806651&r2=808223&rev=808223&view=diff ============================================================================== --- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/OpenWire/EndianTest.cs (original) +++ activemq/activemq-dotnet/Apache.NMS/trunk/src/test/csharp/EndianTest.cs Wed Aug 26 23:42:27 2009 @@ -16,15 +16,14 @@ */ using System.IO; -using Apache.NMS.ActiveMQ.OpenWire; +using Apache.NMS.Util; using NUnit.Framework; -namespace Apache.NMS.ActiveMQ.Test.OpenWire +namespace Apache.NMS.Test { [TestFixture] public class EndianTest { - [Test] public void TestLongEndian() { Modified: activemq/activemq-dotnet/Apache.NMS/trunk/src/test/csharp/NMSTestSupport.cs URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS/trunk/src/test/csharp/NMSTestSupport.cs?rev=808223&r1=808222&r2=808223&view=diff ============================================================================== --- activemq/activemq-dotnet/Apache.NMS/trunk/src/test/csharp/NMSTestSupport.cs (original) +++ activemq/activemq-dotnet/Apache.NMS/trunk/src/test/csharp/NMSTestSupport.cs Wed Aug 26 23:42:27 2009 @@ -41,7 +41,7 @@ { Apache.NMS.Tracer.Trace = new NmsTracer(); } - + public NMSTestSupport() { } @@ -121,8 +121,8 @@ configFound = true; break; } - } - + } + Assert.IsTrue(configFound, "Connection configuration file does not exist."); XmlDocument configDoc = new XmlDocument(); @@ -175,7 +175,7 @@ return (string[]) pathList.ToArray(typeof(string)); } - + /// /// Get the parameters for the ConnectionFactory from the configuration file. /// @@ -201,11 +201,11 @@ { case "string": factoryParams.Add(paramValue); - break; + break; case "int": factoryParams.Add(int.Parse(paramValue)); - break; + break; // TODO: Add more parameter types } Copied: activemq/activemq-dotnet/Apache.NMS/trunk/src/test/csharp/PrimitiveMapTest.cs (from r806651, activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/OpenWire/PrimitiveMapTest.cs) URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS/trunk/src/test/csharp/PrimitiveMapTest.cs?p2=activemq/activemq-dotnet/Apache.NMS/trunk/src/test/csharp/PrimitiveMapTest.cs&p1=activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/OpenWire/PrimitiveMapTest.cs&r1=806651&r2=808223&rev=808223&view=diff ============================================================================== --- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/OpenWire/PrimitiveMapTest.cs (original) +++ activemq/activemq-dotnet/Apache.NMS/trunk/src/test/csharp/PrimitiveMapTest.cs Wed Aug 26 23:42:27 2009 @@ -17,10 +17,10 @@ using System; using System.Collections; -using Apache.NMS.ActiveMQ.OpenWire; +using Apache.NMS.Util; using NUnit.Framework; -namespace Apache.NMS.ActiveMQ.Test.OpenWire +namespace Apache.NMS.Test { [TestFixture] public class PrimitiveMapTest Modified: activemq/activemq-dotnet/Apache.NMS/trunk/vs2008-nms-test.csproj URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS/trunk/vs2008-nms-test.csproj?rev=808223&r1=808222&r2=808223&view=diff ============================================================================== --- activemq/activemq-dotnet/Apache.NMS/trunk/vs2008-nms-test.csproj (original) +++ activemq/activemq-dotnet/Apache.NMS/trunk/vs2008-nms-test.csproj Wed Aug 26 23:42:27 2009 @@ -84,6 +84,9 @@ Code + + + Code @@ -96,6 +99,7 @@ + Code Modified: activemq/activemq-dotnet/Apache.NMS/trunk/vs2008-nms.csproj URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS/trunk/vs2008-nms.csproj?rev=808223&r1=808222&r2=808223&view=diff ============================================================================== --- activemq/activemq-dotnet/Apache.NMS/trunk/vs2008-nms.csproj (original) +++ activemq/activemq-dotnet/Apache.NMS/trunk/vs2008-nms.csproj Wed Aug 26 23:42:27 2009 @@ -89,6 +89,11 @@ + + + + + Code