use of com.torodb.core.transaction.metainf.UnmergeableException in project torodb by torodb.
the class SnapshotMergerTest method testScalarTypeConflict.
/**
* Test that an exception is thrown on scalar type conflicts
*
* @throws Exception
*/
@Test
public void testScalarTypeConflict() throws Exception {
MutableMetaSnapshot changedSnapshot = new WrapperMutableMetaSnapshot(new ImmutableMetaSnapshot(Collections.emptyMap()));
changedSnapshot.addMetaDatabase("dbName1", "dbId1").addMetaCollection("colName1", "colId1").addMetaDocPart(tableRefFactory.createRoot(), "docPartId1").addMetaScalar("fieldId2", FieldType.INTEGER);
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.UnmergeableException in project torodb by torodb.
the class SnapshotMergerTest method testFieldNameAndTypeConflict.
/**
* Test that an exception is thrown on field name and type conflicts
*
* @throws Exception
*/
@Test
public void testFieldNameAndTypeConflict() throws Exception {
MutableMetaSnapshot changedSnapshot = new WrapperMutableMetaSnapshot(new ImmutableMetaSnapshot(Collections.emptyMap()));
changedSnapshot.addMetaDatabase("dbName1", "dbId1").addMetaCollection("colName1", "colId1").addMetaDocPart(tableRefFactory.createRoot(), "docPartId1").addMetaField("fieldName1", "fieldId1", FieldType.TIME);
try {
new SnapshotMerger(currentSnapshot, changedSnapshot).merge();
Assert.fail("A " + UnmergeableException.class.getSimpleName() + " was expected to be thrown");
} catch (UnmergeableException ex) {
}
changedSnapshot = new WrapperMutableMetaSnapshot(new ImmutableMetaSnapshot(Collections.emptyMap()));
changedSnapshot.addMetaDatabase("dbName1", "dbId1").addMetaCollection("colName1", "colId1").addMetaDocPart(tableRefFactory.createRoot(), "docPartId1").addMetaField("fieldName2", "fieldId1", FieldType.INTEGER);
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.UnmergeableException in project torodb by torodb.
the class SnapshotMergerTest method testDatabaseNameConflict.
/**
* Test that an exception is thrown on database name conflicts
*
* @throws Exception
*/
@Test
public void testDatabaseNameConflict() throws Exception {
MutableMetaSnapshot changedSnapshot = new WrapperMutableMetaSnapshot(new ImmutableMetaSnapshot(Collections.emptyMap()));
changedSnapshot.addMetaDatabase("dbName2", "dbId1");
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.UnmergeableException in project torodb by torodb.
the class SnapshotMergerTest method testDocPartRefConflict.
/**
* Test that an exception is thrown on doc part table ref conflicts
*
* @throws Exception
*/
@Test
public void testDocPartRefConflict() throws Exception {
MutableMetaSnapshot changedSnapshot = new WrapperMutableMetaSnapshot(new ImmutableMetaSnapshot(Collections.emptyMap()));
changedSnapshot.addMetaDatabase("dbName1", "dbId1").addMetaCollection("colName1", "colId1").addMetaDocPart(tableRefFactory.createChild(tableRefFactory.createRoot(), "anotherTRef"), "docPartId1");
try {
new SnapshotMerger(currentSnapshot, changedSnapshot).merge();
Assert.fail("A " + UnmergeableException.class.getSimpleName() + " was expected to be thrown");
} catch (UnmergeableException ex) {
}
}
Aggregations