#ARTEMIS-2201 Added tests on DEFAULT_JOURNAL_FILE_OPEN_TIMEOUT value

This commit is contained in:
feuillemorte 2018-12-11 15:05:45 +01:00 committed by Francesco Nigro
parent aac7b8373f
commit 6dfa9a1fa4
1 changed files with 35 additions and 0 deletions

View File

@ -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 {
}