Search in sources :

Example 1 with FakeJournalLoader

use of org.apache.activemq.artemis.tests.unit.core.server.impl.fakes.FakeJournalLoader in project activemq-artemis by apache.

the class StorageManagerTestBase method createStorage.

/**
 * @throws Exception
 */
protected void createStorage() throws Exception {
    if (storeType == StoreConfiguration.StoreType.DATABASE) {
        journal = createJDBCJournalStorageManager(createDefaultJDBCConfig(true));
    } else {
        journal = createJournalStorageManager(createDefaultInVMConfig());
    }
    journal.start();
    journal.loadBindingJournal(new ArrayList<QueueBindingInfo>(), new ArrayList<GroupingInfo>(), new ArrayList<AddressBindingInfo>());
    journal.loadMessageJournal(new FakePostOffice(), null, null, null, null, null, null, new FakeJournalLoader());
}
Also used : GroupingInfo(org.apache.activemq.artemis.core.persistence.GroupingInfo) FakeJournalLoader(org.apache.activemq.artemis.tests.unit.core.server.impl.fakes.FakeJournalLoader) QueueBindingInfo(org.apache.activemq.artemis.core.persistence.QueueBindingInfo) FakePostOffice(org.apache.activemq.artemis.tests.unit.core.server.impl.fakes.FakePostOffice) AddressBindingInfo(org.apache.activemq.artemis.core.persistence.AddressBindingInfo)

Example 2 with FakeJournalLoader

use of org.apache.activemq.artemis.tests.unit.core.server.impl.fakes.FakeJournalLoader in project activemq-artemis by apache.

the class RestartSMTest method testRestartStorageManager.

@Test
public void testRestartStorageManager() throws Exception {
    File testdir = new File(getTestDir());
    deleteDirectory(testdir);
    PostOffice postOffice = new FakePostOffice();
    final JournalStorageManager journal = new JournalStorageManager(createDefaultInVMConfig(), EmptyCriticalAnalyzer.getInstance(), execFactory, execFactory);
    try {
        journal.start();
        List<QueueBindingInfo> queueBindingInfos = new ArrayList<>();
        journal.loadBindingJournal(queueBindingInfos, new ArrayList<GroupingInfo>(), new ArrayList<AddressBindingInfo>());
        journal.loadMessageJournal(postOffice, null, null, null, null, null, null, new FakeJournalLoader());
        journal.stop();
        deleteDirectory(testdir);
        journal.start();
        journal.loadMessageJournal(postOffice, null, null, null, null, null, null, new FakeJournalLoader());
        queueBindingInfos = new ArrayList<>();
        journal.loadBindingJournal(queueBindingInfos, new ArrayList<GroupingInfo>(), new ArrayList<AddressBindingInfo>());
        journal.start();
    } finally {
        try {
            journal.stop();
        } catch (Exception ex) {
            RestartSMTest.log.warn(ex.getMessage(), ex);
        }
    }
}
Also used : GroupingInfo(org.apache.activemq.artemis.core.persistence.GroupingInfo) ArrayList(java.util.ArrayList) FakePostOffice(org.apache.activemq.artemis.tests.unit.core.server.impl.fakes.FakePostOffice) PostOffice(org.apache.activemq.artemis.core.postoffice.PostOffice) QueueBindingInfo(org.apache.activemq.artemis.core.persistence.QueueBindingInfo) FakePostOffice(org.apache.activemq.artemis.tests.unit.core.server.impl.fakes.FakePostOffice) JournalStorageManager(org.apache.activemq.artemis.core.persistence.impl.journal.JournalStorageManager) FakeJournalLoader(org.apache.activemq.artemis.tests.unit.core.server.impl.fakes.FakeJournalLoader) AddressBindingInfo(org.apache.activemq.artemis.core.persistence.AddressBindingInfo) File(java.io.File) Test(org.junit.Test)

Aggregations

AddressBindingInfo (org.apache.activemq.artemis.core.persistence.AddressBindingInfo)2 GroupingInfo (org.apache.activemq.artemis.core.persistence.GroupingInfo)2 QueueBindingInfo (org.apache.activemq.artemis.core.persistence.QueueBindingInfo)2 FakeJournalLoader (org.apache.activemq.artemis.tests.unit.core.server.impl.fakes.FakeJournalLoader)2 FakePostOffice (org.apache.activemq.artemis.tests.unit.core.server.impl.fakes.FakePostOffice)2 File (java.io.File)1 ArrayList (java.util.ArrayList)1 JournalStorageManager (org.apache.activemq.artemis.core.persistence.impl.journal.JournalStorageManager)1 PostOffice (org.apache.activemq.artemis.core.postoffice.PostOffice)1 Test (org.junit.Test)1