Java Code Examples for javax.jms.ConnectionMetaData#getProviderMajorVersion()

The following examples show how to use javax.jms.ConnectionMetaData#getProviderMajorVersion() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AmqpManagementTest.java    From qpid-broker-j with Apache License 2.0 6 votes vote down vote up
private boolean isSupportedClient() throws NamingException, JMSException
{
    if (getProtocol() == Protocol.AMQP_1_0)
    {
        return true;
    }
    else
    {
        Connection con = getConnection();
        try
        {
            final ConnectionMetaData metaData = con.getMetaData();
            // Older Qpid JMS Client 0-x (<=6.1.x) didn't support management addresses.
            return !(metaData.getProviderMajorVersion() < 6 || (metaData.getProviderMajorVersion() == 6
                                                                    && metaData.getProviderMinorVersion() <= 1));
        }
        finally
        {
            con.close();
        }
    }

}
 
Example 2
Source File: ConnectionTest.java    From activemq-artemis with Apache License 2.0 6 votes vote down vote up
@Test
public void testGetMetadata() throws Exception {
   Connection connection = createConnection();

   ConnectionMetaData metaData = connection.getMetaData();

   // TODO - need to check whether these are same as current version
   metaData.getJMSMajorVersion();
   metaData.getJMSMinorVersion();
   metaData.getJMSProviderName();
   metaData.getJMSVersion();
   metaData.getJMSXPropertyNames();
   metaData.getProviderMajorVersion();
   metaData.getProviderMinorVersion();
   metaData.getProviderVersion();

   connection.close();
}
 
Example 3
Source File: JmsConnectionTest.java    From qpid-jms with Apache License 2.0 6 votes vote down vote up
@Test(timeout=30000)
public void testConnectionMetaData() throws Exception {
    connection = new JmsConnection(connectionInfo, provider);

    ConnectionMetaData metaData = connection.getMetaData();

    assertNotNull(metaData);
    assertEquals(2, metaData.getJMSMajorVersion());
    assertEquals(0, metaData.getJMSMinorVersion());
    assertEquals("2.0", metaData.getJMSVersion());
    assertNotNull(metaData.getJMSXPropertyNames());

    assertNotNull(metaData.getProviderVersion());
    assertNotNull(metaData.getJMSProviderName());

    int major = metaData.getProviderMajorVersion();
    int minor = metaData.getProviderMinorVersion();
    assertTrue("Expected non-zero provider major(" + major + ") / minor(" + minor +") version.", (major + minor) != 0);
}