This closes #2460
This commit is contained in:
commit
e41a24af78
|
@ -242,6 +242,10 @@ public class JournalFilesRepository {
|
|||
return dataFiles.size();
|
||||
}
|
||||
|
||||
public int getJournalFileOpenTimeout() {
|
||||
return journalFileOpenTimeout;
|
||||
}
|
||||
|
||||
public Collection<JournalFile> getDataFiles() {
|
||||
return dataFiles;
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue