CloneSet115


Previous CloneSetNext CloneSetBack to Main Report
Clone
Mass
Clones in
CloneSet
Parameter
Count
Clone
Similarity
Syntax Category
[Sequence Length]
72310.998compilation_unit
Clone AbstractionParameter Bindings
Clone Instance
(Click to see clone)
Line CountSource Line
Source File
1721
src/NHibernate.ByteCode.Castle.Tests/DebugConnectionProvider.cs
2681
src/NHibernate.ByteCode.LinFu.Tests/DebugConnectionProvider.cs
3681
src/NHibernate.ByteCode.Spring.Tests/DebugConnectionProvider.cs
Clone Instance
1
Line Count
72
Source Line
1
Source File
src/NHibernate.ByteCode.Castle.Tests/DebugConnectionProvider.cs

using System.Collections;
using System.Data;
using Iesi.Collections;
using NHibernate.Connection;

namespace NHibernate.ByteCode.Castle.Tests
{
        /// <summary>
        /// This connection provider keeps a list of all open connections,
        /// it is used when testing to check that tests clean up after themselves.
        /// </summary>
        public class DebugConnectionProvider : DriverConnectionProvider
        {
                private readonly ISet connections = new ListSet();

                public override IDbConnection GetConnection()
                {
                        IDbConnection connection = base.GetConnection();
                        connections.Add(connection);
                        return connection;
                }

                public override void CloseConnection(IDbConnection conn)
                {
                        base.CloseConnection(conn);
                        connections.Remove(conn);
                }

                public bool HasOpenConnections
                {
                        get
                        {
                                // check to see if all connections that were at one point opened
                                // have been closed through the CloseConnection
                                // method
                                if (connections.IsEmpty)
                                {
                                        // there are no connections, either none were opened or
                                        // all of the closings went through CloseConnection.
                                        return false;
                                }
                                else
                                {
                                        // Disposing of an ISession does not call CloseConnection (should it???)
                                        // so a Diposed of ISession will leave an IDbConnection in the list but
                                        // the IDbConnection will be closed (atleast with MsSql it works this way).
                                        foreach (IDbConnection conn in connections)
                                        {
                                                if (conn.State != ConnectionState.Closed)
                                                {
                                                        return true;
                                                }
                                        }

                                        // all of the connections have been Disposed and were closed that way
                                        // or they were Closed through the CloseConnection method.
                                        return false;
                                }
                        }
                }

                public void CloseAllConnections()
                {
                        while ( !connections.IsEmpty)
                        {
                                IEnumerator en = connections.GetEnumerator();
                                en.MoveNext();
                                CloseConnection(en.Current as IDbConnection);
                        }
                }

        }
}


Clone Instance
2
Line Count
68
Source Line
1
Source File
src/NHibernate.ByteCode.LinFu.Tests/DebugConnectionProvider.cs

using System.Collections;
using System.Data;
using Iesi.Collections;
using NHibernate.Connection;

namespace NHibernate.ByteCode.LinFu.Tests
{
        public class DebugConnectionProvider : DriverConnectionProvider
        {
                private readonly ISet connections = new ListSet();

                public override IDbConnection GetConnection()
                {
                        IDbConnection connection = base.GetConnection();
                        connections.Add(connection);
                        return connection;
                }

                public override void CloseConnection(IDbConnection conn)
                {
                        base.CloseConnection(conn);
                        connections.Remove(conn);
                }

                public bool HasOpenConnections
                {
                        get
                        {
                                // check to see if all connections that were at one point opened
                                // have been closed through the CloseConnection
                                // method
                                if (connections.IsEmpty)
                                {
                                        // there are no connections, either none were opened or
                                        // all of the closings went through CloseConnection.
                                        return false;
                                }
                                else
                                {
                                        // Disposing of an ISession does not call CloseConnection (should it???)
                                        // so a Diposed of ISession will leave an IDbConnection in the list but
                                        // the IDbConnection will be closed (atleast with MsSql it works this way).
                                        foreach (IDbConnection conn in connections)
                                        {
                                                if (conn.State != ConnectionState.Closed)
                                                {
                                                        return true;
                                                }
                                        }

                                        // all of the connections have been Disposed and were closed that way
                                        // or they were Closed through the CloseConnection method.
                                        return false;
                                }
                        }
                }

