activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1059020 - in /activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src: main/csharp/Transport/ main/csharp/Transport/Discovery/ main/csharp/Transport/Failover/ main/csharp/Transport/Mock/ main/csharp/Transport/Tcp/ main/csharp/Util/ test/csh...
Date Fri, 14 Jan 2011 14:38:05 GMT
Author: tabish
Date: Fri Jan 14 14:38:05 2011
New Revision: 1059020

URL: http://svn.apache.org/viewvc?rev=1059020&view=rev
Log:
https://issues.apache.org/jira/browse/AMQNET-306

Adds an Attribute class ActiveMQTransportFactoryAttribute that is applied to all the current
Transport factories and rewrites the TransportFactory class to use a FactoryFinder instance
to search for a ITransportFactory object based on the scheme.  

Added:
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/ActiveMQTransportFactoryAttribute.cs
  (with props)
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Util/FactoryAttribute.cs
  (with props)
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Util/FactoryFinder.cs
  (with props)
Modified:
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Discovery/DiscoveryTransportFactory.cs
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Failover/FailoverTransportFactory.cs
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Mock/MockTransportFactory.cs
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Tcp/SslTransportFactory.cs
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Tcp/TcpTransportFactory.cs
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/TransportFactory.cs
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/Transport/Tcp/TcpFaultyTransportFactory.cs
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/Transport/Tcp/TcpFaultyTransportTest.cs

Added: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/ActiveMQTransportFactoryAttribute.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/ActiveMQTransportFactoryAttribute.cs?rev=1059020&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/ActiveMQTransportFactoryAttribute.cs
(added)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/ActiveMQTransportFactoryAttribute.cs
Fri Jan 14 14:38:05 2011
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+
+using Apache.NMS.ActiveMQ.Util;
+
+namespace Apache.NMS.ActiveMQ.Transport
+{
+    /// <summary>
+    /// Attribute that decorates ITransportFactory implementations to allow
+    /// the TransportFactory to find all the available factories dynamically.
+    /// </summary>
+
+    public class ActiveMQTransportFactoryAttribute : FactoryAttribute
+    {
+        public ActiveMQTransportFactoryAttribute(string scheme) : base(scheme)
+        {
+        }
+    }
+}
+

