Search in sources :

Example 11 with PostOffice

use of org.apache.activemq.artemis.core.postoffice.PostOffice in project activemq-artemis by apache.

the class RemoveDestinationTest method destinationPresentInAdminView.

private boolean destinationPresentInAdminView(ActiveMQTopic amqTopic) throws Exception {
    boolean found = false;
    ArtemisBrokerWrapper wrapper = (ArtemisBrokerWrapper) broker.getBroker();
    PostOffice po = wrapper.getServer().getPostOffice();
    Set<SimpleString> addressSet = po.getAddresses();
    Iterator<SimpleString> iter = addressSet.iterator();
    String addressToFind = amqTopic.getPhysicalName();
    while (iter.hasNext()) {
        if (addressToFind.equals(iter.next().toString())) {
            found = true;
            break;
        }
    }
    return found;
}
Also used : PostOffice(org.apache.activemq.artemis.core.postoffice.PostOffice) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) ArtemisBrokerWrapper(org.apache.activemq.broker.artemiswrapper.ArtemisBrokerWrapper)

Example 12 with PostOffice

use of org.apache.activemq.artemis.core.postoffice.PostOffice 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

PostOffice (org.apache.activemq.artemis.core.postoffice.PostOffice)12 SimpleString (org.apache.activemq.artemis.api.core.SimpleString)9 LocalQueueBinding (org.apache.activemq.artemis.core.postoffice.impl.LocalQueueBinding)6 Binding (org.apache.activemq.artemis.core.postoffice.Binding)5 Bindings (org.apache.activemq.artemis.core.postoffice.Bindings)5 QueueBinding (org.apache.activemq.artemis.core.postoffice.QueueBinding)5 ActiveMQServer (org.apache.activemq.artemis.core.server.ActiveMQServer)5 ScheduledExecutorService (java.util.concurrent.ScheduledExecutorService)4 RemoteQueueBinding (org.apache.activemq.artemis.core.server.cluster.RemoteQueueBinding)4 Test (org.junit.Test)4 PrintWriter (java.io.PrintWriter)3 StringWriter (java.io.StringWriter)3 ArrayList (java.util.ArrayList)3 Filter (org.apache.activemq.artemis.core.filter.Filter)3 PageSubscription (org.apache.activemq.artemis.core.paging.cursor.PageSubscription)3 StorageManager (org.apache.activemq.artemis.core.persistence.StorageManager)3 QueueConfig (org.apache.activemq.artemis.core.server.QueueConfig)3 HierarchicalRepository (org.apache.activemq.artemis.core.settings.HierarchicalRepository)3 ExecutorFactory (org.apache.activemq.artemis.utils.ExecutorFactory)3 File (java.io.File)2