OffHeapPersistence implements SQLitePersistence<O, A>, Closeable { @Override public void expand(long numBytes) { Connection connection = null; try { connection = getConnectionInternal(null, noQueryOptions()); DBQueries.expandDatabase(connection, numBytes); } finally { DBUtils.closeQuietly(connection); } } protected  OffHeapPersistence(SimpleAttribute<O, A> primaryKeyAttribute, Properties overrideProperties); @Override SimpleAttribute<O, A> getPrimaryKeyAttribute(); String getInstanceName(); @Override Connection getConnection(Index<?> index, QueryOptions queryOptions); @Override boolean supportsIndex(Index<O> index); @Override void close(); @Override long getBytesUsed(); @Override void compact(); @Override void expand(long numBytes); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); @Override SQLiteObjectStore<O, A> createObjectStore(); @Override SQLiteOffHeapIdentityIndex<A, O> createIdentityIndex(); @Override void openRequestScopeResources(QueryOptions queryOptions); @Override void closeRequestScopeResources(QueryOptions queryOptions); static OffHeapPersistence<O, A> onPrimaryKey(SimpleAttribute<O, A> primaryKeyAttribute); static OffHeapPersistence<O, A> onPrimaryKeyWithProperties(SimpleAttribute<O, A> primaryKeyAttribute, Properties overrideProperties);  }
@Test public void testExpand() { final long bytesToExpand = 102400; OffHeapPersistence<Car, Integer> persistence = OffHeapPersistence.onPrimaryKey(Car.CAR_ID); @SuppressWarnings("MismatchedQueryAndUpdateOfCollection") IndexedCollection<Car> cars = new ConcurrentIndexedCollection<Car>(persistence); cars.addAll(CarFactory.createCollectionOfCars(50)); persistence.compact(); long initialBytesUsed = persistence.getBytesUsed(); Assert.assertTrue("Initial bytes used should be greater than zero: " + initialBytesUsed, initialBytesUsed > 0); persistence.expand(bytesToExpand); long bytesUsedAfterExpanding = persistence.getBytesUsed(); Assert.assertTrue("Bytes used after expanding (" + bytesUsedAfterExpanding + ") should have been increased by at least bytes to expand (" + bytesToExpand + ") above initial bytes used (" + initialBytesUsed + ")", bytesUsedAfterExpanding >= (initialBytesUsed + bytesToExpand)); persistence.compact(); long bytesUsedAfterCompaction = persistence.getBytesUsed(); Assert.assertTrue("Bytes used after compaction (" + bytesUsedAfterCompaction + ") should be equal to initial bytes used (" + initialBytesUsed + ")", bytesUsedAfterCompaction == initialBytesUsed); }