User: d_jencks
  Date: 01/09/14 18:07:11

  Modified:    src/main/org/jboss/test/dbtest/test DbTypesUnitTestCase.java
  Log:
  Converted to JBossTestCase and logging, made work (dbtest still breaks with 
Hypersonic 1.4)
  
  Revision  Changes    Path
  1.2       +391 -329  
jbosstest/src/main/org/jboss/test/dbtest/test/DbTypesUnitTestCase.java
  
  Index: DbTypesUnitTestCase.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jbosstest/src/main/org/jboss/test/dbtest/test/DbTypesUnitTestCase.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DbTypesUnitTestCase.java  2001/09/12 04:55:38     1.1
  +++ DbTypesUnitTestCase.java  2001/09/15 01:07:11     1.2
  @@ -1,356 +1,418 @@
  +/*
  + * JBoss, the OpenSource J2EE webOS
  + *
  + * Distributable under LGPL license.
  + * See terms of license at gnu.org.
  + */
   package org.jboss.test.dbtest.test;
   
   import java.rmi.*;
  -
  +import java.util.Collection;
   
  -import javax.naming.Context;
  -import javax.naming.InitialContext;
  +import java.util.Date;
  +import java.util.Enumeration;
  +import java.util.Iterator;
  +import java.util.Properties;
   import javax.ejb.DuplicateKeyException;
  -import javax.ejb.Handle;
   import javax.ejb.EJBMetaData;
   import javax.ejb.FinderException;
  +import javax.ejb.Handle;
   
  -import java.util.Date;
  -import java.util.Properties;
  -import java.util.Collection;
  -import java.util.Iterator;
  -import java.util.Enumeration;
  +import javax.naming.Context;
  +import javax.naming.InitialContext;
   
  +import junit.framework.*;
  +
   import org.jboss.test.dbtest.interfaces.AllTypes;
   import org.jboss.test.dbtest.interfaces.AllTypesHome;
   import org.jboss.test.dbtest.interfaces.MyObject;
   import org.jboss.test.dbtest.interfaces.Record;
   import org.jboss.test.dbtest.interfaces.RecordHome;
   
  -import junit.framework.*;
  -import org.jboss.test.util.Deploy;
  +import org.jboss.test.JBossTestCase;
   
  +/**
  + * Test case to try out all db types using cmp against DefaultDS
  + */
   public class DbTypesUnitTestCase
  -    extends TestCase
  +       extends JBossTestCase
   {
  -
  -     static boolean deployed = false;
   
  -    public DbTypesUnitTestCase(String name)
  -    {
  -        super(name);
  -    }
  -
  -     public static void main(String arg[]) {
  -             DbTypesUnitTestCase main = new DbTypesUnitTestCase("main");
  -
  -             try {
  -                     main.setUp();
  -
  -             } catch (Exception e) {
  -                     System.out.println("Setup failed:");
  -                     e.printStackTrace();
  -             }
  -
  -             try {
  -                     main.testAllTypesBean();
  -                     System.out.println();
  -                     
System.out.println("_____________________________________________");
  -                     System.out.println("Congratulations!  Test completed");
  -                     System.out.println("Please report success to the mailing 
list:");
  -                     System.out.println("   [EMAIL PROTECTED]");
  -                     System.out.println();
  -                     System.out.println("Don't forget to mention:");
  -                     System.out.println("   OS                      :");
  -                     System.out.println("   JDK vendor/version      :");
  -                     System.out.println();
  -                     System.out.println("   JBoss version           :");
  -                     System.out.println();
  -                     System.out.println("   Database name/version   :");
  -                     System.out.println("   JDBC driver version     :");
  -                     System.out.println();
  -                     System.out.println("And please include:");
  -                     System.out.println("   Your setup: relevant parts of 
jboss.jcml");
  -                     System.out.println("   The type-mappings from jaws.xml or 
standardjaws.xml if you changed them");
  -                     System.out.println();
  -                     System.out.println("Thanks very much!");
  -                     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 void testAllTypesBean() throws Exception {
  -             int test = 0;
  -
  -             Context ctx = new InitialContext();
  -
  -             System.out.println();
  -             System.out.print(++test+"- "+"Looking up the home AllTypes...");
  -
  -             AllTypesHome allTypesHome;
  -
  -             try {
  -                     allTypesHome = (AllTypesHome) ctx.lookup("AllTypes");
  -
  -                     if (allTypesHome == null) throw new Exception("abort");
  -                             System.out.println("OK");
  -
  -             } catch (Exception e) {
  -                     System.out.println();
  -                     System.out.println("Could not lookup the context:  the beans 
are probably not deployed");
  -                     System.out.println("Check the server trace for details");
  -                     e.printStackTrace();
  -                     throw new Exception();
  -             }
  -
  -             System.out.print(++test+"- "+"Calling findByPrimaryKey on AllTypesHome 
with name seb...");
  -
  -             AllTypes allTypes = null;
  -
  -             try {
  -                     allTypes = allTypesHome.findByPrimaryKey("seb");
  -             } catch (Exception e) {System.out.println(e.getMessage());}
  -
  -             if (allTypes == null) {
  -
  -                     System.out.println("not found OK");
  -                     System.out.print(++test+"- "+"Calling create on AllTypesHome 
with name seb...");
  -                     allTypes = allTypesHome.create("seb");
  -             }
  -
  -             if (allTypes != null) System.out.println("OK"); else {
  -                     System.out.println();
  -                     System.out.println("Could not find or create the alltypes 
bean");
  -                     System.out.println("Check the server trace for details");
  -
  -                     throw new Exception();
  -             }
  -
  -
  -             System.out.println("Getting all the fields");
  -             System.out.println(++test+"- "+"boolean " + allTypes.getBoolean() + " 
OK");
  -             System.out.println(++test+"- "+"byte " + allTypes.getByte() + " OK");
  -             System.out.println(++test+"- "+"short " + allTypes.getShort() + " OK");
  -             System.out.println(++test+"- "+"int " + allTypes.getInt() + " OK");
  -             System.out.println(++test+"- "+"long " + allTypes.getLong() + " OK");
  -             System.out.println(++test+"- "+"float " + allTypes.getFloat() + " OK");
  -             System.out.println(++test+"- "+"double " + allTypes.getDouble() + " 
OK");
  -             System.out.println("No char test yet, bug in jdk");
  -             System.out.println(++test+"- "+"String " + allTypes.getString() + " 
OK");
  -             System.out.println(++test+"- "+"Date " + allTypes.getDate() + " OK");
  -             System.out.println(++test+"- "+"Time " + allTypes.getTime() + " OK");
  -             System.out.println(++test+"- "+"Timestamp " + allTypes.getTimestamp() 
+ " OK");
  -
  -             System.out.print(++test+"- "+"MyObject ");
  -             MyObject obj = allTypes.getObject();
  -             System.out.println("OK");
  -
  -             System.out.print(++test+"- "+"Creating Record beans and adding them to 
the Collection in Alltypes..");
  -             RecordHome recordHome = (RecordHome) ctx.lookup("Record");
  -
  -             Record[] record = new Record[3];
  -             for (int i=0; i<3; i++) {
  -                     try {
  -                             record[i] = recordHome.findByPrimaryKey("bill " + i);
  -                     } catch (FinderException e) {
  -                             record[i] = recordHome.create("bill " + i);
  -                     }
  -
  -                     record[i].setAddress("SanFrancisco, CA 9411"+i);
  -                     allTypes.addObjectToList(record[i]);
  -             }
  -             System.out.println("OK");
  -
  -             System.out.print(++test+"- "+"Getting them back..");
  -
  -             Collection collection = allTypes.getObjectList();
  -             boolean ok = true;
  -
  -             for (int i=0; i<3; i++) ok = ok && collection.contains(record[i]);
  -
  -             if (ok) System.out.println("OK"); else {
  -                     System.out.println("failed");
  -                     throw new Exception("abort");
  -             }
  -
  -        System.out.println("All basic tests passed; Now testing min/max values.");
  -        System.out.println("This is just for information, it's okay if some fail.");
  -        System.out.println("Not all DBs have a column type that supports 8-byte 
numbers.");
  -        // NOTE: In order from most likely to fail to least likely to fail
  -        //       Oracle in particular demonstrates cascading failures and
  -        //       we don't want to miss that
  -
  -    // Double
  -        try {
  -            allTypes.setDouble(Double.MIN_VALUE);
  -            double d;
  -            if((d = allTypes.getDouble()) == Double.MIN_VALUE)
  -                System.out.println(++test+"- Double Min Value OK");
  -            else
  -                System.out.println(++test+"- Double Min Value Different ("+d+" <> 
"+Double.MIN_VALUE+")");
  -        } catch(Exception e) {
  -            System.out.println(++test+"- Double Min Value Failed");
  -        }
  -        try {
  -            allTypes.setDouble(Double.MAX_VALUE);
  -            double d;
  -            if((d = allTypes.getDouble()) == Double.MAX_VALUE)
  -                System.out.println(++test+"- Double Max Value OK");
  -            else
  -                System.out.println(++test+"- Double Max Value Different ("+d+" <> 
"+Double.MAX_VALUE+")");
  -        } catch(Exception e) {
  -            System.out.println(++test+"- Double Max Value Failed");
  -        }
  -    // Float
  -        try {
  -            allTypes.setFloat(Float.MIN_VALUE);
  -            float f;
  -            if((f = allTypes.getFloat()) == Float.MIN_VALUE)
  -                System.out.println(++test+"- Float Min Value OK");
  -            else
  -                System.out.println(++test+"- Float Min Value Different ("+f+" <> 
"+Float.MIN_VALUE+")");
  -        } catch(Exception e) {
  -            System.out.println(++test+"- Float Min Value Failed");
  -        }
  -        try {
  -            allTypes.setFloat(Float.MAX_VALUE);
  -            float f;
  -            if((f = allTypes.getFloat()) == Float.MAX_VALUE)
  -                System.out.println(++test+"- Float Max Value OK");
  -            else
  -                System.out.println(++test+"- Float Max Value Different ("+f+" <> 
"+Float.MAX_VALUE+")");
  -        } catch(Exception e) {
  -            System.out.println(++test+"- Float Max Value Failed");
  -        }
  -
  -    // Long
  -        try {
  -            allTypes.setLong(Long.MIN_VALUE);
  -            long l;
  -            if((l = allTypes.getLong()) == Long.MIN_VALUE)
  -                System.out.println(++test+"- Long Min Value OK");
  -            else
  -                System.out.println(++test+"- Long Min Value Different ("+l+" <> 
"+Long.MIN_VALUE+")");
  -        } catch(Exception e) {
  -            System.out.println(++test+"- Long Min Value Failed");
  -        }
  -        try {
  -            allTypes.setLong(Long.MAX_VALUE);
  -            long l;
  -            if((l = allTypes.getLong()) == Long.MAX_VALUE)
  -                System.out.println(++test+"- Long Max Value OK");
  -            else
  -                System.out.println(++test+"- Long Max Value Different ("+l+" <> 
"+Long.MAX_VALUE+")");
  -        } catch(Exception e) {
  -            System.out.println(++test+"- Long Max Value Failed");
  -        }
  -    // Short
  -        try {
  -            allTypes.setShort(Short.MIN_VALUE);
  -            short s;
  -            if((s = allTypes.getShort()) == Short.MIN_VALUE)
  -                System.out.println(++test+"- Short Min Value OK");
  -            else
  -                System.out.println(++test+"- Short Min Value Different ("+s+" <> 
"+Short.MIN_VALUE+")");
  -        } catch(Exception e) {
  -            System.out.println(++test+"- Short Min Value Failed");
  -        }
  -        try {
  -            allTypes.setShort(Short.MAX_VALUE);
  -            short s;
  -            if((s = allTypes.getShort()) == Short.MAX_VALUE)
  -                System.out.println(++test+"- Short Max Value OK");
  -            else
  -                System.out.println(++test+"- Short Max Value Different ("+s+" <> 
"+Short.MAX_VALUE+")");
  -        } catch(Exception e) {
  -            System.out.println(++test+"- Short Max Value Failed");
  -        }
  -    // Byte
  -        try {
  -            allTypes.setByte(Byte.MIN_VALUE);
  -            byte b;
  -            if((b = allTypes.getByte()) == Byte.MIN_VALUE)
  -                System.out.println(++test+"- Byte Min Value OK");
  -            else
  -                System.out.println(++test+"- Byte Min Value Different ("+b+" <> 
"+Byte.MIN_VALUE+")");
  -        } catch(Exception e) {
  -            System.out.println(++test+"- Byte Min Value Failed");
  -        }
  -        try {
  -            allTypes.setByte(Byte.MAX_VALUE);
  -            byte b;
  -            if((b = allTypes.getByte()) == Byte.MAX_VALUE)
  -                System.out.println(++test+"- Byte Max Value OK");
  -            else
  -                System.out.println(++test+"- Byte Max Value Different ("+b+" <> 
"+Byte.MAX_VALUE+")");
  -        } catch(Exception e) {
  -            System.out.println(++test+"- Byte Max Value Failed");
  -        }
  -    // Int
  -        try {
  -            allTypes.setInt(Integer.MIN_VALUE);
  -            int i;
  -            if((i = allTypes.getInt()) == Integer.MIN_VALUE)
  -                System.out.println(++test+"- Int Min Value OK");
  -            else
  -                System.out.println(++test+"- Int Min Value Different ("+i+" <> 
"+Integer.MIN_VALUE+")");
  -        } catch(Exception e) {
  -            System.out.println(++test+"- Int Min Value Failed");
  -        }
  -        try {
  -            allTypes.setInt(Integer.MAX_VALUE);
  -            int i;
  -            if((i = allTypes.getInt()) == Integer.MAX_VALUE)
  -                System.out.println(++test+"- Int Max Value OK");
  -            else
  -                System.out.println(++test+"- Int Max Value Different ("+i+" <> 
"+Integer.MAX_VALUE+")");
  -        } catch(Exception e) {
  -            System.out.println(++test+"- Int Max Value Failed");
  -        }
  -     }
  -
  -
  -     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,2001");
  -             System.out.println("_____________________________________________");
  -             System.out.println();
  -             System.out.println("Welcome to the database test");
  -             System.out.println("_____________________________________________");
  -             System.out.println();
  -             System.out.print("Deploying the bean...");
  -             System.out.flush();
  -             new org.jboss.jmx.client.Deployer().deploy("../deploy/dbtest.jar");
  -             deployed = true;
  -             System.out.println("done!");
  -             */
  -     }
  +   static boolean deployed = false;
   
      /**
  -    * Setup the test suite.
  +    * Constructor for the DbTypesUnitTestCase object
  +    *
  +    * @param name  Description of Parameter
       */
  -   public static Test suite() {
  -      TestSuite suite = new TestSuite();
  -        
  -      // add a test case to deploy our support applications
  -      String filename = "dbtest.jar";
  -      suite.addTest(new Deploy.Deployer(filename));
  +   public DbTypesUnitTestCase(String name)
  +   {
  +      super(name);
  +   }
   
  -      suite.addTest(new TestSuite(DbTypesUnitTestCase.class));
   
  -      // add a test case to undeploy our support applications
  -      suite.addTest(new Deploy.Undeployer(filename));
   
  -      return suite;
  +
  +   /**
  +    * A unit test for JUnit
  +    *
  +    * @exception Exception  Description of Exception
  +    */
  +   public void testAllTypesBean() throws Exception
  +   {
  +      int test = 0;
  +
  +      Context ctx = new InitialContext();
  +
  +      getLog().debug(++test + "- " + "Looking up the home AllTypes...");
  +
  +      AllTypesHome allTypesHome;
  +
  +      try
  +      {
  +         allTypesHome = (AllTypesHome)ctx.lookup("AllTypes");
  +
  +         if (allTypesHome == null)
  +         {
  +            throw new Exception("abort");
  +         }
  +         getLog().debug("OK");
  +
  +      }
  +      catch (Exception e)
  +      {
  +         getLog().debug("Could not lookup the context:  the beans are probably not 
deployed");
  +         getLog().debug("Check the server trace for details");
  +         e.printStackTrace();
  +         throw new Exception();
  +      }
  +
  +      getLog().debug(++test + "- " + "Calling findByPrimaryKey on AllTypesHome with 
name seb...");
  +
  +      AllTypes allTypes = null;
  +
  +      try
  +      {
  +         allTypes = allTypesHome.findByPrimaryKey("seb");
  +      }
  +      catch (Exception e)
  +      {
  +         getLog().debug(e.getMessage());
  +      }
  +
  +      if (allTypes == null)
  +      {
  +
  +         getLog().debug("not found OK");
  +         getLog().debug(++test + "- " + "Calling create on AllTypesHome with name 
seb...");
  +         allTypes = allTypesHome.create("seb");
  +      }
  +
  +      if (allTypes != null)
  +      {
  +         getLog().debug("OK");
  +      }
  +      else
  +      {
  +         getLog().debug("Could not find or create the alltypes bean");
  +         getLog().debug("Check the server trace for details");
  +
  +         throw new Exception();
  +      }
  +
  +      getLog().debug("Getting all the fields");
  +      getLog().debug(++test + "- " + "boolean " + allTypes.getBoolean() + " OK");
  +      getLog().debug(++test + "- " + "byte " + allTypes.getByte() + " OK");
  +      getLog().debug(++test + "- " + "short " + allTypes.getShort() + " OK");
  +      getLog().debug(++test + "- " + "int " + allTypes.getInt() + " OK");
  +      getLog().debug(++test + "- " + "long " + allTypes.getLong() + " OK");
  +      getLog().debug(++test + "- " + "float " + allTypes.getFloat() + " OK");
  +      getLog().debug(++test + "- " + "double " + allTypes.getDouble() + " OK");
  +      getLog().debug("No char test yet, bug in jdk");
  +      getLog().debug(++test + "- " + "String " + allTypes.getString() + " OK");
  +      getLog().debug(++test + "- " + "Date " + allTypes.getDate() + " OK");
  +      getLog().debug(++test + "- " + "Time " + allTypes.getTime() + " OK");
  +      getLog().debug(++test + "- " + "Timestamp " + allTypes.getTimestamp() + " 
OK");
  +
  +      getLog().debug(++test + "- " + "MyObject ");
  +      MyObject obj = allTypes.getObject();
  +      getLog().debug("OK");
  +
  +      getLog().debug(++test + "- " + "Creating Record beans and adding them to the 
Collection in Alltypes..");
  +      RecordHome recordHome = (RecordHome)ctx.lookup("Record");
  +
  +      Record[] record = new Record[3];
  +      for (int i = 0; i < 3; i++)
  +      {
  +         try
  +         {
  +            record[i] = recordHome.findByPrimaryKey("bill " + i);
  +         }
  +         catch (FinderException e)
  +         {
  +            record[i] = recordHome.create("bill " + i);
  +         }
  +
  +         record[i].setAddress("SanFrancisco, CA 9411" + i);
  +         allTypes.addObjectToList(record[i]);
  +      }
  +      getLog().debug("OK");
  +
  +      getLog().debug(++test + "- " + "Getting them back..");
  +
  +      Collection collection = allTypes.getObjectList();
  +      boolean ok = true;
  +
  +      for (int i = 0; i < 3; i++)
  +      {
  +         ok = ok && collection.contains(record[i]);
  +      }
  +
  +      if (ok)
  +      {
  +         getLog().debug("OK");
  +      }
  +      else
  +      {
  +         getLog().debug("failed");
  +         throw new Exception("abort");
  +      }
  +
  +      getLog().debug("All basic tests passed; Now testing min/max values.");
  +      getLog().debug("This is just for information, it's okay if some fail.");
  +      getLog().debug("Not all DBs have a column type that supports 8-byte 
numbers.");
  +      // NOTE: In order from most likely to fail to least likely to fail
  +      //       Oracle in particular demonstrates cascading failures and
  +      //       we don't want to miss that
  +
  +      // Double
  +      try
  +      {
  +         allTypes.setDouble(Double.MIN_VALUE);
  +         double d;
  +         if ((d = allTypes.getDouble()) == Double.MIN_VALUE)
  +         {
  +            getLog().debug(++test + "- Double Min Value OK");
  +         }
  +         else
  +         {
  +            getLog().debug(++test + "- Double Min Value Different (" + d + " <> " + 
Double.MIN_VALUE + ")");
  +         }
  +      }
  +      catch (Exception e)
  +      {
  +         getLog().debug(++test + "- Double Min Value Failed");
  +      }
  +      try
  +      {
  +         allTypes.setDouble(Double.MAX_VALUE);
  +         double d;
  +         if ((d = allTypes.getDouble()) == Double.MAX_VALUE)
  +         {
  +            getLog().debug(++test + "- Double Max Value OK");
  +         }
  +         else
  +         {
  +            getLog().debug(++test + "- Double Max Value Different (" + d + " <> " + 
Double.MAX_VALUE + ")");
  +         }
  +      }
  +      catch (Exception e)
  +      {
  +         getLog().debug(++test + "- Double Max Value Failed");
  +      }
  +      // Float
  +      try
  +      {
  +         allTypes.setFloat(Float.MIN_VALUE);
  +         float f;
  +         if ((f = allTypes.getFloat()) == Float.MIN_VALUE)
  +         {
  +            getLog().debug(++test + "- Float Min Value OK");
  +         }
  +         else
  +         {
  +            getLog().debug(++test + "- Float Min Value Different (" + f + " <> " + 
Float.MIN_VALUE + ")");
  +         }
  +      }
  +      catch (Exception e)
  +      {
  +         getLog().debug(++test + "- Float Min Value Failed");
  +      }
  +      try
  +      {
  +         allTypes.setFloat(Float.MAX_VALUE);
  +         float f;
  +         if ((f = allTypes.getFloat()) == Float.MAX_VALUE)
  +         {
  +            getLog().debug(++test + "- Float Max Value OK");
  +         }
  +         else
  +         {
  +            getLog().debug(++test + "- Float Max Value Different (" + f + " <> " + 
Float.MAX_VALUE + ")");
  +         }
  +      }
  +      catch (Exception e)
  +      {
  +         getLog().debug(++test + "- Float Max Value Failed");
  +      }
  +
  +      // Long
  +      try
  +      {
  +         allTypes.setLong(Long.MIN_VALUE);
  +         long l;
  +         if ((l = allTypes.getLong()) == Long.MIN_VALUE)
  +         {
  +            getLog().debug(++test + "- Long Min Value OK");
  +         }
  +         else
  +         {
  +            getLog().debug(++test + "- Long Min Value Different (" + l + " <> " + 
Long.MIN_VALUE + ")");
  +         }
  +      }
  +      catch (Exception e)
  +      {
  +         getLog().debug(++test + "- Long Min Value Failed");
  +      }
  +      try
  +      {
  +         allTypes.setLong(Long.MAX_VALUE);
  +         long l;
  +         if ((l = allTypes.getLong()) == Long.MAX_VALUE)
  +         {
  +            getLog().debug(++test + "- Long Max Value OK");
  +         }
  +         else
  +         {
  +            getLog().debug(++test + "- Long Max Value Different (" + l + " <> " + 
Long.MAX_VALUE + ")");
  +         }
  +      }
  +      catch (Exception e)
  +      {
  +         getLog().debug(++test + "- Long Max Value Failed");
  +      }
  +      // Short
  +      try
  +      {
  +         allTypes.setShort(Short.MIN_VALUE);
  +         short s;
  +         if ((s = allTypes.getShort()) == Short.MIN_VALUE)
  +         {
  +            getLog().debug(++test + "- Short Min Value OK");
  +         }
  +         else
  +         {
  +            getLog().debug(++test + "- Short Min Value Different (" + s + " <> " + 
Short.MIN_VALUE + ")");
  +         }
  +      }
  +      catch (Exception e)
  +      {
  +         getLog().debug(++test + "- Short Min Value Failed");
  +      }
  +      try
  +      {
  +         allTypes.setShort(Short.MAX_VALUE);
  +         short s;
  +         if ((s = allTypes.getShort()) == Short.MAX_VALUE)
  +         {
  +            getLog().debug(++test + "- Short Max Value OK");
  +         }
  +         else
  +         {
  +            getLog().debug(++test + "- Short Max Value Different (" + s + " <> " + 
Short.MAX_VALUE + ")");
  +         }
  +      }
  +      catch (Exception e)
  +      {
  +         getLog().debug(++test + "- Short Max Value Failed");
  +      }
  +      // Byte
  +      try
  +      {
  +         allTypes.setByte(Byte.MIN_VALUE);
  +         byte b;
  +         if ((b = allTypes.getByte()) == Byte.MIN_VALUE)
  +         {
  +            getLog().debug(++test + "- Byte Min Value OK");
  +         }
  +         else
  +         {
  +            getLog().debug(++test + "- Byte Min Value Different (" + b + " <> " + 
Byte.MIN_VALUE + ")");
  +         }
  +      }
  +      catch (Exception e)
  +      {
  +         getLog().debug(++test + "- Byte Min Value Failed");
  +      }
  +      try
  +      {
  +         allTypes.setByte(Byte.MAX_VALUE);
  +         byte b;
  +         if ((b = allTypes.getByte()) == Byte.MAX_VALUE)
  +         {
  +            getLog().debug(++test + "- Byte Max Value OK");
  +         }
  +         else
  +         {
  +            getLog().debug(++test + "- Byte Max Value Different (" + b + " <> " + 
Byte.MAX_VALUE + ")");
  +         }
  +      }
  +      catch (Exception e)
  +      {
  +         getLog().debug(++test + "- Byte Max Value Failed");
  +      }
  +      // Int
  +      try
  +      {
  +         allTypes.setInt(Integer.MIN_VALUE);
  +         int i;
  +         if ((i = allTypes.getInt()) == Integer.MIN_VALUE)
  +         {
  +            getLog().debug(++test + "- Int Min Value OK");
  +         }
  +         else
  +         {
  +            getLog().debug(++test + "- Int Min Value Different (" + i + " <> " + 
Integer.MIN_VALUE + ")");
  +         }
  +      }
  +      catch (Exception e)
  +      {
  +         getLog().debug(++test + "- Int Min Value Failed");
  +      }
  +      try
  +      {
  +         allTypes.setInt(Integer.MAX_VALUE);
  +         int i;
  +         if ((i = allTypes.getInt()) == Integer.MAX_VALUE)
  +         {
  +            getLog().debug(++test + "- Int Max Value OK");
  +         }
  +         else
  +         {
  +            getLog().debug(++test + "- Int Max Value Different (" + i + " <> " + 
Integer.MAX_VALUE + ")");
  +         }
  +      }
  +      catch (Exception e)
  +      {
  +         getLog().debug(++test + "- Int Max Value Failed");
  +      }
  +   }
  +
  +
  +   /**
  +    * The JUnit setup method
  +    *
  +    * @exception Exception  Description of Exception
  +    */
  +   protected void setUp() throws Exception
  +   {
  +       super.setUp();
  +       deployJ2ee("dbtest.jar");
  +   }
  +
  +   protected void tearDown() throws Exception
  +   {
  +      undeployJ2ee("dbtest.jar");
  +      super.tearDown();
      }
   }
  
  
  

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

Reply via email to