Search in sources :

Example 1 with ImmutableMetaSnapshot

use of com.torodb.core.transaction.metainf.ImmutableMetaSnapshot in project torodb by torodb.

the class SqlTorodServer method disableDataImportMode.

@Override
public void disableDataImportMode() {
    ImmutableMetaSnapshot snapshot = internalTransactionManager.takeMetaSnapshot();
    backend.disableDataImportMode(snapshot);
}
Also used : ImmutableMetaSnapshot(com.torodb.core.transaction.metainf.ImmutableMetaSnapshot)

Example 2 with ImmutableMetaSnapshot

use of com.torodb.core.transaction.metainf.ImmutableMetaSnapshot in project torodb by torodb.

the class IdentifierFactoryImplTest method longForCounterWithCollisionCharacterDatabaseToIdentifierTest.

@Test
public void longForCounterWithCollisionCharacterDatabaseToIdentifierTest() {
    ImmutableMetaSnapshot metaSnapshot = new ImmutableMetaSnapshot.Builder().put(new ImmutableMetaDatabase.Builder("database_collider", "database_long_long_long_long_long_long_long_long_long_long_longong_long_long_long_long_long_long_long_long_long_long_long_long_1")).build();
    String identifier = identifierFactory.toDatabaseIdentifier(metaSnapshot, "database_long_long_long_long_long_long_long_long_long_long_long_long_long_long_long_long_long_long_long_long_long_long_long_long_long_long_long_long_long_long_long_long");
    Assert.assertEquals("database_long_long_long_long_long_long_long_long_long_long_longong_long_long_long_long_long_long_long_long_long_long_long_long_2", identifier);
}
Also used : ImmutableMetaSnapshot(com.torodb.core.transaction.metainf.ImmutableMetaSnapshot) Test(org.junit.Test)

Example 3 with ImmutableMetaSnapshot

use of com.torodb.core.transaction.metainf.ImmutableMetaSnapshot in project torodb by torodb.

the class IdentifierFactoryImplTest method emptyDatabaseToIdentifierTest.

@Test
public void emptyDatabaseToIdentifierTest() {
    ImmutableMetaSnapshot metaSnapshot = new ImmutableMetaSnapshot.Builder().build();
    String identifier = identifierFactory.toDatabaseIdentifier(metaSnapshot, "");
    Assert.assertEquals("", identifier);
}
Also used : ImmutableMetaSnapshot(com.torodb.core.transaction.metainf.ImmutableMetaSnapshot) Test(org.junit.Test)

Example 4 with ImmutableMetaSnapshot

use of com.torodb.core.transaction.metainf.ImmutableMetaSnapshot in project torodb by torodb.

the class IdentifierFactoryImplTest method long128DatabaseToIdentifierTest.

@Test
public void long128DatabaseToIdentifierTest() {
    ImmutableMetaSnapshot metaSnapshot = new ImmutableMetaSnapshot.Builder().build();
    String identifier = identifierFactory.toDatabaseIdentifier(metaSnapshot, "database_long_long_long_long_long_long_long_long_long_long_long_long_long_long_long_long_long_long_long_long_long_long_long_long");
    Assert.assertEquals("database_long_long_long_long_long_long_long_long_long_long_long_long_long_long_long_long_long_long_long_long_long_long_long_long", identifier);
}
Also used : ImmutableMetaSnapshot(com.torodb.core.transaction.metainf.ImmutableMetaSnapshot) Test(org.junit.Test)

Example 5 with ImmutableMetaSnapshot

use of com.torodb.core.transaction.metainf.ImmutableMetaSnapshot in project torodb by torodb.

the class SnapshotMergerForIndexTest method testNewIndexMultiField.

/**
   * Test a new index with multiple fields Case [1&1.OK1|1&2.OK1].2
   *
   * @throws Exception
   */
@Test
public void testNewIndexMultiField() throws Exception {
    MutableMetaSnapshot currentModifiedSnapshot = new WrapperMutableMetaSnapshot(currentSnapshot);
    ImmutableMetaSnapshot currentSnapshot = currentModifiedSnapshot.immutableCopy();
    MutableMetaSnapshot changedSnapshot = new WrapperMutableMetaSnapshot(currentSnapshot);
    changedSnapshot.getMetaDatabaseByName("dbName1").getMetaCollectionByName("colName1").addMetaIndex("idxName2", false).addMetaIndexField(tableRefFactory.createRoot(), "fieldName2", FieldIndexOrdering.ASC);
    changedSnapshot.getMetaDatabaseByName("dbName1").getMetaCollectionByName("colName1").getMetaIndexByName("idxName2").addMetaIndexField(tableRefFactory.createRoot(), "fieldName3", FieldIndexOrdering.ASC);
    changedSnapshot.getMetaDatabaseByName("dbName1").getMetaCollectionByName("colName1").getMetaIndexByName("idxName2").addMetaIndexField(tableRefFactory.createRoot(), "fieldName4", FieldIndexOrdering.ASC);
    changedSnapshot.getMetaDatabaseByName("dbName1").getMetaCollectionByName("colName1").getMetaIndexByName("idxName2").addMetaIndexField(tableRefFactory.createRoot(), "fieldName5", FieldIndexOrdering.ASC);
    new SnapshotMerger(currentSnapshot, changedSnapshot).merge();
}
Also used : WrapperMutableMetaSnapshot(com.torodb.core.transaction.metainf.WrapperMutableMetaSnapshot) MutableMetaSnapshot(com.torodb.core.transaction.metainf.MutableMetaSnapshot) ImmutableMetaSnapshot(com.torodb.core.transaction.metainf.ImmutableMetaSnapshot) WrapperMutableMetaSnapshot(com.torodb.core.transaction.metainf.WrapperMutableMetaSnapshot) Test(org.junit.Test)

Aggregations

ImmutableMetaSnapshot (com.torodb.core.transaction.metainf.ImmutableMetaSnapshot)65 Test (org.junit.Test)62 MutableMetaSnapshot (com.torodb.core.transaction.metainf.MutableMetaSnapshot)56 WrapperMutableMetaSnapshot (com.torodb.core.transaction.metainf.WrapperMutableMetaSnapshot)55 UnmergeableException (com.torodb.core.transaction.metainf.UnmergeableException)22 SnapshotStage (com.torodb.core.transaction.metainf.MetainfoRepository.SnapshotStage)2 MergerStage (com.torodb.core.transaction.metainf.MetainfoRepository.MergerStage)1 MutableMetaDocPart (com.torodb.core.transaction.metainf.MutableMetaDocPart)1 Connection (java.sql.Connection)1 DSLContext (org.jooq.DSLContext)1