Propchange: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/ActiveMQTransportFactoryAttribute.cs
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Discovery/DiscoveryTransportFactory.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Discovery/DiscoveryTransportFactory.cs?rev=1059020&r1=1059019&r2=1059020&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Discovery/DiscoveryTransportFactory.cs
(original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Discovery/DiscoveryTransportFactory.cs
Fri Jan 14 14:38:05 2011
@@ -23,6 +23,7 @@ using Apache.NMS.Util;
 
 namespace Apache.NMS.ActiveMQ.Transport.Discovery
 {
+    [ActiveMQTransportFactory("discovery")]
 	public class DiscoveryTransportFactory : ITransportFactory
 	{
 		private const int TIMEOUT_IN_SECONDS = 20;

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Failover/FailoverTransportFactory.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Failover/FailoverTransportFactory.cs?rev=1059020&r1=1059019&r2=1059020&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Failover/FailoverTransportFactory.cs
(original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Failover/FailoverTransportFactory.cs
Fri Jan 14 14:38:05 2011
@@ -21,6 +21,7 @@ using Apache.NMS.Util;
 
 namespace Apache.NMS.ActiveMQ.Transport.Failover
 {
+    [ActiveMQTransportFactory("failover")]
 	public class FailoverTransportFactory : ITransportFactory
 	{
 		private ITransport doConnect(Uri location)

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Mock/MockTransportFactory.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Mock/MockTransportFactory.cs?rev=1059020&r1=1059019&r2=1059020&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Mock/MockTransportFactory.cs
(original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Mock/MockTransportFactory.cs
Fri Jan 14 14:38:05 2011
@@ -18,12 +18,14 @@
 using System;
 using System.Collections.Specialized;
 using Apache.NMS.Util;
+using Apache.NMS.ActiveMQ.Util;
 
 namespace Apache.NMS.ActiveMQ.Transport.Mock
 {
 	/// <summary>
 	/// Factory class to create the MockTransport when given on a URI as mock://XXX
 	/// </summary>
+    [ActiveMQTransportFactory("mock")]
 	public class MockTransportFactory : ITransportFactory
 	{
 		public MockTransportFactory()

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Tcp/SslTransportFactory.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Tcp/SslTransportFactory.cs?rev=1059020&r1=1059019&r2=1059020&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Tcp/SslTransportFactory.cs
(original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Tcp/SslTransportFactory.cs
Fri Jan 14 14:38:05 2011
@@ -20,6 +20,7 @@ using System.Net.Sockets;
 
 namespace Apache.NMS.ActiveMQ.Transport.Tcp
 {
+    [ActiveMQTransportFactory("ssl")]
 	public class SslTransportFactory : TcpTransportFactory
 	{
         private string serverName;

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Tcp/TcpTransportFactory.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Tcp/TcpTransportFactory.cs?rev=1059020&r1=1059019&r2=1059020&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Tcp/TcpTransportFactory.cs
(original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Tcp/TcpTransportFactory.cs
Fri Jan 14 14:38:05 2011
@@ -19,11 +19,13 @@ using System;
 using System.Collections.Specialized;
 using System.Net;
 using System.Net.Sockets;
+using Apache.NMS.ActiveMQ.Util;
 using Apache.NMS.ActiveMQ.OpenWire;
 using Apache.NMS.Util;
 
 namespace Apache.NMS.ActiveMQ.Transport.Tcp
 {
+    [ActiveMQTransportFactory("tcp")]
     public class TcpTransportFactory : ITransportFactory
     {
         public TcpTransportFactory()

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/TransportFactory.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/TransportFactory.cs?rev=1059020&r1=1059019&r2=1059020&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/TransportFactory.cs
(original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/TransportFactory.cs
Fri Jan 14 14:38:05 2011
@@ -18,6 +18,7 @@
 using System;
 using System.Reflection;
 using System.Collections.Generic;
+using Apache.NMS.ActiveMQ.Util;
 using Apache.NMS.ActiveMQ.Transport.Discovery;
 using Apache.NMS.ActiveMQ.Transport.Failover;
 using Apache.NMS.ActiveMQ.Transport.Mock;
@@ -29,8 +30,10 @@ namespace Apache.NMS.ActiveMQ.Transport
 	{
 		public static event ExceptionListener OnException;
 
-        private static IDictionary<String, String> schemeToClassName = new Dictionary<String,
String>();
-        private static IDictionary<String, Type> schemeToTypeName = new Dictionary<String,
Type>();
+        private static readonly FactoryFinder<ActiveMQTransportFactoryAttribute, ITransportFactory>
FACTORY_FINDER =
+            new FactoryFinder<ActiveMQTransportFactoryAttribute, ITransportFactory>();
+
+        private static IDictionary<String, Type> TRANSPORT_FACTORY_TYPES = new Dictionary<String,
Type>();
 
 		public static void HandleException(Exception ex)
 		{
@@ -40,34 +43,9 @@ namespace Apache.NMS.ActiveMQ.Transport
 			}
 		}
 
-        public static void RegisterTransport(string scheme, string className)
+        public void RegisterTransportFactory(string scheme, Type factoryType)
         {
-            if(String.IsNullOrEmpty(scheme))
-            {
-                throw new NMSException("Cannot register a transport with an empty scheme.");
-            }
-
-            if(String.IsNullOrEmpty(className))
-            {
-                throw new NMSException("Cannot register a transport with an empty className.");
-            }
-
-            TransportFactory.schemeToClassName[scheme.ToLower()] = className;
-        }
-
-        public static void RegisterTransport(string scheme, Type factoryType)
-        {
-            if(String.IsNullOrEmpty(scheme))
-            {
-                throw new NMSException("Cannot register a transport with an empty scheme.");
-            }
-
-            if(factoryType == null)
-            {
-                throw new NMSException("Cannot register a transport with an empty type name.");
-            }
-
-            TransportFactory.schemeToTypeName[scheme.ToLower()] = factoryType;
+            TRANSPORT_FACTORY_TYPES[scheme] = factoryType;
         }
 
 		/// <summary>
@@ -112,44 +90,7 @@ namespace Apache.NMS.ActiveMQ.Transport
 
 			try
 			{
-				switch(scheme.ToLower())
-				{
-				case "tcp":
-					factory = new TcpTransportFactory();
-					break;
-                case "ssl":
-                    factory = new SslTransportFactory();
-                    break;
-                case "discovery":
-					factory = new DiscoveryTransportFactory();
-					break;
-				case "failover":
-					factory = new FailoverTransportFactory();
-					break;
-				case "mock":
-					factory = new MockTransportFactory();
-					break;
-				default:
-
-                    // Types are easier lets check them first.
-                    if(TransportFactory.schemeToTypeName.ContainsKey(scheme))
-                    {
-                        Type objectType = schemeToTypeName[scheme];
-                        factory = CreateTransportByObjectType(objectType);
-                        break;
-                    }
-
-                    // Now we can look for Class names, may have to search lots of assemblies
-                    // for this one.
-                    if(TransportFactory.schemeToClassName.ContainsKey(scheme))
-                    {
-                        String className = schemeToClassName[scheme];
-                        factory = CreateTransportByClassName(className);
-                        break;
-                    }
-
-					throw new NMSConnectionException(String.Format("The transport {0} is not supported.",
scheme));
-				}
+                factory = NewInstance(scheme.ToLower());
 			}
 			catch(NMSConnectionException)
 			{
@@ -168,50 +109,42 @@ namespace Apache.NMS.ActiveMQ.Transport
 			return factory;
 		}
 
-        private static ITransportFactory CreateTransportByObjectType(Type objectType)
+        private static ITransportFactory NewInstance(string scheme)
         {
-            Tracer.Debug("Attempting to create a Transport by its Object Type: " + objectType.FullName);
-
             try
             {
-                return Activator.CreateInstance(objectType) as ITransportFactory;
+                Type factoryType = FindTransportFactory(scheme);
+
+                if(factoryType == null)
+                {
+                    throw new Exception("NewInstance failed to find a match for id = " +
scheme);
+                }
+
+                return (ITransportFactory) Activator.CreateInstance(factoryType);
             }
-            catch
+            catch(Exception ex)
             {
-                throw new NMSConnectionException("Could not create the transport with type
name: " + objectType);
+                Tracer.WarnFormat("NewInstance failed to create an ITransportFactory with
error: {1}", ex.Message);
+                throw;
             }
         }
 
-        private static ITransportFactory CreateTransportByClassName(String className)
+        private static Type FindTransportFactory(string scheme)
         {
-            Tracer.Debug("Attempting to create a Transport by its Class Name: " + className);
+            if(TRANSPORT_FACTORY_TYPES.ContainsKey(scheme))
+            {
+                return TRANSPORT_FACTORY_TYPES[scheme];
+            }
 
             try
             {
-                Assembly assembly = Assembly.GetExecutingAssembly();
-                Type type = assembly.GetType(className, false);
-
-                if(type == null)
-                {
-                    Assembly[] loadedAssemblies = AppDomain.CurrentDomain.GetAssemblies();
-
-                    foreach(Assembly dll in loadedAssemblies)
-                    {
-                        Tracer.DebugFormat("Checking assembly {0} for class named {1}.",
dll.FullName, className);
-                        type = dll.GetType(className, false);
-
-                        if(type != null)
-                        {
-                            break;
-                        }
-                    }
-                }
-
-                return Activator.CreateInstance(type) as ITransportFactory;
+                Type factoryType = FACTORY_FINDER.FindFactoryType(scheme);
+                TRANSPORT_FACTORY_TYPES[scheme] = factoryType;
+                return factoryType;
             }
             catch
             {
-                throw new NMSConnectionException("Could not create the transport with type
name: " + className);
+                throw new NMSConnectionException("Failed to find Factory for Transport type:
" + scheme);
             }
         }
 	}

Added: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Util/FactoryAttribute.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Util/FactoryAttribute.cs?rev=1059020&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Util/FactoryAttribute.cs
(added)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Util/FactoryAttribute.cs
Fri Jan 14 14:38:05 2011
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+
+namespace Apache.NMS.ActiveMQ.Util
+{
+    [AttributeUsage(AttributeTargets.Class)]
+    public class FactoryAttribute : Attribute
+    {
+        private string factoryIdentifier;
+        private string description;
+
+        public FactoryAttribute(string factoryIdentifier)
+        {
+            this.factoryIdentifier = factoryIdentifier;
+        }
+
+        public string FactoryIdentifier
+        {
+            get { return this.factoryIdentifier; }
+        }
+
+        public string Description
+        {
+            get { return this.description; }
+            set { this.description = value; }
+        }
+    }
+}
+

Propchange: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Util/FactoryAttribute.cs
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Util/FactoryFinder.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Util/FactoryFinder.cs?rev=1059020&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Util/FactoryFinder.cs
(added)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Util/FactoryFinder.cs
Fri Jan 14 14:38:05 2011
@@ -0,0 +1,125 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Reflection;
+using System.Collections.Generic;
+
+namespace Apache.NMS.ActiveMQ.Util
+{
+    public class FactoryFinder<AttributeType, FactoryType> where AttributeType : FactoryAttribute
+    {
+        private static IDictionary<string, bool> DEFAULT_EXCLUDES;
+
+        static FactoryFinder()
+        {
+            DEFAULT_EXCLUDES = new Dictionary<string, bool>();
+
+            DEFAULT_EXCLUDES.Add("mscorlib", true);
+            DEFAULT_EXCLUDES.Add("System", true);
+            DEFAULT_EXCLUDES.Add("Mono", true);
+            DEFAULT_EXCLUDES.Add("Microsoft", true);
+            DEFAULT_EXCLUDES.Add("nunit", true);
+        }
+
+        public Type FindFactoryType(string factoryId)
+        {
+            try
+            {
+                // Look in this assembly first as its most likely to be the source, if we
+                // don't find it here then we expand out to all the currently loaded
+                // assemblies in the current AppDomain.  We could also start searching
+                // through all referenced assemblies in all the currently loaded ones but
+                // that could get out of hand so try this first.
+                Type result = this.SearchAssembly(Assembly.GetExecutingAssembly(), factoryId);
+
+                if(result == null)
+                {
+                    Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
+
+                    foreach(Assembly assembly in assemblies)
+                    {
+                        if(!IsExcluded(assembly))
+                        {
+                            result = SearchAssembly(assembly, factoryId);
+
+                            if(result != null)
+                            {
+                                break;
+                            }
+                        }
+                    }
+                }
+
+                return result;
+            }
+            catch
+            {
+                return null;
+            }
+        }
+
+        private bool IsExcluded(Assembly assembly)
+        {
+            if(assembly.Equals(Assembly.GetExecutingAssembly()))
+            {
+                return true;
+            }
+
+            string name = assembly.GetName().Name;
+
+            foreach(string key in DEFAULT_EXCLUDES.Keys)
+            {
+                if(name.StartsWith(key))
+                {
+                    return true;
+                }
+            }
+
+            return false;
+        }
+
+        private Type SearchAssembly(Assembly assembly, string factoryId)
+        {
+            Tracer.DebugFormat("Searching Assembly: {0} for factory of the id: {1}",
+                               assembly.GetName().Name, factoryId);
+
+            Type[] types = assembly.GetTypes();
+
+            foreach(Type type in types)
+            {
+                object[] attributes = type.GetCustomAttributes(false);
+                foreach(Attribute attribute in attributes)
+                {
+                    if(attribute is AttributeType)
+                    {
+                        FactoryAttribute factoryAttribute = (FactoryAttribute)attribute;
+                        if(factoryAttribute.FactoryIdentifier.Equals(factoryId))
+                        {
+                            Tracer.DebugFormat("Found the Factory of type {0} for id: {1}",
+                                               type.ToString(), factoryId);
+                            return type;
+                        }
+                    }
+                }
+            }
+
+            return null;
+        }
+    }
+}
+

Propchange: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Util/FactoryFinder.cs
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/Transport/Tcp/TcpFaultyTransportFactory.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/Transport/Tcp/TcpFaultyTransportFactory.cs?rev=1059020&r1=1059019&r2=1059020&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/Transport/Tcp/TcpFaultyTransportFactory.cs
(original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/Transport/Tcp/TcpFaultyTransportFactory.cs
Fri Jan 14 14:38:05 2011
@@ -17,9 +17,11 @@
 
 using System;
 using System.Net.Sockets;
+using Apache.NMS.ActiveMQ.Util;
 
 namespace Apache.NMS.ActiveMQ.Transport.Tcp
 {
+    [ActiveMQTransportFactory("tcpfaulty")]
 	public class TcpFaultyTransportFactory : TcpTransportFactory
 	{        
         public TcpFaultyTransportFactory() : base()

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/Transport/Tcp/TcpFaultyTransportTest.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/Transport/Tcp/TcpFaultyTransportTest.cs?rev=1059020&r1=1059019&r2=1059020&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/Transport/Tcp/TcpFaultyTransportTest.cs
(original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/Transport/Tcp/TcpFaultyTransportTest.cs
Fri Jan 14 14:38:05 2011
@@ -39,7 +39,6 @@ namespace Apache.NMS.ActiveMQ.Test
         public override void SetUp()
         {
             base.SetUp();
-            TransportFactory.RegisterTransport("tcpFaulty", typeof(TcpFaultyTransportFactory));
 
             preProcessorFired = false;
             postProcessorFired = false;



Mime
View raw message