[jboss-svn-commits] JBL Code SVN: r5445 - labs/jbossesb/branches/refactor/product/core/common/tests/src/org/jboss/soa/esb/connection

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu Aug 3 12:33:09 EDT 2006


Author: mohit309
Date: 2006-08-03 12:33:07 -0400 (Thu, 03 Aug 2006)
New Revision: 5445

Added:
   labs/jbossesb/branches/refactor/product/core/common/tests/src/org/jboss/soa/esb/connection/AbandonedConnectionFuncTest.java
   labs/jbossesb/branches/refactor/product/core/common/tests/src/org/jboss/soa/esb/connection/ConnectionPoolFuncTest.java
   labs/jbossesb/branches/refactor/product/core/common/tests/src/org/jboss/soa/esb/connection/PasswordDecoderFuncTest.java
   labs/jbossesb/branches/refactor/product/core/common/tests/src/org/jboss/soa/esb/connection/PasswordDecoderTestImpl.java
Removed:
   labs/jbossesb/branches/refactor/product/core/common/tests/src/org/jboss/soa/esb/connection/HashPasswordDecoder.java
   labs/jbossesb/branches/refactor/product/core/common/tests/src/org/jboss/soa/esb/connection/TestConnectionPool.java
   labs/jbossesb/branches/refactor/product/core/common/tests/src/org/jboss/soa/esb/connection/TestPasswordDecoder.java
Log:
Modified Test cases according to specification

Added: labs/jbossesb/branches/refactor/product/core/common/tests/src/org/jboss/soa/esb/connection/AbandonedConnectionFuncTest.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/common/tests/src/org/jboss/soa/esb/connection/AbandonedConnectionFuncTest.java	2006-08-03 16:30:47 UTC (rev 5444)
+++ labs/jbossesb/branches/refactor/product/core/common/tests/src/org/jboss/soa/esb/connection/AbandonedConnectionFuncTest.java	2006-08-03 16:33:07 UTC (rev 5445)
@@ -0,0 +1,71 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.soa.esb.connection;
+
+import junit.framework.TestCase;
+
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.Properties;
+
+/**
+ * TODO
+ * User: MohitK
+ * Date: Aug 3, 2006
+ */
+public class AbandonedConnectionFuncTest extends TestCase {
+
+    Properties properties = new Properties();
+
+    protected void setUp() throws Exception {
+        properties.put(ConnectionProperties.DRIVER_CLASSNAME, "com.mysql.jdbc.Driver");
+        properties.put(ConnectionProperties.CONNECTION_URL, "jdbc:mysql://localhost/rosetta");
+        properties.put(ConnectionProperties.USERNAME, "rosetta");
+        properties.put(ConnectionProperties.PASSWORD, "rosetta");
+        properties.put(ConnectionProperties.ABANDONED_CONNECTION_CHECK_INTERVAL, "30000");
+    }
+
+
+    public void testAbandonedConnections() {
+        PoolDataSource ds = new PoolDataSource();
+        ds.setConnectionProperties(properties);
+        Connection con1 = null;
+        Connection con2 = null;
+        Connection con3 = null;
+        try {
+            con1 = ds.getConnection();
+            con2 = ds.getConnection();
+            try {
+                Thread.sleep(70000);
+            } catch (InterruptedException e) {
+                //Do nothing
+            }
+            con1.createStatement();
+        } catch (SQLException e) {
+            e.printStackTrace();
+            assertTrue(true);
+        }
+    }
+
+}

