Examples of openSequence()


Examples of com.sleepycat.je.Database.openSequence()

        /* Duplicates not allowed. */

        Database db = openDb("dups", true);
        Transaction txn = txnBegin();
        try {
            db.openSequence(txn, key, config);
            fail();
        } catch (IllegalArgumentException expected) {
            String msg = expected.getMessage();
            assertTrue(msg, msg.indexOf("duplicates") >= 0);
        }
View Full Code Here

Examples of com.sleepycat.je.Database.openSequence()

        /* Range min must be less than max. */

        config.setRange(0, 0);
        try {
            db.openSequence(txn, key, config);
            fail();
        } catch (IllegalArgumentException expected) {
            String msg = expected.getMessage();
            assertTrue(msg, msg.indexOf("less than the maximum") >= 0);
        }
View Full Code Here

Examples of com.sleepycat.je.Database.openSequence()

        /* Initial value must be within range. */

        config.setRange(-10, 10);
        config.setInitialValue(-11);
        try {
            db.openSequence(txn, key, config);
            fail();
        } catch (IllegalArgumentException expected) {
            String msg = expected.getMessage();
            assertTrue(msg, msg.indexOf("out of range") >= 0);
        }
View Full Code Here

Examples of com.sleepycat.je.Database.openSequence()

            String msg = expected.getMessage();
            assertTrue(msg, msg.indexOf("out of range") >= 0);
        }
        config.setInitialValue(11);
        try {
            db.openSequence(txn, key, config);
            fail();
        } catch (IllegalArgumentException expected) {
            String msg = expected.getMessage();
            assertTrue(msg, msg.indexOf("out of range") >= 0);
        }
View Full Code Here

Examples of com.sleepycat.je.Database.openSequence()

        config.setRange(-10, 10);
        config.setCacheSize(21);
        config.setInitialValue(0);
        try {
            db.openSequence(txn, key, config);
            fail();
        } catch (IllegalArgumentException expected) {
            String msg = expected.getMessage();
            assertTrue(msg, msg.indexOf("cache size is larger") >= 0);
        }
View Full Code Here

Examples of com.sleepycat.je.Database.openSequence()

        /* Create with legal range values. */

        config.setRange(1, 2);
        config.setInitialValue(1);
        config.setCacheSize(0);
        Sequence seq = db.openSequence(txn, key, config);

        /* Key must not exist if ExclusiveCreate=true. */

        config.setExclusiveCreate(true);
        try {
View Full Code Here

Examples of com.sleepycat.je.Database.openSequence()

        /* Key must not exist if ExclusiveCreate=true. */

        config.setExclusiveCreate(true);
        try {
            db.openSequence(txn, key, config);
            fail();
        } catch (DatabaseException expected) {
            String msg = expected.getMessage();
            assertTrue(msg, msg.indexOf("already exists") >= 0);
        }
View Full Code Here

Examples of com.sleepycat.je.Database.openSequence()

        /* Key must exist if AllowCreate=false. */

        db.removeSequence(txn, key);
        config.setAllowCreate(false);
        try {
            db.openSequence(txn, key, config);
            fail();
        } catch (DatabaseException expected) {
            String msg = expected.getMessage();
            assertTrue(msg, msg.indexOf("does not exist") >= 0);
        }
View Full Code Here

Examples of com.sleepycat.je.Database.openSequence()

        db.removeSequence(txn, key);
        config.setAllowCreate(true);
        config.setRange(-5, 5);
        config.setInitialValue(-5);
        seq = db.openSequence(txn, key, config);
        for (long i = config.getRangeMin(); i <= config.getRangeMax(); i++) {
            assertEquals(i, seq.get(txn, 1));
        }
        try {
            seq.get(txn, 1);
View Full Code Here

Examples of com.sleepycat.je.Database.openSequence()

        config.setAllowCreate(true);
        config.setAllowCreate(true);
        config.setRange(-5, 5);
        config.setInitialValue(5);
        config.setDecrement(true);
        seq = db.openSequence(txn, key, config);
        for (long i = config.getRangeMax(); i >= config.getRangeMin(); i--) {
            assertEquals(i, seq.get(txn, 1));
        }
        try {
            seq.get(txn, 1);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.