use of com.orientechnologies.common.exception.OException in project orientdb by orientechnologies.
the class TruncateClusterTest method testClusterInClassIsAbsent.
public void testClusterInClassIsAbsent() {
final String clusterName = "TruncateClusterInClassIsAbsent";
final int clusterId = database.addCluster(clusterName);
final String className = "TruncateClusterIsAbsentClass";
final OSchema schema = database.getMetadata().getSchema();
final OClass clazz = schema.createClass(className);
clazz.addClusterId(clusterId);
final ODocument document = new ODocument();
document.save(clusterName);
Assert.assertEquals(database.countClusterElements(clusterId), 1);
Assert.assertEquals(database.countClass(className), 1);
try {
clazz.truncateCluster("Wrong" + clusterName);
Assert.fail();
} catch (OException e) {
Assert.assertTrue(true);
}
Assert.assertEquals(database.countClusterElements(clusterId), 1);
Assert.assertEquals(database.countClass(className), 1);
database.dropCluster(clusterId, false);
}
Aggregations