added back csharp m2 repo

git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@412454 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
James Strachan 2006-06-07 16:50:56 +00:00
parent 3324233455
commit fbdc95e6a3
4 changed files with 118 additions and 109 deletions

View File

@ -10,6 +10,14 @@
<artifactId>activemq-dotnet</artifactId> <artifactId>activemq-dotnet</artifactId>
<packaging>dotnet-library</packaging> <packaging>dotnet-library</packaging>
<repositories>
<repository>
<id>maven-csharp</id>
<name>maven-csharp</name>
<url>http://maven-csharp.javaforge.com/repo</url>
</repository>
</repositories>
<build> <build>
<outputDirectory>target/dotnet-assembly</outputDirectory> <outputDirectory>target/dotnet-assembly</outputDirectory>

View File

@ -22,6 +22,6 @@ using System.Runtime.InteropServices;
[assembly: AssemblyCopyrightAttribute("Copyright (C) 2005-2006 Apache Software Foundation")] [assembly: AssemblyCopyrightAttribute("Copyright (C) 2005-2006 Apache Software Foundation")]
[assembly: AssemblyTrademarkAttribute("")] [assembly: AssemblyTrademarkAttribute("")]
[assembly: AssemblyCultureAttribute("")] [assembly: AssemblyCultureAttribute("")]
[assembly: AssemblyVersionAttribute("4.0.2266.0")] [assembly: AssemblyVersionAttribute("4.0.2281.0")]
[assembly: AssemblyInformationalVersionAttribute("4.0")] [assembly: AssemblyInformationalVersionAttribute("4.0")]

View File

