@Test public void testMoveOverPaging() throws Exception { AssertionLoggerHandler.startCapture(); ExecutorService threadPool = Executors.newCachedThreadPool(); try { manager.setMaxFolders(3); for (int i = 1; i <= 10; i++) { HierarchicalRepository<AddressSettings> addressSettings = new HierarchicalObjectRepository<>(); AddressSettings settings = new AddressSettings(); settings.setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE); addressSettings.setDefault(settings); final StorageManager storageManager = new NullStorageManager(); PagingStoreFactoryNIO storeFactory = new PagingStoreFactoryNIO(storageManager, dataLocation, 100, null, new OrderedExecutorFactory(threadPool), true, null); PagingManagerImpl managerImpl = new PagingManagerImpl(storeFactory, addressSettings, -1, ActiveMQDefaultConfiguration.getDefaultManagementAddress()); managerImpl.start(); PagingStore store = managerImpl.getPageStore(new SimpleString("simple-test")); store.startPaging(); store.stop(); managerImpl.stop(); manager.doMove(); Assert.assertEquals(Math.min(i, manager.getMaxFolders()), manager.getNumberOfFolders()); } Assert.assertFalse("The loggers are complaining about address.txt", AssertionLoggerHandler.findText("address.txt")); } finally { AssertionLoggerHandler.stopCapture(); threadPool.shutdown(); } }