diff --git a/activemq-leveldb-store/src/main/scala/org/apache/activemq/leveldb/LevelDBStore.scala b/activemq-leveldb-store/src/main/scala/org/apache/activemq/leveldb/LevelDBStore.scala index 9945be6fbb..42459a5fbf 100644 --- a/activemq-leveldb-store/src/main/scala/org/apache/activemq/leveldb/LevelDBStore.scala +++ b/activemq-leveldb-store/src/main/scala/org/apache/activemq/leveldb/LevelDBStore.scala @@ -700,7 +700,7 @@ class LevelDBStore extends LockableServiceSupport with BrokerServiceAware with P } override def setBatch(id: MessageId): Unit = { - cursorPosition = db.queuePosition(id) + cursorPosition = db.queuePosition(id)+1 } } diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/broker/region/cursors/StoreQueueCursorJournalNoDuplicateTest.java b/activemq-unit-tests/src/test/java/org/apache/activemq/broker/region/cursors/StoreQueueCursorLevelDBNoDuplicateTest.java similarity index 70% rename from activemq-unit-tests/src/test/java/org/apache/activemq/broker/region/cursors/StoreQueueCursorJournalNoDuplicateTest.java rename to activemq-unit-tests/src/test/java/org/apache/activemq/broker/region/cursors/StoreQueueCursorLevelDBNoDuplicateTest.java index 5d48bf6ec8..d119d506ed 100644 --- a/activemq-unit-tests/src/test/java/org/apache/activemq/broker/region/cursors/StoreQueueCursorJournalNoDuplicateTest.java +++ b/activemq-unit-tests/src/test/java/org/apache/activemq/broker/region/cursors/StoreQueueCursorLevelDBNoDuplicateTest.java @@ -17,32 +17,24 @@ package org.apache.activemq.broker.region.cursors; -import java.io.File; - import org.apache.activeio.journal.active.JournalImpl; import org.apache.activemq.broker.BrokerService; import org.apache.activemq.leveldb.LevelDBStore; import org.apache.activemq.store.journal.JournalPersistenceAdapter; +import java.io.File; + /** * @author gtully * @see https://issues.apache.org/activemq/browse/AMQ-2020 **/ -public class StoreQueueCursorJournalNoDuplicateTest extends StoreQueueCursorNoDuplicateTest { +public class StoreQueueCursorLevelDBNoDuplicateTest extends StoreQueueCursorNoDuplicateTest { @Override protected BrokerService createBroker() throws Exception { BrokerService broker = super.createBroker(); - - File dataFileDir = new File("target/activemq-data/StoreQueueCursorJournalNoDuplicateTest"); - File journalDir = new File(dataFileDir, "journal").getCanonicalFile(); - JournalImpl journal = new JournalImpl(journalDir, 3, 1024 * 1024 * 20); - LevelDBStore store = new LevelDBStore(); - store.setDirectory(dataFileDir); - JournalPersistenceAdapter journalAdaptor = new JournalPersistenceAdapter(journal, store, broker.getTaskRunnerFactory()); - journalAdaptor.setMaxCheckpointWorkers(1); - - broker.setPersistenceAdapter(journalAdaptor); + store.setDirectory(new File("target/activemq-data/leveldb")); + broker.setPersistenceAdapter(store); return broker; } }