This commit is contained in:
Francesco Nigro 2018-12-14 11:32:13 +01:00
commit e41a24af78
2 changed files with 44 additions and 0 deletions

View File

@ -242,6 +242,10 @@ public class JournalFilesRepository {
return dataFiles.size();
}
public int getJournalFileOpenTimeout() {
return journalFileOpenTimeout;
}
public Collection<JournalFile> getDataFiles() {
return dataFiles;
}

View File

@ -29,7 +29,10 @@ import java.util.Map;
import java.util.Set;
import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration;
import org.apache.activemq.artemis.core.journal.impl.JournalImpl;
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 +673,35 @@ 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();
JournalImpl journal = (JournalImpl) server.getStorageManager().getBindingsJournal();
Assert.assertEquals(ActiveMQDefaultConfiguration.getDefaultJournalFileOpenTimeout(), journal.getFilesRepository().getJournalFileOpenTimeout());
Assert.assertEquals(ActiveMQDefaultConfiguration.getDefaultJournalFileOpenTimeout(), server.getConfiguration().getJournalFileOpenTimeout());
} finally {
server.stop();
}
}
@Test
public void testJournalFileOpenTimeoutValue() throws Exception {
int timeout = RandomUtil.randomPositiveInt();
Configuration configuration = createConfiguration("shared-store-master-hapolicy-config.xml");
configuration.setJournalFileOpenTimeout(timeout);
ActiveMQServerImpl server = new ActiveMQServerImpl(configuration);
try {
server.start();
JournalImpl journal = (JournalImpl) server.getStorageManager().getBindingsJournal();
Assert.assertEquals(timeout, journal.getFilesRepository().getJournalFileOpenTimeout());
Assert.assertEquals(timeout, server.getConfiguration().getJournalFileOpenTimeout());
} finally {
server.stop();
}
}
@Override
protected Configuration createConfiguration() throws Exception {
FileConfiguration fc = new FileConfiguration();
@ -679,6 +711,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 {
}