JBoss hornetq SVN: r12115 - trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/paging/impl.
by do-not-reply@jboss.org
Author: jbertram
Date: 2012-02-14 11:29:05 -0500 (Tue, 14 Feb 2012)
New Revision: 12115
Modified:
trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/paging/impl/PagingStoreImplTest.java
Log:
[HORNETQ-847] fixed test
Modified: trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/paging/impl/PagingStoreImplTest.java
===================================================================
--- trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/paging/impl/PagingStoreImplTest.java 2012-02-14 16:18:32 UTC (rev 12114)
+++ trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/paging/impl/PagingStoreImplTest.java 2012-02-14 16:29:05 UTC (rev 12115)
@@ -16,6 +16,7 @@
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;
+import java.util.Queue;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.CountDownLatch;
@@ -29,22 +30,40 @@
import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.api.core.HornetQBuffers;
+import org.hornetq.api.core.Pair;
import org.hornetq.api.core.SimpleString;
+import org.hornetq.api.core.TransportConfiguration;
+import org.hornetq.core.journal.IOAsyncTask;
import org.hornetq.core.journal.SequentialFile;
import org.hornetq.core.journal.SequentialFileFactory;
import org.hornetq.core.journal.impl.NIOSequentialFileFactory;
+import org.hornetq.core.journal.Journal;
+import org.hornetq.core.journal.JournalLoadInformation;
+import org.hornetq.core.message.impl.MessageInternal;
import org.hornetq.core.paging.*;
+import org.hornetq.core.paging.cursor.PagePosition;
import org.hornetq.core.paging.impl.PageTransactionInfoImpl;
import org.hornetq.core.paging.impl.PagingStoreImpl;
import org.hornetq.core.persistence.StorageManager;
+import org.hornetq.core.persistence.config.PersistedAddressSetting;
+import org.hornetq.core.persistence.config.PersistedRoles;
import org.hornetq.core.persistence.impl.nullpm.NullStorageManager;
+import org.hornetq.core.persistence.GroupingInfo;
+import org.hornetq.core.persistence.OperationContext;
+import org.hornetq.core.persistence.QueueBindingInfo;
import org.hornetq.core.postoffice.PostOffice;
-import org.hornetq.core.server.ServerMessage;
+import org.hornetq.core.postoffice.Binding;
+import org.hornetq.core.replication.ReplicationManager;
+import org.hornetq.core.server.*;
+import org.hornetq.core.server.cluster.ClusterConnection;
import org.hornetq.core.server.impl.RoutingContextImpl;
import org.hornetq.core.server.impl.ServerMessageImpl;
+import org.hornetq.core.server.group.impl.GroupBinding;
import org.hornetq.core.settings.HierarchicalRepository;
import org.hornetq.core.settings.impl.AddressFullMessagePolicy;
import org.hornetq.core.settings.impl.AddressSettings;
+import org.hornetq.core.transaction.ResourceManager;
+import org.hornetq.core.transaction.Transaction;
import org.hornetq.tests.unit.core.journal.impl.fakes.FakeSequentialFileFactory;
import org.hornetq.tests.unit.util.FakePagingManager;
import org.hornetq.tests.util.RandomUtil;
@@ -1092,6 +1111,14 @@
{
}
+ public void lock()
+ {
+ }
+
+ public void unlock()
+ {
+ }
+
}
class FakeStorageManager implements StorageManager
@@ -1205,20 +1232,6 @@
}
/* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#loadMessageJournal(org.hornetq.core.paging.PagingManager, java.util.Map, org.hornetq.core.transaction.ResourceManager, java.util.Map)
- */
- public JournalLoadInformation loadMessageJournal(final PostOffice postOffice,
- final PagingManager pagingManager,
- final ResourceManager resourceManager,
- final Map<Long, Queue> queues,
- Map<Long, QueueBindingInfo> queueInfos,
- final Map<SimpleString, List<Pair<byte[], Long>>> duplicateIDMap,
- Set<Pair<Long, Long>> pendingLargeMessages) throws Exception
- {
- return new JournalLoadInformation();
- }
-
- /* (non-Javadoc)
* @see org.hornetq.core.persistence.StorageManager#prepare(long, javax.transaction.xa.Xid)
*/
public void prepare(final long txID, final Xid xid) throws Exception
@@ -1405,7 +1418,12 @@
return null;
}
- /* (non-Javadoc)
+ @Override
+ public SequentialFile createFileForLargeMessage(long messageID, String extension) {
+ return null;
+ }
+
+ /* (non-Javadoc)
* @see org.hornetq.core.persistence.StorageManager#isReplicated()
*/
public boolean isReplicated()
@@ -1560,7 +1578,19 @@
{
}
- /* (non-Javadoc)
+ @Override
+ public JournalLoadInformation loadMessageJournal(PostOffice postOffice,
+ PagingManager pagingManager,
+ ResourceManager resourceManager,
+ Map<Long, org.hornetq.core.server.Queue> queues,
+ Map<Long, QueueBindingInfo> queueInfos,
+ Map<SimpleString, List<Pair<byte[], Long>>> duplicateIDMap,
+ Set<Pair<Long, Long>> pendingLargeMessages) throws Exception
+ {
+ return new JournalLoadInformation();
+ }
+
+ /* (non-Javadoc)
* @see org.hornetq.core.persistence.StorageManager#updatePageTransaction(long, org.hornetq.core.paging.PageTransactionInfo, int)
*/
public void updatePageTransaction(long txID, PageTransactionInfo pageTransaction, int depage) throws Exception
@@ -1648,7 +1678,17 @@
return 0;
}
- /* (non-Javadoc)
+ @Override
+ public Journal getBindingsJournal() {
+ return null;
+ }
+
+ @Override
+ public Journal getMessageJournal() {
+ return null;
+ }
+
+ /* (non-Javadoc)
* @see org.hornetq.core.persistence.StorageManager#newSingleThreadContext()
*/
public OperationContext newSingleThreadContext()
@@ -1732,6 +1772,29 @@
}
+ public void startReplication(ReplicationManager replicationManager, PagingManager pagingManager, String nodeID,
+ ClusterConnection clusterConnection, Pair<TransportConfiguration, TransportConfiguration> pair)
+ throws Exception
+ {
+ }
+
+ public boolean addToPage(PagingManager pagingManager,
+ SimpleString address,
+ ServerMessage message,
+ RoutingContext ctx,
+ RouteContextList listCtx) throws Exception
+ {
+ return true;
+ }
+
+ public void stopReplication()
+ {
+ }
+
+ public void addBytesToLargeMessage(SequentialFile appendFile, long messageID, byte[] bytes) throws Exception
+ {
+ }
+
}
class FakeStoreFactory implements PagingStoreFactory
12 years, 10 months
JBoss hornetq SVN: r12114 - trunk/tests/integration-tests.
by do-not-reply@jboss.org
Author: ataylor
Date: 2012-02-14 11:18:32 -0500 (Tue, 14 Feb 2012)
New Revision: 12114
Modified:
trunk/tests/integration-tests/pom.xml
Log:
disable replication tests
Modified: trunk/tests/integration-tests/pom.xml
===================================================================
--- trunk/tests/integration-tests/pom.xml 2012-02-14 15:47:05 UTC (rev 12113)
+++ trunk/tests/integration-tests/pom.xml 2012-02-14 16:18:32 UTC (rev 12114)
@@ -112,6 +112,12 @@
<excludes>
<exclude>**/ReplicatedJMSFailoverTest.java</exclude>
<exclude>org/hornetq/tests/util/*.java</exclude>
+ <!-- exclude some replication tests for now -->
+ <exclude>**/cluster/failover/Remote*.java</exclude>
+ <exclude>**/failover/remote/**.java</exclude>
+ <exclude>**/Replicated*.java</exclude>
+ <excluse>**/replication/**.java</excluse>
+ <exclude>**/*Replicated**.java</exclude>
</excludes>
<argLine>-Djava.library.path=${user.dir}/distribution/hornetq/src/main/resources/bin -Djava.util.logging.config.file=${user.dir}/distribution/hornetq/src/main/resources/stand-alone/non-clustered/logging.properties</argLine>
</configuration>
12 years, 10 months
JBoss hornetq SVN: r12113 - trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/paging/impl.
by do-not-reply@jboss.org
Author: jbertram
Date: 2012-02-14 10:47:05 -0500 (Tue, 14 Feb 2012)
New Revision: 12113
Modified:
trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/paging/impl/PagingStoreImplTest.java
Log:
[HORNETQ-847] fix left-over diff marker
Modified: trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/paging/impl/PagingStoreImplTest.java
===================================================================
--- trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/paging/impl/PagingStoreImplTest.java 2012-02-14 14:41:49 UTC (rev 12112)
+++ trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/paging/impl/PagingStoreImplTest.java 2012-02-14 15:47:05 UTC (rev 12113)
@@ -33,12 +33,7 @@
import org.hornetq.core.journal.SequentialFile;
import org.hornetq.core.journal.SequentialFileFactory;
import org.hornetq.core.journal.impl.NIOSequentialFileFactory;
-import org.hornetq.core.paging.Page;
-import org.hornetq.core.paging.PageTransactionInfo;
-import org.hornetq.core.paging.PagedMessage;
-import org.hornetq.core.paging.PagingManager;
-import org.hornetq.core.paging.PagingStore;
-import org.hornetq.core.paging.PagingStoreFactory;
+import org.hornetq.core.paging.*;
import org.hornetq.core.paging.impl.PageTransactionInfoImpl;
import org.hornetq.core.paging.impl.PagingStoreImpl;
import org.hornetq.core.persistence.StorageManager;
@@ -56,6 +51,13 @@
import org.hornetq.tests.util.UnitTestCase;
import org.hornetq.utils.ExecutorFactory;
+import javax.transaction.xa.Xid;
+import java.nio.ByteBuffer;
+import java.util.*;
+import java.util.concurrent.*;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicLong;
+
/**
*
* @author <a href="mailto:clebert.suconic@jboss.com">Clebert Suconic</a>
@@ -944,6 +946,794 @@
// Inner classes -------------------------------------------------
+ class FakePagingManager implements PagingManager
+ {
+
+ public void activate()
+ {
+ }
+
+ public long addSize(final long size)
+ {
+ return 0;
+ }
+
+ public void addTransaction(final PageTransactionInfo pageTransaction)
+ {
+ }
+
+ public PagingStore createPageStore(final SimpleString destination) throws Exception
+ {
+ return null;
+ }
+
+ public long getTotalMemory()
+ {
+ return 0;
+ }
+
+ public SimpleString[] getStoreNames()
+ {
+ return null;
+ }
+
+ public long getMaxMemory()
+ {
+ return 0;
+ }
+
+ public PagingStore getPageStore(final SimpleString address) throws Exception
+ {
+ return null;
+ }
+
+ public void deletePageStore(SimpleString storeName) throws Exception
+ {
+ }
+
+ public PageTransactionInfo getTransaction(final long transactionID)
+ {
+ return null;
+ }
+
+ public boolean isBackup()
+ {
+ return false;
+ }
+
+ public boolean isGlobalPageMode()
+ {
+ return false;
+ }
+
+ public boolean isPaging(final SimpleString destination) throws Exception
+ {
+ return false;
+ }
+
+ public boolean page(final ServerMessage message, final boolean duplicateDetection) throws Exception
+ {
+ return false;
+ }
+
+ public boolean page(final ServerMessage message, final long transactionId, final boolean duplicateDetection) throws Exception
+ {
+ return false;
+ }
+
+ public void reloadStores() throws Exception
+ {
+ }
+
+ public void removeTransaction(final long transactionID)
+ {
+
+ }
+
+ public void setGlobalPageMode(final boolean globalMode)
+ {
+ }
+
+ public void setPostOffice(final PostOffice postOffice)
+ {
+ }
+
+ public void resumeDepages()
+ {
+ }
+
+ public void sync(final Collection<SimpleString> destinationsToSync) throws Exception
+ {
+ }
+
+ public boolean isStarted()
+ {
+ return false;
+ }
+
+ public void start() throws Exception
+ {
+ }
+
+ public void stop() throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.paging.PagingManager#isGlobalFull()
+ */
+ public boolean isGlobalFull()
+ {
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.paging.PagingManager#getTransactions()
+ */
+ public Map<Long, PageTransactionInfo> getTransactions()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.paging.PagingManager#processReload()
+ */
+ public void processReload()
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.settings.HierarchicalRepositoryChangeListener#onChange()
+ */
+ public void onChange()
+ {
+ }
+
+ }
+
+ class FakeStorageManager implements StorageManager
+ {
+
+ public void setUniqueIDSequence(final long id)
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#addQueueBinding(org.hornetq.core.postoffice.Binding)
+ */
+ public void addQueueBinding(final Binding binding) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#commit(long)
+ */
+ public void commit(final long txID) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#createLargeMessage()
+ */
+ public LargeServerMessage createLargeMessage()
+ {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#deleteDuplicateID(long)
+ */
+ public void deleteDuplicateID(final long recordID) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#deleteDuplicateIDTransactional(long, long)
+ */
+ public void deleteDuplicateIDTransactional(final long txID, final long recordID) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#deleteMessage(long)
+ */
+ public void deleteMessage(final long messageID) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#deleteMessageTransactional(long, long, long)
+ */
+ public void deleteMessageTransactional(final long txID, final long queueID, final long messageID) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#deletePageTransactional(long, long)
+ */
+ public void deletePageTransactional(final long txID, final long recordID) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#deleteQueueBinding(long)
+ */
+ public void deleteQueueBinding(final long queueBindingID) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#generateUniqueID()
+ */
+ public long generateUniqueID()
+ {
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#getCurrentUniqueID()
+ */
+ public long getCurrentUniqueID()
+ {
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#loadBindingJournal(java.util.List)
+ */
+ public JournalLoadInformation loadBindingJournal(final List<QueueBindingInfo> queueBindingInfos,
+ final List<GroupingInfo> groupingInfos) throws Exception
+ {
+ return new JournalLoadInformation();
+ }
+
+ public void addGrouping(final GroupBinding groupBinding) throws Exception
+ {
+ // To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void deleteGrouping(final GroupBinding groupBinding) throws Exception
+ {
+ // To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void sync()
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#loadMessageJournal(org.hornetq.core.paging.PagingManager, java.util.Map, org.hornetq.core.transaction.ResourceManager, java.util.Map)
+ */
+ public JournalLoadInformation loadMessageJournal(final PostOffice postOffice,
+ final PagingManager pagingManager,
+ final ResourceManager resourceManager,
+ final Map<Long, Queue> queues,
+ Map<Long, QueueBindingInfo> queueInfos,
+ final Map<SimpleString, List<Pair<byte[], Long>>> duplicateIDMap,
+ Set<Pair<Long, Long>> pendingLargeMessages) throws Exception
+ {
+ return new JournalLoadInformation();
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#prepare(long, javax.transaction.xa.Xid)
+ */
+ public void prepare(final long txID, final Xid xid) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#rollback(long)
+ */
+ public void rollback(final long txID) throws Exception
+ {
+ }
+
+ public void rollbackBindings(long txID) throws Exception
+ {
+ }
+
+ public void commitBindings(long txID) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#storeAcknowledge(long, long)
+ */
+ public void storeAcknowledge(final long queueID, final long messageID) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#storeAcknowledgeTransactional(long, long, long)
+ */
+ public void storeAcknowledgeTransactional(final long txID, final long queueID, final long messageID) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#storeDuplicateID(org.hornetq.utils.SimpleString, byte[], long)
+ */
+ public void storeDuplicateID(final SimpleString address, final byte[] duplID, final long recordID) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#storeDuplicateIDTransactional(long, org.hornetq.utils.SimpleString, byte[], long)
+ */
+ public void storeDuplicateIDTransactional(final long txID,
+ final SimpleString address,
+ final byte[] duplID,
+ final long recordID) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#storeMessage(org.hornetq.core.server.ServerMessage)
+ */
+ public void storeMessage(final ServerMessage message) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#storeMessageTransactional(long, org.hornetq.core.server.ServerMessage)
+ */
+ public void storeMessageTransactional(final long txID, final ServerMessage message) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#storePageTransaction(long, org.hornetq.core.paging.PageTransactionInfo)
+ */
+ public void storePageTransaction(final long txID, final PageTransactionInfo pageTransaction) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#storeReference(long, long)
+ */
+ public void storeReference(final long queueID, final long messageID) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#storeReferenceTransactional(long, long, long)
+ */
+ public void storeReferenceTransactional(final long txID, final long queueID, final long messageID) throws Exception
+ {
+ }
+
+ public long storeHeuristicCompletion(final Xid xid, final boolean isCommit) throws Exception
+ {
+ return -1;
+ }
+
+ public void deleteHeuristicCompletion(final long txID) throws Exception
+ {
+ }
+
+ public void addQueueBinding(long tx, Binding binding) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#updateDeliveryCount(org.hornetq.core.server.MessageReference)
+ */
+ public void updateDeliveryCount(final MessageReference ref) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#updateDuplicateID(org.hornetq.utils.SimpleString, byte[], long)
+ */
+ public void updateDuplicateID(final SimpleString address, final byte[] duplID, final long recordID) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#updateDuplicateIDTransactional(long, org.hornetq.utils.SimpleString, byte[], long)
+ */
+ public void updateDuplicateIDTransactional(final long txID,
+ final SimpleString address,
+ final byte[] duplID,
+ final long recordID) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#updateScheduledDeliveryTime(org.hornetq.core.server.MessageReference)
+ */
+ public void updateScheduledDeliveryTime(final MessageReference ref) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#updateScheduledDeliveryTimeTransactional(long, org.hornetq.core.server.MessageReference)
+ */
+ public void updateScheduledDeliveryTimeTransactional(final long txID, final MessageReference ref) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.server.HornetQComponent#isStarted()
+ */
+ public boolean isStarted()
+ {
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.server.HornetQComponent#start()
+ */
+ public void start() throws Exception
+ {
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.server.HornetQComponent#stop()
+ */
+ public void stop() throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#afterReplicated(java.lang.Runnable)
+ */
+ public void afterCompleteOperations(final Runnable run)
+ {
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#completeReplication()
+ */
+ public void completeOperations()
+ {
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#createLargeMessage(byte[])
+ */
+ public LargeServerMessage createLargeMessage(final long messageId, final MessageInternal msg)
+ {
+
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#isReplicated()
+ */
+ public boolean isReplicated()
+ {
+
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#loadInternalOnly()
+ */
+ public JournalLoadInformation[] loadInternalOnly() throws Exception
+ {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#pageClosed(org.hornetq.utils.SimpleString, int)
+ */
+ public void pageClosed(final SimpleString storeName, final int pageNumber)
+ {
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#pageDeleted(org.hornetq.utils.SimpleString, int)
+ */
+ public void pageDeleted(final SimpleString storeName, final int pageNumber)
+ {
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#pageWrite(org.hornetq.core.paging.PagedMessage, int)
+ */
+ public void pageWrite(final PagedMessage message, final int pageNumber)
+ {
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#blockOnReplication(long)
+ */
+ public boolean waitOnOperations(final long timeout) throws Exception
+ {
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#setReplicator(org.hornetq.core.replication.ReplicationManager)
+ */
+ public void setReplicator(final ReplicationManager replicator)
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#afterCompleteOperations(org.hornetq.core.journal.IOCompletion)
+ */
+ public void afterCompleteOperations(final IOAsyncTask run)
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#waitOnOperations()
+ */
+ public void waitOnOperations() throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#getContext()
+ */
+ public OperationContext getContext()
+ {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#newContext(java.util.concurrent.Executor)
+ */
+ public OperationContext newContext(final Executor executor)
+ {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#clearContext()
+ */
+ public void clearContext()
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#setContext(org.hornetq.core.persistence.OperationContext)
+ */
+ public void setContext(final OperationContext context)
+ {
+ }
+
+ public void storeReference(final long queueID, final long messageID, final boolean last) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#recoverAddressSettings()
+ */
+ public List<PersistedAddressSetting> recoverAddressSettings() throws Exception
+ {
+ return Collections.emptyList();
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#recoverPersistedRoles()
+ */
+ public List<PersistedRoles> recoverPersistedRoles() throws Exception
+ {
+ return Collections.emptyList();
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#storeAddressSetting(org.hornetq.core.persistconfig.PersistedAddressSetting)
+ */
+ public void storeAddressSetting(PersistedAddressSetting addressSetting) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#storeSecurityRoles(org.hornetq.core.persistconfig.PersistedRoles)
+ */
+ public void storeSecurityRoles(PersistedRoles persistedRoles) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#deleteAddressSetting(org.hornetq.api.core.SimpleString)
+ */
+ public void deleteAddressSetting(SimpleString addressMatch) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#deleteSecurityRoles(org.hornetq.api.core.SimpleString)
+ */
+ public void deleteSecurityRoles(SimpleString addressMatch) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#deletePageTransactional(long)
+ */
+ public void deletePageTransactional(long recordID) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#updatePageTransaction(long, org.hornetq.core.paging.PageTransactionInfo, int)
+ */
+ public void updatePageTransaction(long txID, PageTransactionInfo pageTransaction, int depage) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#storeCursorAcknowledge(long, org.hornetq.core.paging.cursor.PagePosition)
+ */
+ public void storeCursorAcknowledge(long queueID, PagePosition position)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#storeCursorAcknowledgeTransactional(long, long, org.hornetq.core.paging.cursor.PagePosition)
+ */
+ public void storeCursorAcknowledgeTransactional(long txID, long queueID, PagePosition position)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#deleteCursorAcknowledgeTransactional(long, long)
+ */
+ public void deleteCursorAcknowledgeTransactional(long txID, long ackID) throws Exception
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#updatePageTransaction(org.hornetq.core.paging.PageTransactionInfo, int)
+ */
+ public void updatePageTransaction(PageTransactionInfo pageTransaction, int depage) throws Exception
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#storePageCounter(long, long, long)
+ */
+ public long storePageCounter(long txID, long queueID, long value) throws Exception
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#deleteIncrementRecord(long, long)
+ */
+ public void deleteIncrementRecord(long txID, long recordID) throws Exception
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#deletePageCounter(long, long)
+ */
+ public void deletePageCounter(long txID, long recordID) throws Exception
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#storePageCounterInc(long, long, int)
+ */
+ public long storePageCounterInc(long txID, long queueID, int add) throws Exception
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#storePageCounterInc(long, int)
+ */
+ public long storePageCounterInc(long queueID, int add) throws Exception
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#newSingleThreadContext()
+ */
+ public OperationContext newSingleThreadContext()
+ {
+ return getContext();
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#commit(long, boolean)
+ */
+ public void commit(long txID, boolean lineUpContext) throws Exception
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#lineUpContext()
+ */
+ public void lineUpContext()
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#confirmPendingLargeMessageTX(org.hornetq.core.transaction.Transaction, long, long)
+ */
+ public void confirmPendingLargeMessageTX(Transaction transaction, long messageID, long recordID) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#confirmPendingLargeMessage(long)
+ */
+ public void confirmPendingLargeMessage(long recordID) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#stop(boolean)
+ */
+ public void stop(boolean ioCriticalError) throws Exception
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#beforePageRead()
+ */
+ public void beforePageRead() throws Exception
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#afterPageRead()
+ */
+ public void afterPageRead() throws Exception
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#allocateDirectBuffer(int)
+ */
+ public ByteBuffer allocateDirectBuffer(int size)
+ {
+ return ByteBuffer.allocateDirect(size);
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#freeDirectuffer(java.nio.ByteBuffer)
+ */
+ public void freeDirectBuffer(ByteBuffer buffer)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ }
+
class FakeStoreFactory implements PagingStoreFactory
{
12 years, 10 months
JBoss hornetq SVN: r12112 - in branches/Branch_2_2_EAP: src/main/org/hornetq/jms/server/impl and 2 other directories.
by do-not-reply@jboss.org
Author: gaohoward
Date: 2012-02-14 09:41:49 -0500 (Tue, 14 Feb 2012)
New Revision: 12112
Added:
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/persistence/JMSStorageManagerTest.java
Modified:
branches/Branch_2_2_EAP/src/main/org/hornetq/jms/persistence/impl/journal/JMSJournalStorageManagerImpl.java
branches/Branch_2_2_EAP/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/jms/server/management/JMSQueueControlTest.java
Log:
HORNETQ-812
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/jms/persistence/impl/journal/JMSJournalStorageManagerImpl.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/jms/persistence/impl/journal/JMSJournalStorageManagerImpl.java 2012-02-14 09:57:46 UTC (rev 12111)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/jms/persistence/impl/journal/JMSJournalStorageManagerImpl.java 2012-02-14 14:41:49 UTC (rev 12112)
@@ -272,7 +272,6 @@
{
jmsJournal.appendDeleteRecord(destination.getId(), false);
}
- deleteJNDI(type, name);
}
/* (non-Javadoc)
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java 2012-02-14 09:57:46 UTC (rev 12111)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java 2012-02-14 14:41:49 UTC (rev 12112)
@@ -226,7 +226,8 @@
}
cachedCommands.clear();
-
+
+ recoverJndiBindings();
}
catch (Exception e)
{
@@ -234,6 +235,55 @@
}
}
+ private void recoverJndiBindings() throws Exception
+ {
+ // now its time to add journal recovered stuff
+ List<PersistedJNDI> jndiSpace = storage.recoverPersistedJNDI();
+
+ for (PersistedJNDI record : jndiSpace)
+ {
+ Map<String, List<String>> mapJNDI;
+ Map<String, ?> objects;
+
+ switch (record.getType())
+ {
+ case Queue:
+ mapJNDI = queueJNDI;
+ objects = queues;
+ break;
+ case Topic:
+ mapJNDI = topicJNDI;
+ objects = topics;
+ break;
+ default:
+ case ConnectionFactory:
+ mapJNDI = connectionFactoryJNDI;
+ objects = connectionFactories;
+ break;
+ }
+
+ Object objectToBind = objects.get(record.getName());
+
+ if (objectToBind == null)
+ {
+ continue;
+ }
+
+ List<String> jndiList = mapJNDI.get(record.getName());
+ if (jndiList == null)
+ {
+ jndiList = new ArrayList<String>();
+ mapJNDI.put(record.getName(), jndiList);
+ }
+
+ for (String jndi : record.getJndi())
+ {
+ jndiList.add(jndi);
+ bindToJndi(jndi, objectToBind);
+ }
+ }
+ }
+
// HornetQComponent implementation -----------------------------------
public synchronized void start() throws Exception
@@ -1524,50 +1574,6 @@
internalCreateTopic(destination.getName());
}
}
-
- List<PersistedJNDI> jndiSpace = storage.recoverPersistedJNDI();
- for (PersistedJNDI record : jndiSpace)
- {
- Map<String, List<String>> mapJNDI;
- Map<String, ?> objects;
-
- switch (record.getType())
- {
- case Queue:
- mapJNDI = queueJNDI;
- objects = queues;
- break;
- case Topic:
- mapJNDI = topicJNDI;
- objects = topics;
- break;
- default:
- case ConnectionFactory:
- mapJNDI = connectionFactoryJNDI;
- objects = connectionFactories;
- break;
- }
-
- Object objectToBind = objects.get(record.getName());
-
- if (objectToBind == null)
- {
- continue;
- }
-
- List<String> jndiList = mapJNDI.get(record.getName());
- if (jndiList == null)
- {
- jndiList = new ArrayList<String>();
- mapJNDI.put(record.getName(), jndiList);
- }
-
- for (String jndi : record.getJndi())
- {
- jndiList.add(jndi);
- bindToJndi(jndi, objectToBind);
- }
- }
}
/**
Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/jms/server/management/JMSQueueControlTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/jms/server/management/JMSQueueControlTest.java 2012-02-14 09:57:46 UTC (rev 12111)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/jms/server/management/JMSQueueControlTest.java 2012-02-14 14:41:49 UTC (rev 12112)
@@ -1181,6 +1181,54 @@
}
}
+ public void testQueueAddJndi() throws Exception
+ {
+ String testQueueName = "testQueueAddJndi";
+ serverManager.createQueue(true, testQueueName, null, true, testQueueName);
+ HornetQQueue testQueue = (HornetQQueue)HornetQJMSClient.createQueue(testQueueName);
+
+ JMSQueueControl queueControl = createManagementControl(testQueue);
+ String[] bindings = queueControl.getJNDIBindings();
+
+ String newJndi = "newTestQueueAddJndi";
+
+ for (String b : bindings)
+ {
+ assertFalse(b.equals(newJndi));
+ }
+ queueControl.addJNDI(newJndi);
+
+ bindings = queueControl.getJNDIBindings();
+ boolean newBindingAdded = false;
+ for (String b : bindings)
+ {
+ if (b.equals(newJndi))
+ {
+ newBindingAdded = true;
+ }
+ }
+ assertTrue(newBindingAdded);
+
+ serverManager.stop();
+
+ serverManager.start();
+
+ testQueue = (HornetQQueue)HornetQJMSClient.createQueue(testQueueName);
+
+ queueControl = createManagementControl(testQueue);
+
+ bindings = queueControl.getJNDIBindings();
+ newBindingAdded = false;
+ for (String b : bindings)
+ {
+ if (b.equals(newJndi))
+ {
+ newBindingAdded = true;
+ }
+ }
+ assertTrue(newBindingAdded);
+ }
+
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
Added: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/persistence/JMSStorageManagerTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/persistence/JMSStorageManagerTest.java (rev 0)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/persistence/JMSStorageManagerTest.java 2012-02-14 14:41:49 UTC (rev 12112)
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2010 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.hornetq.tests.integration.persistence;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.hornetq.jms.persistence.config.PersistedConnectionFactory;
+import org.hornetq.jms.persistence.config.PersistedDestination;
+import org.hornetq.jms.persistence.config.PersistedJNDI;
+import org.hornetq.jms.persistence.config.PersistedType;
+import org.hornetq.jms.server.config.ConnectionFactoryConfiguration;
+import org.hornetq.jms.server.config.impl.ConnectionFactoryConfigurationImpl;
+
+/**
+ * A JMSStorageManagerTest
+ *
+ * @author <mailto:hgao@redhat.com">Howard Gao</a>
+ *
+ *
+ */
+public class JMSStorageManagerTest extends StorageManagerTestBase
+{
+ //https://issues.jboss.org/browse/HORNETQ-812
+ public void testJNDIPersistence() throws Exception
+ {
+ createJMSStorage();
+
+ jmsJournal.storeDestination(new PersistedDestination(PersistedType.Queue,
+ "jndiPersistQueue", null, true));
+
+ jmsJournal.addJNDI(PersistedType.Queue, "jndiPersistQueue", "jndi-1");
+
+ List<PersistedDestination> destinations = jmsJournal.recoverDestinations();
+
+ List<PersistedJNDI> jndiList = jmsJournal.recoverPersistedJNDI();
+
+ assertEquals(1, destinations.size());
+
+ assertEquals(1, jndiList.size());
+
+ jmsJournal.deleteDestination(PersistedType.Queue, "jndiPersistQueue");
+
+ destinations = jmsJournal.recoverDestinations();
+
+ assertEquals(0, destinations.size());
+
+ jmsJournal.stop();
+
+ createJMSStorage();
+
+ destinations = jmsJournal.recoverDestinations();
+
+ assertEquals(0, destinations.size());
+
+ jndiList = jmsJournal.recoverPersistedJNDI();
+
+ assertEquals(1, jndiList.size());
+
+ PersistedJNDI jndi = jndiList.get(0);
+
+ List<String> jndis = jndi.getJndi();
+
+ assertEquals(1, jndis.size());
+
+ assertEquals("jndi-1", jndis.get(0));
+
+ }
+
+}
12 years, 10 months
JBoss hornetq SVN: r12111 - trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/paging/impl.
by do-not-reply@jboss.org
Author: ataylor
Date: 2012-02-14 04:57:46 -0500 (Tue, 14 Feb 2012)
New Revision: 12111
Modified:
trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/paging/impl/PagingStoreImplTest.java
Log:
fixed test
Modified: trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/paging/impl/PagingStoreImplTest.java
===================================================================
--- trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/paging/impl/PagingStoreImplTest.java 2012-02-14 08:53:10 UTC (rev 12110)
+++ trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/paging/impl/PagingStoreImplTest.java 2012-02-14 09:57:46 UTC (rev 12111)
@@ -33,7 +33,12 @@
import org.hornetq.core.journal.SequentialFile;
import org.hornetq.core.journal.SequentialFileFactory;
import org.hornetq.core.journal.impl.NIOSequentialFileFactory;
-import org.hornetq.core.paging.*;
+import org.hornetq.core.paging.Page;
+import org.hornetq.core.paging.PageTransactionInfo;
+import org.hornetq.core.paging.PagedMessage;
+import org.hornetq.core.paging.PagingManager;
+import org.hornetq.core.paging.PagingStore;
+import org.hornetq.core.paging.PagingStoreFactory;
import org.hornetq.core.paging.impl.PageTransactionInfoImpl;
import org.hornetq.core.paging.impl.PagingStoreImpl;
import org.hornetq.core.persistence.StorageManager;
@@ -51,13 +56,6 @@
import org.hornetq.tests.util.UnitTestCase;
import org.hornetq.utils.ExecutorFactory;
-import javax.transaction.xa.Xid;
-import java.nio.ByteBuffer;
-import java.util.*;
-import java.util.concurrent.*;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.atomic.AtomicLong;
-
/**
*
* @author <a href="mailto:clebert.suconic@jboss.com">Clebert Suconic</a>
@@ -946,795 +944,6 @@
// Inner classes -------------------------------------------------
- class FakePagingManager implements PagingManager
- {
-
- public void activate()
- {
- }
-
- public long addSize(final long size)
- {
- return 0;
- }
-
- public void addTransaction(final PageTransactionInfo pageTransaction)
- {
- }
-
- public PagingStore createPageStore(final SimpleString destination) throws Exception
- {
- return null;
- }
-
- public long getTotalMemory()
- {
- return 0;
- }
-
- public SimpleString[] getStoreNames()
- {
- return null;
- }
-
- public long getMaxMemory()
- {
- return 0;
- }
-
- public PagingStore getPageStore(final SimpleString address) throws Exception
- {
- return null;
- }
-
- public void deletePageStore(SimpleString storeName) throws Exception
- {
- }
-
- public PageTransactionInfo getTransaction(final long transactionID)
- {
- return null;
- }
-
- public boolean isBackup()
- {
- return false;
- }
-
- public boolean isGlobalPageMode()
- {
- return false;
- }
-
- public boolean isPaging(final SimpleString destination) throws Exception
- {
- return false;
- }
-
- public boolean page(final ServerMessage message, final boolean duplicateDetection) throws Exception
- {
- return false;
- }
-
- public boolean page(final ServerMessage message, final long transactionId, final boolean duplicateDetection) throws Exception
- {
- return false;
- }
-
- public void reloadStores() throws Exception
- {
- }
-
- public void removeTransaction(final long transactionID)
- {
-
- }
-
- public void setGlobalPageMode(final boolean globalMode)
- {
- }
-
- public void setPostOffice(final PostOffice postOffice)
- {
- }
-
- public void resumeDepages()
- {
- }
-
- public void sync(final Collection<SimpleString> destinationsToSync) throws Exception
- {
- }
-
- public boolean isStarted()
- {
- return false;
- }
-
- public void start() throws Exception
- {
- }
-
- public void stop() throws Exception
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.paging.PagingManager#isGlobalFull()
- */
- public boolean isGlobalFull()
- {
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.paging.PagingManager#getTransactions()
- */
- public Map<Long, PageTransactionInfo> getTransactions()
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.paging.PagingManager#processReload()
- */
- public void processReload()
- {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.settings.HierarchicalRepositoryChangeListener#onChange()
- */
- public void onChange()
- {
- }
-
- }
-
- class FakeStorageManager implements StorageManager
- {
-
- public void setUniqueIDSequence(final long id)
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#addQueueBinding(org.hornetq.core.postoffice.Binding)
- */
- public void addQueueBinding(final Binding binding) throws Exception
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#commit(long)
- */
- public void commit(final long txID) throws Exception
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#createLargeMessage()
- */
- public LargeServerMessage createLargeMessage()
- {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#deleteDuplicateID(long)
- */
- public void deleteDuplicateID(final long recordID) throws Exception
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#deleteDuplicateIDTransactional(long, long)
- */
- public void deleteDuplicateIDTransactional(final long txID, final long recordID) throws Exception
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#deleteMessage(long)
- */
- public void deleteMessage(final long messageID) throws Exception
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#deleteMessageTransactional(long, long, long)
- */
- public void deleteMessageTransactional(final long txID, final long queueID, final long messageID) throws Exception
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#deletePageTransactional(long, long)
- */
- public void deletePageTransactional(final long txID, final long recordID) throws Exception
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#deleteQueueBinding(long)
- */
- public void deleteQueueBinding(final long queueBindingID) throws Exception
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#generateUniqueID()
- */
- public long generateUniqueID()
- {
- return 0;
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#getCurrentUniqueID()
- */
- public long getCurrentUniqueID()
- {
- return 0;
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#loadBindingJournal(java.util.List)
- */
- public JournalLoadInformation loadBindingJournal(final List<QueueBindingInfo> queueBindingInfos,
- final List<GroupingInfo> groupingInfos) throws Exception
- {
- return new JournalLoadInformation();
- }
-
- public void addGrouping(final GroupBinding groupBinding) throws Exception
- {
- // To change body of implemented methods use File | Settings | File Templates.
- }
-
- public void deleteGrouping(final GroupBinding groupBinding) throws Exception
- {
- // To change body of implemented methods use File | Settings | File Templates.
- }
-
- public void sync()
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#loadMessageJournal(org.hornetq.core.paging.PagingManager, java.util.Map, org.hornetq.core.transaction.ResourceManager, java.util.Map)
- */
- public JournalLoadInformation loadMessageJournal(final PostOffice postOffice,
- final PagingManager pagingManager,
- final ResourceManager resourceManager,
- final Map<Long, Queue> queues,
- Map<Long, QueueBindingInfo> queueInfos,
- final Map<SimpleString, List<Pair<byte[], Long>>> duplicateIDMap,
- Set<Pair<Long, Long>> pendingLargeMessages) throws Exception
- {
- return new JournalLoadInformation();
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#prepare(long, javax.transaction.xa.Xid)
- */
- public void prepare(final long txID, final Xid xid) throws Exception
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#rollback(long)
- */
- public void rollback(final long txID) throws Exception
- {
- }
-
- public void rollbackBindings(long txID) throws Exception
- {
- }
-
- public void commitBindings(long txID) throws Exception
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#storeAcknowledge(long, long)
- */
- public void storeAcknowledge(final long queueID, final long messageID) throws Exception
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#storeAcknowledgeTransactional(long, long, long)
- */
- public void storeAcknowledgeTransactional(final long txID, final long queueID, final long messageID) throws Exception
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#storeDuplicateID(org.hornetq.utils.SimpleString, byte[], long)
- */
- public void storeDuplicateID(final SimpleString address, final byte[] duplID, final long recordID) throws Exception
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#storeDuplicateIDTransactional(long, org.hornetq.utils.SimpleString, byte[], long)
- */
- public void storeDuplicateIDTransactional(final long txID,
- final SimpleString address,
- final byte[] duplID,
- final long recordID) throws Exception
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#storeMessage(org.hornetq.core.server.ServerMessage)
- */
- public void storeMessage(final ServerMessage message) throws Exception
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#storeMessageTransactional(long, org.hornetq.core.server.ServerMessage)
- */
- public void storeMessageTransactional(final long txID, final ServerMessage message) throws Exception
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#storePageTransaction(long, org.hornetq.core.paging.PageTransactionInfo)
- */
- public void storePageTransaction(final long txID, final PageTransactionInfo pageTransaction) throws Exception
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#storeReference(long, long)
- */
- public void storeReference(final long queueID, final long messageID) throws Exception
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#storeReferenceTransactional(long, long, long)
- */
- public void storeReferenceTransactional(final long txID, final long queueID, final long messageID) throws Exception
- {
- }
-
- public long storeHeuristicCompletion(final Xid xid, final boolean isCommit) throws Exception
- {
- return -1;
- }
-
- public void deleteHeuristicCompletion(final long txID) throws Exception
- {
- }
-
- public void addQueueBinding(long tx, Binding binding) throws Exception
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#updateDeliveryCount(org.hornetq.core.server.MessageReference)
- */
- public void updateDeliveryCount(final MessageReference ref) throws Exception
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#updateDuplicateID(org.hornetq.utils.SimpleString, byte[], long)
- */
- public void updateDuplicateID(final SimpleString address, final byte[] duplID, final long recordID) throws Exception
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#updateDuplicateIDTransactional(long, org.hornetq.utils.SimpleString, byte[], long)
- */
- public void updateDuplicateIDTransactional(final long txID,
- final SimpleString address,
- final byte[] duplID,
- final long recordID) throws Exception
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#updateScheduledDeliveryTime(org.hornetq.core.server.MessageReference)
- */
- public void updateScheduledDeliveryTime(final MessageReference ref) throws Exception
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#updateScheduledDeliveryTimeTransactional(long, org.hornetq.core.server.MessageReference)
- */
- public void updateScheduledDeliveryTimeTransactional(final long txID, final MessageReference ref) throws Exception
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.server.HornetQComponent#isStarted()
- */
- public boolean isStarted()
- {
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.server.HornetQComponent#start()
- */
- public void start() throws Exception
- {
-
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.server.HornetQComponent#stop()
- */
- public void stop() throws Exception
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#afterReplicated(java.lang.Runnable)
- */
- public void afterCompleteOperations(final Runnable run)
- {
-
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#completeReplication()
- */
- public void completeOperations()
- {
-
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#createLargeMessage(byte[])
- */
- public LargeServerMessage createLargeMessage(final long messageId, final MessageInternal msg)
- {
-
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#isReplicated()
- */
- public boolean isReplicated()
- {
-
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#loadInternalOnly()
- */
- public JournalLoadInformation[] loadInternalOnly() throws Exception
- {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#pageClosed(org.hornetq.utils.SimpleString, int)
- */
- public void pageClosed(final SimpleString storeName, final int pageNumber)
- {
-
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#pageDeleted(org.hornetq.utils.SimpleString, int)
- */
- public void pageDeleted(final SimpleString storeName, final int pageNumber)
- {
-
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#pageWrite(org.hornetq.core.paging.PagedMessage, int)
- */
- public void pageWrite(final PagedMessage message, final int pageNumber)
- {
-
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#blockOnReplication(long)
- */
- public boolean waitOnOperations(final long timeout) throws Exception
- {
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#setReplicator(org.hornetq.core.replication.ReplicationManager)
- */
- public void setReplicator(final ReplicationManager replicator)
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#afterCompleteOperations(org.hornetq.core.journal.IOCompletion)
- */
- public void afterCompleteOperations(final IOAsyncTask run)
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#waitOnOperations()
- */
- public void waitOnOperations() throws Exception
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#getContext()
- */
- public OperationContext getContext()
- {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#newContext(java.util.concurrent.Executor)
- */
- public OperationContext newContext(final Executor executor)
- {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#clearContext()
- */
- public void clearContext()
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#setContext(org.hornetq.core.persistence.OperationContext)
- */
- public void setContext(final OperationContext context)
- {
- }
-
- public void storeReference(final long queueID, final long messageID, final boolean last) throws Exception
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#recoverAddressSettings()
- */
- public List<PersistedAddressSetting> recoverAddressSettings() throws Exception
- {
- return Collections.emptyList();
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#recoverPersistedRoles()
- */
- public List<PersistedRoles> recoverPersistedRoles() throws Exception
- {
- return Collections.emptyList();
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#storeAddressSetting(org.hornetq.core.persistconfig.PersistedAddressSetting)
- */
- public void storeAddressSetting(PersistedAddressSetting addressSetting) throws Exception
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#storeSecurityRoles(org.hornetq.core.persistconfig.PersistedRoles)
- */
- public void storeSecurityRoles(PersistedRoles persistedRoles) throws Exception
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#deleteAddressSetting(org.hornetq.api.core.SimpleString)
- */
- public void deleteAddressSetting(SimpleString addressMatch) throws Exception
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#deleteSecurityRoles(org.hornetq.api.core.SimpleString)
- */
- public void deleteSecurityRoles(SimpleString addressMatch) throws Exception
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#deletePageTransactional(long)
- */
- public void deletePageTransactional(long recordID) throws Exception
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#updatePageTransaction(long, org.hornetq.core.paging.PageTransactionInfo, int)
- */
- public void updatePageTransaction(long txID, PageTransactionInfo pageTransaction, int depage) throws Exception
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#storeCursorAcknowledge(long, org.hornetq.core.paging.cursor.PagePosition)
- */
- public void storeCursorAcknowledge(long queueID, PagePosition position)
- {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#storeCursorAcknowledgeTransactional(long, long, org.hornetq.core.paging.cursor.PagePosition)
- */
- public void storeCursorAcknowledgeTransactional(long txID, long queueID, PagePosition position)
- {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#deleteCursorAcknowledgeTransactional(long, long)
- */
- public void deleteCursorAcknowledgeTransactional(long txID, long ackID) throws Exception
- {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#updatePageTransaction(org.hornetq.core.paging.PageTransactionInfo, int)
- */
- public void updatePageTransaction(PageTransactionInfo pageTransaction, int depage) throws Exception
- {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#storePageCounter(long, long, long)
- */
- public long storePageCounter(long txID, long queueID, long value) throws Exception
- {
- // TODO Auto-generated method stub
- return 0;
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#deleteIncrementRecord(long, long)
- */
- public void deleteIncrementRecord(long txID, long recordID) throws Exception
- {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#deletePageCounter(long, long)
- */
- public void deletePageCounter(long txID, long recordID) throws Exception
- {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#storePageCounterInc(long, long, int)
- */
- public long storePageCounterInc(long txID, long queueID, int add) throws Exception
- {
- // TODO Auto-generated method stub
- return 0;
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#storePageCounterInc(long, int)
- */
- public long storePageCounterInc(long queueID, int add) throws Exception
- {
- // TODO Auto-generated method stub
- return 0;
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#newSingleThreadContext()
- */
- public OperationContext newSingleThreadContext()
- {
- return getContext();
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#commit(long, boolean)
- */
- public void commit(long txID, boolean lineUpContext) throws Exception
- {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#lineUpContext()
- */
- public void lineUpContext()
- {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#confirmPendingLargeMessageTX(org.hornetq.core.transaction.Transaction, long, long)
- */
- public void confirmPendingLargeMessageTX(Transaction transaction, long messageID, long recordID) throws Exception
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#confirmPendingLargeMessage(long)
- */
- public void confirmPendingLargeMessage(long recordID) throws Exception
- {
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#stop(boolean)
- */
- public void stop(boolean ioCriticalError) throws Exception
- {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#beforePageRead()
- */
- public void beforePageRead() throws Exception
- {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#afterPageRead()
- */
- public void afterPageRead() throws Exception
- {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#allocateDirectBuffer(int)
- */
- public ByteBuffer allocateDirectBuffer(int size)
- {
- return ByteBuffer.allocateDirect(size);
- }
-
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#freeDirectuffer(java.nio.ByteBuffer)
- */
- public void freeDirectBuffer(ByteBuffer buffer)
- {
- // TODO Auto-generated method stub
-
- }
-
- }
-
->>>>>>> .merge-right.r12106
class FakeStoreFactory implements PagingStoreFactory
{
12 years, 10 months
JBoss hornetq SVN: r12110 - in trunk: hornetq-jms/src/main/java/org/hornetq/jms/server/impl and 2 other directories.
by do-not-reply@jboss.org
Author: gaohoward
Date: 2012-02-14 03:53:10 -0500 (Tue, 14 Feb 2012)
New Revision: 12110
Added:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/persistence/JMSStorageManagerTest.java
Modified:
trunk/hornetq-jms/src/main/java/org/hornetq/jms/persistence/impl/journal/JMSJournalStorageManagerImpl.java
trunk/hornetq-jms/src/main/java/org/hornetq/jms/server/impl/JMSServerManagerImpl.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/server/management/JMSQueueControlTest.java
Log:
HORNETQ-812
Modified: trunk/hornetq-jms/src/main/java/org/hornetq/jms/persistence/impl/journal/JMSJournalStorageManagerImpl.java
===================================================================
--- trunk/hornetq-jms/src/main/java/org/hornetq/jms/persistence/impl/journal/JMSJournalStorageManagerImpl.java 2012-02-13 15:34:49 UTC (rev 12109)
+++ trunk/hornetq-jms/src/main/java/org/hornetq/jms/persistence/impl/journal/JMSJournalStorageManagerImpl.java 2012-02-14 08:53:10 UTC (rev 12110)
@@ -272,7 +272,6 @@
{
jmsJournal.appendDeleteRecord(destination.getId(), false);
}
- deleteJNDI(type, name);
}
/* (non-Javadoc)
Modified: trunk/hornetq-jms/src/main/java/org/hornetq/jms/server/impl/JMSServerManagerImpl.java
===================================================================
--- trunk/hornetq-jms/src/main/java/org/hornetq/jms/server/impl/JMSServerManagerImpl.java 2012-02-13 15:34:49 UTC (rev 12109)
+++ trunk/hornetq-jms/src/main/java/org/hornetq/jms/server/impl/JMSServerManagerImpl.java 2012-02-14 08:53:10 UTC (rev 12110)
@@ -237,6 +237,8 @@
}
cachedCommands.clear();
+
+ recoverJndiBindings();
}
catch (Exception e)
@@ -244,7 +246,58 @@
JMSServerManagerImpl.log.error("Failed to start jms deployer", e);
}
}
+
+ private void recoverJndiBindings() throws Exception
+ {
+ //now its time to add journal recovered stuff
+ List<PersistedJNDI> jndiSpace = storage.recoverPersistedJNDI();
+
+ for (PersistedJNDI record : jndiSpace)
+ {
+ Map<String, List<String>> mapJNDI;
+ Map<String, ?> objects;
+ switch (record.getType())
+ {
+ case Queue:
+ mapJNDI = queueJNDI;
+ objects = queues;
+ break;
+ case Topic:
+ mapJNDI = topicJNDI;
+ objects = topics;
+ break;
+ default:
+ case ConnectionFactory:
+ mapJNDI = connectionFactoryJNDI;
+ objects = connectionFactories;
+ break;
+ }
+
+ Object objectToBind = objects.get(record.getName());
+
+ if (objectToBind == null)
+ {
+ continue;
+ }
+
+ List<String> jndiList = mapJNDI.get(record.getName());
+ if (jndiList == null)
+ {
+ jndiList = new ArrayList<String>();
+ mapJNDI.put(record.getName(), jndiList);
+ }
+
+ for (String jndi : record.getJndi())
+ {
+ jndiList.add(jndi);
+ bindToJndi(jndi, objectToBind);
+ }
+ }
+
+
+ }
+
// HornetQComponent implementation -----------------------------------
public synchronized void start() throws Exception
@@ -1535,50 +1588,6 @@
internalCreateTopic(destination.getName());
}
}
-
- List<PersistedJNDI> jndiSpace = storage.recoverPersistedJNDI();
- for (PersistedJNDI record : jndiSpace)
- {
- Map<String, List<String>> mapJNDI;
- Map<String, ?> objects;
-
- switch (record.getType())
- {
- case Queue:
- mapJNDI = queueJNDI;
- objects = queues;
- break;
- case Topic:
- mapJNDI = topicJNDI;
- objects = topics;
- break;
- default:
- case ConnectionFactory:
- mapJNDI = connectionFactoryJNDI;
- objects = connectionFactories;
- break;
- }
-
- Object objectToBind = objects.get(record.getName());
-
- if (objectToBind == null)
- {
- continue;
- }
-
- List<String> jndiList = mapJNDI.get(record.getName());
- if (jndiList == null)
- {
- jndiList = new ArrayList<String>();
- mapJNDI.put(record.getName(), jndiList);
- }
-
- for (String jndi : record.getJndi())
- {
- jndiList.add(jndi);
- bindToJndi(jndi, objectToBind);
- }
- }
}
/**
Modified: trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/server/management/JMSQueueControlTest.java
===================================================================
--- trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/server/management/JMSQueueControlTest.java 2012-02-13 15:34:49 UTC (rev 12109)
+++ trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/server/management/JMSQueueControlTest.java 2012-02-14 08:53:10 UTC (rev 12110)
@@ -22,7 +22,6 @@
import javax.jms.Message;
import javax.jms.MessageConsumer;
import javax.jms.MessageProducer;
-import javax.jms.Queue;
import javax.jms.Session;
import javax.naming.Context;
@@ -1179,7 +1178,55 @@
e.printStackTrace();
}
}
+
+ public void testQueueAddJndi() throws Exception
+ {
+ String testQueueName = "testQueueAddJndi";
+ serverManager.createQueue(true, testQueueName, null, true, testQueueName);
+ HornetQQueue testQueue = (HornetQQueue)HornetQJMSClient.createQueue(testQueueName);
+ JMSQueueControl queueControl = createManagementControl(testQueue);
+ String[] bindings = queueControl.getJNDIBindings();
+
+ String newJndi = "newTestQueueAddJndi";
+
+ for (String b : bindings)
+ {
+ assertFalse(b.equals(newJndi));
+ }
+ queueControl.addJNDI(newJndi);
+
+ bindings = queueControl.getJNDIBindings();
+ boolean newBindingAdded = false;
+ for (String b : bindings)
+ {
+ if (b.equals(newJndi))
+ {
+ newBindingAdded = true;
+ }
+ }
+ assertTrue(newBindingAdded);
+
+ serverManager.stop();
+
+ serverManager.start();
+
+ testQueue = (HornetQQueue)HornetQJMSClient.createQueue(testQueueName);
+
+ queueControl = createManagementControl(testQueue);
+
+ bindings = queueControl.getJNDIBindings();
+ newBindingAdded = false;
+ for (String b : bindings)
+ {
+ if (b.equals(newJndi))
+ {
+ newBindingAdded = true;
+ }
+ }
+ assertTrue(newBindingAdded);
+ }
+
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
Added: trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/persistence/JMSStorageManagerTest.java
===================================================================
--- trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/persistence/JMSStorageManagerTest.java (rev 0)
+++ trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/persistence/JMSStorageManagerTest.java 2012-02-14 08:53:10 UTC (rev 12110)
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2010 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.hornetq.tests.integration.persistence;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.hornetq.jms.persistence.config.PersistedConnectionFactory;
+import org.hornetq.jms.persistence.config.PersistedDestination;
+import org.hornetq.jms.persistence.config.PersistedJNDI;
+import org.hornetq.jms.persistence.config.PersistedType;
+import org.hornetq.jms.server.config.ConnectionFactoryConfiguration;
+import org.hornetq.jms.server.config.impl.ConnectionFactoryConfigurationImpl;
+
+/**
+ * A JMSStorageManagerTest
+ *
+ * @author <mailto:hgao@redhat.com">Howard Gao</a>
+ *
+ *
+ */
+public class JMSStorageManagerTest extends StorageManagerTestBase
+{
+ //https://issues.jboss.org/browse/HORNETQ-812
+ public void testJNDIPersistence() throws Exception
+ {
+ createJMSStorage();
+
+ jmsJournal.storeDestination(new PersistedDestination(PersistedType.Queue,
+ "jndiPersistQueue", null, true));
+
+ jmsJournal.addJNDI(PersistedType.Queue, "jndiPersistQueue", "jndi-1");
+
+ List<PersistedDestination> destinations = jmsJournal.recoverDestinations();
+
+ List<PersistedJNDI> jndiList = jmsJournal.recoverPersistedJNDI();
+
+ assertEquals(1, destinations.size());
+
+ assertEquals(1, jndiList.size());
+
+ jmsJournal.deleteDestination(PersistedType.Queue, "jndiPersistQueue");
+
+ destinations = jmsJournal.recoverDestinations();
+
+ assertEquals(0, destinations.size());
+
+ jmsJournal.stop();
+
+ createJMSStorage();
+
+ destinations = jmsJournal.recoverDestinations();
+
+ assertEquals(0, destinations.size());
+
+ jndiList = jmsJournal.recoverPersistedJNDI();
+
+ assertEquals(1, jndiList.size());
+
+ PersistedJNDI jndi = jndiList.get(0);
+
+ List<String> jndis = jndi.getJndi();
+
+ assertEquals(1, jndis.size());
+
+ assertEquals("jndi-1", jndis.get(0));
+
+ }
+
+}
12 years, 10 months
JBoss hornetq SVN: r12109 - trunk/hornetq-core/src/main/java/org/hornetq/core/persistence/impl/journal.
by do-not-reply@jboss.org
Author: jbertram
Date: 2012-02-13 10:34:49 -0500 (Mon, 13 Feb 2012)
New Revision: 12109
Modified:
trunk/hornetq-core/src/main/java/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java
Log:
[HORNETQ-847] createQueue not idempotent
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java 2012-02-10 18:51:28 UTC (rev 12108)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java 2012-02-13 15:34:49 UTC (rev 12109)
@@ -1923,24 +1923,17 @@
binding.getAddress(),
filterString);
-<<<<<<< .working
readLock();
try
{
- bindingsJournal.appendAddRecord(binding.getID(),
- JournalStorageManager.QUEUE_BINDING_RECORD,
- bindingEncoding,
- true);
+ bindingsJournal.appendAddRecordTransactional(tx, binding.getID(),
+ JournalStorageManager.QUEUE_BINDING_RECORD,
+ bindingEncoding);
}
finally
{
readUnLock();
}
-=======
- bindingsJournal.appendAddRecordTransactional(tx, binding.getID(),
- JournalStorageManager.QUEUE_BINDING_RECORD,
- bindingEncoding);
->>>>>>> .merge-right.r12106
}
public void deleteQueueBinding(final long queueBindingID) throws Exception
12 years, 10 months
JBoss hornetq SVN: r12108 - in branches/Branch_2_2_EAP: src/main/org/hornetq/core/persistence/impl/journal and 5 other directories.
by do-not-reply@jboss.org
Author: jbertram
Date: 2012-02-10 13:51:28 -0500 (Fri, 10 Feb 2012)
New Revision: 12108
Added:
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/client/CreateQueueIdempotentTest.java
Modified:
branches/Branch_2_2_EAP/src/main/org/hornetq/core/persistence/StorageManager.java
branches/Branch_2_2_EAP/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java
branches/Branch_2_2_EAP/src/main/org/hornetq/core/persistence/impl/nullpm/NullStorageManager.java
branches/Branch_2_2_EAP/src/main/org/hornetq/core/postoffice/impl/SimpleAddressManager.java
branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/unit/core/paging/impl/PagingStoreImplTest.java
Log:
[HORNETQ-847] createQueue not idempotent
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/persistence/StorageManager.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/persistence/StorageManager.java 2012-02-10 17:03:56 UTC (rev 12107)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/persistence/StorageManager.java 2012-02-10 18:51:28 UTC (rev 12108)
@@ -193,6 +193,10 @@
void commit(long txID, boolean lineUpContext) throws Exception;
void rollback(long txID) throws Exception;
+
+ void rollbackBindings(long txID) throws Exception;
+
+ void commitBindings(long txID) throws Exception;
void storePageTransaction(long txID, PageTransactionInfo pageTransaction) throws Exception;
@@ -220,7 +224,7 @@
// Bindings related operations
- void addQueueBinding(Binding binding) throws Exception;
+ void addQueueBinding(long tx, Binding binding) throws Exception;
void deleteQueueBinding(long queueBindingID) throws Exception;
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java 2012-02-10 17:03:56 UTC (rev 12107)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java 2012-02-10 18:51:28 UTC (rev 12108)
@@ -758,6 +758,17 @@
commit(txID, true);
}
+ public void commitBindings(final long txID) throws Exception
+ {
+ bindingsJournal.appendCommitRecord(txID, true);
+ }
+
+ public void rollbackBindings(final long txID) throws Exception
+ {
+ // no need to sync, it's going away anyways
+ bindingsJournal.appendRollbackRecord(txID, false);
+ }
+
public void commit(final long txID, final boolean lineUpContext) throws Exception
{
messageJournal.appendCommitRecord(txID, syncTransactional, getContext(syncTransactional), lineUpContext);
@@ -1371,7 +1382,7 @@
// Bindings operations
- public void addQueueBinding(final Binding binding) throws Exception
+ public void addQueueBinding(final long tx, final Binding binding) throws Exception
{
Queue queue = (Queue)binding.getBindable();
@@ -1383,10 +1394,9 @@
binding.getAddress(),
filterString);
- bindingsJournal.appendAddRecord(binding.getID(),
+ bindingsJournal.appendAddRecordTransactional(tx, binding.getID(),
JournalStorageManager.QUEUE_BINDING_RECORD,
- bindingEncoding,
- true);
+ bindingEncoding);
}
public void deleteQueueBinding(final long queueBindingID) throws Exception
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/persistence/impl/nullpm/NullStorageManager.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/persistence/impl/nullpm/NullStorageManager.java 2012-02-10 17:03:56 UTC (rev 12107)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/persistence/impl/nullpm/NullStorageManager.java 2012-02-10 18:51:28 UTC (rev 12108)
@@ -13,16 +13,6 @@
package org.hornetq.core.persistence.impl.nullpm;
-import java.nio.ByteBuffer;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.Executor;
-import java.util.concurrent.atomic.AtomicLong;
-
-import javax.transaction.xa.Xid;
-
import org.hornetq.api.core.Pair;
import org.hornetq.api.core.SimpleString;
import org.hornetq.core.journal.IOAsyncTask;
@@ -49,6 +39,15 @@
import org.hornetq.core.transaction.ResourceManager;
import org.hornetq.core.transaction.Transaction;
+import javax.transaction.xa.Xid;
+import java.nio.ByteBuffer;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.Executor;
+import java.util.concurrent.atomic.AtomicLong;
+
/**
*
* A NullStorageManager
@@ -140,10 +139,18 @@
{
}
- public void storeReference(final long queueID, final long messageID, final boolean last) throws Exception
+ public void rollbackBindings(long txID) throws Exception
{
}
+ public void commitBindings(long txID) throws Exception
+ {
+ }
+
+ public void storeReference(final long queueID, final long messageID, final boolean last) throws Exception
+ {
+ }
+
public void storeReferenceTransactional(final long txID, final long queueID, final long messageID) throws Exception
{
}
@@ -227,7 +234,11 @@
{
}
- /* (non-Javadoc)
+ public void addQueueBinding(long tx, Binding binding) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
* @see org.hornetq.core.persistence.StorageManager#createLargeMessageStorage(long, int, int)
*/
public LargeServerMessage createLargeMessage()
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/postoffice/impl/SimpleAddressManager.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/postoffice/impl/SimpleAddressManager.java 2012-02-10 17:03:56 UTC (rev 12107)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/postoffice/impl/SimpleAddressManager.java 2012-02-10 18:51:28 UTC (rev 12108)
@@ -16,6 +16,7 @@
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
+import org.hornetq.api.core.HornetQException;
import org.hornetq.api.core.SimpleString;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.postoffice.Address;
@@ -56,7 +57,7 @@
{
if (nameMap.putIfAbsent(binding.getUniqueName(), binding) != null)
{
- throw new IllegalStateException("Binding already exists " + binding);
+ throw new HornetQException(HornetQException.QUEUE_EXISTS, "Binding already exists " + binding);
}
if (log.isDebugEnabled())
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java 2012-02-10 17:03:56 UTC (rev 12107)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java 2012-02-10 18:51:28 UTC (rev 12108)
@@ -1682,6 +1682,7 @@
Filter filter = FilterImpl.createFilter(filterString);
+ long txID = storageManager.generateUniqueID();;
long queueID = storageManager.generateUniqueID();
PageSubscription pageSubscription;
@@ -1709,10 +1710,28 @@
if (durable)
{
- storageManager.addQueueBinding(binding);
+ storageManager.addQueueBinding(txID, binding);
}
- postOffice.addBinding(binding);
+ try
+ {
+ postOffice.addBinding(binding);
+ if (durable)
+ {
+ storageManager.commitBindings(txID);
+ }
+ }
+ catch (Exception e)
+ {
+ if (durable)
+ {
+ storageManager.rollbackBindings(txID);
+ }
+ queue.close();
+ pageSubscription.close();
+ throw e;
+ }
+
managementService.registerAddress(address);
managementService.registerQueue(queue, address, storageManager);
Added: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/client/CreateQueueIdempotentTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/client/CreateQueueIdempotentTest.java (rev 0)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/client/CreateQueueIdempotentTest.java 2012-02-10 18:51:28 UTC (rev 12108)
@@ -0,0 +1,211 @@
+/*
+ * Copyright 2009 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.hornetq.tests.integration.client;
+
+import junit.framework.Assert;
+import org.hornetq.api.core.HornetQException;
+import org.hornetq.api.core.SimpleString;
+import org.hornetq.api.core.TransportConfiguration;
+import org.hornetq.api.core.client.ClientSession;
+import org.hornetq.api.core.client.ClientSessionFactory;
+import org.hornetq.api.core.client.HornetQClient;
+import org.hornetq.api.core.client.ServerLocator;
+import org.hornetq.core.config.Configuration;
+import org.hornetq.core.logging.Logger;
+import org.hornetq.core.server.HornetQServer;
+import org.hornetq.core.server.HornetQServers;
+import org.hornetq.tests.util.ServiceTestBase;
+
+import java.util.concurrent.atomic.AtomicInteger;
+
+public class CreateQueueIdempotentTest extends ServiceTestBase
+{
+ private static final Logger log = Logger.getLogger(CreateQueueIdempotentTest.class);
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ public void testSequentialCreateQueueIdempotency() throws Exception
+ {
+ boolean success = false;
+ final SimpleString QUEUE = new SimpleString("SequentialCreateQueueIdempotency");
+
+ Configuration conf = createDefaultConfig();
+
+ conf.setSecurityEnabled(false);
+
+ conf.getAcceptorConfigurations().add(new TransportConfiguration("org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory"));
+
+ HornetQServer server = HornetQServers.newHornetQServer(conf, true);
+
+ server.start();
+ ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration("org.hornetq.core.remoting.impl.invm.InVMConnectorFactory"));
+
+ ClientSessionFactory sf = locator.createSessionFactory();
+
+ ClientSession session = sf.createSession(false, true, true);
+
+ session.createQueue(QUEUE, QUEUE, null, true);
+
+ try
+ {
+ session.createQueue(QUEUE, QUEUE, null, true);
+ }
+ catch (Exception e)
+ {
+ if (e instanceof HornetQException)
+ {
+ if (((HornetQException) e).getCode() == 101)
+ {
+ success = true;
+ }
+ }
+ }
+
+ session.close();
+
+ locator.close();
+
+ server.stop();
+
+ Assert.assertTrue(success);
+ }
+
+ public void testConcurrentCreateQueueIdempotency() throws Exception
+ {
+ boolean success = true;
+ final String QUEUE = "ConcurrentCreateQueueIdempotency";
+ AtomicInteger queuesCreated = new AtomicInteger(0);
+ AtomicInteger failedAttempts = new AtomicInteger(0);
+
+ Configuration conf = createDefaultConfig();
+
+ conf.setSecurityEnabled(false);
+
+ conf.getAcceptorConfigurations().add(new TransportConfiguration("org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory"));
+
+ HornetQServer server = HornetQServers.newHornetQServer(conf, true);
+
+ server.start();
+ final int NUM_THREADS = 5;
+
+ QueueCreator[] queueCreators = new QueueCreator[NUM_THREADS];
+
+
+ for(int i = 0; i < NUM_THREADS; i++)
+ {
+ QueueCreator queueCreator = new QueueCreator(QUEUE, queuesCreated, failedAttempts);
+ queueCreators[i] = queueCreator;
+ }
+
+ for(int i = 0; i < NUM_THREADS; i++)
+ {
+ queueCreators[i].start();
+ }
+
+ for(int i = 0; i < NUM_THREADS; i++)
+ {
+ queueCreators[i].join();
+ }
+
+ server.stop();
+
+ // re-starting the server appears to be an unreliable guide
+ try
+ {
+ server.start();
+ } catch (Exception e)
+ {
+ System.out.println("THIS BLEW UP!!");
+ e.printStackTrace();
+ success = false;
+ }
+
+ server.stop();
+
+ Assert.assertTrue(success);
+ Assert.assertEquals(1, queuesCreated.intValue());
+ Assert.assertEquals(NUM_THREADS - 1, failedAttempts.intValue());
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+ class QueueCreator extends Thread
+ {
+ private String queueName = null;
+ private AtomicInteger queuesCreated = null;
+ private AtomicInteger failedAttempts = null;
+
+
+ QueueCreator(String queueName, AtomicInteger queuesCreated, AtomicInteger failedAttempts)
+ {
+ this.queueName = queueName;
+ this.queuesCreated = queuesCreated;
+ this.failedAttempts = failedAttempts;
+ }
+ @Override
+ public void run()
+ {
+ ServerLocator locator = null;
+ ClientSession session = null;
+
+ try
+ {
+ locator = HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration("org.hornetq.core.remoting.impl.invm.InVMConnectorFactory"));
+ ClientSessionFactory sf = locator.createSessionFactory();
+ session = sf.createSession(false, true, true);
+ final SimpleString QUEUE = new SimpleString(queueName);
+ session.createQueue(QUEUE, QUEUE, null, true);
+ queuesCreated.incrementAndGet();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ if (e instanceof HornetQException)
+ {
+ if (((HornetQException) e).getCode() == 101)
+ {
+ failedAttempts.incrementAndGet();
+ }
+ }
+ }
+ finally
+ {
+ if (locator != null) {
+ locator.close();
+ }
+ if (session != null) {
+ try {
+ session.close();
+ } catch (HornetQException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+ }
+}
Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/unit/core/paging/impl/PagingStoreImplTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/unit/core/paging/impl/PagingStoreImplTest.java 2012-02-10 17:03:56 UTC (rev 12107)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/unit/core/paging/impl/PagingStoreImplTest.java 2012-02-10 18:51:28 UTC (rev 12108)
@@ -13,26 +13,7 @@
package org.hornetq.tests.unit.core.paging.impl;
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.Executor;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.atomic.AtomicLong;
-
-import javax.transaction.xa.Xid;
-
import junit.framework.Assert;
-
import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.api.core.HornetQBuffers;
import org.hornetq.api.core.Pair;
@@ -43,12 +24,7 @@
import org.hornetq.core.journal.SequentialFileFactory;
import org.hornetq.core.journal.impl.NIOSequentialFileFactory;
import org.hornetq.core.message.impl.MessageInternal;
-import org.hornetq.core.paging.Page;
-import org.hornetq.core.paging.PageTransactionInfo;
-import org.hornetq.core.paging.PagedMessage;
-import org.hornetq.core.paging.PagingManager;
-import org.hornetq.core.paging.PagingStore;
-import org.hornetq.core.paging.PagingStoreFactory;
+import org.hornetq.core.paging.*;
import org.hornetq.core.paging.cursor.PagePosition;
import org.hornetq.core.paging.impl.PageTransactionInfoImpl;
import org.hornetq.core.paging.impl.PagingStoreImpl;
@@ -81,6 +57,13 @@
import org.hornetq.tests.util.UnitTestCase;
import org.hornetq.utils.ExecutorFactory;
+import javax.transaction.xa.Xid;
+import java.nio.ByteBuffer;
+import java.util.*;
+import java.util.concurrent.*;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicLong;
+
/**
*
* @author <a href="mailto:clebert.suconic@jboss.com">Clebert Suconic</a>
@@ -1254,7 +1237,15 @@
{
}
- /* (non-Javadoc)
+ public void rollbackBindings(long txID) throws Exception
+ {
+ }
+
+ public void commitBindings(long txID) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
* @see org.hornetq.core.persistence.StorageManager#storeAcknowledge(long, long)
*/
public void storeAcknowledge(final long queueID, final long messageID) throws Exception
@@ -1329,7 +1320,11 @@
{
}
- /* (non-Javadoc)
+ public void addQueueBinding(long tx, Binding binding) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
* @see org.hornetq.core.persistence.StorageManager#updateDeliveryCount(org.hornetq.core.server.MessageReference)
*/
public void updateDeliveryCount(final MessageReference ref) throws Exception
12 years, 11 months
JBoss hornetq SVN: r12107 - in trunk: hornetq-core/src/main/java/org/hornetq/core/persistence and 6 other directories.
by do-not-reply@jboss.org
Author: jbertram
Date: 2012-02-10 12:03:56 -0500 (Fri, 10 Feb 2012)
New Revision: 12107
Added:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/CreateQueueIdempotentTest.java
Modified:
trunk/hornetq-core/src/main/java/
trunk/hornetq-core/src/main/java/org/hornetq/core/persistence/StorageManager.java
trunk/hornetq-core/src/main/java/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java
trunk/hornetq-core/src/main/java/org/hornetq/core/persistence/impl/nullpm/NullStorageManager.java
trunk/hornetq-core/src/main/java/org/hornetq/core/postoffice/impl/SimpleAddressManager.java
trunk/hornetq-core/src/main/java/org/hornetq/core/server/impl/HornetQServerImpl.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/
trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/paging/impl/
trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/paging/impl/PagingStoreImplTest.java
Log:
[HORNETQ-847] createQueue not idempotent
Property changes on: trunk/hornetq-core/src/main/java
___________________________________________________________________
Added: svn:mergeinfo
+ /branches/Branch_2_2_AS7/src/main:12099-12106
/branches/HORNETQ-720_Replication/hornetq-core/src/main/java:10878-11528
/branches/STOMP11/hornetq-core/src/main/java:11225-11517
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/persistence/StorageManager.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/persistence/StorageManager.java 2012-02-10 02:11:36 UTC (rev 12106)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/persistence/StorageManager.java 2012-02-10 17:03:56 UTC (rev 12107)
@@ -200,6 +200,10 @@
void commit(long txID, boolean lineUpContext) throws Exception;
void rollback(long txID) throws Exception;
+
+ void rollbackBindings(long txID) throws Exception;
+
+ void commitBindings(long txID) throws Exception;
void storePageTransaction(long txID, PageTransactionInfo pageTransaction) throws Exception;
@@ -224,7 +228,7 @@
// Bindings related operations
- void addQueueBinding(Binding binding) throws Exception;
+ void addQueueBinding(long tx, Binding binding) throws Exception;
void deleteQueueBinding(long queueBindingID) throws Exception;
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java 2012-02-10 02:11:36 UTC (rev 12106)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java 2012-02-10 17:03:56 UTC (rev 12107)
@@ -1182,9 +1182,20 @@
commit(txID, true);
}
- public void commit(final long txID, final boolean lineUpContext) throws Exception
- {
- readLock();
+ public void commitBindings(final long txID) throws Exception
+ {
+ bindingsJournal.appendCommitRecord(txID, true);
+ }
+
+ public void rollbackBindings(final long txID) throws Exception
+ {
+ // no need to sync, it's going away anyways
+ bindingsJournal.appendRollbackRecord(txID, false);
+ }
+
+ public void commit(final long txID, final boolean lineUpContext) throws Exception
+ {
+ readLock();
try
{
messageJournal.appendCommitRecord(txID, syncTransactional, getContext(syncTransactional), lineUpContext);
@@ -1900,7 +1911,7 @@
// Bindings operations
- public void addQueueBinding(final Binding binding) throws Exception
+ public void addQueueBinding(final long tx, final Binding binding) throws Exception
{
Queue queue = (Queue)binding.getBindable();
@@ -1912,6 +1923,7 @@
binding.getAddress(),
filterString);
+<<<<<<< .working
readLock();
try
{
@@ -1924,6 +1936,11 @@
{
readUnLock();
}
+=======
+ bindingsJournal.appendAddRecordTransactional(tx, binding.getID(),
+ JournalStorageManager.QUEUE_BINDING_RECORD,
+ bindingEncoding);
+>>>>>>> .merge-right.r12106
}
public void deleteQueueBinding(final long queueBindingID) throws Exception
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/persistence/impl/nullpm/NullStorageManager.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/persistence/impl/nullpm/NullStorageManager.java 2012-02-10 02:11:36 UTC (rev 12106)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/persistence/impl/nullpm/NullStorageManager.java 2012-02-10 17:03:56 UTC (rev 12107)
@@ -13,16 +13,6 @@
package org.hornetq.core.persistence.impl.nullpm;
-import java.nio.ByteBuffer;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.Executor;
-import java.util.concurrent.atomic.AtomicLong;
-
-import javax.transaction.xa.Xid;
-
import org.hornetq.api.core.Pair;
import org.hornetq.api.core.SimpleString;
import org.hornetq.api.core.TransportConfiguration;
@@ -55,6 +45,15 @@
import org.hornetq.core.transaction.ResourceManager;
import org.hornetq.core.transaction.Transaction;
+import javax.transaction.xa.Xid;
+import java.nio.ByteBuffer;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.Executor;
+import java.util.concurrent.atomic.AtomicLong;
+
/**
*
* A NullStorageManager
@@ -146,10 +145,18 @@
{
}
- public void storeReference(final long queueID, final long messageID, final boolean last) throws Exception
+ public void rollbackBindings(long txID) throws Exception
{
}
+ public void commitBindings(long txID) throws Exception
+ {
+ }
+
+ public void storeReference(final long queueID, final long messageID, final boolean last) throws Exception
+ {
+ }
+
public void storeReferenceTransactional(final long txID, final long queueID, final long messageID) throws Exception
{
}
@@ -233,7 +240,11 @@
{
}
- /* (non-Javadoc)
+ public void addQueueBinding(long tx, Binding binding) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
* @see org.hornetq.core.persistence.StorageManager#createLargeMessageStorage(long, int, int)
*/
public LargeServerMessage createLargeMessage()
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/postoffice/impl/SimpleAddressManager.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/postoffice/impl/SimpleAddressManager.java 2012-02-10 02:11:36 UTC (rev 12106)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/postoffice/impl/SimpleAddressManager.java 2012-02-10 17:03:56 UTC (rev 12107)
@@ -16,6 +16,7 @@
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
+import org.hornetq.api.core.HornetQException;
import org.hornetq.api.core.SimpleString;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.postoffice.Address;
@@ -56,7 +57,7 @@
{
if (nameMap.putIfAbsent(binding.getUniqueName(), binding) != null)
{
- throw new IllegalStateException("Binding already exists " + binding);
+ throw new HornetQException(HornetQException.QUEUE_EXISTS, "Binding already exists " + binding);
}
if (log.isDebugEnabled())
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/server/impl/HornetQServerImpl.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/server/impl/HornetQServerImpl.java 2012-02-10 02:11:36 UTC (rev 12106)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/server/impl/HornetQServerImpl.java 2012-02-10 17:03:56 UTC (rev 12107)
@@ -1671,6 +1671,7 @@
Filter filter = FilterImpl.createFilter(filterString);
+ long txID = storageManager.generateUniqueID();;
long queueID = storageManager.generateUniqueID();
PageSubscription pageSubscription;
@@ -1698,10 +1699,28 @@
if (durable)
{
- storageManager.addQueueBinding(binding);
+ storageManager.addQueueBinding(txID, binding);
}
- postOffice.addBinding(binding);
+ try
+ {
+ postOffice.addBinding(binding);
+ if (durable)
+ {
+ storageManager.commitBindings(txID);
+ }
+ }
+ catch (Exception e)
+ {
+ if (durable)
+ {
+ storageManager.rollbackBindings(txID);
+ }
+ queue.close();
+ pageSubscription.close();
+ throw e;
+ }
+
managementService.registerAddress(address);
managementService.registerQueue(queue, address, storageManager);
Property changes on: trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client
___________________________________________________________________
Added: svn:mergeinfo
+ /branches/Branch_2_2_AS7/tests/src/org/hornetq/tests/integration/client:12099-12106
/branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client:10878-11528
/branches/STOMP11/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client:11225-11517
Copied: trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/CreateQueueIdempotentTest.java (from rev 12106, branches/Branch_2_2_AS7/tests/src/org/hornetq/tests/integration/client/CreateQueueIdempotentTest.java)
===================================================================
--- trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/CreateQueueIdempotentTest.java (rev 0)
+++ trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/CreateQueueIdempotentTest.java 2012-02-10 17:03:56 UTC (rev 12107)
@@ -0,0 +1,211 @@
+/*
+ * Copyright 2009 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.hornetq.tests.integration.client;
+
+import junit.framework.Assert;
+import org.hornetq.api.core.HornetQException;
+import org.hornetq.api.core.SimpleString;
+import org.hornetq.api.core.TransportConfiguration;
+import org.hornetq.api.core.client.ClientSession;
+import org.hornetq.api.core.client.ClientSessionFactory;
+import org.hornetq.api.core.client.HornetQClient;
+import org.hornetq.api.core.client.ServerLocator;
+import org.hornetq.core.config.Configuration;
+import org.hornetq.core.logging.Logger;
+import org.hornetq.core.server.HornetQServer;
+import org.hornetq.core.server.HornetQServers;
+import org.hornetq.tests.util.ServiceTestBase;
+
+import java.util.concurrent.atomic.AtomicInteger;
+
+public class CreateQueueIdempotentTest extends ServiceTestBase
+{
+ private static final Logger log = Logger.getLogger(CreateQueueIdempotentTest.class);
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ public void testSequentialCreateQueueIdempotency() throws Exception
+ {
+ boolean success = false;
+ final SimpleString QUEUE = new SimpleString("SequentialCreateQueueIdempotency");
+
+ Configuration conf = createDefaultConfig();
+
+ conf.setSecurityEnabled(false);
+
+ conf.getAcceptorConfigurations().add(new TransportConfiguration("org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory"));
+
+ HornetQServer server = HornetQServers.newHornetQServer(conf, true);
+
+ server.start();
+ ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration("org.hornetq.core.remoting.impl.invm.InVMConnectorFactory"));
+
+ ClientSessionFactory sf = locator.createSessionFactory();
+
+ ClientSession session = sf.createSession(false, true, true);
+
+ session.createQueue(QUEUE, QUEUE, null, true);
+
+ try
+ {
+ session.createQueue(QUEUE, QUEUE, null, true);
+ }
+ catch (Exception e)
+ {
+ if (e instanceof HornetQException)
+ {
+ if (((HornetQException) e).getCode() == 101)
+ {
+ success = true;
+ }
+ }
+ }
+
+ session.close();
+
+ locator.close();
+
+ server.stop();
+
+ Assert.assertTrue(success);
+ }
+
+ public void testConcurrentCreateQueueIdempotency() throws Exception
+ {
+ boolean success = true;
+ final String QUEUE = "ConcurrentCreateQueueIdempotency";
+ AtomicInteger queuesCreated = new AtomicInteger(0);
+ AtomicInteger failedAttempts = new AtomicInteger(0);
+
+ Configuration conf = createDefaultConfig();
+
+ conf.setSecurityEnabled(false);
+
+ conf.getAcceptorConfigurations().add(new TransportConfiguration("org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory"));
+
+ HornetQServer server = HornetQServers.newHornetQServer(conf, true);
+
+ server.start();
+ final int NUM_THREADS = 5;
+
+ QueueCreator[] queueCreators = new QueueCreator[NUM_THREADS];
+
+
+ for(int i = 0; i < NUM_THREADS; i++)
+ {
+ QueueCreator queueCreator = new QueueCreator(QUEUE, queuesCreated, failedAttempts);
+ queueCreators[i] = queueCreator;
+ }
+
+ for(int i = 0; i < NUM_THREADS; i++)
+ {
+ queueCreators[i].start();
+ }
+
+ for(int i = 0; i < NUM_THREADS; i++)
+ {
+ queueCreators[i].join();
+ }
+
+ server.stop();
+
+ // re-starting the server appears to be an unreliable guide
+ try
+ {
+ server.start();
+ } catch (Exception e)
+ {
+ System.out.println("THIS BLEW UP!!");
+ e.printStackTrace();
+ success = false;
+ }
+
+ server.stop();
+
+ Assert.assertTrue(success);
+ Assert.assertEquals(1, queuesCreated.intValue());
+ Assert.assertEquals(NUM_THREADS - 1, failedAttempts.intValue());
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+ class QueueCreator extends Thread
+ {
+ private String queueName = null;
+ private AtomicInteger queuesCreated = null;
+ private AtomicInteger failedAttempts = null;
+
+
+ QueueCreator(String queueName, AtomicInteger queuesCreated, AtomicInteger failedAttempts)
+ {
+ this.queueName = queueName;
+ this.queuesCreated = queuesCreated;
+ this.failedAttempts = failedAttempts;
+ }
+ @Override
+ public void run()
+ {
+ ServerLocator locator = null;
+ ClientSession session = null;
+
+ try
+ {
+ locator = HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration("org.hornetq.core.remoting.impl.invm.InVMConnectorFactory"));
+ ClientSessionFactory sf = locator.createSessionFactory();
+ session = sf.createSession(false, true, true);
+ final SimpleString QUEUE = new SimpleString(queueName);
+ session.createQueue(QUEUE, QUEUE, null, true);
+ queuesCreated.incrementAndGet();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ if (e instanceof HornetQException)
+ {
+ if (((HornetQException) e).getCode() == 101)
+ {
+ failedAttempts.incrementAndGet();
+ }
+ }
+ }
+ finally
+ {
+ if (locator != null) {
+ locator.close();
+ }
+ if (session != null) {
+ try {
+ session.close();
+ } catch (HornetQException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+ }
+}
Property changes on: trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/paging/impl
___________________________________________________________________
Added: svn:mergeinfo
+ /branches/Branch_2_2_AS7/tests/src/org/hornetq/tests/unit/core/paging/impl:12099-12106
/branches/HORNETQ-720_Replication/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/paging/impl:10878-11528
/branches/STOMP11/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/paging/impl:11225-11517
Modified: trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/paging/impl/PagingStoreImplTest.java
===================================================================
--- trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/paging/impl/PagingStoreImplTest.java 2012-02-10 02:11:36 UTC (rev 12106)
+++ trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/paging/impl/PagingStoreImplTest.java 2012-02-10 17:03:56 UTC (rev 12107)
@@ -33,12 +33,7 @@
import org.hornetq.core.journal.SequentialFile;
import org.hornetq.core.journal.SequentialFileFactory;
import org.hornetq.core.journal.impl.NIOSequentialFileFactory;
-import org.hornetq.core.paging.Page;
-import org.hornetq.core.paging.PageTransactionInfo;
-import org.hornetq.core.paging.PagedMessage;
-import org.hornetq.core.paging.PagingManager;
-import org.hornetq.core.paging.PagingStore;
-import org.hornetq.core.paging.PagingStoreFactory;
+import org.hornetq.core.paging.*;
import org.hornetq.core.paging.impl.PageTransactionInfoImpl;
import org.hornetq.core.paging.impl.PagingStoreImpl;
import org.hornetq.core.persistence.StorageManager;
@@ -56,6 +51,13 @@
import org.hornetq.tests.util.UnitTestCase;
import org.hornetq.utils.ExecutorFactory;
+import javax.transaction.xa.Xid;
+import java.nio.ByteBuffer;
+import java.util.*;
+import java.util.concurrent.*;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicLong;
+
/**
*
* @author <a href="mailto:clebert.suconic@jboss.com">Clebert Suconic</a>
@@ -944,6 +946,795 @@
// Inner classes -------------------------------------------------
+ class FakePagingManager implements PagingManager
+ {
+
+ public void activate()
+ {
+ }
+
+ public long addSize(final long size)
+ {
+ return 0;
+ }
+
+ public void addTransaction(final PageTransactionInfo pageTransaction)
+ {
+ }
+
+ public PagingStore createPageStore(final SimpleString destination) throws Exception
+ {
+ return null;
+ }
+
+ public long getTotalMemory()
+ {
+ return 0;
+ }
+
+ public SimpleString[] getStoreNames()
+ {
+ return null;
+ }
+
+ public long getMaxMemory()
+ {
+ return 0;
+ }
+
+ public PagingStore getPageStore(final SimpleString address) throws Exception
+ {
+ return null;
+ }
+
+ public void deletePageStore(SimpleString storeName) throws Exception
+ {
+ }
+
+ public PageTransactionInfo getTransaction(final long transactionID)
+ {
+ return null;
+ }
+
+ public boolean isBackup()
+ {
+ return false;
+ }
+
+ public boolean isGlobalPageMode()
+ {
+ return false;
+ }
+
+ public boolean isPaging(final SimpleString destination) throws Exception
+ {
+ return false;
+ }
+
+ public boolean page(final ServerMessage message, final boolean duplicateDetection) throws Exception
+ {
+ return false;
+ }
+
+ public boolean page(final ServerMessage message, final long transactionId, final boolean duplicateDetection) throws Exception
+ {
+ return false;
+ }
+
+ public void reloadStores() throws Exception
+ {
+ }
+
+ public void removeTransaction(final long transactionID)
+ {
+
+ }
+
+ public void setGlobalPageMode(final boolean globalMode)
+ {
+ }
+
+ public void setPostOffice(final PostOffice postOffice)
+ {
+ }
+
+ public void resumeDepages()
+ {
+ }
+
+ public void sync(final Collection<SimpleString> destinationsToSync) throws Exception
+ {
+ }
+
+ public boolean isStarted()
+ {
+ return false;
+ }
+
+ public void start() throws Exception
+ {
+ }
+
+ public void stop() throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.paging.PagingManager#isGlobalFull()
+ */
+ public boolean isGlobalFull()
+ {
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.paging.PagingManager#getTransactions()
+ */
+ public Map<Long, PageTransactionInfo> getTransactions()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.paging.PagingManager#processReload()
+ */
+ public void processReload()
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.settings.HierarchicalRepositoryChangeListener#onChange()
+ */
+ public void onChange()
+ {
+ }
+
+ }
+
+ class FakeStorageManager implements StorageManager
+ {
+
+ public void setUniqueIDSequence(final long id)
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#addQueueBinding(org.hornetq.core.postoffice.Binding)
+ */
+ public void addQueueBinding(final Binding binding) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#commit(long)
+ */
+ public void commit(final long txID) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#createLargeMessage()
+ */
+ public LargeServerMessage createLargeMessage()
+ {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#deleteDuplicateID(long)
+ */
+ public void deleteDuplicateID(final long recordID) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#deleteDuplicateIDTransactional(long, long)
+ */
+ public void deleteDuplicateIDTransactional(final long txID, final long recordID) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#deleteMessage(long)
+ */
+ public void deleteMessage(final long messageID) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#deleteMessageTransactional(long, long, long)
+ */
+ public void deleteMessageTransactional(final long txID, final long queueID, final long messageID) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#deletePageTransactional(long, long)
+ */
+ public void deletePageTransactional(final long txID, final long recordID) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#deleteQueueBinding(long)
+ */
+ public void deleteQueueBinding(final long queueBindingID) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#generateUniqueID()
+ */
+ public long generateUniqueID()
+ {
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#getCurrentUniqueID()
+ */
+ public long getCurrentUniqueID()
+ {
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#loadBindingJournal(java.util.List)
+ */
+ public JournalLoadInformation loadBindingJournal(final List<QueueBindingInfo> queueBindingInfos,
+ final List<GroupingInfo> groupingInfos) throws Exception
+ {
+ return new JournalLoadInformation();
+ }
+
+ public void addGrouping(final GroupBinding groupBinding) throws Exception
+ {
+ // To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void deleteGrouping(final GroupBinding groupBinding) throws Exception
+ {
+ // To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void sync()
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#loadMessageJournal(org.hornetq.core.paging.PagingManager, java.util.Map, org.hornetq.core.transaction.ResourceManager, java.util.Map)
+ */
+ public JournalLoadInformation loadMessageJournal(final PostOffice postOffice,
+ final PagingManager pagingManager,
+ final ResourceManager resourceManager,
+ final Map<Long, Queue> queues,
+ Map<Long, QueueBindingInfo> queueInfos,
+ final Map<SimpleString, List<Pair<byte[], Long>>> duplicateIDMap,
+ Set<Pair<Long, Long>> pendingLargeMessages) throws Exception
+ {
+ return new JournalLoadInformation();
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#prepare(long, javax.transaction.xa.Xid)
+ */
+ public void prepare(final long txID, final Xid xid) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#rollback(long)
+ */
+ public void rollback(final long txID) throws Exception
+ {
+ }
+
+ public void rollbackBindings(long txID) throws Exception
+ {
+ }
+
+ public void commitBindings(long txID) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#storeAcknowledge(long, long)
+ */
+ public void storeAcknowledge(final long queueID, final long messageID) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#storeAcknowledgeTransactional(long, long, long)
+ */
+ public void storeAcknowledgeTransactional(final long txID, final long queueID, final long messageID) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#storeDuplicateID(org.hornetq.utils.SimpleString, byte[], long)
+ */
+ public void storeDuplicateID(final SimpleString address, final byte[] duplID, final long recordID) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#storeDuplicateIDTransactional(long, org.hornetq.utils.SimpleString, byte[], long)
+ */
+ public void storeDuplicateIDTransactional(final long txID,
+ final SimpleString address,
+ final byte[] duplID,
+ final long recordID) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#storeMessage(org.hornetq.core.server.ServerMessage)
+ */
+ public void storeMessage(final ServerMessage message) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#storeMessageTransactional(long, org.hornetq.core.server.ServerMessage)
+ */
+ public void storeMessageTransactional(final long txID, final ServerMessage message) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#storePageTransaction(long, org.hornetq.core.paging.PageTransactionInfo)
+ */
+ public void storePageTransaction(final long txID, final PageTransactionInfo pageTransaction) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#storeReference(long, long)
+ */
+ public void storeReference(final long queueID, final long messageID) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#storeReferenceTransactional(long, long, long)
+ */
+ public void storeReferenceTransactional(final long txID, final long queueID, final long messageID) throws Exception
+ {
+ }
+
+ public long storeHeuristicCompletion(final Xid xid, final boolean isCommit) throws Exception
+ {
+ return -1;
+ }
+
+ public void deleteHeuristicCompletion(final long txID) throws Exception
+ {
+ }
+
+ public void addQueueBinding(long tx, Binding binding) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#updateDeliveryCount(org.hornetq.core.server.MessageReference)
+ */
+ public void updateDeliveryCount(final MessageReference ref) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#updateDuplicateID(org.hornetq.utils.SimpleString, byte[], long)
+ */
+ public void updateDuplicateID(final SimpleString address, final byte[] duplID, final long recordID) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#updateDuplicateIDTransactional(long, org.hornetq.utils.SimpleString, byte[], long)
+ */
+ public void updateDuplicateIDTransactional(final long txID,
+ final SimpleString address,
+ final byte[] duplID,
+ final long recordID) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#updateScheduledDeliveryTime(org.hornetq.core.server.MessageReference)
+ */
+ public void updateScheduledDeliveryTime(final MessageReference ref) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#updateScheduledDeliveryTimeTransactional(long, org.hornetq.core.server.MessageReference)
+ */
+ public void updateScheduledDeliveryTimeTransactional(final long txID, final MessageReference ref) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.server.HornetQComponent#isStarted()
+ */
+ public boolean isStarted()
+ {
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.server.HornetQComponent#start()
+ */
+ public void start() throws Exception
+ {
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.server.HornetQComponent#stop()
+ */
+ public void stop() throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#afterReplicated(java.lang.Runnable)
+ */
+ public void afterCompleteOperations(final Runnable run)
+ {
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#completeReplication()
+ */
+ public void completeOperations()
+ {
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#createLargeMessage(byte[])
+ */
+ public LargeServerMessage createLargeMessage(final long messageId, final MessageInternal msg)
+ {
+
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#isReplicated()
+ */
+ public boolean isReplicated()
+ {
+
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#loadInternalOnly()
+ */
+ public JournalLoadInformation[] loadInternalOnly() throws Exception
+ {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#pageClosed(org.hornetq.utils.SimpleString, int)
+ */
+ public void pageClosed(final SimpleString storeName, final int pageNumber)
+ {
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#pageDeleted(org.hornetq.utils.SimpleString, int)
+ */
+ public void pageDeleted(final SimpleString storeName, final int pageNumber)
+ {
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#pageWrite(org.hornetq.core.paging.PagedMessage, int)
+ */
+ public void pageWrite(final PagedMessage message, final int pageNumber)
+ {
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#blockOnReplication(long)
+ */
+ public boolean waitOnOperations(final long timeout) throws Exception
+ {
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#setReplicator(org.hornetq.core.replication.ReplicationManager)
+ */
+ public void setReplicator(final ReplicationManager replicator)
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#afterCompleteOperations(org.hornetq.core.journal.IOCompletion)
+ */
+ public void afterCompleteOperations(final IOAsyncTask run)
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#waitOnOperations()
+ */
+ public void waitOnOperations() throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#getContext()
+ */
+ public OperationContext getContext()
+ {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#newContext(java.util.concurrent.Executor)
+ */
+ public OperationContext newContext(final Executor executor)
+ {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#clearContext()
+ */
+ public void clearContext()
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#setContext(org.hornetq.core.persistence.OperationContext)
+ */
+ public void setContext(final OperationContext context)
+ {
+ }
+
+ public void storeReference(final long queueID, final long messageID, final boolean last) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#recoverAddressSettings()
+ */
+ public List<PersistedAddressSetting> recoverAddressSettings() throws Exception
+ {
+ return Collections.emptyList();
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#recoverPersistedRoles()
+ */
+ public List<PersistedRoles> recoverPersistedRoles() throws Exception
+ {
+ return Collections.emptyList();
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#storeAddressSetting(org.hornetq.core.persistconfig.PersistedAddressSetting)
+ */
+ public void storeAddressSetting(PersistedAddressSetting addressSetting) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#storeSecurityRoles(org.hornetq.core.persistconfig.PersistedRoles)
+ */
+ public void storeSecurityRoles(PersistedRoles persistedRoles) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#deleteAddressSetting(org.hornetq.api.core.SimpleString)
+ */
+ public void deleteAddressSetting(SimpleString addressMatch) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#deleteSecurityRoles(org.hornetq.api.core.SimpleString)
+ */
+ public void deleteSecurityRoles(SimpleString addressMatch) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#deletePageTransactional(long)
+ */
+ public void deletePageTransactional(long recordID) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#updatePageTransaction(long, org.hornetq.core.paging.PageTransactionInfo, int)
+ */
+ public void updatePageTransaction(long txID, PageTransactionInfo pageTransaction, int depage) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#storeCursorAcknowledge(long, org.hornetq.core.paging.cursor.PagePosition)
+ */
+ public void storeCursorAcknowledge(long queueID, PagePosition position)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#storeCursorAcknowledgeTransactional(long, long, org.hornetq.core.paging.cursor.PagePosition)
+ */
+ public void storeCursorAcknowledgeTransactional(long txID, long queueID, PagePosition position)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#deleteCursorAcknowledgeTransactional(long, long)
+ */
+ public void deleteCursorAcknowledgeTransactional(long txID, long ackID) throws Exception
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#updatePageTransaction(org.hornetq.core.paging.PageTransactionInfo, int)
+ */
+ public void updatePageTransaction(PageTransactionInfo pageTransaction, int depage) throws Exception
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#storePageCounter(long, long, long)
+ */
+ public long storePageCounter(long txID, long queueID, long value) throws Exception
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#deleteIncrementRecord(long, long)
+ */
+ public void deleteIncrementRecord(long txID, long recordID) throws Exception
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#deletePageCounter(long, long)
+ */
+ public void deletePageCounter(long txID, long recordID) throws Exception
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#storePageCounterInc(long, long, int)
+ */
+ public long storePageCounterInc(long txID, long queueID, int add) throws Exception
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#storePageCounterInc(long, int)
+ */
+ public long storePageCounterInc(long queueID, int add) throws Exception
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#newSingleThreadContext()
+ */
+ public OperationContext newSingleThreadContext()
+ {
+ return getContext();
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#commit(long, boolean)
+ */
+ public void commit(long txID, boolean lineUpContext) throws Exception
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#lineUpContext()
+ */
+ public void lineUpContext()
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#confirmPendingLargeMessageTX(org.hornetq.core.transaction.Transaction, long, long)
+ */
+ public void confirmPendingLargeMessageTX(Transaction transaction, long messageID, long recordID) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#confirmPendingLargeMessage(long)
+ */
+ public void confirmPendingLargeMessage(long recordID) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#stop(boolean)
+ */
+ public void stop(boolean ioCriticalError) throws Exception
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#beforePageRead()
+ */
+ public void beforePageRead() throws Exception
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#afterPageRead()
+ */
+ public void afterPageRead() throws Exception
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#allocateDirectBuffer(int)
+ */
+ public ByteBuffer allocateDirectBuffer(int size)
+ {
+ return ByteBuffer.allocateDirect(size);
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#freeDirectuffer(java.nio.ByteBuffer)
+ */
+ public void freeDirectBuffer(ByteBuffer buffer)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ }
+
+>>>>>>> .merge-right.r12106
class FakeStoreFactory implements PagingStoreFactory
{
12 years, 11 months
JBoss hornetq SVN: r12106 - branches/Branch_2_2_AS7/src/main/org/hornetq/core/server/impl.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2012-02-09 21:11:36 -0500 (Thu, 09 Feb 2012)
New Revision: 12106
Modified:
branches/Branch_2_2_AS7/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java
Log:
HORNETQ-847 - fixing org.hornetq.tests.integration.jms.server.management.TopicControlTest.testListXXXSubscriptionsAsJSON
Modified: branches/Branch_2_2_AS7/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java
===================================================================
--- branches/Branch_2_2_AS7/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java 2012-02-09 22:18:43 UTC (rev 12105)
+++ branches/Branch_2_2_AS7/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java 2012-02-10 02:11:36 UTC (rev 12106)
@@ -1683,7 +1683,7 @@
Filter filter = FilterImpl.createFilter(filterString);
- long txID = -1;
+ long txID = storageManager.generateUniqueID();;
long queueID = storageManager.generateUniqueID();
PageSubscription pageSubscription;
@@ -1711,21 +1711,20 @@
if (durable)
{
- txID = storageManager.generateUniqueID();
storageManager.addQueueBinding(txID, binding);
}
try
{
postOffice.addBinding(binding);
- if (txID != -1)
+ if (durable)
{
storageManager.commitBindings(txID);
}
}
catch (Exception e)
{
- if (txID != -1)
+ if (durable)
{
storageManager.rollbackBindings(txID);
}
12 years, 11 months