activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajdav...@apache.org
Subject svn commit: r470395 - /incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/ActiveMQConnectionFactoryTest.java
Date Thu, 02 Nov 2006 15:47:47 GMT
Author: rajdavies
Date: Thu Nov  2 07:47:46 2006
New Revision: 470395

URL: http://svn.apache.org/viewvc?view=rev&rev=470395
Log:
Added test to make sure ConnectionFactory is serializable - which
is a requirement of the JMS spec

Modified:
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/ActiveMQConnectionFactoryTest.java

Modified: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/ActiveMQConnectionFactoryTest.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/ActiveMQConnectionFactoryTest.java?view=diff&rev=470395&r1=470394&r2=470395
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/ActiveMQConnectionFactoryTest.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/ActiveMQConnectionFactoryTest.java
Thu Nov  2 07:47:46 2006
@@ -17,6 +17,10 @@
  */
 package org.apache.activemq;
 
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
 import java.net.URI;
 import java.net.URISyntaxException;
 
@@ -105,6 +109,21 @@
 			fail("Expected connection failure.");
 		} catch (JMSException e) {
 		}
+    }
+    
+    public void testFactorySerializable() throws Exception{
+        String clientID="TestClientID";
+        ActiveMQConnectionFactory cf=new ActiveMQConnectionFactory();
+        cf.setClientID(clientID);
+        ByteArrayOutputStream bytesOut=new ByteArrayOutputStream();
+        ObjectOutputStream objectsOut=new ObjectOutputStream(bytesOut);
+        objectsOut.writeObject(cf);
+        objectsOut.flush();
+        byte[] data=bytesOut.toByteArray();
+        ByteArrayInputStream bytesIn=new ByteArrayInputStream(data);
+        ObjectInputStream objectsIn=new ObjectInputStream(bytesIn);
+        cf=(ActiveMQConnectionFactory)objectsIn.readObject();
+        assertEquals(cf.getClientID(),clientID);
     }
 
     protected void assertCreateConnection(String uri) throws Exception {



Mime
View raw message