ARTEMIS-2201 Added tests on DEFAULT_JOURNAL_FILE_OPEN_TIMEOUT value

This commit is contained in:
feuillemorte 2018-12-13 15:14:05 +01:00 committed by Francesco Nigro
parent 6dfa9a1fa4
commit a3001fd9bd
2 changed files with 10 additions and 1 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,6 +29,7 @@ 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;
@ -677,6 +678,8 @@ public class FileConfigurationTest extends ConfigurationImplTest {
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();
@ -685,12 +688,14 @@ public class FileConfigurationTest extends ConfigurationImplTest {
@Test
public void testJournalFileOpenTimeoutValue() throws Exception {
int timeout = RandomUtil.randomInt();
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();