Package org.apache.openjpa.persistence.query.common.apps

Examples of org.apache.openjpa.persistence.query.common.apps.QTimeout


            em = emf.createEntityManager();
            assertNotNull(em);

            try {
                long startTime = System.currentTimeMillis();
                QTimeout qt = em.find(QTimeout.class, new Integer(1));
                em.getTransaction().begin();
                qt.setStringField("updated");
                em.flush();
                em.getTransaction().commit();
                long endTime = System.currentTimeMillis();
                long runTime = endTime - startTime;
                getLog().trace("testQueryTimeout6() - EM find/update runTime" +
                    " msecs=" + runTime);
                // Hack - Windows sometimes returns 1999 instead of 2000+
                assertTrue("Should have taken 2+ secs, but was msecs=" +
                    runTime, runTime > 1900);
                em.clear();
                qt = em.find(QTimeout.class, new Integer(1));
                assertEquals("Verify the entity was updated.",
                    qt.getStringField(), "updated");
            } catch (Exception e) {
                // setting a timeout property via PU or Map shouldn't cause a
                // timeout exception
                fail("Unexpected testQueryTimeout6() exception = " + e);
            }
View Full Code Here


     * Internal setup convenience method to create some entities for testing
     */
    private void setupCreateEntities() {
        getLog().trace("setupCreateEntities()");
        String[] _strings = new String[] { "a", "b", "c" };
        QTimeout qt = null;
        EntityManager em = null;

        // create some initial entities
        try {
            em = emf.createEntityManager();
            assertNotNull(em);
            getLog().trace("setupCreateEntities() - creating 3 Qtimeout");
            em.getTransaction().begin();
            for (int i = 0; i < _strings.length; i++) {
                qt = new QTimeout(i, _strings[i]);
                em.persist(qt);
            }
            em.getTransaction().commit();
        } catch (Exception e) {
            fail("setupCreateEntities() - Unexpected Exception - " + e);
View Full Code Here

            em = emf.createEntityManager();
            assertNotNull(em);

            try {
                long startTime = System.currentTimeMillis();
                QTimeout qt = em.find(QTimeout.class, new Integer(1));
                em.getTransaction().begin();
                qt.setStringField("updated");
                em.flush();
                em.getTransaction().commit();
                long endTime = System.currentTimeMillis();
                long runTime = endTime - startTime;
                getLog().trace("testQueryTimeout6() - EM find/update runTime" +
                    " msecs=" + runTime);
                // Hack - Windows sometimes returns 1999 instead of 2000+
                assertTrue("Should have taken 2+ secs, but was msecs=" +
                    runTime, runTime > 1900);
                em.clear();
                qt = em.find(QTimeout.class, new Integer(1));
                assertEquals("Verify the entity was updated.",
                    qt.getStringField(), "updated");
            } catch (Exception e) {
                // setting a timeout property via PU or Map shouldn't cause a
                // timeout exception
                fail("Unexpected testQueryTimeout6() exception = " + e);
            }
View Full Code Here

     * Internal setup convenience method to create some entities for testing
     */
    private void setupCreateEntities() {
        getLog().trace("setupCreateEntities()");
        String[] _strings = new String[] { "a", "b", "c" };
        QTimeout qt = null;
        EntityManager em = null;

        // create some initial entities
        try {
            em = emf.createEntityManager();
            assertNotNull(em);
            getLog().trace("setupCreateEntities() - creating 3 Qtimeout");
            em.getTransaction().begin();
            for (int i = 0; i < _strings.length; i++) {
                qt = new QTimeout(i, _strings[i]);
                em.persist(qt);
            }
            em.getTransaction().commit();
        } catch (Exception e) {
            fail("setupCreateEntities() - Unexpected Exception - " + e);
View Full Code Here

            em = emf.createEntityManager();
            assertNotNull(em);

            try {
                long startTime = System.currentTimeMillis();
                QTimeout qt = em.find(QTimeout.class, new Integer(1));
                em.getTransaction().begin();
                qt.setStringField("updated");
                em.flush();
                em.getTransaction().commit();
                long endTime = System.currentTimeMillis();
                long runTime = endTime - startTime;
                getLog().trace("testQueryTimeout6() - EM find/update runTime" +
                    " msecs=" + runTime);
                // Hack - Windows sometimes returns 1999 instead of 2000+
                assertTrue("Should have taken 2+ secs, but was msecs=" +
                    runTime, runTime > 1900);
                em.clear();
                qt = em.find(QTimeout.class, new Integer(1));
                assertEquals("Verify the entity was updated.",
                    qt.getStringField(), "updated");
            } catch (Exception e) {
                // setting a timeout property via PU or Map shouldn't cause a
                // timeout exception
                fail("Unexpected testQueryTimeout6() exception = " + e);
            }
View Full Code Here

     * Internal setup convenience method to create some entities for testing
     */
    private void setupCreateEntities() {
        getLog().trace("setupCreateEntities()");
        String[] _strings = new String[] { "a", "b", "c" };
        QTimeout qt = null;
        EntityManager em = null;

        // create some initial entities
        try {
            em = emf.createEntityManager();
            assertNotNull(em);
            getLog().trace("setupCreateEntities() - creating 3 Qtimeout");
            em.getTransaction().begin();
            for (int i = 0; i < _strings.length; i++) {
                qt = new QTimeout(i, _strings[i]);
                em.persist(qt);
            }
            em.getTransaction().commit();
        } catch (Exception e) {
            fail("setupCreateEntities() - Unexpected Exception - " + e);
View Full Code Here

            em = emf.createEntityManager();
            assertNotNull(em);

            try {
                long startTime = System.currentTimeMillis();
                QTimeout qt = em.find(QTimeout.class, new Integer(1));
                em.getTransaction().begin();
                qt.setStringField("updated");
                em.flush();
                em.getTransaction().commit();
                long endTime = System.currentTimeMillis();
                long runTime = endTime - startTime;
                getLog().trace("testQueryTimeout6() - EM find/update runTime" +
                    " msecs=" + runTime);
                // Hack - Windows sometimes returns 1999 instead of 2000+
                assertTrue("Should have taken 2+ secs, but was msecs=" +
                    runTime, runTime > 1900);
                em.clear();
                qt = em.find(QTimeout.class, new Integer(1));
                assertEquals("Verify the entity was updated.",
                    qt.getStringField(), "updated");
            } catch (Exception e) {
                // setting a timeout property via PU or Map shouldn't cause a
                // timeout exception
                fail("Unexpected testQueryTimeout6() exception = " + e);
            }
View Full Code Here

     * Internal setup convenience method to create some entities for testing
     */
    private void setupCreateEntities() {
        getLog().trace("setupCreateEntities()");
        String[] _strings = new String[] { "a", "b", "c" };
        QTimeout qt = null;
        EntityManager em = null;

        // create some initial entities
        try {
            em = emf.createEntityManager();
            assertNotNull(em);
            getLog().trace("setupCreateEntities() - creating 3 Qtimeout");
            em.getTransaction().begin();
            for (int i = 0; i < _strings.length; i++) {
                qt = new QTimeout(i, _strings[i]);
                em.persist(qt);
            }
            em.getTransaction().commit();
        } catch (Exception e) {
            fail("setupCreateEntities() - Unexpected Exception - " + e);
View Full Code Here

TOP

Related Classes of org.apache.openjpa.persistence.query.common.apps.QTimeout

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.