Added: labs/jbossesb/branches/refactor/product/core/common/tests/src/org/jboss/soa/esb/connection/ConnectionPoolFuncTest.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/common/tests/src/org/jboss/soa/esb/connection/ConnectionPoolFuncTest.java	2006-08-03 16:30:47 UTC (rev 5444)
+++ labs/jbossesb/branches/refactor/product/core/common/tests/src/org/jboss/soa/esb/connection/ConnectionPoolFuncTest.java	2006-08-03 16:33:07 UTC (rev 5445)
@@ -0,0 +1,84 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.soa.esb.connection;
+
+import junit.framework.TestCase;
+import org.jboss.soa.esb.connection.ConnectionProperties;
+import org.jboss.soa.esb.connection.PoolDataSource;
+
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.Properties;
+
+/**
+ * TODO
+ * @author MohitK
+ * Date: Jul 22, 2006
+ */
+public class ConnectionPoolFuncTest extends TestCase {
+
+    Properties properties = new Properties();
+
+    protected void setUp() throws Exception {
+        properties.put(ConnectionProperties.DRIVER_CLASSNAME, "com.mysql.jdbc.Driver");
+        properties.put(ConnectionProperties.CONNECTION_URL, "jdbc:mysql://localhost/rosetta");
+        properties.put(ConnectionProperties.USERNAME, "rosetta");
+        properties.put(ConnectionProperties.PASSWORD, "rosetta");
+    }
+
+
+    public void testConnectionPool() {
+        PoolDataSource ds = new PoolDataSource();
+        ds.setConnectionProperties(properties);
+        Connection con = null;
+        Statement stat = null;
+        try {
+            con = ds.getConnection();
+            stat = con.createStatement();
+            ResultSet rs = stat.executeQuery("SELECT count(*) FROM uid_table;");
+            while (rs.next()) {
+                int count = rs.getInt(1);
+                System.out.println("count = " + count);
+            }
+
+        } catch (SQLException e) {
+            e.printStackTrace();
+            fail();
+        }finally{
+            try {
+                if (stat != null) {
+                    stat.close();
+                }
+                if(con!=null){
+                    con.close();
+                }
+            } catch (SQLException e) {
+                e.printStackTrace();
+            }
+        }
+    }
+
+
+
+}

Deleted: labs/jbossesb/branches/refactor/product/core/common/tests/src/org/jboss/soa/esb/connection/HashPasswordDecoder.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/common/tests/src/org/jboss/soa/esb/connection/HashPasswordDecoder.java	2006-08-03 16:30:47 UTC (rev 5444)
+++ labs/jbossesb/branches/refactor/product/core/common/tests/src/org/jboss/soa/esb/connection/HashPasswordDecoder.java	2006-08-03 16:33:07 UTC (rev 5445)
@@ -1,36 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt 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.soa.esb.connection;
-
-import org.jboss.soa.esb.connection.PasswordDecoder;
-
-/**
- * TODO
- * User: MohitK
- * Date: Aug 1, 2006
- */
-public class HashPasswordDecoder implements PasswordDecoder {
-
-    public String decode(String encodedPassword) {
-        return "password";
-    }
-}

Added: labs/jbossesb/branches/refactor/product/core/common/tests/src/org/jboss/soa/esb/connection/PasswordDecoderFuncTest.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/common/tests/src/org/jboss/soa/esb/connection/PasswordDecoderFuncTest.java	2006-08-03 16:30:47 UTC (rev 5444)
+++ labs/jbossesb/branches/refactor/product/core/common/tests/src/org/jboss/soa/esb/connection/PasswordDecoderFuncTest.java	2006-08-03 16:33:07 UTC (rev 5445)
@@ -0,0 +1,90 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.soa.esb.connection;
+
+import junit.framework.TestCase;
+import org.jboss.soa.esb.connection.ConnectionProperties;
+import org.jboss.soa.esb.connection.PoolDataSource;
+import org.jboss.soa.esb.connection.PasswordDecoderTestImpl;
+
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.Properties;
+
+/**
+ * TODO
+ * @author MohitK
+ * Date: Aug 1, 2006
+ */
+public class PasswordDecoderFuncTest extends TestCase {
+
+    Properties properties = new Properties();
+
+    protected void setUp() throws Exception {
+        properties.put(ConnectionProperties.DRIVER_CLASSNAME, "oracle.jdbc.driver.OracleDriver");
+        properties.put(ConnectionProperties.CONNECTION_URL, "jdbc:oracle:thin:@localhost:1521:EMS");
+        properties.put(ConnectionProperties.USERNAME, "CLEARSTORY");
+        properties.put(ConnectionProperties.PASSWORD, "password");
+        properties.setProperty(ConnectionProperties.PASSWORD_DECODER, PasswordDecoderTestImpl.class.getName());
+    }
+
+    public void testPasswordDecoder() {
+
+        PoolDataSource ds = new PoolDataSource();
+        ds.setConnectionProperties(properties);
+        Connection con1 = null;
+        Statement stat = null;
+        try {
+            con1 = ds.getConnection();
+            stat = con1.createStatement();
+            ResultSet rs = stat.executeQuery("select count(*) from WM_SERVER");
+            while (rs.next()) {
+                int count = rs.getInt(1);
+                System.out.println("count = " + count);
+            }
+
+
+        } catch (SQLException e) {
+            e.printStackTrace();
+            fail();
+        } finally {
+            if (stat != null) {
+                try {
+                    stat.close();
+                } catch (SQLException e) {
+                    e.printStackTrace();
+                    fail();
+                }
+            }
+            if (con1 != null) {
+                try {
+                    con1.close();
+                } catch (SQLException e) {
+                    e.printStackTrace();
+                    fail();
+                }
+            }
+        }
+    }
+}

