This commit is contained in:
Timothy Bish 2018-02-28 14:31:07 -05:00
commit d61f058ff2
2 changed files with 20 additions and 4 deletions

View File

@ -193,7 +193,7 @@ public class OpenWireConnection extends AbstractRemotingConnection implements Se
private final Set<SimpleString> knownDestinations = new ConcurrentHashSet<>();
private AtomicBoolean disableTtl = new AtomicBoolean(false);
private final AtomicBoolean disableTtl = new AtomicBoolean(false);
public OpenWireConnection(Connection connection,
ActiveMQServer server,
@ -1676,7 +1676,7 @@ public class OpenWireConnection extends AbstractRemotingConnection implements Se
@Override
public String getClientID() {
return context.getClientId();
return context != null ? context.getClientId() : null;
}
@Override

View File

@ -60,9 +60,12 @@ import javax.jms.MessageProducer;
import javax.jms.Queue;
import javax.jms.Session;
import org.apache.activemq.artemis.api.core.ActiveMQException;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.plugin.ActiveMQServerPlugin;
import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection;
import org.apache.activemq.artemis.tests.integration.openwire.BasicOpenWireTest;
import org.junit.Test;
@ -76,6 +79,19 @@ public class OpenwirePluginTest extends BasicOpenWireTest {
long maxAddressSize, Map<String, AddressSettings> settings) {
ActiveMQServer server = super.createServer(realFiles, configuration, pageSize, maxAddressSize, settings);
server.registerBrokerPlugin(verifier);
server.registerBrokerPlugin(new ActiveMQServerPlugin() {
@Override
public void afterCreateConnection(RemotingConnection connection) throws ActiveMQException {
try {
//Verify that calling getClientID() before initialized doesn't cause an error
//Test for ARTEMIS-1713
connection.getClientID();
} catch (Exception e) {
throw new ActiveMQException(e.getMessage());
}
}
});
configuration.getAddressesSettings().put("autoCreated", new AddressSettings().setAutoDeleteAddresses(true)
.setAutoDeleteQueues(true).setAutoCreateQueues(true).setAutoCreateAddresses(true));
@ -83,7 +99,7 @@ public class OpenwirePluginTest extends BasicOpenWireTest {
return server;
}
@Test
@Test(timeout = 10000)
public void testAckedMessageAreConsumed() throws JMSException {
connection.start();
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
@ -119,7 +135,7 @@ public class OpenwirePluginTest extends BasicOpenWireTest {
}
@Test
@Test(timeout = 10000)
public void testAutoCreatedQueue() throws JMSException {
connection.start();
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);