Program: 147447
Project: 147447
Buggy source:
/** 
 * This test case will test functionality of tenant dead letter channel. 1. Publish 1 queue message to tenant. 2. Add consumer for the queue message. 3. Consumer do not acknowledge for the queue message. 4. Message will put into tenant dlc after retry sending queue message 10 times. 5. Number of messages in tenant dlc should be equal to 1. 6. Number of messages in super tenant dlc should be equal to 0.
 * @throws JMSException
 * @throws IOException
 * @throws NamingException
 * @throws AndesClientConfigurationException
 * @throws AndesClientException
 * @throws LoginAuthenticationExceptionException
 * @throws XPathExpressionException
 * @throws AndesAdminServiceBrokerManagerAdminException
 * @throws URISyntaxException
 * @throws SAXException
 * @throws LogoutAuthenticationExceptionException
 * @throws XMLStreamException
 */
@Test(groups="String_Node_Str",description="String_Node_Str") public void performTenantDeadLetterChannelTestCase() throws JMSException, IOException, NamingException, AndesClientConfigurationException, AndesClientException, LoginAuthenticationExceptionException, XPathExpressionException, AndesAdminServiceBrokerManagerAdminException, URISyntaxException, SAXException, LogoutAuthenticationExceptionException, XMLStreamException, AutomationUtilException {
  int sendMessageCount=1;
  Queue tenantUserDlcQueue;
  Queue superAdminDlcQueue;
  String destinationName="String_Node_Str";
  AutomationContext tenantContext=new AutomationContext("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  LoginLogoutClient loginLogoutClient=new LoginLogoutClient(tenantContext);
  String sessionCookie=loginLogoutClient.login();
  AndesAdminClient andesClient=new AndesAdminClient(super.backendURL,sessionCookie,ConfigurationContextProvider.getInstance().getConfigurationContext());
  loginLogoutClient.logout();
  andesClient.purgeQueue(tenantDlcQueueName);
  AutomationContext superTenantContext=new AutomationContext("String_Node_Str","String_Node_Str",FrameworkConstants.SUPER_TENANT_KEY,FrameworkConstants.SUPER_TENANT_ADMIN);
  LoginLogoutClient loginLogoutSuperTenant=new LoginLogoutClient(superTenantContext);
  String SuperTenantSessionCookie=loginLogoutSuperTenant.login();
  AndesAdminClient andesAdminClient=new AndesAdminClient(super.backendURL,SuperTenantSessionCookie,ConfigurationContextProvider.getInstance().getConfigurationContext());
  loginLogoutSuperTenant.logout();
  andesClient.purgeQueue(superTenantDlcQueueName);
  AndesJMSConsumerClientConfiguration consumerConfig=new AndesJMSConsumerClientConfiguration("String_Node_Str","String_Node_Str",ExchangeType.QUEUE,destinationName);
  consumerConfig.setAcknowledgeMode(JMSAcknowledgeMode.CLIENT_ACKNOWLEDGE);
  consumerConfig.setAcknowledgeAfterEachMessageCount(200L);
  consumerConfig.setPrintsPerMessageCount(sendMessageCount);
  AndesClient consumerClient=new AndesClient(consumerConfig,true);
  consumerClient.startClient();
  AndesJMSPublisherClientConfiguration tenantPublisherConfig=new AndesJMSPublisherClientConfiguration("String_Node_Str","String_Node_Str",ExchangeType.QUEUE,destinationName);
  tenantPublisherConfig.setNumberOfMessagesToSend(sendMessageCount);
  tenantPublisherConfig.setPrintsPerMessageCount(sendMessageCount);
  AndesClient tenantPublisherClient=new AndesClient(tenantPublisherConfig,true);
  tenantPublisherClient.startClient();
  AndesClientUtils.waitForMessagesAndShutdown(consumerClient,AndesClientConstants.DEFAULT_RUN_TIME);
  tenantUserDlcQueue=andesClient.getDlcQueue();
  superAdminDlcQueue=andesAdminClient.getDlcQueue();
  Assert.assertEquals(tenantUserDlcQueue.getMessageCount(),sendMessageCount,"String_Node_Str");
  Assert.assertEquals(superAdminDlcQueue.getMessageCount(),0,"String_Node_Str");
}

Fixed version (ground truth):
/** 
 * This test case will test functionality of tenant dead letter channel. 1. Publish 1 queue message to tenant. 2. Add consumer for the queue message. 3. Consumer do not acknowledge for the queue message. 4. Message will put into tenant dlc after retry sending queue message 10 times. 5. Number of messages in tenant dlc should be equal to 1. 6. Number of messages in super tenant dlc should be equal to 0.
 * @throws JMSException
 * @throws IOException
 * @throws NamingException
 * @throws AndesClientConfigurationException
 * @throws AndesClientException
 * @throws LoginAuthenticationExceptionException
 * @throws XPathExpressionException
 * @throws AndesAdminServiceBrokerManagerAdminException
 * @throws URISyntaxException
 * @throws SAXException
 * @throws LogoutAuthenticationExceptionException
 * @throws XMLStreamException
 */
@Test(groups="String_Node_Str",description="String_Node_Str") public void performTenantDeadLetterChannelTestCase() throws JMSException, IOException, NamingException, AndesClientConfigurationException, AndesClientException, LoginAuthenticationExceptionException, XPathExpressionException, AndesAdminServiceBrokerManagerAdminException, URISyntaxException, SAXException, LogoutAuthenticationExceptionException, XMLStreamException, AutomationUtilException {
  int sendMessageCount=1;
  Queue tenantUserDlcQueue;
  Queue superAdminDlcQueue;
  String destinationName="String_Node_Str";
  AutomationContext tenantContext=new AutomationContext("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  LoginLogoutClient loginLogoutClient=new LoginLogoutClient(tenantContext);
  String sessionCookie=loginLogoutClient.login();
  AndesAdminClient andesClient=new AndesAdminClient(super.backendURL,sessionCookie);
  loginLogoutClient.logout();
  andesClient.purgeQueue(tenantDlcQueueName);
  AutomationContext superTenantContext=new AutomationContext("String_Node_Str","String_Node_Str",FrameworkConstants.SUPER_TENANT_KEY,FrameworkConstants.SUPER_TENANT_ADMIN);
  LoginLogoutClient loginLogoutSuperTenant=new LoginLogoutClient(superTenantContext);
  String SuperTenantSessionCookie=loginLogoutSuperTenant.login();
  AndesAdminClient andesAdminClient=new AndesAdminClient(super.backendURL,SuperTenantSessionCookie);
  loginLogoutSuperTenant.logout();
  andesClient.purgeQueue(superTenantDlcQueueName);
  AndesJMSConsumerClientConfiguration consumerConfig=new AndesJMSConsumerClientConfiguration("String_Node_Str","String_Node_Str",ExchangeType.QUEUE,destinationName);
  consumerConfig.setAcknowledgeMode(JMSAcknowledgeMode.CLIENT_ACKNOWLEDGE);
  consumerConfig.setAcknowledgeAfterEachMessageCount(200L);
  consumerConfig.setPrintsPerMessageCount(sendMessageCount);
  AndesClient consumerClient=new AndesClient(consumerConfig,true);
  consumerClient.startClient();
  AndesJMSPublisherClientConfiguration tenantPublisherConfig=new AndesJMSPublisherClientConfiguration("String_Node_Str","String_Node_Str",ExchangeType.QUEUE,destinationName);
  tenantPublisherConfig.setNumberOfMessagesToSend(sendMessageCount);
  tenantPublisherConfig.setPrintsPerMessageCount(sendMessageCount);
  AndesClient tenantPublisherClient=new AndesClient(tenantPublisherConfig,true);
  tenantPublisherClient.startClient();
  AndesClientUtils.waitForMessagesAndShutdown(consumerClient,AndesClientConstants.DEFAULT_RUN_TIME);
  tenantUserDlcQueue=andesClient.getDlcQueue();
  superAdminDlcQueue=andesAdminClient.getDlcQueue();
  Assert.assertEquals(tenantUserDlcQueue.getMessageCount(),sendMessageCount,"String_Node_Str");
  Assert.assertEquals(superAdminDlcQueue.getMessageCount(),0,"String_Node_Str");
}