User: mulder
Date: 00/10/20 07:19:01
Modified: src/main/org/jboss/test/dbtest/test Main.java
Log:
- Reorder the min/max tests so the most likely to fail are first.
This reveals some cascading problems (such as with Oracle).
- Add Oracle 8 settings.
Revision Changes Path
1.3 +74 -54 jbosstest/src/main/org/jboss/test/dbtest/test/Main.java
Index: Main.java
===================================================================
RCS file:
/products/cvs/ejboss/jbosstest/src/main/org/jboss/test/dbtest/test/Main.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Main.java 2000/10/19 19:56:31 1.2
+++ Main.java 2000/10/20 14:19:00 1.3
@@ -144,8 +144,7 @@
RecordHome recordHome = (RecordHome) ctx.lookup("Record");
Record[] record = new Record[3];
- int i;
- for (i=0; i<3; i++) {
+ for (int i=0; i<3; i++) {
try {
record[i] = recordHome.findByPrimaryKey("bill " + i);
} catch (FinderException e) {
@@ -162,38 +161,22 @@
Collection collection = allTypes.getObjectList();
boolean ok = true;
- for (i=0; i<3; i++) ok = ok && collection.contains(record[i]);
+ 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.");
- System.out.println("Now testing min/max values...");
+ 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.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");
- }
-
- try {
allTypes.setDouble(Double.MIN_VALUE);
double d;
if((d = allTypes.getDouble()) == Double.MIN_VALUE)
@@ -213,28 +196,49 @@
} catch(Exception e) {
System.out.println(++test+"- Double Max Value Failed");
}
-
+ // Float
try {
- allTypes.setByte(Byte.MIN_VALUE);
- byte b;
- if((b = allTypes.getByte()) == Byte.MIN_VALUE)
- System.out.println(++test+"- Byte Min Value OK");
+ 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+"- Byte Min Value Different ("+b+" <>
"+Byte.MIN_VALUE+")");
+ System.out.println(++test+"- Float Min Value Different ("+f+" <>
"+Float.MIN_VALUE+")");
} catch(Exception e) {
- System.out.println(++test+"- Byte Min Value Failed");
+ System.out.println(++test+"- Float 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");
+ 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+"- Byte Max Value Different ("+b+" <>
"+Byte.MAX_VALUE+")");
+ System.out.println(++test+"- Float Max Value Different ("+f+" <>
"+Float.MAX_VALUE+")");
} catch(Exception e) {
- System.out.println(++test+"- Byte Max Value Failed");
+ 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;
@@ -255,31 +259,47 @@
} catch(Exception e) {
System.out.println(++test+"- Short Max Value Failed");
}
-
+ // Byte
try {
- allTypes.setInt(Integer.MIN_VALUE);
- System.out.println(++test+"- Int Min Value OK");
+ 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+"- Int Min Value Failed");
+ System.out.println(++test+"- Byte Min Value Failed");
}
try {
- allTypes.setInt(Integer.MAX_VALUE);
- System.out.println(++test+"- Int Max Value OK");
+ 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+"- Int Max Value Failed");
+ System.out.println(++test+"- Byte Max Value Failed");
}
-
+ // Int
try {
- allTypes.setLong(Long.MIN_VALUE);
- System.out.println(++test+"- Long Min Value OK");
+ 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+"- Long Min Value Failed");
+ System.out.println(++test+"- Int Min Value Failed");
}
try {
- allTypes.setLong(Long.MAX_VALUE);
- System.out.println(++test+"- Long Max Value OK");
+ 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+"- Long Max Value Failed");
+ System.out.println(++test+"- Int Max Value Failed");
}
}