Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Barker <mike@middlesoft.co.uk>2009-07-14 00:59:00 +0400
committerMichael Barker <mike@middlesoft.co.uk>2009-07-14 00:59:00 +0400
commit95dc3521c07b15316c0087fb5f088e65162077e4 (patch)
tree451b8996f7f6b9c816f66c71a0ec3b91b2244210 /mcs/class/Mono.Messaging
parent972ba36bac338904d6ec443814683a5bca6352d0 (diff)
parent9e3a325d750510b55beacc23db3d79b6d247c835 (diff)
2009-07-11 Michael Barker <mike@middlesoft.co.uk>
* MessageQueueException.cs: Removed MonoTODO. * MessageBaseTest.cs: Moved from Mono.Messaging.Test * MessageEnumeratorTest.cs: Moved from Mono.Messaging.Test * MessageTest.cs: Used using aliases to prevent namespace clashes. * AdminTest.cs: Remove unused variables. * AsyncPeekTest.cs: Remove unused variables. * AsyncReceiveTest.cs: Remove unused variables. * MessageFactory.cs: Switched to DateTime.UtcNow. * RabbitMQMessageQueue.cs: Removed some unecessary references to realm. * RabbitMQMessagingProvider.cs: Removed some unecessary references to realm. Changed volatile field to use Interlocked.Increment (++i is not thread safe). * Mono.Messaging.RabbitMQ_test.dll.sources: Moved MessageEnumeratorTest.cs and MessageBaseTest.cs from Mono.Messaging.Test. * MessageBaseTest.cs: Moved to Mono.Messaging.RabbitMQ.Test * MessageEnumeratorTest.cs: Moved to Mono.Messaging.RabbitMQ.Test * MessagingProviderLocator.cs: Removed unessecary fields, made fields readonly and some formatting changes. * Mono.Messaging_test.dll.sources: Moved MessageBaseTest.cs and MessageEnumeratorTest.cs to Mono.Messaging.RabbitMQ.Test. svn path=/trunk/mcs/; revision=137816
Diffstat (limited to 'mcs/class/Mono.Messaging')
-rw-r--r--mcs/class/Mono.Messaging/ChangeLog5
-rw-r--r--mcs/class/Mono.Messaging/Mono.Messaging/ChangeLog5
-rw-r--r--mcs/class/Mono.Messaging/Mono.Messaging/MessagingProviderLocator.cs12
-rw-r--r--mcs/class/Mono.Messaging/Mono.Messaging_test.dll.sources4
-rw-r--r--mcs/class/Mono.Messaging/Test/Mono.Messaging/ChangeLog5
-rw-r--r--mcs/class/Mono.Messaging/Test/Mono.Messaging/MessageBaseTest.cs113
-rw-r--r--mcs/class/Mono.Messaging/Test/Mono.Messaging/MessageEnumeratorExceptionTest.cs105
7 files changed, 22 insertions, 227 deletions
diff --git a/mcs/class/Mono.Messaging/ChangeLog b/mcs/class/Mono.Messaging/ChangeLog
index 9cfd069df5f..3e0f8ab586f 100644
--- a/mcs/class/Mono.Messaging/ChangeLog
+++ b/mcs/class/Mono.Messaging/ChangeLog
@@ -1,3 +1,8 @@
+2009-06-11 Michael Barker <mike@middlesoft.co.uk>
+
+ * Mono.Messaging_test.dll.sources: Moved MessageBaseTest.cs and
+ MessageEnumeratorTest.cs to Mono.Messaging.RabbitMQ.Test.
+
2009-05-23 Michael Barker <mike@middlesoft.co.uk>
* Mono.Messaging_test.dll.sources: Added MessageEnumeratorExceptionTest.cs
diff --git a/mcs/class/Mono.Messaging/Mono.Messaging/ChangeLog b/mcs/class/Mono.Messaging/Mono.Messaging/ChangeLog
index 38bd62f9ae2..d10ef8bab69 100644
--- a/mcs/class/Mono.Messaging/Mono.Messaging/ChangeLog
+++ b/mcs/class/Mono.Messaging/Mono.Messaging/ChangeLog
@@ -1,3 +1,8 @@
+2009-07-11 Michael Barker <mike@middlesoft.co.uk>
+
+ * MessagingProviderLocator.cs: Removed unessecary fields, made fields
+ readonly and some formatting changes.
+
2009-05-23 Michael Barker <mike@middlesoft.co.uk>
* IMessageEnumerator.cs: Added additional methods to support operations
diff --git a/mcs/class/Mono.Messaging/Mono.Messaging/MessagingProviderLocator.cs b/mcs/class/Mono.Messaging/Mono.Messaging/MessagingProviderLocator.cs
index f1ced06174f..e6f65da5388 100644
--- a/mcs/class/Mono.Messaging/Mono.Messaging/MessagingProviderLocator.cs
+++ b/mcs/class/Mono.Messaging/Mono.Messaging/MessagingProviderLocator.cs
@@ -43,10 +43,9 @@ namespace Mono.Messaging
public class MessagingProviderLocator
{
public static readonly TimeSpan InfiniteTimeout = TimeSpan.MaxValue;
+ private static readonly MessagingProviderLocator instance = new MessagingProviderLocator();
+ private readonly IMessagingProvider provider;
- private static MessagingProviderLocator instance = new MessagingProviderLocator();
- private readonly object syncObj = new object();
- private IMessagingProvider provider = null;
private MessagingProviderLocator () {
string providerName = System.Environment.GetEnvironmentVariable("MONO_MESSAGING_PROVIDER");
@@ -55,7 +54,9 @@ namespace Mono.Messaging
provider = CreateProvider (providerName);
}
- public static MessagingProviderLocator Instance { get { return instance; } }
+ public static MessagingProviderLocator Instance {
+ get { return instance; }
+ }
public static IMessagingProvider GetProvider ()
{
@@ -68,8 +69,7 @@ namespace Mono.Messaging
if (t == null)
throw new Exception ("Can't find class: " + className);
- ConstructorInfo ci = t.GetConstructor (BindingFlags.Public |
- BindingFlags.Instance,
+ ConstructorInfo ci = t.GetConstructor (BindingFlags.Public | BindingFlags.Instance,
Type.DefaultBinder,
new Type[0],
new ParameterModifier[0]);
diff --git a/mcs/class/Mono.Messaging/Mono.Messaging_test.dll.sources b/mcs/class/Mono.Messaging/Mono.Messaging_test.dll.sources
index d5bfcb3a87e..8c82b8604c4 100644
--- a/mcs/class/Mono.Messaging/Mono.Messaging_test.dll.sources
+++ b/mcs/class/Mono.Messaging/Mono.Messaging_test.dll.sources
@@ -1,3 +1 @@
-Mono.Messaging/MessageBaseTest.cs
-Mono.Messaging/MessageEnumeratorExceptionTest.cs
-Mono.Messaging/QueueReferenceTest.cs \ No newline at end of file
+Mono.Messaging/QueueReferenceTest.cs
diff --git a/mcs/class/Mono.Messaging/Test/Mono.Messaging/ChangeLog b/mcs/class/Mono.Messaging/Test/Mono.Messaging/ChangeLog
index 76e40f0761b..888dec2e4f3 100644
--- a/mcs/class/Mono.Messaging/Test/Mono.Messaging/ChangeLog
+++ b/mcs/class/Mono.Messaging/Test/Mono.Messaging/ChangeLog
@@ -1,3 +1,8 @@
+2009-06-11 Michael Barker <mike@middlesoft.co.uk>
+
+ * MessageBaseTest.cs: Moved to Mono.Messaging.RabbitMQ.Test
+ * MessageEnumeratorTest.cs: Moved to Mono.Messaging.RabbitMQ.Test
+
2009-05-23 Michael Barker <mike@middlesoft.co.uk>
* MessageEnumeratorExceptionTest.cs: New
diff --git a/mcs/class/Mono.Messaging/Test/Mono.Messaging/MessageBaseTest.cs b/mcs/class/Mono.Messaging/Test/Mono.Messaging/MessageBaseTest.cs
deleted file mode 100644
index 52a47047236..00000000000
--- a/mcs/class/Mono.Messaging/Test/Mono.Messaging/MessageBaseTest.cs
+++ /dev/null
@@ -1,113 +0,0 @@
-//
-// Mono.Messaging.RabbitMQ
-//
-// Authors:
-// Michael Barker (mike@middlesoft.co.uk)
-//
-// (C) 2008 Michael Barker
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Messaging;
-using System.Reflection;
-using Mono.Messaging;
-
-using NUnit.Framework;
-
-namespace MonoTests.Mono.Messaging {
-
- [TestFixture]
- public class MessageBaseTest {
-
- [Test]
- public void CheckDefaultValues ()
- {
- Type[] types = {
- typeof (IMessage), typeof (object), typeof (IMessageFormatter)
- };
-
- ConstructorInfo ci = typeof (Message).GetConstructor (
- BindingFlags.NonPublic | BindingFlags.Instance,
- Type.DefaultBinder, types, new ParameterModifier[0]);
-
- if (ci == null)
- throw new Exception ("ConstructorInfo is null");
-
- Message m = (Message) ci.Invoke (new object[] { new MessageBase (), null, null });
-
- Assert.IsNull (m.Body, "Body default should be Null");
- Assert.IsNull (m.Formatter, "Formatter default should null");
-
- Assert.AreEqual (System.Messaging.AcknowledgeTypes.None,
- m.AcknowledgeType,
- "AcknowledgeType default should be None");
- Assert.AreEqual (null, m.AdministrationQueue,
- "AdministrationQueue default should be null");
- Assert.AreEqual (0, m.AppSpecific, "AppSpecific default should be 0");
- Assert.AreEqual (true, m.AttachSenderId, "AttachSenderId default should be true");
- Assert.AreEqual ("Microsoft Base Cryptographic Provider, Ver. 1.0", m.AuthenticationProviderName,
- "AuthenticationProviderName should default to \"Microsoft Base Cryptographic Provider, Ver. 1.0\"");
- Assert.AreEqual (System.Messaging.CryptographicProviderType.RsaFull,
- m.AuthenticationProviderType,
- "AuthenticationProviderType should default to RsaFull");
- Assert.AreEqual (null, m.BodyStream, "BodyStream should default to null");
- Assert.AreEqual (Guid.Empty, m.ConnectorType, "ConnectorType should default to empty");
- Assert.AreEqual (null, m.CorrelationId, "CorrelationId should default to null");
- Assert.AreEqual (new byte[0], m.DestinationSymmetricKey,
- "DestinationSymmetricKey should default to an empty array");
- Assert.AreEqual (new byte[0], m.DigitalSignature,
- "DigitalSignature default to an empty array");
- Assert.AreEqual (System.Messaging.EncryptionAlgorithm.Rc2,
- m.EncryptionAlgorithm,
- "EncryptionAlgorithm should default to Rc2");
- Assert.AreEqual (new byte[0], m.Extension,
- "Extension should default to an empty array");
- Assert.AreEqual (System.Messaging.HashAlgorithm.Sha, m.HashAlgorithm,
- "HashAlgorithm should default to Sha");
- Assert.AreEqual (Guid.Empty.ToString () + "\\0", m.Id, "Id should default to Guid.Empty");
- Assert.AreEqual ("", m.Label, "Label should default to \"\"");
- Assert.AreEqual (false, m.IsFirstInTransaction, "IsFirstInTransaction should default to false");
- Assert.AreEqual (false, m.IsLastInTransaction, "IsLastInTransaction should default to false");
- Assert.AreEqual (System.Messaging.MessagePriority.Normal, m.Priority,
- "Priority should default to Normal");
- Assert.AreEqual (false, m.Recoverable, "Recoverable should default to false");
- Assert.AreEqual (null, m.ResponseQueue, "ResponseQueue should default to null");
- //Assert.AreEqual (null, m.SecurityContext, "SecurityContext should default to null");
- Assert.AreEqual (new byte[0], m.SenderCertificate,
- "SenderCertificate should default to an empty array");
- Assert.AreEqual (Message.InfiniteTimeout, m.TimeToBeReceived,
- "TimeToBeReceived should default to InfiniteTimeout");
- Assert.AreEqual (Message.InfiniteTimeout, m.TimeToReachQueue,
- "TimeToReadQueue should default to InfiniteTimeout");
- Assert.AreEqual (false, m.UseAuthentication,
- "UseAuthentication should default to false");
- Assert.AreEqual (false, m.UseDeadLetterQueue,
- "UseDeadLetterQueue should default to false");
- Assert.AreEqual (false, m.UseEncryption, "Encryption should default to false");
- Assert.AreEqual (false, m.UseJournalQueue,
- "UseJournalQueue should default to false");
- Assert.AreEqual (false, m.UseTracing, "UseTracing should default to false");
- }
- }
-}
diff --git a/mcs/class/Mono.Messaging/Test/Mono.Messaging/MessageEnumeratorExceptionTest.cs b/mcs/class/Mono.Messaging/Test/Mono.Messaging/MessageEnumeratorExceptionTest.cs
deleted file mode 100644
index 36edde5d52e..00000000000
--- a/mcs/class/Mono.Messaging/Test/Mono.Messaging/MessageEnumeratorExceptionTest.cs
+++ /dev/null
@@ -1,105 +0,0 @@
-//
-// MessageEnumeratorTest.cs -
-// NUnit Test Cases for MessageEnumerator
-//
-// Author:
-// Michael Barker <mike@middlesoft.co.uk>
-//
-// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-using System;
-using System.Security;
-using System.Security.Permissions;
-using System.Reflection;
-
-using Mono.Messaging;
-
-using NUnit.Framework;
-using NUnit.Mocks;
-
-
-namespace MonoTests.Mono.Messaging {
-
- [TestFixture]
- public class MessageEnumeratorExceptionTest
- {
- private DynamicMock mockME;
-
- [SetUp]
- public void Init ()
- {
- mockME = new DynamicMock (typeof (IMessageEnumerator));
- }
-
- [Test]
- [ExpectedException("System.Messaging.MessageQueueException")]
- public void RemoveCurrentThrowsConnectionException ()
- {
- mockME.ExpectAndThrow ("RemoveCurrent", new ConnectionException (QueueReference.DEFAULT), null);
- System.Messaging.MessageEnumerator me = CreateEnumerator ((IMessageEnumerator) mockME.MockInstance);
- me.RemoveCurrent ();
- }
-
- [Test]
- [ExpectedException("System.InvalidOperationException")]
- public void RemoveCurrentThrowsMessageUnavailableException ()
- {
- mockME.ExpectAndThrow ("RemoveCurrent", new MessageUnavailableException (), null);
- System.Messaging.MessageEnumerator me = CreateEnumerator ((IMessageEnumerator) mockME.MockInstance);
- me.RemoveCurrent ();
- }
-
- [Test]
- [ExpectedException("System.Messaging.MessageQueueException")]
- public void RemoveCurrentThrowsMonoMessagingException ()
- {
- mockME.ExpectAndThrow ("RemoveCurrent", new MonoMessagingException (), null);
- System.Messaging.MessageEnumerator me = CreateEnumerator ((IMessageEnumerator) mockME.MockInstance);
- me.RemoveCurrent ();
- }
-
- [Test]
- [ExpectedException("System.NotImplementedException")]
- public void RemoveCurrentThrowsMessageNotImplemented ()
- {
- mockME.ExpectAndThrow ("RemoveCurrent", new NotImplementedException (), null);
- System.Messaging.MessageEnumerator me = CreateEnumerator ((IMessageEnumerator) mockME.MockInstance);
- me.RemoveCurrent ();
- }
-
- public System.Messaging.MessageEnumerator CreateEnumerator (IMessageEnumerator ime)
- {
- Type[] types = {
- typeof (IMessageEnumerator), typeof (System.Messaging.IMessageFormatter)
- };
-
- ConstructorInfo ci = typeof (System.Messaging.MessageEnumerator).GetConstructor (
- BindingFlags.NonPublic | BindingFlags.Instance,
- Type.DefaultBinder, types, new ParameterModifier[0]);
-
- if (ci == null)
- throw new Exception ("ConstructorInfo is null");
-
- return (System.Messaging.MessageEnumerator) ci.Invoke (new object[] { ime, null });
- }
- }
-}