Added: labs/jbossesb/branches/refactor/product/core/common/tests/src/org/jboss/soa/esb/connection/PasswordDecoderTestImpl.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/common/tests/src/org/jboss/soa/esb/connection/PasswordDecoderTestImpl.java	2006-08-03 16:30:47 UTC (rev 5444)
+++ labs/jbossesb/branches/refactor/product/core/common/tests/src/org/jboss/soa/esb/connection/PasswordDecoderTestImpl.java	2006-08-03 16:33:07 UTC (rev 5445)
@@ -0,0 +1,36 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.soa.esb.connection;
+
+import org.jboss.soa.esb.connection.PasswordDecoder;
+
+/**
+ * TODO
+ * @author MohitK
+ * Date: Aug 1, 2006
+ */
+public class PasswordDecoderTestImpl implements PasswordDecoder {
+
+    public String decode(String encodedPassword) {
+        return "password";
+    }
+}

Deleted: labs/jbossesb/branches/refactor/product/core/common/tests/src/org/jboss/soa/esb/connection/TestConnectionPool.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/common/tests/src/org/jboss/soa/esb/connection/TestConnectionPool.java	2006-08-03 16:30:47 UTC (rev 5444)
+++ labs/jbossesb/branches/refactor/product/core/common/tests/src/org/jboss/soa/esb/connection/TestConnectionPool.java	2006-08-03 16:33:07 UTC (rev 5445)
@@ -1,104 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt 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.soa.esb.connection;
-
-import junit.framework.TestCase;
-import org.jboss.soa.esb.connection.ConnectionProperties;
-import org.jboss.soa.esb.connection.PoolDataSource;
-
-import java.sql.Connection;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.util.Properties;
-
-/**
- * TODO
- * User: MohitK
- * Date: Jul 22, 2006
- */
-public class TestConnectionPool extends TestCase {
-
-    Properties properties = new Properties();
-
-    protected void setUp() throws Exception {
-        properties.put(ConnectionProperties.DRIVER_CLASSNAME, "oracle.jdbc.driver.OracleDriver");
-        properties.put(ConnectionProperties.CONNECTION_URL, "jdbc:oracle:thin:@localhost:1521:EMS");
-        properties.put(ConnectionProperties.USERNAME, "CLEARSTORY");
-        properties.put(ConnectionProperties.PASSWORD, "password");
-        properties.put(ConnectionProperties.ABANDONED_CONNECTION_CHECK_INTERVAL, "30000");
-    }
-
-
-    public void testConnectionPool() {
-        PoolDataSource ds = new PoolDataSource();
-        ds.setConnectionProperties(properties);
-        Connection con1 = null;
-        Connection con2 = null;
-        Connection con3 = null;
-        Connection con4 = null;
-        Connection con5 = null;
-        Connection con6 = null;
-        Connection con7 = null;
-        Connection con8 = null;
-        Connection con9 = null;
-        Connection con10 = null;
-        Statement stat = null;
-        try {
-            con1 = ds.getConnection();
-            con2 = ds.getConnection();
-            stat = con1.createStatement();
-            ResultSet rs = stat.executeQuery("select count(*) from WM_SERVER");
-            while (rs.next()) {
-                int count = rs.getInt(1);
-                System.out.println("count = " + count);
-            }
-            try {
-                if (stat != null) {
-                    stat.close();
-                }
-            } catch (SQLException e) {
-                e.printStackTrace();
-            }
-            con3 = ds.getConnection();
-            con4 = ds.getConnection();
-            con5 = ds.getConnection();
-            con6 = ds.getConnection();
-            con7 = ds.getConnection();
-            con8 = ds.getConnection();
-            con9 = ds.getConnection();
-            try {
-                Thread.sleep(35000);
-            } catch (InterruptedException e) {
-                e.printStackTrace();
-            }
-            stat = con3.createStatement();
-            stat.executeQuery("select count(*) from WM_SERVER");
-        } catch (SQLException e) {
-            e.printStackTrace();
-            fail();
-        }
-    }
-
-
-
-}

