ARTEMIS-1207: Align when setClientId can be called

Update ActiveMQConnection to change/alighn behaviour for addtional methods:
- getMetaData
- stop

Adding test to avoid regression.

This is aligning with qpid-jms and openwire clients
This commit is contained in:
Michael Andre Pearce 2017-06-06 16:09:58 +01:00 committed by Clebert Suconic
parent dc9cee2f79
commit e8fa02bf80
2 changed files with 17 additions and 3 deletions

View File

@ -267,8 +267,6 @@ public class ActiveMQConnection extends ActiveMQConnectionForContextImpl impleme
public ConnectionMetaData getMetaData() throws JMSException {
checkClosed();
justCreated = false;
if (metaData == null) {
metaData = new ActiveMQConnectionMetaData(thisVersion);
}
@ -323,7 +321,6 @@ public class ActiveMQConnection extends ActiveMQConnectionForContextImpl impleme
session.stop();
}
justCreated = false;
started = false;
}

View File

@ -97,6 +97,15 @@ public class ConnectionTest extends JMSTestCase {
connection2.setClientID(clientID);
}
@Test
public void testSetClientIdAfterStop() throws Exception {
try (Connection connection = createConnection()) {
connection.stop();
connection.setClientID("clientId");
}
}
@Test
public void testSetClientAfterStart() throws Exception {
Connection connection = null;
@ -174,6 +183,14 @@ public class ConnectionTest extends JMSTestCase {
connection.close();
}
@Test
public void testSetClientIdAfterGetMetadata() throws Exception {
try (Connection connection = createConnection()) {
connection.getMetaData();
connection.setClientID("clientId");
}
}
/**
* Test creation of QueueSession
*/