@ -18,111 +18,112 @@ using NUnit.Framework;
using System; using System;
using System.IO; using System.IO;
namespace ActiveMQ.OpenWire namespace ActiveMQ.OpenWire {
{ [ TestFixture ]
[TestFixture] public class BooleanStreamTest
public class BooleanStreamTest {
{ protected int endOfStreamMarker = 0x12345678;
protected int endOfStreamMarker = 0x12345678; int numberOfBytes = 8 * 200;
int numberOfBytes = 8 * 200;
public delegate bool GetBooleanValueDelegate(int index, int count); public delegate bool GetBooleanValueDelegate(int index, int count);
[Test] [ Test ]
public void TestBooleanMarshallingUsingAllTrue() public void TestBooleanMarshallingUsingAllTrue()
{ {
DoTestBooleanStream(numberOfBytes, new GetBooleanValueDelegate(GetBooleanValueAllTrue)); DoTestBooleanStream(numberOfBytes, new GetBooleanValueDelegate(GetBooleanValueAllTrue));
} }
public bool GetBooleanValueAllTrue(int index, int count) public bool GetBooleanValueAllTrue(int index, int count)
{ {
return true; return true;
} }
[Test] [ Test ]
public void TestBooleanMarshallingUsingAllFalse() public void TestBooleanMarshallingUsingAllFalse()
{ {
DoTestBooleanStream(numberOfBytes, new GetBooleanValueDelegate(GetBooleanValueAllFalse)); DoTestBooleanStream(numberOfBytes, new GetBooleanValueDelegate(GetBooleanValueAllFalse));
} }
public bool GetBooleanValueAllFalse(int index, int count) public bool GetBooleanValueAllFalse(int index, int count)
{ {
return false; return false;
} }
[Test] [ Test ]
public void TestBooleanMarshallingUsingAlternateTrueFalse() public void TestBooleanMarshallingUsingAlternateTrueFalse()
{ {
DoTestBooleanStream(numberOfBytes, new GetBooleanValueDelegate(GetBooleanValueAlternateTrueFalse)); DoTestBooleanStream(
} numberOfBytes, new GetBooleanValueDelegate(GetBooleanValueAlternateTrueFalse));
public bool GetBooleanValueAlternateTrueFalse(int index, int count) }
{ public bool GetBooleanValueAlternateTrueFalse(int index, int count)
return (index & 1) == 0; {
} return (index & 1) == 0;
}
[Test] [ Test ]
public void TestBooleanMarshallingUsingAlternateFalseTrue() public void TestBooleanMarshallingUsingAlternateFalseTrue()
{ {
DoTestBooleanStream(numberOfBytes, new GetBooleanValueDelegate(GetBooleanValueAlternateFalseTrue)); DoTestBooleanStream(
} numberOfBytes, new GetBooleanValueDelegate(GetBooleanValueAlternateFalseTrue));
public bool GetBooleanValueAlternateFalseTrue(int index, int count) }
{ public bool GetBooleanValueAlternateFalseTrue(int index, int count)
return (index & 1) != 0; {
} return (index & 1) != 0;
}
protected void DoTestBooleanStream(int numberOfBytes, GetBooleanValueDelegate valueDelegate) protected void DoTestBooleanStream(int numberOfBytes, GetBooleanValueDelegate valueDelegate)
{ {
for (int i = 1017; i < numberOfBytes; i++) for (int i = 1017; i < numberOfBytes; i++)
{ {
AssertMarshalBooleans(i, valueDelegate); AssertMarshalBooleans(i, valueDelegate);
} }
} }
protected void AssertMarshalBooleans(int count, GetBooleanValueDelegate valueDelegate) protected void AssertMarshalBooleans(int count, GetBooleanValueDelegate valueDelegate)
{ {
BooleanStream bs = new BooleanStream(); BooleanStream bs = new BooleanStream();
for (int i = 0; i < count; i++) for (int i = 0; i < count; i++)
{ {
bs.WriteBoolean(valueDelegate(i, count)); bs.WriteBoolean(valueDelegate(i, count));
} }
MemoryStream buffer = new MemoryStream(); MemoryStream buffer = new MemoryStream();
BinaryWriter ds = new OpenWireBinaryWriter(buffer); BinaryWriter ds = new OpenWireBinaryWriter(buffer);
bs.Marshal(ds); bs.Marshal(ds);
ds.Write(endOfStreamMarker); ds.Write(endOfStreamMarker);
// now lets read from the stream // now lets read from the stream
MemoryStream ins = new MemoryStream(buffer.ToArray()); MemoryStream ins = new MemoryStream(buffer.ToArray());
BinaryReader dis = new OpenWireBinaryReader(ins); BinaryReader dis = new OpenWireBinaryReader(ins);
bs = new BooleanStream(); bs = new BooleanStream();
bs.Unmarshal(dis); bs.Unmarshal(dis);
for (int i = 0; i < count; i++) for (int i = 0; i < count; i++)
{ {
bool expected = valueDelegate(i, count); bool expected = valueDelegate(i, count);
try try
{ {
bool actual = bs.ReadBoolean(); bool actual = bs.ReadBoolean();
Assert.AreEqual(expected, actual); Assert.AreEqual(expected, actual);
} }
catch (Exception e) catch (Exception e)
{ {
Assert.Fail("Failed to parse bool: " + i + " out of: " + count + " due to: " + e); Assert.Fail(
} "Failed to parse bool: " + i + " out of: " + count + " due to: " + e);
} }
int marker = dis.ReadInt32(); }
Assert.AreEqual(endOfStreamMarker, marker, "did not match: "+endOfStreamMarker+" and "+marker); int marker = dis.ReadInt32();
Assert.AreEqual(
endOfStreamMarker, marker, "did not match: " + endOfStreamMarker + " and " + marker);
// lets try read and we should get an exception // lets try read and we should get an exception
try try
{ {
dis.ReadByte(); dis.ReadByte();
Assert.Fail("Should have reached the end of the stream"); Assert.Fail("Should have reached the end of the stream");
} }
catch (IOException) catch (IOException)
{ {
} }
} }
}
}
} }

View File

@ -22,6 +22,6 @@ using System.Runtime.InteropServices;
[assembly: AssemblyCopyrightAttribute("Copyright (C) 2005-2006 Apache Software Foundation")] [assembly: AssemblyCopyrightAttribute("Copyright (C) 2005-2006 Apache Software Foundation")]
[assembly: AssemblyTrademarkAttribute("")] [assembly: AssemblyTrademarkAttribute("")]
[assembly: AssemblyCultureAttribute("")] [assembly: AssemblyCultureAttribute("")]
[assembly: AssemblyVersionAttribute("4.0.2266.0")] [assembly: AssemblyVersionAttribute("4.0.2281.0")]
[assembly: AssemblyInformationalVersionAttribute("4.0")] [assembly: AssemblyInformationalVersionAttribute("4.0")]