[JBoss-dev] CVS update: jbosstest/src/main/org/jboss/test/xa/bean XATestBean.java
User: user57 Date: 02/02/14 22:15:57 Modified:src/main/org/jboss/test/xa/bean XATestBean.java Log: o replaced most System.out usage with Log4j. should really introduce some base classes to make this mess more maintainable... Revision ChangesPath 1.5 +2 -0 jbosstest/src/main/org/jboss/test/xa/bean/XATestBean.java Index: XATestBean.java === RCS file: /cvsroot/jboss/jbosstest/src/main/org/jboss/test/xa/bean/XATestBean.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- XATestBean.java 17 Sep 2001 17:33:54 - 1.4 +++ XATestBean.java 15 Feb 2002 06:15:57 - 1.5 @@ -24,6 +24,8 @@ public class XATestBean implements SessionBean { + org.apache.log4j.Category log = org.apache.log4j.Category.getInstance(getClass()); + public final static String DROP_TABLE = DROP TABLE XA_TEST; ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jbosstest/src/main/org/jboss/test/xa/bean XATestBean.java
User: d_jencks Date: 01/09/17 10:33:54 Modified:src/main/org/jboss/test/xa/bean XATestBean.java Log: Finished converting to JBossTestCase for deploy and logging. Security tests still do not work due to deploy problems Revision ChangesPath 1.4 +7 -0 jbosstest/src/main/org/jboss/test/xa/bean/XATestBean.java Index: XATestBean.java === RCS file: /cvsroot/jboss/jbosstest/src/main/org/jboss/test/xa/bean/XATestBean.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- XATestBean.java 2001/07/06 00:38:51 1.3 +++ XATestBean.java 2001/09/17 17:33:54 1.4 @@ -1,3 +1,10 @@ +/* + * JBoss, the OpenSource J2EE webOS + * + * Distributable under LGPL license. + * See terms of license at gnu.org. + */ + package org.jboss.test.xa.bean; import java.sql.Connection; ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jbosstest/src/main/org/jboss/test/xa/bean XATestBean.java
User: starksm Date: 01/07/08 18:06:07 Modified:src/main/org/jboss/test/xa/bean Tag: Branch_2_4 XATestBean.java Log: Merge latest changes from main to the 2.4 branch Revision ChangesPath No revision No revision 1.2.2.1 +49 -1 jbosstest/src/main/org/jboss/test/xa/bean/XATestBean.java Index: XATestBean.java === RCS file: /cvsroot/jboss/jbosstest/src/main/org/jboss/test/xa/bean/XATestBean.java,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- XATestBean.java 2001/01/07 23:14:43 1.2 +++ XATestBean.java 2001/07/09 01:06:07 1.2.2.1 @@ -14,7 +14,15 @@ import javax.sql.DataSource; import org.jboss.test.xa.interfaces.CantSeeDataException; -public class XATestBean implements SessionBean { +public class XATestBean +implements SessionBean +{ +public final static String DROP_TABLE = +DROP TABLE XA_TEST; + +public final static String CREATE_TABLE = +CREATE TABLE XA_TEST(ID INTEGER NOT NULL PRIMARY KEY, DATA INTEGER NOT NULL); + public final static String DB_1_NAME = java:comp/env/jdbc/DBConnection1; public final static String DB_2_NAME = java:comp/env/jdbc/DBConnection2; @@ -36,6 +44,46 @@ public void setSessionContext(SessionContext parm1) throws EJBException { } +protected void execute(DataSource ds, String sql) throws SQLException { +Connection con = ds.getConnection(); +try { +Statement s = con.createStatement(); +s.execute(sql); +s.close(); +} +finally { +con.close(); +} +} + +protected void execute(Connection con, String sql) throws SQLException { +Statement s = con.createStatement(); +s.execute(sql); +s.close(); +} + +public void createTables() throws NamingException, SQLException { +Context ctx = new InitialContext(); +try { +DataSource ds1 = (DataSource)ctx.lookup(DB_1_NAME); +try { +execute(ds1, DROP_TABLE); +} +catch (Exception ignore) {} +execute(ds1, CREATE_TABLE); + +DataSource ds2 = (DataSource)ctx.lookup(DB_2_NAME); +try { +execute(ds2, DROP_TABLE); +} +catch (Exception ignore) {} +execute(ds2, CREATE_TABLE); +} +finally { +ctx.close(); +} +} + public void clearData() { try { Context ctx = new InitialContext(); ___ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jbosstest/src/main/org/jboss/test/xa/bean XATestBean.java
User: user57 Date: 01/07/05 17:38:51 Modified:src/main/org/jboss/test/xa/bean XATestBean.java Log: o changed xatest.sh to use the JUnit runner cleaned up classpath. o cleaned up commandline in mq-test.sh. o Changed XATest so that it deploys/tests/undeploys. o Added a createTables() method in XATestBean that will try to drop/create the required tables in the datasources. o Changd the jboss.xml to use java:/DefaultDS and java:/InstantDB for the two datasource references. o Updated the build for the xatest to include the org.jboss.test.util classes. Revision ChangesPath 1.3 +49 -1 jbosstest/src/main/org/jboss/test/xa/bean/XATestBean.java Index: XATestBean.java === RCS file: /cvsroot/jboss/jbosstest/src/main/org/jboss/test/xa/bean/XATestBean.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- XATestBean.java 2001/01/07 23:14:43 1.2 +++ XATestBean.java 2001/07/06 00:38:51 1.3 @@ -14,7 +14,15 @@ import javax.sql.DataSource; import org.jboss.test.xa.interfaces.CantSeeDataException; -public class XATestBean implements SessionBean { +public class XATestBean +implements SessionBean +{ +public final static String DROP_TABLE = +DROP TABLE XA_TEST; + +public final static String CREATE_TABLE = +CREATE TABLE XA_TEST(ID INTEGER NOT NULL PRIMARY KEY, DATA INTEGER NOT NULL); + public final static String DB_1_NAME = java:comp/env/jdbc/DBConnection1; public final static String DB_2_NAME = java:comp/env/jdbc/DBConnection2; @@ -36,6 +44,46 @@ public void setSessionContext(SessionContext parm1) throws EJBException { } +protected void execute(DataSource ds, String sql) throws SQLException { +Connection con = ds.getConnection(); +try { +Statement s = con.createStatement(); +s.execute(sql); +s.close(); +} +finally { +con.close(); +} +} + +protected void execute(Connection con, String sql) throws SQLException { +Statement s = con.createStatement(); +s.execute(sql); +s.close(); +} + +public void createTables() throws NamingException, SQLException { +Context ctx = new InitialContext(); +try { +DataSource ds1 = (DataSource)ctx.lookup(DB_1_NAME); +try { +execute(ds1, DROP_TABLE); +} +catch (Exception ignore) {} +execute(ds1, CREATE_TABLE); + +DataSource ds2 = (DataSource)ctx.lookup(DB_2_NAME); +try { +execute(ds2, DROP_TABLE); +} +catch (Exception ignore) {} +execute(ds2, CREATE_TABLE); +} +finally { +ctx.close(); +} +} + public void clearData() { try { Context ctx = new InitialContext(); ___ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development