mirror of https://github.com/apache/activemq.git
Added test to make sure ConnectionFactory is serializable - which
is a requirement of the JMS spec git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@470395 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ae687a1182
commit
8a8f41c33b
|
@ -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;
|
||||
|
||||
|
@ -107,6 +111,21 @@ public class ActiveMQConnectionFactoryTest extends CombinationTestSupport {
|
|||
}
|
||||
}
|
||||
|
||||
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 {
|
||||
// Start up a broker with a tcp connector.
|
||||
BrokerService broker = new BrokerService();
|
||||
|
|
Loading…
Reference in New Issue