Search in sources :

Example 1 with ActiveMQConnectionMetaData

use of org.apache.activemq.artemis.jms.client.ActiveMQConnectionMetaData in project activemq-artemis by apache.

the class ManifestTest method testManifestEntries.

// Constants -----------------------------------------------------
// Static --------------------------------------------------------
// Attributes ----------------------------------------------------
// Constructors --------------------------------------------------
// Public --------------------------------------------------------
@Test
public void testManifestEntries() throws Exception {
    Properties props = System.getProperties();
    String userDir = props.getProperty("build.lib");
    UnitTestLogger.LOGGER.trace("userDir is " + userDir);
    // The jar must be there
    File file = new File("build/jars", "activemq-core.jar");
    Assert.assertTrue(file.exists());
    // Open the jar and load MANIFEST.MF
    JarFile jar = new JarFile(file);
    Manifest manifest = jar.getManifest();
    ActiveMQServer server = ActiveMQServers.newActiveMQServer(createBasicConfig());
    ConnectionMetaData meta = new ActiveMQConnectionMetaData(server.getVersion());
    // Compare the value from ConnectionMetaData and MANIFEST.MF
    Attributes attrs = manifest.getMainAttributes();
    Assert.assertEquals(meta.getProviderVersion(), attrs.getValue("ActiveMQ-Version"));
}
Also used : ActiveMQConnectionMetaData(org.apache.activemq.artemis.jms.client.ActiveMQConnectionMetaData) ActiveMQServer(org.apache.activemq.artemis.core.server.ActiveMQServer) ConnectionMetaData(javax.jms.ConnectionMetaData) ActiveMQConnectionMetaData(org.apache.activemq.artemis.jms.client.ActiveMQConnectionMetaData) Attributes(java.util.jar.Attributes) Properties(java.util.Properties) JarFile(java.util.jar.JarFile) Manifest(java.util.jar.Manifest) JarFile(java.util.jar.JarFile) File(java.io.File) Test(org.junit.Test)

Aggregations

File (java.io.File)1 Properties (java.util.Properties)1 Attributes (java.util.jar.Attributes)1 JarFile (java.util.jar.JarFile)1 Manifest (java.util.jar.Manifest)1 ConnectionMetaData (javax.jms.ConnectionMetaData)1 ActiveMQServer (org.apache.activemq.artemis.core.server.ActiveMQServer)1 ActiveMQConnectionMetaData (org.apache.activemq.artemis.jms.client.ActiveMQConnectionMetaData)1 Test (org.junit.Test)1