diff --git a/pom.xml b/pom.xml index 078bece..0327186 100644 --- a/pom.xml +++ b/pom.xml @@ -268,6 +268,7 @@ OpenHFT :: ${project.artifactId} ${project.version} + net.openhft.hashing net.openhft.hashing.*;-noimport:=true, !java.*, @@ -289,6 +290,24 @@ + + + maven-failsafe-plugin + 3.2.5 + + + + integration-test + verify + + + + ${project.build.directory}/${project.build.finalName}.jar + + + + + diff --git a/src/test/java/net/openhft/hashing/AutomaticModuleNameIT.java b/src/test/java/net/openhft/hashing/AutomaticModuleNameIT.java new file mode 100644 index 0000000..1de4c03 --- /dev/null +++ b/src/test/java/net/openhft/hashing/AutomaticModuleNameIT.java @@ -0,0 +1,37 @@ +/* + * Copyright 2013-2025 chronicle.software; SPDX-License-Identifier: Apache-2.0 + */ +package net.openhft.hashing; + +import org.junit.Test; + +import java.io.File; +import java.io.IOException; +import java.util.jar.Attributes; +import java.util.jar.JarFile; +import java.util.jar.Manifest; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +public class AutomaticModuleNameIT { + + private static final String EXPECTED_MODULE_NAME = "net.openhft.hashing"; + + @Test + public void packagedJarDeclaresAutomaticModuleName() throws IOException { + final String packagedJarPath = System.getProperty("packaged.jar"); + assertNotNull("packaged.jar system property", packagedJarPath); + + final File packagedJar = new File(packagedJarPath); + assertTrue("Packaged JAR does not exist: " + packagedJar, packagedJar.isFile()); + + try (JarFile jarFile = new JarFile(packagedJar)) { + final Manifest manifest = jarFile.getManifest(); + assertNotNull("Packaged JAR has no manifest: " + packagedJar, manifest); + final Attributes attributes = manifest.getMainAttributes(); + assertEquals(EXPECTED_MODULE_NAME, attributes.getValue("Automatic-Module-Name")); + } + } +}