Package com.impetus.client.crud.datatypes.entities

Examples of com.impetus.client.crud.datatypes.entities.StudentMongoInt


    public void testPersist(boolean useSameEm)
    {
        EntityManager em = emf.createEntityManager();

        // Insert max value of int
        StudentMongoInt studentMax = new StudentMongoInt();
        studentMax.setAge((Short) getMaxValue(short.class));
        studentMax.setId((Integer) getMaxValue(int.class));
        studentMax.setName((String) getMaxValue(String.class));
        em.persist(studentMax);

        // Insert min value of int
        StudentMongoInt studentMin = new StudentMongoInt();
        studentMin.setAge((Short) getMinValue(short.class));
        studentMin.setId((Integer) getMinValue(int.class));
        studentMin.setName((String) getMinValue(String.class));
        em.persist(studentMin);

        // Insert random value of int
        StudentMongoInt student = new StudentMongoInt();
        student.setAge((Short) getRandomValue(short.class));
        student.setId((Integer) getRandomValue(int.class));
        student.setName((String) getRandomValue(String.class));
        em.persist(student);
        em.close();
    }
View Full Code Here


    public void testFindById(boolean useSameEm)
    {
        EntityManager em = emf.createEntityManager();

        StudentMongoInt studentMax = em.find(StudentMongoInt.class, getMaxValue(int.class));
        Assert.assertNotNull(studentMax);
        Assert.assertEquals(getMaxValue(short.class), studentMax.getAge());
        Assert.assertEquals(getMaxValue(String.class), studentMax.getName());

        if (!useSameEm)
        {
            em.close();
            em = emf.createEntityManager();
        }
        StudentMongoInt studentMin = em.find(StudentMongoInt.class, getMinValue(int.class));
        Assert.assertNotNull(studentMin);
        Assert.assertEquals(getMinValue(short.class), studentMin.getAge());
        Assert.assertEquals(getMinValue(String.class), studentMin.getName());

        if (!useSameEm)
        {
            em.close();
            em = emf.createEntityManager();
        }
        StudentMongoInt student = em.find(StudentMongoInt.class, getRandomValue(int.class));
        Assert.assertNotNull(student);
        Assert.assertEquals(getRandomValue(short.class), student.getAge());
        Assert.assertEquals(getRandomValue(String.class), student.getName());
        em.close();
    }
View Full Code Here

    }

    public void testMerge(boolean useSameEm)
    {
        EntityManager em = emf.createEntityManager();
        StudentMongoInt student = em.find(StudentMongoInt.class, getMaxValue(int.class));
        Assert.assertNotNull(student);
        Assert.assertEquals(getMaxValue(short.class), student.getAge());
        Assert.assertEquals(getMaxValue(String.class), student.getName());

        student.setName("Kuldeep");
        em.merge(student);
        if (!useSameEm)
        {
            em.close();
            em = emf.createEntityManager();
        }
        StudentMongoInt newStudent = em.find(StudentMongoInt.class, getMaxValue(int.class));
        Assert.assertNotNull(newStudent);
        Assert.assertEquals(getMaxValue(short.class), newStudent.getAge());
        Assert.assertEquals("Kuldeep", newStudent.getName());
    }
View Full Code Here

    public void testDelete(boolean useSameEm)
    {
        EntityManager em = emf.createEntityManager();

        StudentMongoInt studentMax = em.find(StudentMongoInt.class, getMaxValue(int.class));
        Assert.assertNotNull(studentMax);
        Assert.assertEquals(getMaxValue(short.class), studentMax.getAge());
        Assert.assertEquals("Kuldeep", studentMax.getName());
        em.remove(studentMax);
        if (!useSameEm)
        {
            em.close();
            em = emf.createEntityManager();
        }
        studentMax = em.find(StudentMongoInt.class, getMaxValue(int.class));
        Assert.assertNull(studentMax);
        if (!useSameEm)
        {
            em.close();
            em = emf.createEntityManager();
        }

        StudentMongoInt studentMin = em.find(StudentMongoInt.class, getMinValue(int.class));
        Assert.assertNotNull(studentMin);
        Assert.assertEquals(getMinValue(short.class), studentMin.getAge());
        Assert.assertEquals("Kuldeep", studentMin.getName());
        em.remove(studentMin);
        if (!useSameEm)
        {
            em.close();
            em = emf.createEntityManager();
View Full Code Here

        if (!useSameEm)
        {
            em.close();
            em = emf.createEntityManager();
        }
        StudentMongoInt newStudent = em.find(StudentMongoInt.class, getRandomValue(int.class));
        Assert.assertNull(newStudent);
        em.close();
    }
View Full Code Here

        if (!useSameEm)
        {
            em.close();
            em = emf.createEntityManager();
        }
        StudentMongoInt newStudent = em.find(StudentMongoInt.class, getRandomValue(int.class));
        Assert.assertNotNull(newStudent);
        Assert.assertEquals(getRandomValue(short.class), newStudent.getAge());
        Assert.assertEquals("Vivek", newStudent.getName());
        em.close();
    }
View Full Code Here

TOP

Related Classes of com.impetus.client.crud.datatypes.entities.StudentMongoInt

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.