Package org.apache.qpid.server.store

Examples of org.apache.qpid.server.store.MessageStore


     * interrogating the store with its own implementation methods and verifying
     * expected exceptions are thrown to indicate the message is not present.
     */
    public void testMessageCreationAndRemoval() throws Exception
    {
        MessageStore store = getVirtualHost().getMessageStore();
        AbstractBDBMessageStore bdbStore = assertBDBStore(store);

        StoredMessage<MessageMetaData> storedMessage_0_8 = createAndStoreSingleChunkMessage_0_8(store);
        long messageid_0_8 = storedMessage_0_8.getMessageNumber();

View Full Code Here


     * in the TransactionLog interface implemented by the store, and verifying the
     * behaviour using BDB implementation methods.
     */
    public void testTranCommit() throws Exception
    {
        MessageStore log = getVirtualHost().getMessageStore();

        AbstractBDBMessageStore bdbStore = assertBDBStore(log);

        final UUID mockQueueId = UUIDGenerator.generateRandomUUID();
        TransactionLogResource mockQueue = new TransactionLogResource()
        {
            @Override
            public UUID getId()
            {
                return mockQueueId;
            }
        };

        Transaction txn = log.newTransaction();

        txn.enqueueMessage(mockQueue, new MockMessage(1L));
        txn.enqueueMessage(mockQueue, new MockMessage(5L));
        txn.commitTran();

View Full Code Here

     * implemented by the store, and verifying the behaviour using BDB
     * implementation methods.
     */
    public void testTranRollbackBeforeCommit() throws Exception
    {
        MessageStore log = getVirtualHost().getMessageStore();

        AbstractBDBMessageStore bdbStore = assertBDBStore(log);

        final UUID mockQueueId = UUIDGenerator.generateRandomUUID();
        TransactionLogResource mockQueue = new TransactionLogResource()
        {
            @Override
            public UUID getId()
            {
                return mockQueueId;
            }
        };

        Transaction txn = log.newTransaction();

        txn.enqueueMessage(mockQueue, new MockMessage(21L));
        txn.abortTran();

        txn = log.newTransaction();
        txn.enqueueMessage(mockQueue, new MockMessage(22L));
        txn.enqueueMessage(mockQueue, new MockMessage(23L));
        txn.commitTran();

        List<Long> enqueuedIds = bdbStore.getEnqueuedMessages(mockQueueId);
View Full Code Here

        assertEquals("Second Message is incorrect", 23L, val.longValue());
    }

    public void testOnDelete() throws Exception
    {
        MessageStore log = getVirtualHost().getMessageStore();
        AbstractBDBMessageStore bdbStore = assertBDBStore(log);
        String storeLocation = bdbStore.getStoreLocation();

        File location = new File(storeLocation);
        assertTrue("Store does not exist at " + storeLocation, location.exists());
View Full Code Here

     * implemented by the store, and verifying the behaviour using BDB
     * implementation methods.
     */
    public void testTranRollbackAfterCommit() throws Exception
    {
        MessageStore log = getVirtualHost().getMessageStore();

        AbstractBDBMessageStore bdbStore = assertBDBStore(log);

        final UUID mockQueueId = UUIDGenerator.generateRandomUUID();
        TransactionLogResource mockQueue = new TransactionLogResource()
        {
            @Override
            public UUID getId()
            {
                return mockQueueId;
            }
        };

        Transaction txn = log.newTransaction();

        txn.enqueueMessage(mockQueue, new MockMessage(30L));
        txn.commitTran();

        txn = log.newTransaction();
        txn.enqueueMessage(mockQueue, new MockMessage(31L));
        txn.abortTran();

        txn = log.newTransaction();
        txn.enqueueMessage(mockQueue, new MockMessage(32L));
        txn.commitTran();

        List<Long> enqueuedIds = bdbStore.getEnqueuedMessages(mockQueueId);

View Full Code Here

    }

    @Override
    protected MessageStore createStore() throws Exception
    {
        MessageStore store = new BDBMessageStore();
        return store;
    }
View Full Code Here

        if (!(o instanceof MessageStore))
        {
            throw new ClassCastException("Message store class must implement " + MessageStore.class + ". Class " + clazz +
                                         " does not.");
        }
        MessageStore messageStore = (MessageStore) o;
        VirtualHostConfigRecoveryHandler recoveryHandler = new VirtualHostConfigRecoveryHandler(this);

        MessageStoreLogSubject storeLogSubject = new MessageStoreLogSubject(this, messageStore);

        messageStore.configureConfigStore(this.getName(),
                                          recoveryHandler,
                                          hostConfig.getStoreConfiguration(),
                                          storeLogSubject);

        messageStore.configureMessageStore(this.getName(),
                                           recoveryHandler,
                                           hostConfig.getStoreConfiguration(),
                                           storeLogSubject);
        messageStore.configureTransactionLog(this.getName(),
                                           recoveryHandler,
                                           hostConfig.getStoreConfiguration(),
                                           storeLogSubject);

        _messageStore = messageStore;
View Full Code Here

            exception(ssn, xfr, errorCode, description);
           
            return;
        }
       
        final MessageStore store = getVirtualHost(ssn).getMessageStore();
        StoredMessage<MessageMetaData_0_10> storeMessage = store.addMessage(messageMetaData);
        ByteBuffer body = xfr.getBody();
        if(body != null)
        {
            storeMessage.addContent(0, body);
        }
View Full Code Here

     * store after it has been reloaded. Both 0-8 and 0-10 metadata is used to
     * verify their ability to co-exist within the store and be successful retrieved.
     */
    public void testBDBMessagePersistence() throws Exception
    {
        MessageStore store = getVirtualHost().getMessageStore();

        AbstractBDBMessageStore bdbStore = assertBDBStore(store);

        // Create content ByteBuffers.
        // Split the content into 2 chunks for the 0-8 message, as per broker behaviour.
View Full Code Here

        return props;
    }

    public void testGetContentWithOffset() throws Exception
    {
        MessageStore store = getVirtualHost().getMessageStore();
        AbstractBDBMessageStore bdbStore = assertBDBStore(store);
        StoredMessage<MessageMetaData> storedMessage_0_8 = createAndStoreSingleChunkMessage_0_8(store);
        long messageid_0_8 = storedMessage_0_8.getMessageNumber();

        // normal case: offset is 0
View Full Code Here

TOP

Related Classes of org.apache.qpid.server.store.MessageStore

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.