This closes #1910
This commit is contained in:
commit
d61f058ff2
|
@ -193,7 +193,7 @@ public class OpenWireConnection extends AbstractRemotingConnection implements Se
|
||||||
|
|
||||||
private final Set<SimpleString> knownDestinations = new ConcurrentHashSet<>();
|
private final Set<SimpleString> knownDestinations = new ConcurrentHashSet<>();
|
||||||
|
|
||||||
private AtomicBoolean disableTtl = new AtomicBoolean(false);
|
private final AtomicBoolean disableTtl = new AtomicBoolean(false);
|
||||||
|
|
||||||
public OpenWireConnection(Connection connection,
|
public OpenWireConnection(Connection connection,
|
||||||
ActiveMQServer server,
|
ActiveMQServer server,
|
||||||
|
@ -1676,7 +1676,7 @@ public class OpenWireConnection extends AbstractRemotingConnection implements Se
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getClientID() {
|
public String getClientID() {
|
||||||
return context.getClientId();
|
return context != null ? context.getClientId() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -60,9 +60,12 @@ import javax.jms.MessageProducer;
|
||||||
import javax.jms.Queue;
|
import javax.jms.Queue;
|
||||||
import javax.jms.Session;
|
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.config.Configuration;
|
||||||
import org.apache.activemq.artemis.core.server.ActiveMQServer;
|
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.core.settings.impl.AddressSettings;
|
||||||
|
import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection;
|
||||||
import org.apache.activemq.artemis.tests.integration.openwire.BasicOpenWireTest;
|
import org.apache.activemq.artemis.tests.integration.openwire.BasicOpenWireTest;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
@ -76,6 +79,19 @@ public class OpenwirePluginTest extends BasicOpenWireTest {
|
||||||
long maxAddressSize, Map<String, AddressSettings> settings) {
|
long maxAddressSize, Map<String, AddressSettings> settings) {
|
||||||
ActiveMQServer server = super.createServer(realFiles, configuration, pageSize, maxAddressSize, settings);
|
ActiveMQServer server = super.createServer(realFiles, configuration, pageSize, maxAddressSize, settings);
|
||||||
server.registerBrokerPlugin(verifier);
|
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)
|
configuration.getAddressesSettings().put("autoCreated", new AddressSettings().setAutoDeleteAddresses(true)
|
||||||
.setAutoDeleteQueues(true).setAutoCreateQueues(true).setAutoCreateAddresses(true));
|
.setAutoDeleteQueues(true).setAutoCreateQueues(true).setAutoCreateAddresses(true));
|
||||||
|
@ -83,7 +99,7 @@ public class OpenwirePluginTest extends BasicOpenWireTest {
|
||||||
return server;
|
return server;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test(timeout = 10000)
|
||||||
public void testAckedMessageAreConsumed() throws JMSException {
|
public void testAckedMessageAreConsumed() throws JMSException {
|
||||||
connection.start();
|
connection.start();
|
||||||
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
|
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 {
|
public void testAutoCreatedQueue() throws JMSException {
|
||||||
connection.start();
|
connection.start();
|
||||||
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
|
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
|
||||||
|
|
Loading…
Reference in New Issue