Search in sources :

Example 21 with OException

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);
}
Also used : OSchema(com.orientechnologies.orient.core.metadata.schema.OSchema) OClass(com.orientechnologies.orient.core.metadata.schema.OClass) OException(com.orientechnologies.common.exception.OException) ODocument(com.orientechnologies.orient.core.record.impl.ODocument)

Aggregations

OException (com.orientechnologies.common.exception.OException)21 IOException (java.io.IOException)12 ODocument (com.orientechnologies.orient.core.record.impl.ODocument)11 OModificationOperationProhibitedException (com.orientechnologies.common.concur.lock.OModificationOperationProhibitedException)5 OIOException (com.orientechnologies.common.io.OIOException)5 OChannelBinaryAsynchClient (com.orientechnologies.orient.client.binary.OChannelBinaryAsynchClient)4 OOfflineNodeException (com.orientechnologies.common.concur.OOfflineNodeException)3 OInterruptedException (com.orientechnologies.common.concur.lock.OInterruptedException)3 ODatabaseDocumentTx (com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx)3 ORecordId (com.orientechnologies.orient.core.id.ORecordId)3 OTokenException (com.orientechnologies.orient.core.metadata.security.OTokenException)3 OCommandSQL (com.orientechnologies.orient.core.sql.OCommandSQL)3 OOfflineClusterException (com.orientechnologies.orient.core.storage.impl.local.paginated.OOfflineClusterException)3 ODistributedRedirectException (com.orientechnologies.orient.enterprise.channel.binary.ODistributedRedirectException)3 OTokenSecurityException (com.orientechnologies.orient.enterprise.channel.binary.OTokenSecurityException)3 NamingException (javax.naming.NamingException)3 ONeedRetryException (com.orientechnologies.common.concur.ONeedRetryException)2 ODatabaseDocumentInternal (com.orientechnologies.orient.core.db.ODatabaseDocumentInternal)2 ODatabaseDocument (com.orientechnologies.orient.core.db.document.ODatabaseDocument)2 OIdentifiable (com.orientechnologies.orient.core.db.record.OIdentifiable)2