diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/FileConfigurationTest.java b/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/FileConfigurationTest.java index a60eb2d1c5..cf78e2d645 100644 --- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/FileConfigurationTest.java +++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/FileConfigurationTest.java @@ -29,7 +29,9 @@ import java.util.Map; import java.util.Set; import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration; +import org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl; import org.apache.activemq.artemis.core.server.plugin.ActiveMQServerBasePlugin; +import org.apache.activemq.artemis.utils.RandomUtil; import org.apache.activemq.artemis.utils.critical.CriticalAnalyzerPolicy; import org.apache.activemq.artemis.api.core.BroadcastGroupConfiguration; import org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration; @@ -670,6 +672,31 @@ public class FileConfigurationTest extends ConfigurationImplTest { assertTrue("check failed, " + defaultConfirmationWinSize + ":" + defaultIdCacheSize, ConfigurationImpl.checkoutDupCacheSize(defaultConfirmationWinSize, defaultIdCacheSize)); } + @Test + public void testJournalFileOpenTimeoutDefaultValue() throws Exception { + ActiveMQServerImpl server = new ActiveMQServerImpl(); + try { + server.start(); + Assert.assertEquals(ActiveMQDefaultConfiguration.getDefaultJournalFileOpenTimeout(), server.getConfiguration().getJournalFileOpenTimeout()); + } finally { + server.stop(); + } + } + + @Test + public void testJournalFileOpenTimeoutValue() throws Exception { + int timeout = RandomUtil.randomInt(); + Configuration configuration = createConfiguration("shared-store-master-hapolicy-config.xml"); + configuration.setJournalFileOpenTimeout(timeout); + ActiveMQServerImpl server = new ActiveMQServerImpl(configuration); + try { + server.start(); + Assert.assertEquals(timeout, server.getConfiguration().getJournalFileOpenTimeout()); + } finally { + server.stop(); + } + } + @Override protected Configuration createConfiguration() throws Exception { FileConfiguration fc = new FileConfiguration(); @@ -679,6 +706,14 @@ public class FileConfigurationTest extends ConfigurationImplTest { return fc; } + private Configuration createConfiguration(String filename) throws Exception { + FileConfiguration fc = new FileConfiguration(); + FileDeploymentManager deploymentManager = new FileDeploymentManager(filename); + deploymentManager.addDeployable(fc); + deploymentManager.readConfiguration(); + return fc; + } + public static class EmptyPlugin1 implements ActiveMQServerPlugin { }