Package com.impetus.client.crud.entities

Examples of com.impetus.client.crud.entities.MongoDBCappedEntity


        Assert.assertTrue(indexInfo.isEmpty() || indexInfo.size() == 1);

        // Insert "Max" records successfully
        for (int i = 1; i <= max; i++)
        {
            MongoDBCappedEntity entity = new MongoDBCappedEntity();
            entity.setPersonId(i + "");
            entity.setPersonName("Person_Name_" + i);
            entity.setAge((short) i);

            em.persist(entity);
        }

        // Insert one more record and check whether it replaces first one
        MongoDBCappedEntity entity = new MongoDBCappedEntity();
        entity.setPersonId((max + 1) + "");
        entity.setPersonName("Person_Name_" + (max + 1));
        entity.setAge((short) (max + 1));
        em.persist(entity);

        em.clear();
        MongoDBCappedEntity firstRecord = em.find(MongoDBCappedEntity.class, "1");
        Assert.assertNull(firstRecord);

        MongoDBCappedEntity lastRecord = em.find(MongoDBCappedEntity.class, "" + (max + 1));
        Assert.assertNotNull(lastRecord);

        // Deleting documents within a capped collection should simply ignore,
        // as is done by native API
        em.remove(lastRecord);
View Full Code Here

TOP

Related Classes of com.impetus.client.crud.entities.MongoDBCappedEntity

Copyright © 2018 www.massapicom. 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.