User: starksm 
  Date: 01/07/31 18:59:18

  Modified:    src/main/org/jboss/test/testbean/test Main.java
  Log:
  Update to use assert and fail rather than System.out
  
  Revision  Changes    Path
  1.10      +146 -169  jbosstest/src/main/org/jboss/test/testbean/test/Main.java
  
  Index: Main.java
  ===================================================================
  RCS file: /cvsroot/jboss/jbosstest/src/main/org/jboss/test/testbean/test/Main.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- Main.java 2001/07/10 02:34:05     1.9
  +++ Main.java 2001/08/01 01:59:18     1.10
  @@ -55,7 +55,7 @@
   *
   * @author <a href="mailto:[EMAIL PROTECTED]";>Marc Fleury</a>
   * @author <a href="mailto:[EMAIL PROTECTED]";>Hugo Pinto</a>
  -* @version $Id: Main.java,v 1.9 2001/07/10 02:34:05 user57 Exp $
  +* @version $Id: Main.java,v 1.10 2001/08/01 01:59:18 starksm Exp $
   */
   public class Main 
      extends junit.framework.TestCase
  @@ -154,44 +154,38 @@
         {
            System.out.println(++test+"- trying to create one with same primkey: 1, 
Patrick");
            b1 = home.create (1, "Patrick");
  +         fail("Was able to create duplicate SimpleBMP");
         }
         catch (Exception _e)
         {
            System.out.println (_e.toString ());
         }
  -      
  +
         System.out.println(++test+"- create some more dummys:");
         for (int i = 0; i < 50; ++i)
            home.create (i + 3, ("Dummy "+i));
  -      
  -      try
  -      {
  -         System.out.println(++test+"- trying to find Robert again");
  -         b1 = home.findByPrimaryKey (new Integer (2));
  -         System.out.println ("getName (): "+b1.getName ());
  -      }
  -      catch (Exception _e)
  -      {
  -         System.out.println (_e.toString ());
  -      }
  -      
  +
  +      System.out.println(++test+"- trying to find Robert again");
  +      b1 = home.findByPrimaryKey (new Integer (2));
  +      System.out.println ("getName (): "+b1.getName ());
  +
         try
         {
            System.out.println(++test+"- trying to find an not existing bean");
            b1 = home.findByPrimaryKey (new Integer (0));
  -         System.out.println ("getName (): "+b1.getName ());
  +         assert("findByPrimaryKey(0) should fail", b1 == null);
         }
         catch (Exception _e)
         {
            System.out.println (_e.toString ());
         }
  -      
  +
         System.out.println(++test+"- rename Daniel to Maria: 1, Daniel");
         b1 = home.findByPrimaryKey (new Integer (1));
         System.out.println ("name old: " + b1.getName ());
         b1.setName ("Maria");
  -      System.out.println ("name new: " + b1.getName ());
  -      
  +      assert("getName == Maria", "Maria".equals(b1.getName ()));
  +
         System.out.println(++test+"- find all beans:");
         Iterator it = home.findAll ().iterator ();
         while (it.hasNext ())
  @@ -234,11 +228,12 @@
           System.out.print(++test+"- "+"Calling create on StatelessSessionHome...");
           StatelessSession statelessSession =
           statelessSessionHome.create();
  -        if (statelessSession != null) System.out.println("ok");
  -        
  +        assert("statelessSessionHome.create() != null", statelessSession != null);
  +        System.out.println("ok");
  +
           System.out.print(++test+"- "+"Calling getEJBHome() on StatelessSession...");
  -        if (statelessSession.getEJBHome() != null) System.out.println("ok");
  -        else throw new Exception ("Null home not OK");
  +        assert("statelessSession.getEJBHome() != null", 
statelessSession.getEJBHome() != null);
  +        System.out.println("ok");
           
           System.out.print(++test+"- "+"Calling Business Method A on 
StatelessSession... ");
           statelessSession.callBusinessMethodA();
  @@ -250,31 +245,22 @@
           System.out.println(++test+"- "+"Calling Business Method C on 
StatelessSession... ");
           System.out.println(statelessSession.callBusinessMethodC());
           System.out.println(++test+"- "+"Calling Business Method D on 
StatelessSession... ");
  -        try {
  -        statelessSession.callBusinessMethodD();
  -        System.out.println("ERROR, no exception was thrown");
  -        }
  -        catch (BusinessMethodException e) {
  -        System.out.println("Caught BusinessMethodException OK");
  +        try
  +        {
  +         statelessSession.callBusinessMethodD();
  +         fail("callBusinessMethodD, no exception was thrown");
  +        }
  +        catch (BusinessMethodException e)
  +        {
  +           System.out.println("Caught BusinessMethodException OK");
           }
  -        catch (Exception e) {
  -        System.out.println("ERROR, type "+e.getClass());
  -        }
           System.out.print(++test+"- "+"Calling Business Method E (getEJBObject) on 
StatelessSession... ");
           System.out.println(statelessSession.callBusinessMethodE());
  -        
  +
           System.out.print(++test+"- "+"Calling testClassLoading on 
StatelessSession... ");
  -        try {
           statelessSession.testClassLoading();
           System.out.println("OK");
  -        }
  -        catch (BusinessMethodException e) {
  -        System.out.println("Failed");
  -        }
  -        catch (Exception e) {
  -        System.out.println("ERROR, type "+e.getClass());
  -        }
  -        
  +
           System.out.println("***Testing the various local Object class calls");
           System.out.print(++test+"- "+"toString ... ");
           System.out.println(statelessSession.toString());
  @@ -289,20 +275,22 @@
           System.out.println(statelessSession.getPrimaryKey());
           System.out.print(++test+"- "+"Get Handle ... ");
           Handle statelessHandle = statelessSession.getHandle();
  -        if (statelessHandle != null) System.out.println("OK");
  +        assert("statelessHandle != null", statelessHandle != null);
  +        System.out.println("OK");
           System.out.print(++test+"- "+"Serialize handle and deserialize..");
           MarshalledObject mo = new MarshalledObject(statelessHandle);
           Handle handle2 = (Handle) mo.get();
           StatelessSession statelessSession2 = (StatelessSession) 
handle2.getEJBObject();
  -        if (statelessSession2 != null) System.out.println("OK");
  +        assert("statelessSession2 != null", statelessSession2 != null);
  +        System.out.println("OK");
           System.out.println(++test+"- "+"Calling businessMethodB on it...");
           System.out.println(statelessSession2.callBusinessMethodB());
           System.out.println(++test+"- "+"They should be 
identical..."+statelessSession.isIdentical(statelessSession2));
           System.out.println("***Testing the various local EJBHome class calls");
           System.out.print(++test+"- "+"Getting the metaData...");
           EJBMetaData statelessMetaData = statelessSessionHome.getEJBMetaData();
  -        if (statelessMetaData != null) System.out.println("OK");
  -        else System.out.println("NULL METADATA");
  +        assert("statelessMetaData != null", statelessMetaData != null);
  +        System.out.println("OK");
           System.out.println(++test+"- "+"Is stateless Session? 
"+statelessMetaData.isStatelessSession());
           System.out.println(++test+"- "+"The remote class is 
"+statelessMetaData.getRemoteInterfaceClass());
           
  @@ -324,15 +312,17 @@
           System.out.print(++test+"- "+"Looking up the home 
nextgen.StatefulSession...");
           StatefulSessionHome  statefulSessionHome =
           (StatefulSessionHome) ctx.lookup("nextgen.StatefulSession");
  -        if (statefulSessionHome!= null ) System.out.println("ok");
  -            System.out.print(++test+"- "+"Calling create on StatefulSessionHome 
with name Marc...");
  +        assert("statefulSessionHome!= null", statefulSessionHome!= null);
  +        System.out.println("ok");
  +        System.out.print(++test+"- "+"Calling create on StatefulSessionHome with 
name Marc...");
           StatefulSession statefulSession =
           statefulSessionHome.create("Marc");
  -        if (statefulSession != null) System.out.println("ok");
  +        assert("statefulSession != null", statefulSession != null);
  +        System.out.println("ok");
               System.out.print(++test+"- "+"Calling getEJBHome() on 
StatefulSession...");
  -        if (statefulSession.getEJBHome() != null) System.out.println("ok");
  -            else throw new Exception ("null home not ok");
  -            System.out.println(++test+"- "+"Calling Business Method A on 
StatefulSession... ");
  +        assert("statefulSession.getEJBHome() != null", statefulSession.getEJBHome() 
!= null);
  +        System.out.println("ok");
  +        System.out.println(++test+"- "+"Calling Business Method A on 
StatefulSession... ");
           System.out.println(statefulSession.callBusinessMethodA());
           System.out.println(++test+"- "+"Calling Business Method A (state) on 
StatefulSession... ");
           System.out.println(statefulSession.callBusinessMethodA());
  @@ -357,12 +347,14 @@
           System.out.println(statefulSession.getPrimaryKey());
           System.out.print(++test+"- "+"Get Handle ... ");
           Handle statefulHandle = statefulSession.getHandle();
  -        if (statefulHandle != null) System.out.println("OK");
  +        assert("statefulHandle != null", statefulHandle != null);
  +        System.out.println("OK");
               System.out.print(++test+"- "+"Serialize handle and deserialize....");
           MarshalledObject mo2 = new MarshalledObject(statefulHandle);
           Handle statefulHandle2 = (Handle) mo2.get();
           StatefulSession statefulSession2 = (StatefulSession) 
statefulHandle2.getEJBObject();
  -        if (statefulSession2 != null) System.out.println("OK");
  +        assert("statefulSession2 != null", statefulSession2 != null);
  +        System.out.println("OK");
               System.out.println(++test+"- "+"Calling businessMethodB on it...");
           System.out.println(statefulSession2.callBusinessMethodB());
           System.out.println(++test+"- "+"They should be 
identical..."+statefulSession.isIdentical(statefulSession2));
  @@ -371,11 +363,13 @@
           statefulSession.remove();
           System.out.println("ok");
           System.out.print(++test+"- "+"Calling StatefulHome.remove(Handle) (this 
should fail)...");
  -        try {
  +        try
  +        {
               statefulSessionHome.remove(statefulSession2.getHandle());
  -            System.out.println("NOT OK");
  +            fail("statefulSessionHome.remove did not fail");
           }
  -        catch (Exception e) {
  +        catch (Exception e)
  +        {
               System.out.println("not found OK");
           }
           System.out.print(++test+"- "+"Creating a 3rd bean and calling it...");
  @@ -388,12 +382,12 @@
           System.out.print(++test+"- "+"I should not be able to remove it 
directly...");
           try {
               ss3.remove();
  -            System.out.println("NOT OK");
  +            fail("ss3.remove() did not fail");
           } catch (Exception e) {
               System.out.println("OK");
           }
        }
  -     
  +
        public void testEntityBeanCMP() 
                throws Exception
        {
  @@ -432,8 +426,8 @@
               System.out.println("ok");
           }
           System.out.print(++test+"- "+"Calling getEJBHome() on EntityCMP...");
  -        if (enterpriseEntity.getEJBHome() != null) System.out.println("ok");
  -            else throw new Exception ("new home not ok");
  +        assert("enterpriseEntity.getEJBHome() != null", 
enterpriseEntity.getEJBHome() != null);
  +        System.out.println("ok");
               
           System.out.print(++test+"- "+"Getting a new reference with findByPK...");
           EnterpriseEntity enterpriseEntity2 = null;
  @@ -443,8 +437,8 @@
           catch (Exception re) {
               re.printStackTrace();
           }
  -        if (enterpriseEntity2 != null) System.out.println("ok");
  -            else System.out.println("not ok");
  +        assert("enterpriseEntity2 != null", enterpriseEntity2 != null);
  +        System.out.println("ok");
               System.out.println(++test+"- "+"Calling Business Method A on 
enterpriseEntity... ");
           System.out.println(enterpriseEntity.callBusinessMethodA());
           
  @@ -466,8 +460,8 @@
           
           System.out.print(++test+"- "+"Calling getOtherField() on enterpriseEntity 
(should be 4)...");
           int value = enterpriseEntity.getOtherField();
  -        if (value == 4) System.out.println("value is "+value+", OK");
  -        else System.out.println("NOT OK value is "+value);
  +        assert("enterpriseEntity.getOtherField() == 4", value == 4);
  +        System.out.println("value is "+value+", OK");
      
        System.out.println("***Testing the various local Object class calls");
           System.out.print(++test+"- "+"toString ... ");
  @@ -483,7 +477,8 @@
           System.out.println(enterpriseEntity.getPrimaryKey());
           System.out.print(++test+"- "+"Get Handle ... ");
           Handle entityHandle = enterpriseEntity.getHandle();
  -        if (entityHandle != null) System.out.println("OK");
  +        assert("entityHandle != null", entityHandle != null);
  +        System.out.println("OK");
           System.out.print(++test+"- "+"Serialize handle and deserialize....");
           MarshalledObject mo3 = new MarshalledObject(entityHandle);
           Handle entityHandle3 = (Handle) mo3.get();
  @@ -499,7 +494,7 @@
                System.out.print(++test+"- "+"Calling enterpriseEntity.remove() 
(should fail)...");
                try {
                    enterpriseEntity.remove();
  -             System.out.println("NOT OK");
  +          fail("enterpriseEntity.remove() did not fail");
                }
                catch (Exception e) {
                    System.out.println("OK");
  @@ -543,19 +538,21 @@
           
           System.out.print(++test+"- "+"Looking up home for nextgen.EntityBMP...");
           EntityBMPHome bmpHome = (EntityBMPHome) ctx.lookup("nextgen.EntityBMP");
  -        if (bmpHome != null )System.out.println("ok");
  +        assert("bmpHome != null", bmpHome != null);
  +        System.out.println("ok");
               
           // the current test will always return
           
           System.out.print(++test+"- "+"Calling create on the home...");
           EntityBMP bmpBean = bmpHome.create("Marc");
  -        if (bmpBean!= null) System.out.println("ok");
  +        assert("bmpBean != null", bmpBean != null);
  +        System.out.println("ok");
               
           // Let's call a business method to see the flow of server calls
           
           System.out.print(++test+"- "+"Calling getEJBHome() on EntityBMP...");
  -        if (bmpBean.getEJBHome() != null) System.out.println("ok");
  -            else throw new Exception("Null Home");
  +        assert("bmpBean.getEJBHome() != null", bmpBean.getEJBHome() != null);
  +        System.out.println("ok");
               
           System.out.println(++test+"- "+"Calling business methodA on BMP bean...");
           System.out.println(bmpBean.callBusinessMethodA());
  @@ -600,7 +597,8 @@
           
           System.out.print(++test+"- "+"Looking up home for nextgen.EntityPK...");
           EntityPKHome pkHome = (EntityPKHome) ctx.lookup("nextgen.EntityPK");
  -        if (pkHome != null )System.out.println("ok");
  +        assert("pkHome != null", pkHome != null);
  +        System.out.println("ok");
               
           System.out.print(++test+"- "+"Calling find on the home...");
           EntityPK pkBean = null;
  @@ -617,14 +615,11 @@
           }
           
           
  -        if (pkBean!= null) System.out.println("ok");
  -            
  +        assert("pkBean != null", pkBean != null);
  +        System.out.println("ok");
  +    
           System.out.print(++test+"- "+"Retrieving other field...");
  -        if (pkBean.getOtherField() == 0) {
  -            System.out.println("0, ok");
  -        } else {
  -            System.out.println("failed");
  -        }
  +        assert("pkBean.getOtherField() == 0", pkBean.getOtherField() == 0);
           System.out.print(++test+"- "+"Setting it to 4...");
           pkBean.setOtherField(4);
           System.out.println("ok");
  @@ -634,45 +629,40 @@
           // Now we should be able to find it
           pkBean = pkHome.findByPrimaryKey(new AComplexPK(true, 10, 100,1000.0, 
"Marc"));
           
  -        if (pkBean != null) System.out.println("ok");
  +        assert("pkBean != null", pkBean != null);
  +        System.out.println("ok");
               
           // check if the other field has been saved
           System.out.print(++test+"- "+"Retrieving other field again, should be 
4...");
           int newValue = pkBean.getOtherField();
  -        if (newValue == 4) {
  -            System.out.println("4, ok");
  -        } else {
  -            System.out.println("failed, value is " + newValue);
  -        }
  +        assert("pkBean.getOtherField() == 4", newValue == 4);
  +        System.out.println("4, ok");
           
                // Get a new EJBObject for this guy
                // Now we should be able to find it
  -             System.out.print(++test+"- "+"gettting a new reference ... ") ;
  +             System.out.print(++test+"- gettting a new reference ... ") ;
                EntityPK pkBean2 = pkHome.findByPrimaryKey(new AComplexPK(true, 10, 
100,1000.0, "Marc"));
  -             if (pkBean2 != null) System.out.println("ok");
  -             System.out.print(++test+"- "+"Retrieving other field again, should be 
4...");
  +      assert("findByPrimaryKey AComplexPK", pkBean2 != null);
  +             System.out.println("ok");
  +             System.out.print(++test+"- Retrieving other field again, should be 
4...");
                int newValue2 = pkBean2.getOtherField();
  -             if (newValue2 == 4) {
  -                 System.out.println("4, ok");
  -             } else {
  -                 System.out.println("failed, value is " + newValue2);
  -             }
  -        
  -     
  -     
  -     
  +      assert("Retrieving other field again, should be 4...", newValue2 == 4);
  +
           // Now remove it
           System.out.println(++test+"- "+"Removing the bean...");
           pkBean.remove();
  -        try {
  +        try
  +        {
               System.out.println(++test+"- "+"I should not find it...");
               pkBean = pkHome.findByPrimaryKey(new AComplexPK(true, 10, 100, 1000.0, 
"Marc"));
  -        } catch (Exception e) {
  -            
  +            assert("findByPrimaryKey should fail", pkBean == null);
  +        }
  +         catch (Exception e)
  +         {
               System.out.println("not found, OK");
           }
        }
  -     
  +
       public void testTxSession() 
        throws Exception
       {
  @@ -859,89 +849,95 @@
                Collection coll = allTypes.getObjectList();
                System.out.println("OK");
                System.out.print(++test+"- "+"stateful bean ");
  -             if (coll.contains(sfBean)) System.out.println("OK"); else 
System.out.println("FAILED");
  +      assert(coll.contains(sfBean));
  +             System.out.println("OK");
                System.out.print(++test+"- "+"stateless bean ");
  -             if (coll.contains(slBean)) System.out.println("OK"); else 
System.out.println("FAILED");
  +      assert(coll.contains(slBean));
  +             System.out.println("OK");
                System.out.print(++test+"- "+"entity bean ");
  -             if (coll.contains(eeBean)) System.out.println("OK"); else 
System.out.println("FAILED");
  -                     
  +      assert(coll.contains(eeBean));
  +      System.out.println("OK");
  +
                System.out.println("Testing automatically generated finders");
                
                System.out.print(++test+"- "+"findAll()..");
                coll = allTypesHome.findAll();
  -             if (coll.contains(allTypes)) System.out.println("OK"); else 
System.out.println("FAILED");
  +      assert(coll.contains(allTypes));
  +             System.out.println("OK");
                
                System.out.print(++test+"- "+"findByPrimaryKey()...");
                AllTypes result = allTypesHome.findByPrimaryKey("seb");
  -             if (result.equals(allTypes)) System.out.println("OK"); else 
System.out.println("FAILED");
  -             
  +      assert(result.equals(allTypes));
  +      System.out.println("OK");
  +
                System.out.print(++test+"- "+"findByABoolean()..");
                coll = allTypesHome.findByABoolean(allTypes.getBoolean());
  -             if (coll.contains(allTypes)) System.out.println("OK"); else 
System.out.println("FAILED");
  -             
  +             assert(coll.contains(allTypes));
  +      System.out.println("OK");
  +
                System.out.print(++test+"- "+"findByAByte()..");
                coll = allTypesHome.findByAByte(allTypes.getByte());
  -             if (coll.contains(allTypes)) System.out.println("OK"); else 
System.out.println("FAILED");
  +             assert (coll.contains(allTypes));System.out.println("OK");
                
                System.out.print(++test+"- "+"findByAShort()..");
                coll = allTypesHome.findByAShort(allTypes.getShort());
  -             if (coll.contains(allTypes)) System.out.println("OK"); else 
System.out.println("FAILED");
  +             assert (coll.contains(allTypes));System.out.println("OK");
                
                System.out.print(++test+"- "+"findByAnInt()..");
                coll = allTypesHome.findByAnInt(allTypes.getInt());
  -             if (coll.contains(allTypes)) System.out.println("OK"); else 
System.out.println("FAILED");
  +             assert (coll.contains(allTypes));System.out.println("OK");
                
                System.out.print(++test+"- "+"findByALong()..");
                coll = allTypesHome.findByALong(allTypes.getLong());
  -             if (coll.contains(allTypes)) System.out.println("OK"); else 
System.out.println("FAILED");
  +             assert (coll.contains(allTypes));System.out.println("OK");
                
                System.out.print(++test+"- "+"findByAFloat()..");
                coll = allTypesHome.findByAFloat(allTypes.getFloat());
  -             if (coll.contains(allTypes)) System.out.println("OK"); else 
System.out.println("FAILED");
  +             assert (coll.contains(allTypes));System.out.println("OK");
                
                System.out.print(++test+"- "+"findByADouble()..");
                coll = allTypesHome.findByADouble(allTypes.getDouble());
  -             if (coll.contains(allTypes)) System.out.println("OK"); else 
System.out.println("FAILED");
  +             assert (coll.contains(allTypes));System.out.println("OK");
   
                System.out.println("No Char test yet, bug in jdk");
            
                System.out.print(++test+"- "+"findByAString()..");
                coll = allTypesHome.findByAString(allTypes.getString());
  -             if (coll.contains(allTypes)) System.out.println("OK"); else 
System.out.println("FAILED");
  +             assert (coll.contains(allTypes));System.out.println("OK");
                
                System.out.print(++test+"- "+"findByADate()..");
                coll = allTypesHome.findByADate(allTypes.getDate());
  -             if (coll.contains(allTypes)) System.out.println("OK"); else 
System.out.println("FAILED");
  +             assert (coll.contains(allTypes));System.out.println("OK");
                
                System.out.print(++test+"- "+"findByATimestamp()..");
                coll = allTypesHome.findByATimestamp(allTypes.getTimestamp());
  -             if (coll.contains(allTypes)) System.out.println("OK"); else 
System.out.println("FAILED");
  +             assert (coll.contains(allTypes));System.out.println("OK");
                
                System.out.print(++test+"- "+"findByAnObject()..");
                coll = allTypesHome.findByAnObject(allTypes.getObject());
  -             if (coll.contains(allTypes)) System.out.println("OK"); else 
System.out.println("FAILED");
  +             assert (coll.contains(allTypes));System.out.println("OK");
                
                System.out.print(++test+"- "+"findByStatefulSession()..");
                coll = 
allTypesHome.findByStatefulSession((StatefulSession)allTypes.getStateful().getEJBObject());
  -             if (coll.contains(allTypes)) System.out.println("OK"); else 
System.out.println("FAILED");
  +             assert (coll.contains(allTypes));System.out.println("OK");
                
                System.out.print(++test+"- "+"findByStatelessSession()..");
                coll = 
allTypesHome.findByStatelessSession((StatelessSession)allTypes.getStateless().getEJBObject());
  -             if (coll.contains(allTypes)) System.out.println("OK"); else 
System.out.println("FAILED");
  +             assert (coll.contains(allTypes));System.out.println("OK");
                
                System.out.print(++test+"- "+"findByEnterpriseEntity()..");
                coll = 
allTypesHome.findByEnterpriseEntity((EnterpriseEntity)allTypes.getEntity().getEJBObject());
  -             if (coll.contains(allTypes)) System.out.println("OK"); else 
System.out.println("FAILED");
  +             assert (coll.contains(allTypes));System.out.println("OK");
                
                System.out.println("Testing finders defined in jaws.xml");
                
                System.out.print(++test+"- "+"findByMinInt()..");
                coll = allTypesHome.findByMinInt(0);
  -             if (coll.contains(allTypes)) System.out.println("OK"); else 
System.out.println("FAILED");
  +             assert (coll.contains(allTypes));System.out.println("OK");
                
                System.out.print(++test+"- "+"findByIntAndDouble()..");
                coll = allTypesHome.findByIntAndDouble(allTypes.getInt(), 
allTypes.getDouble());
  -             if (coll.contains(allTypes)) System.out.println("OK"); else 
System.out.println("FAILED");
  +             assert (coll.contains(allTypes));System.out.println("OK");
       }
        
       public void testBeanManagedTransactionDemarcation() 
  @@ -1000,11 +996,11 @@
                System.out.print(++test+"- "+"Beginning a transaction (container 
should throw an exception)...");
                try {
                        System.out.print(bmtSL.txBegin());
  -                     System.out.println(" ... FAILED");
  +                     fail("bmtSL.txBegin() did not fail");
                } catch (RemoteException e) {
                        System.out.println(" ... OK, exception message: "+ 
e.getMessage());
                }
  -                                     
  +
                //*/
           System.out.println();
           System.out.println();
  @@ -1012,33 +1008,7 @@
           System.out.println("Test OK, "+test+" tests run, congratulations");
           
           Date finishDate = new Date();
  -        
  -        
           System.out.println("Tests took 
"+(finishDate.getTime()-startDate.getTime())+" milliseconds");
  -        /*
  -        System.out.println("Speed test now (1000 iterations) ...");
  -        Date startDate = new Date();
  -        for (int i = 0; i<1000 ; i++) {
  -        hello1.sayHello();
  -        }
  -        Date finishDate = new Date();
  -        System.out.println("Test finished and took : "+
  -        (finishDate.getTime()-startDate.getTime())+
  -        " milliSeconds");
  -        
  -        
  -        synchronized (this) {
  -        
  -        try {
  -        
  -        wait(10000);
  -        }
  -        catch (Exception e) {e.printStackTrace();};
  -        }
  -        
  -        System.out.println("Make it talk again (activation test) ...");
  -        System.out.println(hello1.sayHello());
  -        */
       }
   
       protected void installInvalidNamingProperties() {
  @@ -1094,25 +1064,32 @@
          restoreValidNamingProperties();
      }
   
  -   /**
  -    * Setup the test suite.
  -    */
      public static Test suite() {
  -      TestSuite suite = new TestSuite();
  -        
  -      // add a test case to deploy our support applications
  -      String[] filenames = {
  -         "bmp.jar",
  -         "testbean.jar",
  -         "testbean2.jar"
  -      };
  -      suite.addTest(new Deploy.Deployer(filenames));
  +       TestSuite suite = new TestSuite();
  +
  +       try {
  +           String[] filenames = {
  +               "bmp.jar",
  +               "testbean.jar",
  +               "testbean2.jar"
  +           };
              
  -      suite.addTest(new TestSuite(Main.class));
  +           System.out.println("Deploying...");
  +           for (int i=0; i<filenames.length; i++) {
  +               Deploy.deploy(filenames[i]);
  +           }
              
  -      // add a test case to undeploy our support applications
  -      suite.addTest(new Deploy.Undeployer(filenames));
  -
  -      return suite;
  +           suite.addTest(new TestSuite(Main.class));
  +           
  +           // add a test cases to undeploy our support applications
  +           for (int i=0; i<filenames.length; i++) {           
  +               suite.addTest(new Deploy.Undeployer(filenames[i]));
  +           }
  +       }
  +       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