Deleted: labs/jbossesb/branches/refactor/product/core/common/tests/src/org/jboss/soa/esb/connection/TestPasswordDecoder.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/common/tests/src/org/jboss/soa/esb/connection/TestPasswordDecoder.java	2006-08-03 16:30:47 UTC (rev 5444)
+++ labs/jbossesb/branches/refactor/product/core/common/tests/src/org/jboss/soa/esb/connection/TestPasswordDecoder.java	2006-08-03 16:33:07 UTC (rev 5445)
@@ -1,90 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt 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.soa.esb.connection;
-
-import junit.framework.TestCase;
-import org.jboss.soa.esb.connection.ConnectionProperties;
-import org.jboss.soa.esb.connection.PoolDataSource;
-import org.jboss.soa.esb.connection.HashPasswordDecoder;
-
-import java.sql.Connection;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.util.Properties;
-
-/**
- * TODO
- * User: MohitK
- * Date: Aug 1, 2006
- */
-public class TestPasswordDecoder extends TestCase {
-
-    Properties properties = new Properties();
-
-    protected void setUp() throws Exception {
-        properties.put(ConnectionProperties.DRIVER_CLASSNAME, "oracle.jdbc.driver.OracleDriver");
-        properties.put(ConnectionProperties.CONNECTION_URL, "jdbc:oracle:thin:@localhost:1521:EMS");
-        properties.put(ConnectionProperties.USERNAME, "CLEARSTORY");
-        properties.put(ConnectionProperties.PASSWORD, "password");
-        properties.setProperty(ConnectionProperties.PASSWORD_DECODER, HashPasswordDecoder.class.getName());
-    }
-
-    public void testPasswordDecoder() {
-
-        PoolDataSource ds = new PoolDataSource();
-        ds.setConnectionProperties(properties);
-        Connection con1 = null;
-        Statement stat = null;
-        try {
-            con1 = ds.getConnection();
-            stat = con1.createStatement();
-            ResultSet rs = stat.executeQuery("select count(*) from WM_SERVER");
-            while (rs.next()) {
-                int count = rs.getInt(1);
-                System.out.println("count = " + count);
-            }
-
-
-        } catch (SQLException e) {
-            e.printStackTrace();
-            fail();
-        } finally {
-            if (stat != null) {
-                try {
-                    stat.close();
-                } catch (SQLException e) {
-                    e.printStackTrace();
-                    fail();
-                }
-            }
-            if (con1 != null) {
-                try {
-                    con1.close();
-                } catch (SQLException e) {
-                    e.printStackTrace();
-                    fail();
-                }
-            }
-        }
-    }
-}




More information about the jboss-svn-commits mailing list