Examples of OLocalPaginatedStorage


Examples of com.orientechnologies.orient.core.storage.impl.local.paginated.OLocalPaginatedStorage

* @author <a href="mailto:enisher@gmail.com">Artem Orobets</a>
*/
public class ODistributedStorageTest {
  @Test
  public void testSupportedFreezeTrue() {
    OLocalPaginatedStorage storage = Mockito.mock(OLocalPaginatedStorage.class);
    ODistributedStorage ds = new ODistributedStorage(Mockito.mock(OServer.class), storage);

    ds.freeze(true);

    Mockito.verify(storage).freeze(true);
View Full Code Here

Examples of com.orientechnologies.orient.core.storage.impl.local.paginated.OLocalPaginatedStorage

    Mockito.verify(storage).freeze(true);
  }

  @Test
  public void testSupportedFreezeFalse() {
    OLocalPaginatedStorage storage = Mockito.mock(OLocalPaginatedStorage.class);
    ODistributedStorage ds = new ODistributedStorage(Mockito.mock(OServer.class), storage);

    ds.freeze(false);

    Mockito.verify(storage).freeze(false);
View Full Code Here

Examples of com.orientechnologies.orient.core.storage.impl.local.paginated.OLocalPaginatedStorage

    ds.freeze(false);
  }

  @Test
  public void testSupportedRelease() {
    OLocalPaginatedStorage storage = Mockito.mock(OLocalPaginatedStorage.class);
    ODistributedStorage ds = new ODistributedStorage(Mockito.mock(OServer.class), storage);

    ds.release();

    Mockito.verify(storage).release();
View Full Code Here

Examples of com.orientechnologies.orient.core.storage.impl.local.paginated.OLocalPaginatedStorage

  public static final String NAME = "plocal";

  public OStorage createStorage(final String dbName, final Map<String, String> configuration) {
    try {
      // GET THE STORAGE
      return new OLocalPaginatedStorage(dbName, dbName, getMode(configuration));

    } catch (Throwable t) {
      OLogManager.instance().error(this,
          "Error on opening database: " + dbName + ". Current location is: " + new java.io.File(".").getAbsolutePath(), t,
          ODatabaseException.class);
View Full Code Here

Examples of com.orientechnologies.orient.core.storage.impl.local.paginated.OLocalPaginatedStorage

    sbTree = new OSBTreeBonsaiLocal<Integer, OIdentifiable>(".sbt", true);
    sbTree.create("actualSBTree", OIntegerSerializer.INSTANCE, OLinkSerializer.INSTANCE, actualStorage);
  }

  private void createExpectedSBTree() {
    final OLocalPaginatedStorage expectedStorage = mock(OLocalPaginatedStorage.class);
    OStorageConfiguration storageConfiguration = mock(OStorageConfiguration.class);
    storageConfiguration.clusters = new ArrayList<OStorageClusterConfiguration>();
    storageConfiguration.fileTemplate = new OStorageSegmentConfiguration();
    storageConfiguration.binaryFormatVersion = Integer.MAX_VALUE;

    expectedStorageDir = buildDirectory + "/sbtreeWithWALTestExpected";
    when(expectedStorage.getStoragePath()).thenReturn(expectedStorageDir);
    when(expectedStorage.getName()).thenReturn("sbtreeWithWALTesExpected");
    when(expectedStorage.getComponentsFactory()).thenReturn(new OCurrentStorageComponentsFactory(storageConfiguration));

    File buildDir = new File(buildDirectory);
    if (!buildDir.exists())
      buildDir.mkdirs();

    File expectedStorageDirFile = new File(expectedStorageDir);
    if (!expectedStorageDirFile.exists())
      expectedStorageDirFile.mkdirs();

    expectedDiskCache = new OReadWriteDiskCache(400L * 1024 * 1024 * 1024, 1648L * 1024 * 1024,
        OGlobalConfiguration.DISK_CACHE_PAGE_SIZE.getValueAsInteger() * 1024, 1000000, 100, expectedStorage, null, false, false);

    OStorageVariableParser variableParser = new OStorageVariableParser(expectedStorageDir);
    OAtomicOperationsManager atomicOperationsManager = new OAtomicOperationsManager(null);

    when(expectedStorage.getStorageTransaction()).thenReturn(null);
    when(expectedStorage.getAtomicOperationsManager()).thenReturn(atomicOperationsManager);
    when(expectedStorage.getDiskCache()).thenReturn(expectedDiskCache);
    when(expectedStorage.getWALInstance()).thenReturn(null);
    when(expectedStorage.getVariableParser()).thenReturn(variableParser);
    when(expectedStorage.getConfiguration()).thenReturn(storageConfiguration);
    when(expectedStorage.getMode()).thenReturn("rw");

    when(storageConfiguration.getDirectory()).thenReturn(expectedStorageDir);

    expectedSBTree = new OSBTreeBonsaiLocal<Integer, OIdentifiable>(".sbt", true);
    expectedSBTree.create("expectedSBTree", OIntegerSerializer.INSTANCE, OLinkSerializer.INSTANCE, expectedStorage);
View Full Code Here

Examples of com.orientechnologies.orient.core.storage.impl.local.paginated.OLocalPaginatedStorage

    freezeCluster(iClusterId, false);
  }

  @Override
  public void releaseCluster(final int iClusterId) {
    final OLocalPaginatedStorage storage;
    if (getStorage() instanceof OLocalPaginatedStorage)
      storage = ((OLocalPaginatedStorage) getStorage());
    else {
      OLogManager.instance().error(this, "We can not freeze non local storage.");
      return;
    }

    storage.release(iClusterId);
  }
View Full Code Here

Examples of com.orientechnologies.orient.core.storage.impl.local.paginated.OLocalPaginatedStorage

  }

  @Override
  public void freezeCluster(final int iClusterId, final boolean throwException) {
    if (getStorage() instanceof OLocalPaginatedStorage) {
      final OLocalPaginatedStorage paginatedStorage = ((OLocalPaginatedStorage) getStorage());
      paginatedStorage.freeze(throwException, iClusterId);
    } else {
      OLogManager.instance().error(this, "Only local paginated storage supports cluster freeze.");
    }
  }
View Full Code Here

Examples of com.orientechnologies.orient.core.storage.impl.local.paginated.OLocalPaginatedStorage

  private ODiskWriteAheadLog createWAL() throws IOException {
    return createWAL(2, OWALPage.PAGE_SIZE * 4);
  }

  private ODiskWriteAheadLog createWAL(int maxPagesCacheSize, int maxSegmentSize) throws IOException {
    OLocalPaginatedStorage paginatedStorage = mock(OLocalPaginatedStorage.class);
    when(paginatedStorage.getName()).thenReturn("WriteAheadLogTest");
    when(paginatedStorage.getStoragePath()).thenReturn(testDir.getAbsolutePath());

    return new ODiskWriteAheadLog(maxPagesCacheSize, -1, maxSegmentSize, 100L * 1024L * 1024L * 1024L, paginatedStorage);
  }
View Full Code Here

Examples of com.orientechnologies.orient.core.storage.impl.local.paginated.OLocalPaginatedStorage

  }

