User: user57  
  Date: 01/07/05 17:38:51

  Modified:    src/main/org/jboss/test/xa/test Main.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  Changes    Path
  1.4       +40 -52    jbosstest/src/main/org/jboss/test/xa/test/Main.java
  
  Index: Main.java
  ===================================================================
  RCS file: /cvsroot/jboss/jbosstest/src/main/org/jboss/test/xa/test/Main.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Main.java 2001/05/19 19:19:54     1.3
  +++ Main.java 2001/07/06 00:38:51     1.4
  @@ -16,51 +16,25 @@
   import java.util.Iterator;
   import java.util.Enumeration;
   
  +import junit.framework.Test;
  +import junit.framework.TestCase;
  +import junit.framework.TestSuite;
  +
  +import org.jboss.test.util.Deploy;
  +
   import org.jboss.test.xa.interfaces.CantSeeDataException;
   import org.jboss.test.xa.interfaces.XATest;
   import org.jboss.test.xa.interfaces.XATestHome;
  -
  -
  -public class Main extends junit.framework.TestCase {
  -
  -    static boolean deployed = false;
  -
  -    public static void main(String arg[]) {
  -        Main main = new Main("main");
  -
  -        try {
  -            main.setUp();
  -
  -        } catch (Exception e) {
  -            System.out.println("Setup failed:");
  -            e.printStackTrace();
  -        }
  -
  -        try {
  -            main.testXABean();
  -            System.out.println();
  -            System.out.println("_____________________________________________");
  -            System.out.println("Congratulations!  Test completed");
  -            System.out.println("_____________________________________________");
  -            System.out.println();
  -
  -        } catch (Exception e) {
  -            e.printStackTrace();
  -            System.out.println();
  -            System.out.println("_____________________________________________");
  -            System.out.println("Sorry, test failed.  Try again with different 
settings!");
  -            System.out.println("Thanks for your time...");
  -            System.out.println();
   
  -        }
  -    }
  -
  +public class Main
  +    extends TestCase
  +{
       public Main(String name)
       {
           super(name);
       }
   
  -    public void testXABean() throws Exception   {
  +    public void testXABean() throws Exception {
           int test = 0;
   
           Context ctx = new InitialContext();
  @@ -101,6 +75,17 @@
           }
   
           System.out.println();
  +        System.out.print(++test+"- "+"Creating required tables...");
  +        try {
  +            bean.createTables();
  +            System.out.println("OK");            
  +        }
  +        catch (Exception e) {
  +            System.out.println("\nFailed to create tables");
  +            throw e;
  +        }
  +        
  +        System.out.println();
           System.out.print(++test+"- "+"Clearing any old data...");
           try {
               bean.clearData();
  @@ -130,24 +115,27 @@
           }
       }
   
  -
       protected void setUp() throws Exception
       {
  -        if (deployed) return;
  +    }
   
  -        System.out.println("_____________________________________________");
  -        System.out.println();
  -        System.out.println("jBoss, the EJB Open Source Server");
  -        System.out.println("Copyright (C), The jBoss Organization, 2000");
  -        System.out.println("_____________________________________________");
  -        System.out.println();
  -        System.out.println("Welcome to the XADataSource test");
  -        System.out.println("_____________________________________________");
  -        System.out.println();
  -        System.out.print("Deploying the bean...");
  -        System.out.flush();
  -        new org.jboss.jmx.client.Deployer().deploy("../deploy/xatest.jar");
  -        deployed = true;
  -        System.out.println("done!");
  +     public static Test suite() {
  +        TestSuite suite = new TestSuite();
  +     
  +        try {
  +            System.out.println("Deploying...");
  +            Deploy.deploy("../deploy/xatest.jar");
  +
  +            suite.addTest(new TestSuite(Main.class));
  +
  +            // add a test case to undeploy our support applications
  +            suite.addTest(new Deploy.Undeployer("../deploy/xatest.jar"));
  +        }
  +        catch (Throwable t) {
  +            t.printStackTrace();
  +            System.exit(0);
  +        }
  +
  +        return suite;
       }
   }
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to