" <binding>/TestConnectionFactory</binding>\n" +
" </bindings>\n" +
" </attribute>\n" +
" </mbean>";
ObjectName on = ServerManagement.deploy(mbeanConfig);
ServerManagement.invoke(on, "create", new Object[0], new String[0]);
ServerManagement.invoke(on, "start", new Object[0], new String[0]);
ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("/TestConnectionFactory");
Connection c = cf.createConnection();
assertEquals("sofiavergara", c.getClientID());
try
{
c.setClientID("somethingelse");
fail("should throw exception");
}
catch(javax.jms.IllegalStateException e)
{
// OK
}
//Now try and deploy another one with the same client id
mbeanConfig =
"<mbean code=\"org.jboss.jms.server.connectionfactory.ConnectionFactory\"\n" +
" name=\"jboss.messaging.connectionfactory:service=TestConnectionFactory2\"\n" +
" xmbean-dd=\"xmdesc/ConnectionFactory-xmbean.xml\">\n" +
" <constructor>\n" +
" <arg type=\"java.lang.String\" value=\"sofiavergara\"/>\n" +
" </constructor>\n" +
" <depends optional-attribute-name=\"ServerPeer\">jboss.messaging:service=ServerPeer</depends>\n" +
" <depends optional-attribute-name=\"Connector\">jboss.messaging:service=Connector,transport=bisocket</depends>\n" +
" <attribute name=\"JNDIBindings\">\n" +
" <bindings>\n" +
" <binding>/TestConnectionFactory2</binding>\n" +
" </bindings>\n" +
" </attribute>\n" +
" </mbean>";
ObjectName on2 = ServerManagement.deploy(mbeanConfig);
ServerManagement.invoke(on2, "create", new Object[0], new String[0]);
ServerManagement.invoke(on2, "start", new Object[0], new String[0]);
ServerManagement.invoke(on2, "stop", new Object[0], new String[0]);