                public void CloseAllConnections()
                {
                        while ( !connections.IsEmpty)
                        {
                                IEnumerator en = connections.GetEnumerator();
                                en.MoveNext();
                                CloseConnection(en.Current as IDbConnection);
                        }
                }

        }
}


Clone Instance
3
Line Count
68
Source Line
1
Source File
src/NHibernate.ByteCode.Spring.Tests/DebugConnectionProvider.cs

using System.Collections;
using System.Data;
using Iesi.Collections;
using NHibernate.Connection;

namespace NHibernate.ByteCode.Spring.Tests
{
        public class DebugConnectionProvider : DriverConnectionProvider
        {
                private readonly ISet connections = new ListSet();

                public override IDbConnection GetConnection()
                {
                        IDbConnection connection = base.GetConnection();
                        connections.Add(connection);
                        return connection;
                }

                public override void CloseConnection(IDbConnection conn)
                {
                        base.CloseConnection(conn);
                        connections.Remove(conn);
                }

                public bool HasOpenConnections
                {
                        get
                        {
                                // check to see if all connections that were at one point opened
                                // have been closed through the CloseConnection
                                // method
                                if (connections.IsEmpty)
                                {
                                        // there are no connections, either none were opened or
                                        // all of the closings went through CloseConnection.
                                        return false;
                                }
                                else
                                {
                                        // Disposing of an ISession does not call CloseConnection (should it???)
                                        // so a Diposed of ISession will leave an IDbConnection in the list but
                                        // the IDbConnection will be closed (atleast with MsSql it works this way).
                                        foreach (IDbConnection conn in connections)
                                        {
                                                if (conn.State != ConnectionState.Closed)
                                                {
                                                        return true;
                                                }
                                        }

                                        // all of the connections have been Disposed and were closed that way
                                        // or they were Closed through the CloseConnection method.
                                        return false;
                                }
                        }
                }

                public void CloseAllConnections()
                {
                        while ( !connections.IsEmpty)
                        {
                                IEnumerator en = connections.GetEnumerator();
                                en.MoveNext();
                                CloseConnection(en.Current as IDbConnection);
                        }
                }

        }
}


Clone AbstractionParameter Count: 1Parameter Bindings

using System.Collections;
using System.Data;
using Iesi.Collections;
using NHibernate.Connection;
namespace NHibernate.ByteCode. [[#variable68761b20]].Tests
{
   /// <summary>
   /// This connection provider keeps a list of all open connections,
   /// it is used when testing to check that tests clean up after themselves.
   /// </summary>
   public class DebugConnectionProvider: DriverConnectionProvider
   {
      private readonly ISet connections = new ListSet();

      public override IDbConnection GetConnection()
      {
         IDbConnection connection = base.GetConnection();
         connections.Add(connection);
         return connection;
      }

      public override void CloseConnection(IDbConnection conn)
      {
         base.CloseConnection(conn);
         connections.Remove(conn);
      }

      public bool HasOpenConnections
      {
         get
         {
            // check to see if all connections that were at one point opened
            // have been closed through the CloseConnection
            // method
            if (connections.IsEmpty)
            {
               // there are no connections, either none were opened or
               // all of the closings went through CloseConnection.
               return false;
            }
            else
            {
               // Disposing of an ISession does not call CloseConnection (should it???)
               // so a Diposed of ISession will leave an IDbConnection in the list but
               // the IDbConnection will be closed (atleast with MsSql it works this way).
               foreach (IDbConnection conn in connections)
               {
                  if (conn.State != ConnectionState.Closed)
                  {
                     return true;
                  }
               }
               // all of the connections have been Disposed and were closed that way
               // or they were Closed through the CloseConnection method.
               return false;
            }
         }
      }

      public void CloseAllConnections()
      {
         while ( !connections.IsEmpty)
         {
            IEnumerator en = connections.GetEnumerator();
            en.MoveNext();
            CloseConnection(en.Current as IDbConnection);
         }
      }

   }
}
 

CloneAbstraction
Parameter Bindings
Parameter
Index
Clone
Instance
Parameter
Name
Value
11[[#68761b20]]
Castle 
12[[#68761b20]]
LinFu 
13[[#68761b20]]
Spring