ARTEMIS-3374 fix tests and shared subscriber case
A couple of tests were explicitly written to delete the configuration-managed queue. Since this is no longer allowed these tests had to change.
This commit is contained in:
parent
4c06d447fd
commit
bf875c3a37
|
@ -743,13 +743,9 @@ public class ActiveMQSession implements QueueSession, TopicSession {
|
|||
|
||||
QueueQuery subResponse = session.queueQuery(queueName);
|
||||
|
||||
if (!(subResponse.isExists() && Objects.equals(subResponse.getAddress(), dest.getSimpleAddress()) && Objects.equals(subResponse.getFilterString(), coreFilterString))) {
|
||||
if ((!subResponse.isExists() || !Objects.equals(subResponse.getAddress(), dest.getSimpleAddress()) || !Objects.equals(subResponse.getFilterString(), coreFilterString)) && !subResponse.isConfigurationManaged()) {
|
||||
try {
|
||||
if (durability == ConsumerDurability.DURABLE) {
|
||||
createSharedQueue(dest, RoutingType.MULTICAST, queueName, coreFilterString, true, response);
|
||||
} else {
|
||||
createSharedQueue(dest, RoutingType.MULTICAST, queueName, coreFilterString, false, response);
|
||||
}
|
||||
createSharedQueue(dest, RoutingType.MULTICAST, queueName, coreFilterString, durability == ConsumerDurability.DURABLE, response);
|
||||
} catch (ActiveMQQueueExistsException ignored) {
|
||||
// We ignore this because querying and then creating the queue wouldn't be idempotent
|
||||
// we could also add a parameter to ignore existence what would require a bigger work around to avoid
|
||||
|
|
|
@ -1110,7 +1110,7 @@ public class ProtonServerSenderContext extends ProtonInitializable implements Pr
|
|||
* recreate the queue (JMS semantics). However, if the corresponding queue is managed via the
|
||||
* configuration then we don't want to change it
|
||||
*/
|
||||
if (!result.isConfigurationManaged() && (!Objects.equals(result.getFilterString(), simpleStringSelector) || (sender.getSource() != null && !sender.getSource().getAddress().equals(result.getAddress().toString())))) {
|
||||
if (!result.isConfigurationManaged() && (!Objects.equals(result.getAddress(), addressToUse) || !Objects.equals(result.getFilterString(), simpleStringSelector))) {
|
||||
|
||||
if (result.getConsumerCount() == 0) {
|
||||
sessionSPI.deleteQueue(queue);
|
||||
|
@ -1132,7 +1132,7 @@ public class ProtonServerSenderContext extends ProtonInitializable implements Pr
|
|||
if (shared && sender.getName() != null) {
|
||||
queue = createQueueName(connection.isUseCoreSubscriptionNaming(), getClientId(), sender.getName(), shared, global, isVolatile);
|
||||
QueueQueryResult result = sessionSPI.queueQuery(queue, routingTypeToUse, false);
|
||||
if (!(result.isExists() && Objects.equals(result.getAddress(), addressToUse) && Objects.equals(result.getFilterString(), simpleStringSelector))) {
|
||||
if ((!result.isExists() || !Objects.equals(result.getAddress(), addressToUse) || !Objects.equals(result.getFilterString(), simpleStringSelector)) && !result.isConfigurationManaged()) {
|
||||
sessionSPI.createSharedVolatileQueue(addressToUse, RoutingType.MULTICAST, queue, simpleStringSelector);
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -98,13 +98,6 @@ public class SecureConfigurationTest extends ActiveMQTestBase {
|
|||
} catch (JMSSecurityException j) {
|
||||
//Expected exception
|
||||
}
|
||||
|
||||
try {
|
||||
sendAndReceiveTextUsingTopic(connectionFactory, null, message, "secured_topic_shared_durable", (t, s) -> s.createSharedDurableConsumer(t, "secured_topic_shared_durable/queue", "age < 10"));
|
||||
Assert.fail("Security exception expected, but did not occur, excepetion expected as not permissioned to dynamically create queue");
|
||||
} catch (JMSSecurityException j) {
|
||||
//Expected exception
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -124,13 +117,6 @@ public class SecureConfigurationTest extends ActiveMQTestBase {
|
|||
} catch (JMSSecurityException j) {
|
||||
//Expected exception
|
||||
}
|
||||
|
||||
try {
|
||||
sendAndReceiveTextUsingTopic(connectionFactory, null, message, "secured_topic_shared", (t, s) -> s.createSharedConsumer(t, "secured_topic_shared/queue", "age < 10"));
|
||||
Assert.fail("Security exception expected, but did not occur, excepetion expected as not permissioned to dynamically create queue");
|
||||
} catch (JMSSecurityException j) {
|
||||
//Expected exception
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -148,20 +134,6 @@ public class SecureConfigurationTest extends ActiveMQTestBase {
|
|||
} catch (JMSSecurityException j) {
|
||||
//Expected exception
|
||||
}
|
||||
|
||||
try {
|
||||
sendAndReceiveTextUsingTopic(connectionFactory, "clientId", message, "secured_topic_durable", (t, s) -> s.createDurableSubscriber(t, "secured_topic_durable/queue", "age < 10", false));
|
||||
Assert.fail("Security exception expected, but did not occur, excepetion expected as not permissioned to dynamically create queue");
|
||||
} catch (JMSSecurityException j) {
|
||||
//Expected exception
|
||||
}
|
||||
|
||||
try {
|
||||
sendAndReceiveTextUsingTopic(connectionFactory, "clientId", message, "secured_topic_durable", (t, s) -> s.createDurableSubscriber(t, "secured_topic_durable/queue", "age < 10", true));
|
||||
Assert.fail("Security exception expected, but did not occur, excepetion expected as not permissioned to dynamically create queue");
|
||||
} catch (JMSSecurityException j) {
|
||||
//Expected exception
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in New Issue