[teiid-commits] teiid SVN: r622 - trunk/common-core/src/test/java/com/metamatrix/api/exception.
teiid-commits at lists.jboss.org
teiid-commits at lists.jboss.org
Mon Mar 23 16:58:43 EDT 2009
Author: shawkins
Date: 2009-03-23 16:58:43 -0400 (Mon, 23 Mar 2009)
New Revision: 622
Modified:
trunk/common-core/src/test/java/com/metamatrix/api/exception/TestMetaMatrixCoreException.java
Log:
TEIID-431 deferring a test for now
Modified: trunk/common-core/src/test/java/com/metamatrix/api/exception/TestMetaMatrixCoreException.java
===================================================================
--- trunk/common-core/src/test/java/com/metamatrix/api/exception/TestMetaMatrixCoreException.java 2009-03-23 20:26:22 UTC (rev 621)
+++ trunk/common-core/src/test/java/com/metamatrix/api/exception/TestMetaMatrixCoreException.java 2009-03-23 20:58:43 UTC (rev 622)
@@ -1,8 +1,16 @@
package com.metamatrix.api.exception;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.ObjectStreamClass;
import java.sql.BatchUpdateException;
import java.sql.SQLException;
+import javax.naming.OperationNotSupportedException;
+
import junit.framework.TestCase;
import com.metamatrix.core.MetaMatrixCoreException;
@@ -11,13 +19,13 @@
public class TestMetaMatrixCoreException extends TestCase {
public void testSQLExceptionUnrolling() throws Exception {
- SQLException se = new BatchUpdateException("foo", new int[] {1});
+ SQLException se = new BatchUpdateException("foo", new int[] {1}); //$NON-NLS-1$
MetaMatrixCoreException mmce = new MetaMatrixCoreException(se);
mmce = UnitTestUtil.helpSerialize(mmce);
assertEquals(SQLException.class, mmce.getCause().getClass());
- assertEquals("foo", mmce.getMessage());
- assertEquals("java.sql.BatchUpdateException: foo", mmce.getCause().getMessage());
+ assertEquals("foo", mmce.getMessage()); //$NON-NLS-1$
+ assertEquals("java.sql.BatchUpdateException: foo", mmce.getCause().getMessage()); //$NON-NLS-1$
}
public void testInitCause() throws Exception {
@@ -30,5 +38,28 @@
}
}
+
+ public void defer_testDeserializationUnknownException() throws Exception {
+ MetaMatrixCoreException mmce = new MetaMatrixCoreException(new OperationNotSupportedException());
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ObjectOutputStream oos = new ObjectOutputStream(baos);
+ oos.writeObject(mmce);
+ oos.flush();
+
+ ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray())) {
+ @Override
+ protected Class<?> resolveClass(ObjectStreamClass desc)
+ throws IOException, ClassNotFoundException {
+ if (desc.getName().equals(OperationNotSupportedException.class.getName())) {
+ throw new ClassNotFoundException();
+ }
+ return super.resolveClass(desc);
+ }
+
+ };
+
+ mmce = (MetaMatrixComponentException)ois.readObject();
+ }
}
More information about the teiid-commits
mailing list