createTestPaginatedCluster();
}
private void createPaginatedCluster() throws IOException {
storage = mock(OLocalPaginatedStorage.class);
OStorageConfiguration storageConfiguration = mock(OStorageConfiguration.class);
storageConfiguration.clusters = new ArrayList<OStorageClusterConfiguration>();
storageConfiguration.fileTemplate = new OStorageSegmentConfiguration();
storageConfiguration.binaryFormatVersion = Integer.MAX_VALUE;
storageDir = buildDirectory + "/localPaginatedClusterWithWALTestOne";
when(storage.getStoragePath()).thenReturn(storageDir);
when(storage.getName()).thenReturn("localPaginatedClusterWithWALTestOne");
when(storage.getComponentsFactory()).thenReturn(new OCurrentStorageComponentsFactory(storageConfiguration));
File buildDir = new File(buildDirectory);
if (!buildDir.exists())
buildDir.mkdirs();
File storageDirOneFile = new File(storageDir);
if (!storageDirOneFile.exists())
storageDirOneFile.mkdirs();
writeAheadLog = new ODiskWriteAheadLog(6000, -1, 10 * 1024L * OWALPage.PAGE_SIZE, 100L * 1024 * 1024 * 1024, storage);
diskCache = new OReadWriteDiskCache(400L * 1024 * 1024 * 1024, 1648L * 1024 * 1024,
OGlobalConfiguration.DISK_CACHE_PAGE_SIZE.getValueAsInteger() * 1024, 1000000, 100, storage, null, false, false);
atomicOperationsManager = new OAtomicOperationsManager(writeAheadLog);
when(storage.getStorageTransaction()).thenReturn(null);
when(storage.getAtomicOperationsManager()).thenReturn(atomicOperationsManager);
when(storage.getDiskCache()).thenReturn(diskCache);
when(storage.getWALInstance()).thenReturn(writeAheadLog);
when(storage.getConfiguration()).thenReturn(storageConfiguration);
when(storage.getMode()).thenReturn("rw");
when(storageConfiguration.getDirectory()).thenReturn(storageDir);
paginatedCluster = new OPaginatedCluster();
testCluster.configure(testStorage, 6, "testPaginatedClusterWithWALTest", buildDirectory, -1);
paginatedCluster.create(-1);
}