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

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


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

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

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

        // Insert random value of String
        StudentMongoString student = new StudentMongoString();
        student.setAge((Short) getRandomValue(short.class));
        student.setId((String) getRandomValue(String.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();

        StudentMongoString studentMax = em.find(StudentMongoString.class, getMaxValue(String.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();
        }
        StudentMongoString studentMin = em.find(StudentMongoString.class, getMinValue(String.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();
        }
        StudentMongoString student = em.find(StudentMongoString.class, getRandomValue(String.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();
        StudentMongoString student = em.find(StudentMongoString.class, getMaxValue(String.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();
        }
        StudentMongoString newStudent = em.find(StudentMongoString.class, getMaxValue(String.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();

        StudentMongoString studentMax = em.find(StudentMongoString.class, getMaxValue(String.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();
View Full Code Here

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

        if (!useSameEm)
        {
            em.close();
            em = emf.createEntityManager();
        }
        StudentMongoString newStudent = em.find(StudentMongoString.class, getRandomValue(String.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.StudentMongoString

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.