[jboss-cvs] JBossAS SVN: r93299 - in projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core: connectionmanager and 3 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Sep 8 16:06:52 EDT 2009
Author: gurkanerdogdu
Date: 2009-09-08 16:06:52 -0400 (Tue, 08 Sep 2009)
New Revision: 93299
Added:
projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/
projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/common/
projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/common/MockConnectionFactory.java
projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/common/MockConnectionManager.java
projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/common/MockConnectionRequestInfo.java
projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/common/MockHandle.java
projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/common/MockManagedConnection.java
projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/common/MockManagedConnectionFactory.java
projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/common/package.html
projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/unit/
projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/unit/AbstractConnectionManagerTestCase.java
projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/unit/ConnectionCounterTestCase.java
projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/unit/PoolParamsTestCase.java
projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/unit/nonTx/
projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/unit/nonTx/NonTxConnectionManagerTestCase.java
projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/unit/nonTx/package.html
projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/unit/package.html
Log:
[JBJCA-165] Connection Pooling JUnit & Integration Tests
Added: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/common/MockConnectionFactory.java
===================================================================
--- projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/common/MockConnectionFactory.java (rev 0)
+++ projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/common/MockConnectionFactory.java 2009-09-08 20:06:52 UTC (rev 93299)
@@ -0,0 +1,122 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008-2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jca.test.core.connectionmanager.common;
+
+import javax.naming.NamingException;
+import javax.naming.Reference;
+import javax.resource.ResourceException;
+import javax.resource.cci.Connection;
+import javax.resource.cci.ConnectionFactory;
+import javax.resource.cci.ConnectionSpec;
+import javax.resource.cci.RecordFactory;
+import javax.resource.cci.ResourceAdapterMetaData;
+import javax.resource.spi.ConnectionManager;
+import javax.resource.spi.ManagedConnectionFactory;
+
+/**
+ * Mock connection factory.
+ * @author <a href="mailto:gurkanerdogdu at yahoo.com">Gurkan Erdogdu</a>
+ * @version $Rev$ $Date$
+ *
+ */
+public class MockConnectionFactory implements ConnectionFactory
+{
+ //Serialize UID
+ private static final long serialVersionUID = 3835383490257981043L;
+
+ /**Connection manager*/
+ private ConnectionManager connectionManager;
+
+ /**Connection factory*/
+ private ManagedConnectionFactory managedConnectionFactory;
+
+ /**
+ * Creates an instance.
+ * @param connectionManager cm
+ * @param managedConnectionFactory mcf
+ */
+ public MockConnectionFactory(ConnectionManager connectionManager, ManagedConnectionFactory managedConnectionFactory)
+ {
+ this.connectionManager = connectionManager;
+ this.managedConnectionFactory = managedConnectionFactory;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Connection getConnection() throws ResourceException
+ {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+
+ public Connection getConnection(ConnectionSpec properties) throws ResourceException
+ {
+ MockConnectionRequestInfo ri = new MockConnectionRequestInfo();
+
+ return (Connection)this.connectionManager.allocateConnection(this.managedConnectionFactory, ri);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+
+ public ResourceAdapterMetaData getMetaData() throws ResourceException
+ {
+
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+
+ public RecordFactory getRecordFactory() throws ResourceException
+ {
+
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+
+ public void setReference(Reference reference)
+ {
+
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+
+ public Reference getReference() throws NamingException
+ {
+
+ return null;
+ }
+
+}
Property changes on: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/common/MockConnectionFactory.java
___________________________________________________________________
Name: svn:keywords
+ Rev Date
Name: svn:eol-style
+ native
Added: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/common/MockConnectionManager.java
===================================================================
--- projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/common/MockConnectionManager.java (rev 0)
+++ projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/common/MockConnectionManager.java 2009-09-08 20:06:52 UTC (rev 93299)
@@ -0,0 +1,55 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008-2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jca.test.core.connectionmanager.common;
+
+import org.jboss.jca.core.connectionmanager.AbstractConnectionManager;
+import org.jboss.jca.core.connectionmanager.listener.ConnectionListener;
+
+import javax.resource.ResourceException;
+import javax.resource.spi.ManagedConnection;
+
+/**
+ * Mock connection manager.
+ * @author <a href="mailto:gurkanerdogdu at yahoo.com">Gurkan Erdogdu</a>
+ * @version $Rev$ $Date$
+ *
+ */
+public class MockConnectionManager extends AbstractConnectionManager
+{
+ /**
+ * Creates a new mock connection manager.
+ */
+ public MockConnectionManager()
+ {
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ConnectionListener createConnectionListener(ManagedConnection managedConnection,
+ Object context) throws ResourceException
+ {
+ return null;
+ }
+
+}
Property changes on: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/common/MockConnectionManager.java
___________________________________________________________________
Name: svn:keywords
+ Rev Date
Name: svn:eol-style
+ native
Added: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/common/MockConnectionRequestInfo.java
===================================================================
--- projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/common/MockConnectionRequestInfo.java (rev 0)
+++ projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/common/MockConnectionRequestInfo.java 2009-09-08 20:06:52 UTC (rev 93299)
@@ -0,0 +1,82 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008-2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jca.test.core.connectionmanager.common;
+
+import javax.resource.spi.ConnectionRequestInfo;
+
+/**
+ * Mock connection reqest info.
+ * @author <a href="mailto:gurkanerdogdu at yahoo.com">Gurkan Erdogdu</a>
+ * @version $Rev$ $Date$
+ *
+ */
+public class MockConnectionRequestInfo implements ConnectionRequestInfo
+{
+ /**Property*/
+ private String someProperty = "property";
+
+ /**
+ * Creates a new instance
+ */
+ public MockConnectionRequestInfo()
+ {
+
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode()
+ {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((someProperty == null) ? 0 : someProperty.hashCode());
+ return result;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ MockConnectionRequestInfo other = (MockConnectionRequestInfo) obj;
+ if (someProperty == null)
+ {
+ if (other.someProperty != null)
+ return false;
+ }
+ else if (!someProperty.equals(other.someProperty))
+ return false;
+ return true;
+ }
+
+
+
+}
Property changes on: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/common/MockConnectionRequestInfo.java
___________________________________________________________________
Name: svn:keywords
+ Rev Date
Name: svn:eol-style
+ native
Added: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/common/MockHandle.java
===================================================================
--- projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/common/MockHandle.java (rev 0)
+++ projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/common/MockHandle.java 2009-09-08 20:06:52 UTC (rev 93299)
@@ -0,0 +1,90 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008-2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jca.test.core.connectionmanager.common;
+
+import javax.resource.ResourceException;
+import javax.resource.cci.Connection;
+import javax.resource.cci.ConnectionMetaData;
+import javax.resource.cci.Interaction;
+import javax.resource.cci.LocalTransaction;
+import javax.resource.cci.ResultSetInfo;
+
+/**
+ * Mock connection handle.
+ *
+ * @author <a href="mailto:gurkanerdogdu at yahoo.com">Gurkan Erdogdu</a>
+ * @version $Rev$ $Date$
+ *
+ */
+public class MockHandle implements Connection
+{
+
+ /**
+ * {@inheritDoc}
+ */
+ public void close() throws ResourceException
+ {
+
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+
+ public Interaction createInteraction() throws ResourceException
+ {
+
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+
+ public LocalTransaction getLocalTransaction() throws ResourceException
+ {
+
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+
+ public ConnectionMetaData getMetaData() throws ResourceException
+ {
+
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+
+ public ResultSetInfo getResultSetInfo() throws ResourceException
+ {
+
+ return null;
+ }
+
+}
Property changes on: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/common/MockHandle.java
___________________________________________________________________
Name: svn:keywords
+ Rev Date
Name: svn:eol-style
+ native
Added: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/common/MockManagedConnection.java
===================================================================
--- projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/common/MockManagedConnection.java (rev 0)
+++ projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/common/MockManagedConnection.java 2009-09-08 20:06:52 UTC (rev 93299)
@@ -0,0 +1,160 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008-2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jca.test.core.connectionmanager.common;
+
+import java.io.PrintWriter;
+
+import javax.resource.ResourceException;
+import javax.resource.spi.ConnectionEventListener;
+import javax.resource.spi.ConnectionRequestInfo;
+import javax.resource.spi.LocalTransaction;
+import javax.resource.spi.ManagedConnection;
+import javax.resource.spi.ManagedConnectionMetaData;
+import javax.security.auth.Subject;
+import javax.transaction.xa.XAResource;
+
+/**
+ * Mocked managed connection.
+ *
+ * @author <a href="mailto:gurkanerdogdu at yahoo.com">Gurkan Erdogdu</a>
+ * @version $Rev$ $Date$
+ *
+ */
+public class MockManagedConnection implements ManagedConnection
+{
+ /**
+ * Creates a new instance.
+ */
+ public MockManagedConnection()
+ {
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void addConnectionEventListener(ConnectionEventListener listener)
+ {
+
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+
+ public void associateConnection(Object connection) throws ResourceException
+ {
+
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+
+ public void cleanup() throws ResourceException
+ {
+
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+
+ public void destroy() throws ResourceException
+ {
+
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+
+ public Object getConnection(Subject subject, ConnectionRequestInfo cxRequestInfo) throws ResourceException
+ {
+ return new MockHandle();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+
+ public LocalTransaction getLocalTransaction() throws ResourceException
+ {
+
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+
+ public PrintWriter getLogWriter() throws ResourceException
+ {
+
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+
+ public ManagedConnectionMetaData getMetaData() throws ResourceException
+ {
+
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+
+ public XAResource getXAResource() throws ResourceException
+ {
+
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+
+ public void removeConnectionEventListener(ConnectionEventListener listener)
+ {
+
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+
+ public void setLogWriter(PrintWriter out) throws ResourceException
+ {
+
+
+ }
+
+}
Property changes on: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/common/MockManagedConnection.java
___________________________________________________________________
Name: svn:keywords
+ Rev Date
Name: svn:eol-style
+ native
Added: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/common/MockManagedConnectionFactory.java
===================================================================
--- projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/common/MockManagedConnectionFactory.java (rev 0)
+++ projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/common/MockManagedConnectionFactory.java 2009-09-08 20:06:52 UTC (rev 93299)
@@ -0,0 +1,106 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008-2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jca.test.core.connectionmanager.common;
+
+import java.io.PrintWriter;
+import java.util.Set;
+
+import javax.resource.ResourceException;
+import javax.resource.spi.ConnectionManager;
+import javax.resource.spi.ConnectionRequestInfo;
+import javax.resource.spi.ManagedConnection;
+import javax.resource.spi.ManagedConnectionFactory;
+import javax.security.auth.Subject;
+
+/**
+ * Mock managed connection factory.
+ *
+ * @author <a href="mailto:gurkanerdogdu at yahoo.com">Gurkan Erdogdu</a>
+ * @version $Rev$ $Date$
+ *
+ */
+public class MockManagedConnectionFactory implements ManagedConnectionFactory
+{
+ //Serialize UID
+ private static final long serialVersionUID = -5176317097693203493L;
+
+ /**
+ * {@inheritDoc}
+ */
+ public Object createConnectionFactory(ConnectionManager cxManager) throws ResourceException
+ {
+ return new MockConnectionFactory(cxManager, this);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+
+ public Object createConnectionFactory() throws ResourceException
+ {
+
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+
+ public ManagedConnection createManagedConnection(Subject subject, ConnectionRequestInfo cxRequestInfo)
+ throws ResourceException
+ {
+
+ return new MockManagedConnection();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+
+ public PrintWriter getLogWriter() throws ResourceException
+ {
+
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @SuppressWarnings("unchecked")
+ public ManagedConnection matchManagedConnections(Set connectionSet, Subject subject,
+ ConnectionRequestInfo cxRequestInfo) throws ResourceException
+ {
+
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+
+ public void setLogWriter(PrintWriter out) throws ResourceException
+ {
+
+
+ }
+
+}
Property changes on: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/common/MockManagedConnectionFactory.java
___________________________________________________________________
Name: svn:keywords
+ Rev Date
Name: svn:eol-style
+ native
Added: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/common/package.html
===================================================================
--- projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/common/package.html (rev 0)
+++ projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/common/package.html 2009-09-08 20:06:52 UTC (rev 93299)
@@ -0,0 +1,3 @@
+<body>
+Package covering some mock classes.
+</body>
Property changes on: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/common/package.html
___________________________________________________________________
Name: svn:eol-style
+ native
Added: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/unit/AbstractConnectionManagerTestCase.java
===================================================================
--- projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/unit/AbstractConnectionManagerTestCase.java (rev 0)
+++ projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/unit/AbstractConnectionManagerTestCase.java 2009-09-08 20:06:52 UTC (rev 93299)
@@ -0,0 +1,278 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008-2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jca.test.core.connectionmanager.unit;
+
+import org.jboss.jca.core.connectionmanager.AbstractConnectionManager;
+import org.jboss.jca.core.connectionmanager.CachedConnectionManager;
+import org.jboss.jca.core.connectionmanager.pool.strategy.OnePool;
+import org.jboss.jca.test.core.connectionmanager.common.MockConnectionManager;
+import org.jboss.jca.test.core.connectionmanager.common.MockManagedConnectionFactory;
+
+import javax.resource.ResourceException;
+import javax.security.auth.Subject;
+import javax.transaction.RollbackException;
+import javax.transaction.SystemException;
+
+import org.jboss.security.SubjectFactory;
+import org.jboss.util.NotImplementedException;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * AbstractConnectionManagerTestCase.
+ * @author <a href="mailto:gurkanerdogdu at yahoo.com">Gurkan Erdogdu</a>
+ * @version $Rev$ $Date$
+ *
+ */
+public class AbstractConnectionManagerTestCase
+{
+ /**Mock instance*/
+ private static AbstractConnectionManager connectionManager = null;
+
+ /**
+ * Init.
+ */
+ @BeforeClass
+ public static void init()
+ {
+ connectionManager = new MockConnectionManager();
+ }
+
+ /**
+ * testPoolingStrategyNotNull.
+ */
+ @Test
+ public void testPoolingStrategyNotNull()
+ {
+ assertNull(connectionManager.getPoolingStrategy());
+ connectionManager.setPoolingStrategy(new OnePool(null, null, false));
+ assertNotNull(connectionManager.getPoolingStrategy());
+ assertTrue(connectionManager.getPoolingStrategy() instanceof OnePool);
+ }
+
+ /**
+ * testGetCachedConnectionManager.
+ */
+ @Test
+ public void testGetCachedConnectionManager()
+ {
+ assertNull(connectionManager.getCachedConnectionManager());
+ connectionManager.setCachedConnectionManager(new CachedConnectionManager());
+ assertNotNull(connectionManager.getCachedConnectionManager());
+ }
+
+ /**
+ * testJndiName.
+ */
+ @Test
+ public void testJndiName()
+ {
+ assertNull(connectionManager.getJndiName());
+ connectionManager.setJndiName("jndi_name");
+ assertNotNull(connectionManager.getJndiName());
+ assertEquals("jndi_name", connectionManager.getJndiName());
+ }
+
+ /**
+ * testSecDomainJndiName.
+ */
+ @Test
+ public void testSecDomainJndiName()
+ {
+ assertNull(connectionManager.getSecurityDomainJndiName());
+ connectionManager.setSecurityDomainJndiName("jndi_name");
+ assertNotNull(connectionManager.getSecurityDomainJndiName());
+ assertEquals("jndi_name", connectionManager.getSecurityDomainJndiName());
+ }
+
+ /**
+ * testSubjectFactory.
+ */
+ @Test
+ public void testSubjectFactory()
+ {
+ assertNull(connectionManager.getSubjectFactory());
+ SubjectFactory fact = new SubjectFactory()
+ {
+
+ public Subject createSubject()
+ {
+ return null;
+ }
+
+ public Subject createSubject(String arg0)
+ {
+ return null;
+ }
+
+ };
+ connectionManager.setSubjectFactory(fact);
+ assertNotNull(connectionManager.getSubjectFactory());
+ assertEquals(fact, connectionManager.getSubjectFactory());
+ }
+
+ /**
+ * testGetManagedConnectionFactory.
+ */
+ @Test
+ public void testGetManagedConnectionFactory()
+ {
+ assertNull(connectionManager.getManagedConnectionFactory());
+ MockManagedConnectionFactory mcf = new MockManagedConnectionFactory();
+ connectionManager.setPoolingStrategy(new OnePool(mcf, null, false));
+ assertNotNull(connectionManager.getManagedConnectionFactory());
+ assertEquals(mcf, connectionManager.getManagedConnectionFactory());
+ }
+
+ /**
+ * testAllocationRetry.
+ */
+ @Test
+ public void testAllocationRetry()
+ {
+ assertEquals(0, connectionManager.getAllocationRetry());
+ connectionManager.setAllocationRetry(5);
+ assertEquals(5, connectionManager.getAllocationRetry());
+ }
+
+ /**
+ * setAllocationRetryInMilisec.
+ */
+ @Test
+ public void setAllocationRetryInMilisec()
+ {
+ assertEquals(0L, connectionManager.getAllocationRetryWaitMillis());
+ connectionManager.setAllocationRetryWaitMillis(5000L);
+ assertEquals(5000L, connectionManager.getAllocationRetryWaitMillis());
+
+ }
+
+
+ /**
+ * testGetTransactionManagerInstance.
+ */
+ @Test
+ public void testGetTransactionManagerInstance()
+ {
+ assertNull(connectionManager.getTransactionManagerInstance());
+ }
+
+ /**
+ * testIsTransactional.
+ */
+ @Test
+ public void testIsTransactional()
+ {
+ assertFalse(connectionManager.isTransactional());
+ }
+
+ /**
+ * testGetTimeLeftBeforeTrsTimeout.
+ */
+ @Test
+ public void testGetTimeLeftBeforeTrsTimeout()
+ {
+ try
+ {
+ assertEquals(-1L, connectionManager.getTimeLeftBeforeTransactionTimeout(false));
+ }
+ catch (RollbackException e)
+ {
+ //No action
+ }
+ }
+
+ /**
+ * testGetTransactionTimeout.
+ */
+ @Test(expected = NotImplementedException.class)
+ public void testGetTransactionTimeout()
+ {
+ try
+ {
+ connectionManager.getTransactionTimeout();
+ }
+ catch (SystemException e)
+ {
+ //No action
+ }
+ }
+
+
+ /**
+ * testGetManagedConnectionFactoryIsNull.
+ */
+ @Test
+ public void testGetManagedConnectionFactoryIsNull()
+ {
+ connectionManager.setPoolingStrategy(null);
+ assertNull(connectionManager.getManagedConnectionFactory());
+ }
+
+ /**
+ * testGetManagedConnectionInShutdownedManager
+ * @throws ResourceException for exception
+ */
+ @Test(expected = ResourceException.class)
+ public void testGetManagedConnectionInShutdownedManager() throws ResourceException
+ {
+ connectionManager.setShutDown(true);
+ connectionManager.getManagedConnection(null, null);
+ }
+
+ /**
+ * testAllocateConnectionPoolingStrategyNull.
+ * @throws ResourceException for exception
+ */
+ @Test(expected = ResourceException.class)
+ public void testAllocateConnectionPoolingStrategyNull() throws ResourceException
+ {
+ connectionManager.setPoolingStrategy(null);
+ connectionManager.allocateConnection(null, null);
+ }
+
+ /**
+ * testAllocateConnectionWrongMCF.
+ * @throws ResourceException for exception
+ */
+ @Test(expected = ResourceException.class)
+ public void testAllocateConnectionWrongMCF() throws ResourceException
+ {
+ OnePool pool = new OnePool(new MockManagedConnectionFactory(), null, false);
+ connectionManager.setPoolingStrategy(pool);
+ connectionManager.allocateConnection(new MockManagedConnectionFactory(), null);
+ }
+
+
+ /**
+ * Destroy.
+ */
+ @AfterClass
+ public static void destroy()
+ {
+ connectionManager = null;
+ }
+}
Property changes on: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/unit/AbstractConnectionManagerTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Rev Date
Name: svn:eol-style
+ native
Added: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/unit/ConnectionCounterTestCase.java
===================================================================
--- projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/unit/ConnectionCounterTestCase.java (rev 0)
+++ projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/unit/ConnectionCounterTestCase.java 2009-09-08 20:06:52 UTC (rev 93299)
@@ -0,0 +1,192 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008-2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.jca.test.core.connectionmanager.unit;
+
+import org.jboss.jca.core.connectionmanager.ConnectionCounter;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * <code>ConnectionCounter</code> unit tests.
+ *
+ * @author gurkanerdogdu
+ * @version $Rev$ $Date$
+ *
+ */
+public class ConnectionCounterTestCase
+{
+ /**
+ * Test {@link ConnectionCounter#getGuaranteedCount()}.
+ */
+ @Test
+ public void testGetGuaranteedCount()
+ {
+ ConnectionCounter counter = new ConnectionCounter();
+ assertEquals(0, counter.getCreatedCount());
+ counter.inc();
+ assertEquals(1, counter.getGuaranteedCount());
+ counter.inc();
+ counter.inc();
+ assertEquals(3, counter.getGuaranteedCount());
+ counter.dec();
+ assertEquals(2, counter.getGuaranteedCount());
+ }
+
+ /**
+ * Test {@link ConnectionCounter#getGuaranteedCount()}.
+ */
+ @Test
+ public void testGetCount()
+ {
+ ConnectionCounter counter = new ConnectionCounter();
+ assertEquals(0, counter.getCreatedCount());
+ counter.inc();
+ assertEquals(1, counter.getCount());
+ counter.inc();
+ counter.inc();
+ assertEquals(3, counter.getCount());
+ counter.dec();
+ assertEquals(2, counter.getCount());
+
+ }
+
+ /**
+ * Test {@link ConnectionCounter#GetGuaranteedCount()}.
+ */
+ @Test
+ public void testGetCreatedCount()
+ {
+ ConnectionCounter counter = new ConnectionCounter();
+ assertEquals(0, counter.getCreatedCount());
+ counter.inc();
+ assertEquals(1, counter.getCreatedCount());
+ counter.inc();
+ assertEquals(2, counter.getCreatedCount());
+ }
+
+ /**
+ * Test {@link ConnectionCounter#GetGuaranteedCount()}.
+ */
+ @Test
+ public void testGetDestroyedCount()
+ {
+ ConnectionCounter counter = new ConnectionCounter();
+ assertEquals(0, counter.getDestroyedCount());
+ counter.inc();
+ assertEquals(1, counter.getCreatedCount());
+ counter.dec();
+ assertEquals(1, counter.getDestroyedCount());
+
+ }
+
+ /**
+ * Test {@link ConnectionCounter#GetGuaranteedCount()}.
+ */
+ @Test
+ public void testInc()
+ {
+ ConnectionCounter counter = new ConnectionCounter();
+ assertEquals(0, counter.getCreatedCount());
+
+ for (int i = 0; i < 5; i++)
+ {
+ counter.inc();
+ }
+
+ assertEquals(5, counter.getCreatedCount());
+ }
+
+ /**
+ * Test {@link ConnectionCounter#GetGuaranteedCount()}.
+ */
+ @Test
+ public void testUpdateBlockTime()
+ {
+ ConnectionCounter counter = new ConnectionCounter();
+ assertEquals(0L, counter.getTotalBlockTime());
+ counter.updateBlockTime(1234567L);
+ long lo = counter.getTotalBlockTime();
+ assertEquals(1234567L, lo);
+ }
+
+ /**
+ * Test {@link ConnectionCounter#GetGuaranteedCount()}.
+ */
+ @Test
+ public void testGetTotalBlockTime()
+ {
+ ConnectionCounter counter = new ConnectionCounter();
+ assertEquals(0L, counter.getTotalBlockTime());
+ counter.updateBlockTime(1L);
+ counter.updateBlockTime(5L);
+ assertEquals(6L, counter.getTotalBlockTime());
+ }
+
+ /**
+ * Test {@link ConnectionCounter#GetGuaranteedCount()}.
+ */
+ @Test
+ public void testGetTimedOut()
+ {
+ ConnectionCounter counter = new ConnectionCounter();
+ assertEquals(0L, counter.getTimedOutCount());
+
+ counter.incTimedOutCount();
+ counter.incTimedOutCount();
+ assertEquals(2L, counter.getTimedOutCount());
+ }
+
+ /**
+ * Test {@link ConnectionCounter#GetGuaranteedCount()}.
+ */
+ @Test
+ public void testIncTimedOut()
+ {
+ ConnectionCounter counter = new ConnectionCounter();
+ assertEquals(0L, counter.getTimedOutCount());
+
+ counter.incTimedOutCount();
+ counter.incTimedOutCount();
+ assertEquals(2L, counter.getTimedOutCount());
+ }
+
+ /**
+ * Test {@link ConnectionCounter#GetGuaranteedCount()}.
+ */
+ @Test
+ public void testGetMaxWaitTime()
+ {
+ ConnectionCounter counter = new ConnectionCounter();
+ assertEquals(0L, counter.getMaxWaitTime());
+ counter.updateBlockTime(10L);
+ assertEquals(10L, counter.getMaxWaitTime());
+ counter.updateBlockTime(20L);
+ assertEquals(20L, counter.getMaxWaitTime());
+ counter.updateBlockTime(10L);
+ assertEquals(20L, counter.getMaxWaitTime());
+ }
+
+
+}
Property changes on: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/unit/ConnectionCounterTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Rev Date
Name: svn:eol-style
+ native
Added: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/unit/PoolParamsTestCase.java
===================================================================
--- projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/unit/PoolParamsTestCase.java (rev 0)
+++ projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/unit/PoolParamsTestCase.java 2009-09-08 20:06:52 UTC (rev 93299)
@@ -0,0 +1,136 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008-2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.jca.test.core.connectionmanager.unit;
+
+import org.jboss.jca.core.connectionmanager.pool.PoolParams;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * <code>PoolParams</code> unit test.
+ *
+ * @author gurkanerdogdu
+ * @version $Rev$ $Date$
+ *
+ */
+public class PoolParamsTestCase
+{
+ /**
+ * Test {@link PoolParams#getMinSize()}
+ */
+ @Test
+ public void testMinSize()
+ {
+ PoolParams params = new PoolParams();
+ assertEquals(0, params.getMinSize());
+ params.setMinSize(10);
+ assertEquals(10, params.getMinSize());
+ }
+
+ /**
+ * Test {@link PoolParams#getMaxSize()}
+ */
+ @Test
+ public void testMaxSize()
+ {
+ PoolParams params = new PoolParams();
+ assertEquals(10, params.getMaxSize());
+ params.setMaxSize(20);
+ assertEquals(20, params.getMaxSize());
+ }
+
+ /**
+ * Test {@link PoolParams#getBlockingTimeout()}
+ */
+ @Test
+ public void testBlockingTimeout()
+ {
+ PoolParams params = new PoolParams();
+ assertEquals(30000, params.getBlockingTimeout());
+ params.setBlockingTimeout(60000);
+ assertEquals(60000, params.getBlockingTimeout());
+ }
+
+ /**
+ * Test {@link PoolParams#getIdleTimeout()}
+ */
+ @Test
+ public void testIdleTimeout()
+ {
+ PoolParams params = new PoolParams();
+ assertEquals(1000 * 60 * 30, params.getIdleTimeout());
+ params.setIdleTimeout(1000 * 60 * 20);
+ assertEquals(1000 * 60 * 20, params.getIdleTimeout());
+ }
+
+ /**
+ * Test {@link PoolParams#getBackgroundValidationInterval()}
+ */
+ @Test
+ public void testBackgroundValidationInterval()
+ {
+ PoolParams params = new PoolParams();
+ assertEquals(0L, params.getBackgroundValidationInterval());
+ params.setBackgroundValidationInterval(50000L);
+ assertEquals(50000L, params.getBackgroundValidationInterval());
+ }
+
+ /**
+ * Test {@link PoolParams#isPrefill()}
+ */
+ @Test
+ public void testIsPrefill()
+ {
+ PoolParams params = new PoolParams();
+ assertFalse("Prefill must be false", params.isPrefill());
+ params.setPrefill(true);
+ assertTrue("Prefill must be true", params.isPrefill());
+ }
+
+ /**
+ * Test {@link PoolParams#isStrictMin()}
+ */
+ @Test
+ public void testIsStrictMin()
+ {
+ PoolParams params = new PoolParams();
+ assertFalse("StrictMin must be false", params.isStrictMin());
+ params.setStrictMin(true);
+ assertTrue("StrictMin must be true", params.isStrictMin());
+ }
+
+ /**
+ * Test {@link PoolParams#isUseFastFail()}
+ */
+ @Test
+ public void testIsUseFastFail()
+ {
+ PoolParams params = new PoolParams();
+ assertFalse("UseFastFail must be false", params.isUseFastFail());
+ params.setUseFastFail(true);
+ assertTrue("UseFastFail must be true", params.isUseFastFail());
+ }
+
+}
Property changes on: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/unit/PoolParamsTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Rev Date
Name: svn:eol-style
+ native
Added: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/unit/nonTx/NonTxConnectionManagerTestCase.java
===================================================================
--- projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/unit/nonTx/NonTxConnectionManagerTestCase.java (rev 0)
+++ projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/unit/nonTx/NonTxConnectionManagerTestCase.java 2009-09-08 20:06:52 UTC (rev 93299)
@@ -0,0 +1,103 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008-2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jca.test.core.connectionmanager.unit.nonTx;
+
+import org.jboss.jca.core.api.ConnectionManager;
+
+import org.jboss.jca.core.connectionmanager.ConnectionManagerImpl;
+import org.jboss.jca.core.connectionmanager.notx.NoTxConnectionManager;
+import org.jboss.jca.core.connectionmanager.pool.PoolParams;
+import org.jboss.jca.core.connectionmanager.pool.strategy.OnePool;
+import org.jboss.jca.test.core.connectionmanager.common.MockConnectionRequestInfo;
+import org.jboss.jca.test.core.connectionmanager.common.MockHandle;
+import org.jboss.jca.test.core.connectionmanager.common.MockManagedConnectionFactory;
+
+import javax.resource.ResourceException;
+import javax.resource.spi.ManagedConnectionFactory;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * NonTxConnectionManagerTestCase.
+ * @author <a href="mailto:gurkanerdogdu at yahoo.com">Gurkan Erdogdu</a>
+ * @version $Rev$ $Date$
+ *
+ */
+public class NonTxConnectionManagerTestCase
+{
+ private static ConnectionManager connectionManager = null;
+
+ private static ManagedConnectionFactory mcf = null;
+
+ /**
+ * Initialize.
+ */
+ @BeforeClass
+ public static void init()
+ {
+ connectionManager = new ConnectionManagerImpl();
+ NoTxConnectionManager noTxCm = new NoTxConnectionManager();
+ mcf = new MockManagedConnectionFactory();
+ PoolParams poolParams = new PoolParams();
+
+ OnePool onePool = new OnePool(mcf, poolParams, true);
+ onePool.setConnectionListenerFactory(noTxCm);
+
+ noTxCm.setPoolingStrategy(onePool);
+
+ connectionManager.setRealConnectionManager(noTxCm);
+ }
+
+ /**
+ * Test allocate connection.
+ */
+ @Test
+ public void testAllocateConnection()
+ {
+ Object object = null;
+ try
+ {
+ object = connectionManager.allocateConnection(mcf, new MockConnectionRequestInfo());
+ }
+ catch (ResourceException e)
+ {
+ e.printStackTrace();
+ }
+
+ assertNotNull(object);
+ assertTrue(object instanceof MockHandle);
+ }
+
+ /**
+ * Destroy.
+ */
+ @AfterClass
+ public static void destroy()
+ {
+ connectionManager = null;
+ mcf = null;
+ }
+}
Property changes on: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/unit/nonTx/NonTxConnectionManagerTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Rev Date
Name: svn:eol-style
+ native
Added: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/unit/nonTx/package.html
===================================================================
--- projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/unit/nonTx/package.html (rev 0)
+++ projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/unit/nonTx/package.html 2009-09-08 20:06:52 UTC (rev 93299)
@@ -0,0 +1,3 @@
+<body>
+Unit Test cases covering the NoTx Connection Manager implementation.
+</body>
Property changes on: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/unit/nonTx/package.html
___________________________________________________________________
Name: svn:eol-style
+ native
Added: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/unit/package.html
===================================================================
--- projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/unit/package.html (rev 0)
+++ projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/unit/package.html 2009-09-08 20:06:52 UTC (rev 93299)
@@ -0,0 +1,3 @@
+<body>
+Unit Test cases covering the Connection Manager implementation.
+</body>
Property changes on: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/test/core/connectionmanager/unit/package.html
___________________________________________________________________
Name: svn:eol-style
+ native
More information about the jboss-cvs-commits
mailing list