use of com.torodb.core.transaction.metainf.ImmutableMetaSnapshot in project torodb by torodb.
the class SnapshotMergerTest method testDatabaseIdConflict.
/**
* Test that an exception is thrown on database id conflicts
*
* @throws Exception
*/
@Test
public void testDatabaseIdConflict() throws Exception {
MutableMetaSnapshot changedSnapshot = new WrapperMutableMetaSnapshot(new ImmutableMetaSnapshot(Collections.emptyMap()));
changedSnapshot.addMetaDatabase("dbName1", "dbId2");
try {
new SnapshotMerger(currentSnapshot, changedSnapshot).merge();
Assert.fail("A " + UnmergeableException.class.getSimpleName() + " was expected to be thrown");
} catch (UnmergeableException ex) {
}
}
use of com.torodb.core.transaction.metainf.ImmutableMetaSnapshot in project torodb by torodb.
the class SnapshotMergerTest method testScalar_different.
/**
* Test that no exception is thrown when creating a new scalar with different id and type
*
* @throws Exception
*/
@Test
public void testScalar_different() throws Exception {
MutableMetaSnapshot changedSnapshot = new WrapperMutableMetaSnapshot(new ImmutableMetaSnapshot(Collections.emptyMap()));
changedSnapshot.addMetaDatabase("dbName1", "dbId1").addMetaCollection("colName1", "colId1").addMetaDocPart(tableRefFactory.createRoot(), "docPartId1").addMetaScalar("fieldId20", FieldType.LONG);
new SnapshotMerger(currentSnapshot, changedSnapshot).merge();
}
use of com.torodb.core.transaction.metainf.ImmutableMetaSnapshot in project torodb by torodb.
the class SnapshotMergerTest method testCollectionNameConflict.
/**
* Test that an exception is thrown on collection name conflicts
*
* @throws Exception
*/
@Test
public void testCollectionNameConflict() throws Exception {
MutableMetaSnapshot changedSnapshot = new WrapperMutableMetaSnapshot(new ImmutableMetaSnapshot(Collections.emptyMap()));
changedSnapshot.addMetaDatabase("dbName1", "dbId1").addMetaCollection("colName2", "colId1");
try {
new SnapshotMerger(currentSnapshot, changedSnapshot).merge();
Assert.fail("A " + UnmergeableException.class.getSimpleName() + " was expected to be thrown");
} catch (UnmergeableException ex) {
}
}
use of com.torodb.core.transaction.metainf.ImmutableMetaSnapshot in project torodb by torodb.
the class SnapshotMergerTest method testDocPartIdConflict.
/**
* Test that an exception is thrown on doc part id conflicts
*
* @throws Exception
*/
@Test
public void testDocPartIdConflict() throws Exception {
MutableMetaSnapshot changedSnapshot = new WrapperMutableMetaSnapshot(new ImmutableMetaSnapshot(Collections.emptyMap()));
changedSnapshot.addMetaDatabase("dbName1", "dbId1").addMetaCollection("colName1", "colId1").addMetaDocPart(tableRefFactory.createRoot(), "docPartId2");
try {
new SnapshotMerger(currentSnapshot, changedSnapshot).merge();
Assert.fail("A " + UnmergeableException.class.getSimpleName() + " was expected to be thrown");
} catch (UnmergeableException ex) {
}
}
use of com.torodb.core.transaction.metainf.ImmutableMetaSnapshot in project torodb by torodb.
the class SnapshotMergerTest method testField_differentName.
/**
* Test that no exception is thrown when creating a new field that shares type but not name with a
* previous one.
*
* @throws Exception
*/
@Test
public void testField_differentName() throws Exception {
MutableMetaSnapshot changedSnapshot = new WrapperMutableMetaSnapshot(new ImmutableMetaSnapshot(Collections.emptyMap()));
changedSnapshot.addMetaDatabase("dbName1", "dbId1").addMetaCollection("colName1", "colId1").addMetaDocPart(tableRefFactory.createRoot(), "docPartId1").addMetaField("fieldName2", "fieldId4", FieldType.INTEGER);
new SnapshotMerger(currentSnapshot, changedSnapshot).merge();
}
Aggregations