  public void testLogTruncation() throws Exception {
    writeAheadLog.close();

    OLocalPaginatedStorage paginatedStorage = mock(OLocalPaginatedStorage.class);
    when(paginatedStorage.getName()).thenReturn("WriteAheadLogTest");
    when(paginatedStorage.getStoragePath()).thenReturn(testDir.getAbsolutePath());

    writeAheadLog = new ODiskWriteAheadLog(2, -1, 2 * OWALPage.PAGE_SIZE, 4 * OWALPage.PAGE_SIZE, paginatedStorage);

    List<OWALRecord> writtenRecords = new ArrayList<OWALRecord>();
    long seed = System.currentTimeMillis();
View Full Code Here

Examples of com.orientechnologies.orient.core.storage.impl.local.paginated.OLocalPaginatedStorage

  }

  public void testLogOneCheckPointTruncation() throws Exception {
    writeAheadLog.close();

    OLocalPaginatedStorage paginatedStorage = mock(OLocalPaginatedStorage.class);
    when(paginatedStorage.getName()).thenReturn("WriteAheadLogTest");
    when(paginatedStorage.getStoragePath()).thenReturn(testDir.getAbsolutePath());

    writeAheadLog = new ODiskWriteAheadLog(2, -1, 2 * OWALPage.PAGE_SIZE, 4 * OWALPage.PAGE_SIZE, paginatedStorage);

    List<OWALRecord> writtenRecords = new ArrayList<OWALRecord>();

View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.