NO-JIRA fix ManifestTest
As the test needs the generated jms jars to be verified I moved it from unit-tests to smoke-tests. Updated the test to look for the correct jars as the originally specified does not exist. Update the test to assert against Implementation-Version instead of ActiveMQ-Version in the manifest file as the ActiveMQ-Version property does not exist.
This commit is contained in:
parent
0c651dd17b
commit
2a26e46a8c
|
@ -85,10 +85,6 @@
|
||||||
<configuration>
|
<configuration>
|
||||||
<skipTests>${skipUnitTests}</skipTests>
|
<skipTests>${skipUnitTests}</skipTests>
|
||||||
<argLine>${activemq-surefire-argline}</argLine>
|
<argLine>${activemq-surefire-argline}</argLine>
|
||||||
<excludes>
|
|
||||||
<!--todo this test is dependent on the jar so needs to be run post package as an integration test-->
|
|
||||||
<exclude>**/ManifestTest.java</exclude>
|
|
||||||
</excludes>
|
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
<properties>
|
<properties>
|
||||||
<activemq.basedir>${project.basedir}/../../</activemq.basedir>
|
<activemq.basedir>${project.basedir}/../../</activemq.basedir>
|
||||||
<sts-surefire-extra-args />
|
<sts-surefire-extra-args />
|
||||||
|
<artemis-distribuiton-lib-dir>-Ddistribution.lib="${activemq.basedir}/artemis-distribution/target/apache-artemis-${project.version}-bin/apache-artemis-${project.version}/lib"</artemis-distribuiton-lib-dir>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
@ -1209,7 +1210,7 @@
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
<configuration>
|
<configuration>
|
||||||
<skipTests>${skipSmokeTests}</skipTests>
|
<skipTests>${skipSmokeTests}</skipTests>
|
||||||
<argLine>${sts-surefire-extra-args} ${activemq-surefire-argline}</argLine>
|
<argLine>${sts-surefire-extra-args} ${activemq-surefire-argline} ${artemis-distribuiton-lib-dir}</argLine>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
|
|
|
@ -14,10 +14,13 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.activemq.artemis.tests.unit.jms.misc;
|
package org.apache.activemq.artemis.tests.smoke.jms;
|
||||||
|
|
||||||
import javax.jms.ConnectionMetaData;
|
import javax.jms.ConnectionMetaData;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.jar.Attributes;
|
import java.util.jar.Attributes;
|
||||||
import java.util.jar.JarFile;
|
import java.util.jar.JarFile;
|
||||||
|
@ -25,42 +28,43 @@ import java.util.jar.Manifest;
|
||||||
|
|
||||||
import org.apache.activemq.artemis.core.server.ActiveMQServer;
|
import org.apache.activemq.artemis.core.server.ActiveMQServer;
|
||||||
import org.apache.activemq.artemis.core.server.ActiveMQServers;
|
import org.apache.activemq.artemis.core.server.ActiveMQServers;
|
||||||
|
import org.apache.activemq.artemis.core.version.Version;
|
||||||
import org.apache.activemq.artemis.jms.client.ActiveMQConnectionMetaData;
|
import org.apache.activemq.artemis.jms.client.ActiveMQConnectionMetaData;
|
||||||
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
|
import org.apache.activemq.artemis.tests.smoke.common.SmokeTestBase;
|
||||||
import org.jboss.logging.Logger;
|
import org.jboss.logging.Logger;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public class ManifestTest extends ActiveMQTestBase {
|
public class ManifestTest extends SmokeTestBase {
|
||||||
|
|
||||||
private static final Logger log = Logger.getLogger(ManifestTest.class);
|
private static final Logger log = Logger.getLogger(ManifestTest.class);
|
||||||
|
private static List<String> jarFiles = new ArrayList<>(Arrays.asList(
|
||||||
|
"artemis-jms-client-", "artemis-jms-server-"));
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testManifestEntries() throws Exception {
|
public void testManifestEntries() throws Exception {
|
||||||
|
|
||||||
Properties props = System.getProperties();
|
Properties props = System.getProperties();
|
||||||
String userDir = props.getProperty("build.lib");
|
String distributionLibDir = props.getProperty("distribution.lib");
|
||||||
|
|
||||||
log.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());
|
ActiveMQServer server = ActiveMQServers.newActiveMQServer(createBasicConfig());
|
||||||
|
Version serverVersion = server.getVersion();
|
||||||
|
String serverFullVersion = serverVersion.getFullVersion();
|
||||||
|
ConnectionMetaData meta = new ActiveMQConnectionMetaData(serverVersion);
|
||||||
|
|
||||||
ConnectionMetaData meta = new ActiveMQConnectionMetaData(server.getVersion());
|
for (String jarFile : jarFiles) {
|
||||||
|
// The jar must be there
|
||||||
|
File file = new File(distributionLibDir, jarFile + serverFullVersion + ".jar");
|
||||||
|
Assert.assertTrue(file.exists());
|
||||||
|
|
||||||
// Compare the value from ConnectionMetaData and MANIFEST.MF
|
// Open the jar and load MANIFEST.MF
|
||||||
Attributes attrs = manifest.getMainAttributes();
|
JarFile jar = new JarFile(file);
|
||||||
|
Manifest manifest = jar.getManifest();
|
||||||
|
|
||||||
Assert.assertEquals(meta.getProviderVersion(), attrs.getValue("ActiveMQ-Version"));
|
// Compare the value from ConnectionMetaData and MANIFEST.MF
|
||||||
|
Attributes attrs = manifest.getMainAttributes();
|
||||||
|
Assert.assertEquals(meta.getProviderVersion(), attrs.getValue("Implementation-Version"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue