[
https://issues.apache.org/jira/browse/ARTEMIS-1895?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16495249#comment-16495249
]
ASF GitHub Bot commented on ARTEMIS-1895:
-----------------------------------------
Github user michaelandrepearce commented on a diff in the pull request:
https://github.com/apache/activemq-artemis/pull/2116#discussion_r191793991
--- Diff:
tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/SessionMetadataAddExceptionTest.java
---
@@ -75,6 +93,37 @@ public void testInvalidClientIdSetFactory() throws
Exception {
cf.createConnection();
}
+ @Test(timeout = 5000, expected = JMSException.class)
+ public void testDuplicateClientIdSet() throws Exception {
+ ActiveMQConnectionFactory activeMQConnectionFactory =
(ActiveMQConnectionFactory) cf;
+ Connection con = cf.createConnection();
+ Connection con2 = cf.createConnection();
+ try {
+ con.setClientID("valid");
+ con2.setClientID("valid");
+ fail("Should have failed for duplicate clientId");
+ } catch (InvalidClientIDException e) {
+ assertEquals(1, duplicateCount.get());
+ throw e;
--- End diff --
Problem here is assert will be bypassed and test will still pass if another
exception thrown as tests expects JMSException.
Expects should be explicit and need a catch all with and assert fail
> Add duplicate metadata failure callback to ActiveMQServerPlugin
> ---------------------------------------------------------------
>
> Key: ARTEMIS-1895
> URL: https://issues.apache.org/jira/browse/ARTEMIS-1895
> Project: ActiveMQ Artemis
> Issue Type: Improvement
> Components: Broker
> Affects Versions: 2.6.0
> Reporter: Christopher L. Shannon
> Assignee: Christopher L. Shannon
> Priority: Minor
> Fix For: 2.7.0
>
>
> I have a usecase where it would be useful to have a callback as part of the
> plugin api when there is duplicate session metadata detected (ie duplicate
> clientId). This new callback will allow a user to add custom handling such
> as logging, etc.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)