You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by py...@apache.org on 2007/07/17 08:31:04 UTC
svn commit: r556825 [10/10] - in
/harmony/enhanced/classlib/branches/java6/modules:
archive/src/main/java/java/util/jar/ archive/src/main/java/java/util/zip/
archive/src/main/java/org/apache/harmony/archive/internal/nls/
archive/src/main/java/org/apach...
Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/serial/SerialClobTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/serial/SerialClobTest.java?view=diff&rev=556825&r1=556824&r2=556825
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/serial/SerialClobTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/serial/SerialClobTest.java Mon Jul 16 23:30:22 2007
@@ -71,8 +71,8 @@
fail("should throw SerialException");
} catch (SerialException e) {
// expected
- }
-
+ }
+
try {
new SerialClob((Clob) null);
fail("should throw SQLException");
@@ -94,28 +94,28 @@
InputStream is = serialClob.getAsciiStream();
assertTrue(mockClob.isGetAsciiStreamInvoked);
assertEquals(mockClob.asciiInputStream, is);
-
+
try {
serialClob = new SerialClob("helloo".toCharArray());
serialClob.getAsciiStream();
fail("should throw SerialException");
} catch (SerialException e) {
- // expected
- }
+ // expected
+ }
}
public void testGetCharacterStream() throws Exception {
char[] buf = "helloo".toCharArray();
SerialClob serialClob = new SerialClob(buf);
-
+
Reader reader = serialClob.getCharacterStream();
char[] data = new char[buf.length];
int read = reader.read(data);
assertEquals(buf.length, read);
assertTrue(Arrays.equals(buf, data));
assertFalse(reader.ready());
-
+
MockSerialClob mockClob = new MockSerialClob();
mockClob.characterStreamReader = new CharArrayReader(mockClob.buf);
mockClob.asciiInputStream = new ByteArrayInputStream(new byte[] { 1 });
@@ -144,21 +144,21 @@
} catch (SerialException e) {
// expected
}
-
+
try {
sub = serialClob.getSubString(7, 1);
fail("should throw SerialException");
} catch (SerialException e) {
// expected
}
-
+
try {
sub = serialClob.getSubString(1, 7);
fail("should throw SerialException");
} catch (SerialException e) {
// expected
}
-
+
try {
sub = serialClob.getSubString(1, -2);
fail("should throw SerialException");
@@ -171,10 +171,10 @@
} catch (SerialException e) {
// expected
}
-
+
LongLengthClob longClob = new LongLengthClob();
serialClob = new SerialClob(longClob);
-
+
try {
serialClob.getSubString(1, 3);
fail("should throw SerialException");
@@ -189,56 +189,56 @@
SerialClob searchClob = new SerialClob("llo".toCharArray());
long pos = serialClob.position(searchClob, 1);
assertEquals(3, pos);
-
+
pos = serialClob.position(searchClob, 3);
assertEquals(3, pos);
-
+
searchClob = new SerialClob("o".toCharArray());
pos = serialClob.position(searchClob, 6);
assertEquals(6, pos);
-
+
searchClob = new SerialClob("ooooooo".toCharArray());
pos = serialClob.position(searchClob, 1);
assertEquals(-1, pos);
-
+
searchClob = new SerialClob("llo".toCharArray());
pos = serialClob.position(searchClob, 4);
assertEquals(-1, pos);
-
+
pos = serialClob.position(searchClob, 0);
assertEquals(-1, pos);
-
+
pos = serialClob.position(searchClob, -1);
assertEquals(-1, pos);
-
+
pos = serialClob.position(searchClob, 10);
assertEquals(-1, pos);
}
public void testPositionLStringJ() throws Exception {
SerialClob serialClob = new SerialClob("helloo".toCharArray());
-
+
long pos = serialClob.position("llo", 1);
assertEquals(3, pos);
-
+
pos = serialClob.position("llo", 3);
assertEquals(3, pos);
-
+
pos = serialClob.position("o", 6);
assertEquals(6, pos);
-
+
pos = serialClob.position("ooooooo", 1);
assertEquals(-1, pos);
-
+
pos = serialClob.position("llo", 4);
assertEquals(-1, pos);
-
+
pos = serialClob.position("llo", 0);
assertEquals(-1, pos);
-
+
pos = serialClob.position("llo", -1);
assertEquals(-1, pos);
-
+
pos = serialClob.position("llo", 10);
assertEquals(-1, pos);
}
@@ -260,14 +260,14 @@
assertNotNull(os);
assertTrue(mockClob.isSetAsciiStreamInvoked);
assertEquals(mockClob.asciiOutputStream, os);
-
+
try {
serialClob = new SerialClob("helloo".toCharArray());
// Harmony-3491, non bug difference from RI
serialClob.setAsciiStream(1);
fail("should throw SerialException");
} catch (SerialException e) {
- // expected
+ // expected
}
}
@@ -280,14 +280,14 @@
Writer writer = serialClob.setCharacterStream(1);
assertTrue(mockClob.isSetCharacterStreamInvoked);
assertEquals(mockClob.characterStreamWriter, writer);
-
+
try {
serialClob = new SerialClob("helloo".toCharArray());
// Harmony-3491, non bug difference from RI
serialClob.setCharacterStream(1);
fail("should throw SerialException");
} catch (SerialException e) {
- // expected
+ // expected
}
}
@@ -295,31 +295,31 @@
String s = "hello";
char[] buf = s.toCharArray();
SerialClob serialClob = new SerialClob(buf);
-
+
int count = serialClob.setString(1, "olleh");
String sub = serialClob.getSubString(1, 5);
assertEquals("olleh", sub);
assertEquals(5, count);
-
+
count = serialClob.setString(2, "mm");
sub = serialClob.getSubString(1, 5);
assertEquals("ommeh", sub);
assertEquals(2, count);
-
+
try {
serialClob.setString(-1, "hello");
fail("should throw SerialException");
} catch (SerialException e) {
// expected
}
-
+
try {
serialClob.setString(6, "hello");
fail("should throw SerialException");
} catch (SerialException e) {
// expected
}
-
+
// Harmony-3335, non bug difference from RI
try {
serialClob.setString(2, "hello");
@@ -335,34 +335,34 @@
String sub = serialClob.getSubString(1, 5);
assertEquals("olleh", sub);
assertEquals(5, count);
-
- count = serialClob.setString(2, "mmnn",1, 2);
+
+ count = serialClob.setString(2, "mmnn", 1, 2);
sub = serialClob.getSubString(1, 5);
// RI's bug
assertEquals(2, count);
assertEquals("omneh", sub);
-
+
try {
serialClob.setString(-1, "hello", 0, 5);
fail("should throw SerialException");
} catch (SerialException e) {
// expected
}
-
+
try {
serialClob.setString(6, "hello", 0, 5);
fail("should throw SerialException");
} catch (SerialException e) {
// expected
}
-
+
try {
serialClob.setString(1, "hello", 0, 6);
fail("should throw SerialException");
} catch (SerialException e) {
// expected
}
-
+
// Harmony-3335, non bug difference from RI
try {
serialClob.setString(2, "hello", 0, 5);
@@ -370,7 +370,7 @@
} catch (SerialException e) {
// expected
}
-
+
try {
// Harmony-3335
serialClob.setString(1, "hello", -1, 5);
@@ -404,10 +404,11 @@
// expected
}
}
+
private static class LongLengthClob extends MockClob {
@Override
public long length() throws SQLException {
- return (long)Integer.MAX_VALUE * (long)2 + 4;
+ return (long) Integer.MAX_VALUE * (long) 2 + 4;
}
}
@@ -416,15 +417,15 @@
public char[] buf = { 1, 2, 3 };
public Reader characterStreamReader;
-
+
public Writer characterStreamWriter;
public InputStream asciiInputStream;
-
+
public OutputStream asciiOutputStream;
-
+
public boolean isGetAsciiStreamInvoked;
-
+
public boolean isSetAsciiStreamInvoked;
public boolean isSetCharacterStreamInvoked;
Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/serial/SerialExceptionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/serial/SerialExceptionTest.java?view=diff&rev=556825&r1=556824&r2=556825
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/serial/SerialExceptionTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/serial/SerialExceptionTest.java Mon Jul 16 23:30:22 2007
@@ -24,7 +24,7 @@
import org.apache.harmony.testframework.serialization.SerializationTest;
public class SerialExceptionTest extends TestCase {
- /**
+ /**
* @tests serialization/deserialization compatibility.
*/
public void testSerializationSelf() throws Exception {
Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/serial/SerialJavaObjectTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/serial/SerialJavaObjectTest.java?view=diff&rev=556825&r1=556824&r2=556825
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/serial/SerialJavaObjectTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/serial/SerialJavaObjectTest.java Mon Jul 16 23:30:22 2007
@@ -26,8 +26,8 @@
import junit.framework.TestCase;
public class SerialJavaObjectTest extends TestCase {
- public void test_Constructor() throws Exception {
- TransientFieldClass tfc = new TransientFieldClass();
+ public void test_Constructor() throws Exception {
+ TransientFieldClass tfc = new TransientFieldClass();
SerialJavaObject sjo;
try {
sjo = new SerialJavaObject(tfc);
@@ -41,39 +41,44 @@
fail("should throw SerialException");
} catch (SerialException e) {
// excepted
- }
-
- SerializableClass sc = new SerializableClass();
- sjo = new SerialJavaObject(sc);
- assertSame(sc, sjo.getObject());
- Arrays.equals(sjo.getFields(), sc.getClass().getFields());
-
+ }
+
+ SerializableClass sc = new SerializableClass();
+ sjo = new SerialJavaObject(sc);
+ assertSame(sc, sjo.getObject());
+ Arrays.equals(sjo.getFields(), sc.getClass().getFields());
+
try {
new SerialJavaObject(null);
fail("should throw NullPointerException");
} catch (NullPointerException e) {
// expected
}
- }
-
- static class TransientFieldClass {
- transient int i;
- String s;
- }
-
- static class NonSerialiableClass {
- int i;
- String s;
- }
-
- static class StaticFieldClass {
- static int i;
- String s;
- }
-
- static class SerializableClass implements Serializable {
- private static final long serialVersionUID = 0L;
- int i;
- String s;
- }
+ }
+
+ static class TransientFieldClass {
+ transient int i;
+
+ String s;
+ }
+
+ static class NonSerialiableClass {
+ int i;
+
+ String s;
+ }
+
+ static class StaticFieldClass {
+ static int i;
+
+ String s;
+ }
+
+ static class SerializableClass implements Serializable {
+ private static final long serialVersionUID = 0L;
+
+ int i;
+
+ String s;
+ }
}
Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/serial/SerialRefTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/serial/SerialRefTest.java?view=diff&rev=556825&r1=556824&r2=556825
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/serial/SerialRefTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/serial/SerialRefTest.java Mon Jul 16 23:30:22 2007
@@ -32,147 +32,147 @@
*/
public class SerialRefTest extends TestCase {
- private SerialRef sr;
+ private SerialRef sr;
- private SerialRef sr2;
+ private SerialRef sr2;
- private MockRef ref;
+ private MockRef ref;
- @Override
+ @Override
protected void setUp() throws Exception {
- super.setUp();
- ref = new MockRef();
- sr = new SerialRef(ref);
-
- MockAbnormalRef maf = new MockAbnormalRef();
- sr2 = new SerialRef(maf);
- }
-
- /**
- * @tests javax.sql.rowset.serial.SerialRef#SerialRef(Ref ref)
- */
- public void testConstructorRef() throws SerialException, SQLException {
- try {
- new SerialRef(null);
- fail("should throw SQLException");
- } catch (SQLException e) {
- // expected
- }
-
- try {
- ref.setBaseTypeName(null);
- new SerialRef(ref);
- fail("should throw SQLException");
- } catch (SQLException e) {
- // expected
- }
- }
-
- /**
- * @tests javax.sql.rowset.serial.SerialRef#getBaseTypeName()
- */
- public void testGetBaseTypeName() throws SQLException {
- assertEquals(MockRef.BASE_TYPE_NAME, sr.getBaseTypeName());
- }
-
- /**
- * @tests javax.sql.rowset.serial.SerialRef#getObject()
- */
- public void testGetObject() throws SQLException {
- assertSame(ref.obj1, sr.getObject());
-
- sr.setObject(null);
- assertNull(sr.getObject());
-
- Object obj = new Object();
- sr.setObject(obj);
- assertSame(obj, sr.getObject());
-
- try {
- sr2.getObject();
- fail("should throw SerialException");
- } catch (SerialException e) {
- // expected
- }
-
- try {
- sr2.setObject(obj);
- fail("should throw SerialException");
- } catch (SerialException e) {
- // expected
- }
-
- }
-
- /**
- * @tests javax.sql.rowset.serial.SerialRef#getObject(Map)
- */
- public void testGetObjectLjava_util_Map() throws SQLException {
- try {
- assertNull(sr.getObject(null));
- fail("should throw NullPointerException");
- } catch (NullPointerException e) {
- // expected
- }
-
- Map<String, Class<?>> map = new Hashtable<String, Class<?>>();
- assertNull(sr.getObject(map));
-
- map.put("MockRef", MockRef.class);
- assertNull(sr.getObject(map));
-
- sr.setObject("MockRef1");
- assertNull(sr.getObject(map));
-
- sr.setObject("MockRef");
- assertSame(MockRef.class, sr.getObject(map));
- }
-
- static class MockRef implements Ref {
- private static final String BASE_TYPE_NAME = "MockBaseTypeName";
-
- String baseTypeName = BASE_TYPE_NAME;
-
- Object obj1 = new Object();
-
- Object obj2 = new Object();
-
- public String getBaseTypeName() throws SQLException {
- return baseTypeName;
- }
-
- public Object getObject() throws SQLException {
- return obj1;
- }
-
- public Object getObject(Map<String, Class<?>> map) throws SQLException {
- return obj2;
- }
-
- public void setObject(Object value) throws SQLException {
- obj1 = value;
- }
-
- public void setBaseTypeName(String name) {
- baseTypeName = name;
- }
- };
+ super.setUp();
+ ref = new MockRef();
+ sr = new SerialRef(ref);
+
+ MockAbnormalRef maf = new MockAbnormalRef();
+ sr2 = new SerialRef(maf);
+ }
+
+ /**
+ * @tests javax.sql.rowset.serial.SerialRef#SerialRef(Ref ref)
+ */
+ public void testConstructorRef() throws SerialException, SQLException {
+ try {
+ new SerialRef(null);
+ fail("should throw SQLException");
+ } catch (SQLException e) {
+ // expected
+ }
+
+ try {
+ ref.setBaseTypeName(null);
+ new SerialRef(ref);
+ fail("should throw SQLException");
+ } catch (SQLException e) {
+ // expected
+ }
+ }
+
+ /**
+ * @tests javax.sql.rowset.serial.SerialRef#getBaseTypeName()
+ */
+ public void testGetBaseTypeName() throws SQLException {
+ assertEquals(MockRef.BASE_TYPE_NAME, sr.getBaseTypeName());
+ }
+
+ /**
+ * @tests javax.sql.rowset.serial.SerialRef#getObject()
+ */
+ public void testGetObject() throws SQLException {
+ assertSame(ref.obj1, sr.getObject());
+
+ sr.setObject(null);
+ assertNull(sr.getObject());
+
+ Object obj = new Object();
+ sr.setObject(obj);
+ assertSame(obj, sr.getObject());
+
+ try {
+ sr2.getObject();
+ fail("should throw SerialException");
+ } catch (SerialException e) {
+ // expected
+ }
+
+ try {
+ sr2.setObject(obj);
+ fail("should throw SerialException");
+ } catch (SerialException e) {
+ // expected
+ }
+
+ }
+
+ /**
+ * @tests javax.sql.rowset.serial.SerialRef#getObject(Map)
+ */
+ public void testGetObjectLjava_util_Map() throws SQLException {
+ try {
+ assertNull(sr.getObject(null));
+ fail("should throw NullPointerException");
+ } catch (NullPointerException e) {
+ // expected
+ }
+
+ Map<String, Class<?>> map = new Hashtable<String, Class<?>>();
+ assertNull(sr.getObject(map));
+
+ map.put("MockRef", MockRef.class);
+ assertNull(sr.getObject(map));
+
+ sr.setObject("MockRef1");
+ assertNull(sr.getObject(map));
+
+ sr.setObject("MockRef");
+ assertSame(MockRef.class, sr.getObject(map));
+ }
+
+ static class MockRef implements Ref {
+ private static final String BASE_TYPE_NAME = "MockBaseTypeName";
+
+ String baseTypeName = BASE_TYPE_NAME;
+
+ Object obj1 = new Object();
+
+ Object obj2 = new Object();
+
+ public String getBaseTypeName() throws SQLException {
+ return baseTypeName;
+ }
- static class MockAbnormalRef extends MockRef {
- @Override
public Object getObject() throws SQLException {
- throw new SQLException();
- }
+ return obj1;
+ }
- @Override
public Object getObject(Map<String, Class<?>> map) throws SQLException {
- throw new SQLException();
- }
+ return obj2;
+ }
- @Override
public void setObject(Object value) throws SQLException {
- throw new SQLException();
- }
- };
+ obj1 = value;
+ }
+
+ public void setBaseTypeName(String name) {
+ baseTypeName = name;
+ }
+ };
+
+ static class MockAbnormalRef extends MockRef {
+ @Override
+ public Object getObject() throws SQLException {
+ throw new SQLException();
+ }
+
+ @Override
+ public Object getObject(Map<String, Class<?>> map) throws SQLException {
+ throw new SQLException();
+ }
+
+ @Override
+ public void setObject(Object value) throws SQLException {
+ throw new SQLException();
+ }
+ };
}
Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/transaction/InvalidTransactionExceptionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/transaction/InvalidTransactionExceptionTest.java?view=diff&rev=556825&r1=556824&r2=556825
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/transaction/InvalidTransactionExceptionTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/transaction/InvalidTransactionExceptionTest.java Mon Jul 16 23:30:22 2007
@@ -23,76 +23,77 @@
public class InvalidTransactionExceptionTest extends TestCase {
- /*
- * ConstructorTest
- */
- public void testInvalidTransactionExceptionString() {
-
- String[] init1 = { "a", "1", "valid1", "----", "&valid*", null, "", "\u0000" };
-
- String[] theFinalStates1 = init1;
-
- Exception[] theExceptions = { null, null, null, null, null, null, null,
- null };
-
- InvalidTransactionException aInvalidTransactionException;
- int loopCount = init1.length;
- for (int i = 0; i < loopCount; i++) {
- try {
- aInvalidTransactionException = new InvalidTransactionException(
- init1[i]);
- if (theExceptions[i] != null) {
+ /*
+ * ConstructorTest
+ */
+ public void testInvalidTransactionExceptionString() {
+
+ String[] init1 = { "a", "1", "valid1", "----", "&valid*", null, "",
+ "\u0000" };
+
+ String[] theFinalStates1 = init1;
+
+ Exception[] theExceptions = { null, null, null, null, null, null, null,
+ null };
+
+ InvalidTransactionException aInvalidTransactionException;
+ int loopCount = init1.length;
+ for (int i = 0; i < loopCount; i++) {
+ try {
+ aInvalidTransactionException = new InvalidTransactionException(
+ init1[i]);
+ if (theExceptions[i] != null) {
fail();
}
- assertEquals(i + " Final state mismatch",
- aInvalidTransactionException.getMessage(),
- theFinalStates1[i]);
+ assertEquals(i + " Final state mismatch",
+ aInvalidTransactionException.getMessage(),
+ theFinalStates1[i]);
- } catch (Exception e) {
- if (theExceptions[i] == null) {
+ } catch (Exception e) {
+ if (theExceptions[i] == null) {
fail(i + "Unexpected exception");
}
- assertEquals(i + "Exception mismatch", e.getClass(),
- theExceptions[i].getClass());
- assertEquals(i + "Exception mismatch", e.getMessage(),
- theExceptions[i].getMessage());
- } // end try
- } // end for
-
- } // end method testInvalidTransactionExceptionString
-
- /*
- * ConstructorTest
- */
- public void testInvalidTransactionException() {
-
- String[] theFinalStates1 = { null };
-
- Exception[] theExceptions = { null };
-
- InvalidTransactionException aInvalidTransactionException;
- int loopCount = 1;
- for (int i = 0; i < loopCount; i++) {
- try {
- aInvalidTransactionException = new InvalidTransactionException();
- if (theExceptions[i] != null) {
+ assertEquals(i + "Exception mismatch", e.getClass(),
+ theExceptions[i].getClass());
+ assertEquals(i + "Exception mismatch", e.getMessage(),
+ theExceptions[i].getMessage());
+ } // end try
+ } // end for
+
+ } // end method testInvalidTransactionExceptionString
+
+ /*
+ * ConstructorTest
+ */
+ public void testInvalidTransactionException() {
+
+ String[] theFinalStates1 = { null };
+
+ Exception[] theExceptions = { null };
+
+ InvalidTransactionException aInvalidTransactionException;
+ int loopCount = 1;
+ for (int i = 0; i < loopCount; i++) {
+ try {
+ aInvalidTransactionException = new InvalidTransactionException();
+ if (theExceptions[i] != null) {
fail();
}
- assertEquals(i + " Final state mismatch",
- aInvalidTransactionException.getMessage(),
- theFinalStates1[i]);
+ assertEquals(i + " Final state mismatch",
+ aInvalidTransactionException.getMessage(),
+ theFinalStates1[i]);
- } catch (Exception e) {
- if (theExceptions[i] == null) {
+ } catch (Exception e) {
+ if (theExceptions[i] == null) {
fail(i + "Unexpected exception");
}
- assertEquals(i + "Exception mismatch", e.getClass(),
- theExceptions[i].getClass());
- assertEquals(i + "Exception mismatch", e.getMessage(),
- theExceptions[i].getMessage());
- } // end try
- } // end for
+ assertEquals(i + "Exception mismatch", e.getClass(),
+ theExceptions[i].getClass());
+ assertEquals(i + "Exception mismatch", e.getMessage(),
+ theExceptions[i].getMessage());
+ } // end try
+ } // end for
- } // end method testInvalidTransactionException
+ } // end method testInvalidTransactionException
} // end class InvalidTransactionExceptionTest
Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/transaction/TransactionRequiredExceptionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/transaction/TransactionRequiredExceptionTest.java?view=diff&rev=556825&r1=556824&r2=556825
==============================================================================
Binary files /tmp/tmpLCpXCD and /tmp/tmpV2jAfX differ
Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/transaction/TransactionRolledbackExceptionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/transaction/TransactionRolledbackExceptionTest.java?view=diff&rev=556825&r1=556824&r2=556825
==============================================================================
Binary files /tmp/tmpyXkvkI and /tmp/tmpQ0BVdW differ
Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/transaction/xa/XAExceptionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/transaction/xa/XAExceptionTest.java?view=diff&rev=556825&r1=556824&r2=556825
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/transaction/xa/XAExceptionTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/transaction/xa/XAExceptionTest.java Mon Jul 16 23:30:22 2007
@@ -27,198 +27,198 @@
public class XAExceptionTest extends TestCase {
- /*
- * Public statics test
- */
- public void testPublicStatics() {
-
- HashMap<String, Integer> thePublicStatics = new HashMap<String, Integer>();
- thePublicStatics.put("XAER_OUTSIDE", new Integer(-9));
- thePublicStatics.put("XAER_DUPID", new Integer(-8));
- thePublicStatics.put("XAER_RMFAIL", new Integer(-7));
- thePublicStatics.put("XAER_PROTO", new Integer(-6));
- thePublicStatics.put("XAER_INVAL", new Integer(-5));
- thePublicStatics.put("XAER_NOTA", new Integer(-4));
- thePublicStatics.put("XAER_RMERR", new Integer(-3));
- thePublicStatics.put("XAER_ASYNC", new Integer(-2));
- thePublicStatics.put("XA_RDONLY", new Integer(3));
- thePublicStatics.put("XA_RETRY", new Integer(4));
- thePublicStatics.put("XA_HEURMIX", new Integer(5));
- thePublicStatics.put("XA_HEURRB", new Integer(6));
- thePublicStatics.put("XA_HEURCOM", new Integer(7));
- thePublicStatics.put("XA_HEURHAZ", new Integer(8));
- thePublicStatics.put("XA_NOMIGRATE", new Integer(9));
- thePublicStatics.put("XA_RBEND", new Integer(107));
- thePublicStatics.put("XA_RBTRANSIENT", new Integer(107));
- thePublicStatics.put("XA_RBTIMEOUT", new Integer(106));
- thePublicStatics.put("XA_RBPROTO", new Integer(105));
- thePublicStatics.put("XA_RBOTHER", new Integer(104));
- thePublicStatics.put("XA_RBINTEGRITY", new Integer(103));
- thePublicStatics.put("XA_RBDEADLOCK", new Integer(102));
- thePublicStatics.put("XA_RBCOMMFAIL", new Integer(101));
- thePublicStatics.put("XA_RBROLLBACK", new Integer(100));
- thePublicStatics.put("XA_RBBASE", new Integer(100));
-
- Class<?> xAExceptionClass;
- try {
- xAExceptionClass = Class
- .forName("javax.transaction.xa.XAException");
- } catch (ClassNotFoundException e) {
- fail("javax.transaction.xa.XAException class not found!");
- return;
- } // end try
-
- Field[] theFields = xAExceptionClass.getDeclaredFields();
- int requiredModifier = Modifier.PUBLIC + Modifier.STATIC
- + Modifier.FINAL;
-
- int countPublicStatics = 0;
- for (Field element : theFields) {
- String fieldName = element.getName();
- int theMods = element.getModifiers();
- if (Modifier.isPublic(theMods) && Modifier.isStatic(theMods)) {
- try {
- Object fieldValue = element.get(null);
- Object expectedValue = thePublicStatics.get(fieldName);
- if (expectedValue == null) {
- fail("Field " + fieldName + " missing!");
- } // end
- assertEquals("Field " + fieldName + " value mismatch: ",
- expectedValue, fieldValue);
- assertEquals("Field " + fieldName + " modifier mismatch: ",
- requiredModifier, theMods);
- countPublicStatics++;
- } catch (IllegalAccessException e) {
- fail("Illegal access to Field " + fieldName);
- } // end try
- } // end if
- } // end for
-
- } // end method testPublicStatics
-
- /*
- * ConstructorTest
- */
- public void testXAExceptionint() {
-
- int[] init1 = { -2147483648, 2147483647, 0, 1856939228, -217759650,
- -1808025128, -69857128 };
-
- String[] theFinalStates1 = { null, null, null, null, null, null, null };
-
- Exception[] theExceptions = { null, null, null, null, null, null, null };
-
- XAException aXAException;
- int loopCount = init1.length;
- for (int i = 0; i < loopCount; i++) {
- try {
- aXAException = new XAException(init1[i]);
- if (theExceptions[i] != null) {
+ /*
+ * Public statics test
+ */
+ public void testPublicStatics() {
+
+ HashMap<String, Integer> thePublicStatics = new HashMap<String, Integer>();
+ thePublicStatics.put("XAER_OUTSIDE", new Integer(-9));
+ thePublicStatics.put("XAER_DUPID", new Integer(-8));
+ thePublicStatics.put("XAER_RMFAIL", new Integer(-7));
+ thePublicStatics.put("XAER_PROTO", new Integer(-6));
+ thePublicStatics.put("XAER_INVAL", new Integer(-5));
+ thePublicStatics.put("XAER_NOTA", new Integer(-4));
+ thePublicStatics.put("XAER_RMERR", new Integer(-3));
+ thePublicStatics.put("XAER_ASYNC", new Integer(-2));
+ thePublicStatics.put("XA_RDONLY", new Integer(3));
+ thePublicStatics.put("XA_RETRY", new Integer(4));
+ thePublicStatics.put("XA_HEURMIX", new Integer(5));
+ thePublicStatics.put("XA_HEURRB", new Integer(6));
+ thePublicStatics.put("XA_HEURCOM", new Integer(7));
+ thePublicStatics.put("XA_HEURHAZ", new Integer(8));
+ thePublicStatics.put("XA_NOMIGRATE", new Integer(9));
+ thePublicStatics.put("XA_RBEND", new Integer(107));
+ thePublicStatics.put("XA_RBTRANSIENT", new Integer(107));
+ thePublicStatics.put("XA_RBTIMEOUT", new Integer(106));
+ thePublicStatics.put("XA_RBPROTO", new Integer(105));
+ thePublicStatics.put("XA_RBOTHER", new Integer(104));
+ thePublicStatics.put("XA_RBINTEGRITY", new Integer(103));
+ thePublicStatics.put("XA_RBDEADLOCK", new Integer(102));
+ thePublicStatics.put("XA_RBCOMMFAIL", new Integer(101));
+ thePublicStatics.put("XA_RBROLLBACK", new Integer(100));
+ thePublicStatics.put("XA_RBBASE", new Integer(100));
+
+ Class<?> xAExceptionClass;
+ try {
+ xAExceptionClass = Class
+ .forName("javax.transaction.xa.XAException");
+ } catch (ClassNotFoundException e) {
+ fail("javax.transaction.xa.XAException class not found!");
+ return;
+ } // end try
+
+ Field[] theFields = xAExceptionClass.getDeclaredFields();
+ int requiredModifier = Modifier.PUBLIC + Modifier.STATIC
+ + Modifier.FINAL;
+
+ int countPublicStatics = 0;
+ for (Field element : theFields) {
+ String fieldName = element.getName();
+ int theMods = element.getModifiers();
+ if (Modifier.isPublic(theMods) && Modifier.isStatic(theMods)) {
+ try {
+ Object fieldValue = element.get(null);
+ Object expectedValue = thePublicStatics.get(fieldName);
+ if (expectedValue == null) {
+ fail("Field " + fieldName + " missing!");
+ } // end
+ assertEquals("Field " + fieldName + " value mismatch: ",
+ expectedValue, fieldValue);
+ assertEquals("Field " + fieldName + " modifier mismatch: ",
+ requiredModifier, theMods);
+ countPublicStatics++;
+ } catch (IllegalAccessException e) {
+ fail("Illegal access to Field " + fieldName);
+ } // end try
+ } // end if
+ } // end for
+
+ } // end method testPublicStatics
+
+ /*
+ * ConstructorTest
+ */
+ public void testXAExceptionint() {
+
+ int[] init1 = { -2147483648, 2147483647, 0, 1856939228, -217759650,
+ -1808025128, -69857128 };
+
+ String[] theFinalStates1 = { null, null, null, null, null, null, null };
+
+ Exception[] theExceptions = { null, null, null, null, null, null, null };
+
+ XAException aXAException;
+ int loopCount = init1.length;
+ for (int i = 0; i < loopCount; i++) {
+ try {
+ aXAException = new XAException(init1[i]);
+ if (theExceptions[i] != null) {
fail();
}
- assertEquals(i + " Final state mismatch", aXAException
- .getMessage(), theFinalStates1[i]);
+ assertEquals(i + " Final state mismatch", aXAException
+ .getMessage(), theFinalStates1[i]);
- } catch (Exception e) {
- if (theExceptions[i] == null) {
+ } catch (Exception e) {
+ if (theExceptions[i] == null) {
fail(i + "Unexpected exception");
}
- assertEquals(i + "Exception mismatch", e.getClass(),
- theExceptions[i].getClass());
- assertEquals(i + "Exception mismatch", e.getMessage(),
- theExceptions[i].getMessage());
- } // end try
- } // end for
-
- } // end method testXAExceptionint
-
- /*
- * ConstructorTest
- */
- public void testXAExceptionString() {
-
- String[] init1 = { "a", "1", "valid1", "----", "&valid*", null, "", "