Author: borges
Date: 2011-08-09 06:30:29 -0400 (Tue, 09 Aug 2011)
New Revision: 11160
Modified:
branches/HORNETQ-720_Replication/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/paging/impl/PagingStoreImplTest.java
Log:
Remove FakeStorageManager as it is the same thing as the NullStorageManager.
Modified:
branches/HORNETQ-720_Replication/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/paging/impl/PagingStoreImplTest.java
===================================================================
---
branches/HORNETQ-720_Replication/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/paging/impl/PagingStoreImplTest.java 2011-08-09
10:29:32 UTC (rev 11159)
+++
branches/HORNETQ-720_Replication/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/paging/impl/PagingStoreImplTest.java 2011-08-09
10:30:29 UTC (rev 11160)
@@ -15,7 +15,6 @@
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@@ -27,59 +26,39 @@
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;
import org.hornetq.api.core.SimpleString;
-import org.hornetq.core.journal.IOAsyncTask;
-import org.hornetq.core.journal.JournalLoadInformation;
import org.hornetq.core.journal.SequentialFile;
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.cursor.PagePosition;
import org.hornetq.core.paging.impl.PageTransactionInfoImpl;
import org.hornetq.core.paging.impl.PagingStoreImpl;
import org.hornetq.core.paging.impl.TestSupportPageStore;
-import org.hornetq.core.persistence.GroupingInfo;
-import org.hornetq.core.persistence.OperationContext;
-import org.hornetq.core.persistence.QueueBindingInfo;
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.postoffice.Binding;
import org.hornetq.core.postoffice.PostOffice;
-import org.hornetq.core.replication.ReplicationManager;
-import org.hornetq.core.server.LargeServerMessage;
-import org.hornetq.core.server.MessageReference;
-import org.hornetq.core.server.Queue;
import org.hornetq.core.server.ServerMessage;
-import org.hornetq.core.server.group.impl.GroupBinding;
import org.hornetq.core.server.impl.RoutingContextImpl;
import org.hornetq.core.server.impl.ServerMessageImpl;
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.tests.unit.core.journal.impl.fakes.FakeSequentialFileFactory;
-import org.hornetq.tests.unit.core.server.impl.fakes.FakePostOffice;
import org.hornetq.tests.util.RandomUtil;
import org.hornetq.tests.util.UnitTestCase;
import org.hornetq.utils.ExecutorFactory;
/**
- *
+ *
* @author <a href="mailto:clebert.suconic@jboss.com">Clebert
Suconic</a>
*
*/
@@ -704,7 +683,7 @@
public void testRestartPage() throws Throwable
{
clearData();
- SequentialFileFactory factory = new NIOSequentialFileFactory(this.getPageDir());
+ SequentialFileFactory factory = new
NIOSequentialFileFactory(UnitTestCase.getPageDir());
PagingStoreFactory storeFactory = new FakeStoreFactory(factory);
@@ -740,14 +719,14 @@
storeImpl.startPaging();
assertNotNull(storeImpl.getCurrentPage());
-
+
storeImpl.stop();
}
public void testOrderOnPaging() throws Throwable
{
clearData();
- SequentialFileFactory factory = new NIOSequentialFileFactory(this.getPageDir());
+ SequentialFileFactory factory = new
NIOSequentialFileFactory(UnitTestCase.getPageDir());
PagingStoreFactory storeFactory = new FakeStoreFactory(factory);
@@ -903,14 +882,9 @@
private StorageManager createStorageManagerMock()
{
- return new FakeStorageManager();
+ return new NullStorageManager();
}
- private PostOffice createPostOfficeMock()
- {
- return new FakePostOffice();
- }
-
private ExecutorFactory getExecutorFactory()
{
return new ExecutorFactory()
@@ -1113,575 +1087,7 @@
}
- 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) 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
- {
- }
-
- /* (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
- {
- }
-
- /* (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
-
- }
-
- }
-
class FakeStoreFactory implements PagingStoreFactory
{