User: user57  
  Date: 01/07/09 19:34:04

  Modified:    src/main/org/jboss/test/lock/test Main.java
  Log:
   o changed all deploy tests to deploy as a test and to not call System.exit().
     this should allow reports to be generated for tests that fail to deploy.
   o modified run_tests.xml basic-security-tests to not-halt on error, so that
     test-and-report will produce reports even if the security tests fail.
  
  Revision  Changes    Path
  1.5       +87 -91    jbosstest/src/main/org/jboss/test/lock/test/Main.java
  
  Index: Main.java
  ===================================================================
  RCS file: /cvsroot/jboss/jbosstest/src/main/org/jboss/test/lock/test/Main.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Main.java 2001/07/06 02:29:21     1.4
  +++ Main.java 2001/07/10 02:34:04     1.5
  @@ -19,41 +19,41 @@
   
   import org.jboss.test.util.Deploy;
   
  -public class Main extends junit.framework.TestCase
  +public class Main extends
  +   TestCase
   {
        
  -     boolean deployed = false;
  -     int nbThreads;
  -     int iterations;
  -     boolean b2b;
  -    boolean nodeploy;
  -     
  -     HashMap param = new HashMap();
  -     EnterpriseEntity entity;
  -     
  -     public static void main(String arg[]) throws Exception {
  -             Main main = new Main(arg);
  -             
  -             main.testLock();
  -     }
  -
  -     public Main(String arg[]) {
  -             super("main");
  -             // scanning parameters
  -             int i = 0;
  -             while (i < arg.length) {
  -                     StringTokenizer st = new StringTokenizer (arg[i++], "=");
  -                     param.put (st.nextToken (),     st.hasMoreTokens () ? 
st.nextToken () : "");
  -             }
  -             if (param.containsKey("help") || param.containsKey("-help")) {
  -                     System.out.println("Valid Parameters:");
  -                     System.out.println("  threads=<t>     run <t> threads 
concurrently (default 2)");
  -                     System.out.println("  iterations=<n>  each thread will perform 
<n> calls (default 10)");
  -                     System.out.println("  b2b             use bean to bean calls 
(default: single bean call)");
  -                     System.out.println();
  -                     System.exit(0);
  -             }
  -     }
  +   boolean deployed = false;
  +   int nbThreads;
  +   int iterations;
  +   boolean b2b;
  +   boolean nodeploy;
  +   
  +   HashMap param = new HashMap();
  +   EnterpriseEntity entity;
  +     
  +   public static void main(String arg[]) throws Exception {
  +      Main main = new Main(arg);
  +      main.testLock();
  +   }
  +
  +   public Main(String arg[]) {
  +      super("main");
  +      // scanning parameters
  +      int i = 0;
  +      while (i < arg.length) {
  +         StringTokenizer st = new StringTokenizer (arg[i++], "=");
  +         param.put (st.nextToken (), st.hasMoreTokens () ? st.nextToken () : "");
  +      }
  +      if (param.containsKey("help") || param.containsKey("-help")) {
  +         System.out.println("Valid Parameters:");
  +         System.out.println("  threads=<t>     run <t> threads concurrently 
(default 2)");
  +         System.out.println("  iterations=<n>  each thread will perform <n> calls 
(default 10)");
  +         System.out.println("  b2b             use bean to bean calls (default: 
single bean call)");
  +         System.out.println();
  +         System.exit(0);
  +      }
  +   }
   
       public Main(String name)
       {
  @@ -136,64 +136,60 @@
                System.out.println("done!");
                */
        }
  -     
  -
  -    public static Test suite() {
  -        TestSuite suite = new TestSuite();
  -     
  -        try {
  -            String filename = "../deploy/locktest.jar";
  -            System.out.println("Deploying...");
  -            Deploy.deploy(filename);
  -
  -            suite.addTest(new TestSuite(Main.class));
  -
  -            // add a test case to undeploy our support applications
  -            suite.addTest(new Deploy.Undeployer(filename));
  -        }
  -        catch (Throwable t) {
  -            t.printStackTrace();
  -            System.exit(0);
  -        }
  -
  -        return suite;
  -    }
        
  -     public class Worker extends Thread {
  -             public String name;
  -             public boolean running;
  -             
  -             public Worker(String name) {
  -                     this.name = name;
  -                     running = true;
  -             }
  -             
  -             public void run() {
  -                     long start = System.currentTimeMillis();
  -                     int i;
  -                     
  -                     for (i=0; i<iterations; i++) {
  -                             if (!running) break;
  -                                     
  -                             try { 
  -                                     if (b2b) {
  -                                             entity.setAndCopyField(name+" i="+i);
  -                                 
  -                                     } else {
  -                                             entity.setField(name+" i="+i);
  -                                     
  -                                     }
  -                                 System.out.println(name + " " + (i+1) + " 
iterations done");
  -                             } catch (Exception e) {
  -                                     System.out.println(name + " caught an 
exception, dying");
  -                                     e.printStackTrace();
  -                                     running = false;
  -                             }
  -                     }
  -                     
  -                     long end = System.currentTimeMillis();
  -                     System.out.println(name + ": did " + i + " iterations in " + 
(end-start) + "ms");
  -             }
  -     }
  +   /**
  +    * Setup the test suite.
  +    */
  +   public static Test suite() {
  +      TestSuite suite = new TestSuite();
  +        
  +      // add a test case to deploy our support applications
  +      String filename = "locktest.jar";
  +      suite.addTest(new Deploy.Deployer(filename));
  +
  +      suite.addTest(new TestSuite(Main.class));
  +
  +      // add a test case to undeploy our support applications
  +      suite.addTest(new Deploy.Undeployer(filename));
  +      
  +      return suite;
  +   }
  +     
  +   public class Worker extends Thread {
  +      public String name;
  +      public boolean running;
  +      
  +      public Worker(String name) {
  +         this.name = name;
  +         running = true;
  +      }
  +      
  +      public void run() {
  +         long start = System.currentTimeMillis();
  +         int i;
  +         
  +         for (i=0; i<iterations; i++) {
  +            if (!running) break;
  +            
  +            try { 
  +               if (b2b) {
  +                  entity.setAndCopyField(name+" i="+i);
  +                  
  +               } else {
  +                  entity.setField(name+" i="+i);
  +                  
  +               }
  +               System.out.println(name + " " + (i+1) + " iterations done");
  +            } catch (Exception e) {
  +               System.out.println(name + " caught an exception, dying");
  +               e.printStackTrace();
  +               running = false;
  +            }
  +         }
  +         
  +         long end = System.currentTimeMillis();
  +         System.out.println(name + ": did " + i + " iterations in " + (end-start) + 
"ms");
  +      }
  +   }
   }
   
  
  
  

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

Reply via email to