Examples of RuntimeTest1


Examples of org.apache.openjpa.persistence.kernel.common.apps.RuntimeTest1

        pm.setOptimistic(true);
        pm.validateChanges();        // no-op outside trans
        startTx(pm);
        boolean hasConn = hasConnection(pm);

        RuntimeTest1 pc = (RuntimeTest1) pm.find(RuntimeTest1.class, _oid);
        pc.setIntField1(100);

        RuntimeTest1 npc = new RuntimeTest1();
        npc.setIntField(2);
        npc.setIntField1(2);
        pm.persist(npc);

        pm.validateChanges();
        if (!hasConn)
            assertFalse(hasConnection(pm));

        assertEquals(100, pc.getIntField1());
        assertTrue(pm.isPersistent(npc));

        pc.setIntField1(200);
        npc.setIntField1(300);
        endTx(pm);

        assertEquals(200, pc.getIntField1());
        assertTrue(pm.isPersistent(npc));
        assertEquals(300, npc.getIntField1());
        endEm(pm);
    }
View Full Code Here

Examples of org.apache.openjpa.persistence.kernel.common.apps.RuntimeTest1

        pm.setOptimistic(true);
        pm.validateChanges();        // no-op outside trans
        startTx(pm);
        boolean hasConn = hasConnection(pm);

        RuntimeTest1 pc = (RuntimeTest1) pm.find(RuntimeTest1.class, _oid);
        pc.setIntField1(100);

        RuntimeTest1 npc = new RuntimeTest1();
        pm.persist(npc);
        Object noid = pm.getObjectId(npc);

        pm.validateChanges();
        if (!hasConn)
            assertFalse(hasConnection(pm));

        assertEquals(100, pc.getIntField1());
        assertTrue(pm.isPersistent(npc));

        pc.setIntField1(200);
        npc.setIntField1(300);
        rollbackTx(pm);

        assertEquals(1, pc.getIntField1());
        assertFalse(pm.isPersistent(npc));
        assertEquals(0, npc.getIntField1());
        endEm(pm);

        pm = getPM();
        try {
            RuntimeTest1 temp =
                (RuntimeTest1) pm.find(RuntimeTest1.class, noid);

            fail("Object should not exist." + temp.getIntField() + "::" +
                temp.getIntField1());
        } catch (Exception jonfe) {
        }
    }
View Full Code Here

Examples of org.apache.openjpa.persistence.kernel.common.apps.RuntimeTest1

    public void testSimple() {
        // test create
        {
            OpenJPAEntityManager pm = getPM();
            startTx(pm);
            pm.persist(new RuntimeTest1("testSimple", 12));
            endTx(pm);
            endEm(pm);
        }

        // test Query
        {
            OpenJPAEntityManager pm = getPM();
            startTx(pm);
            String theQuery =
                "SELECT r FROM RuntimeTest1 r WHERE r.stringField = \'testSimple\'";
            OpenJPAQuery query = pm.createQuery(theQuery);
            List list = query.getResultList();
            assertSize(1, list);
            endTx(pm);
            endEm(pm);
        }

        // test Update
        {
            OpenJPAEntityManager pm = getPM();
            startTx(pm);
            String theQuery =
                "SELECT r FROM RuntimeTest1 r WHERE r.stringField = \'testSimple\'";
            OpenJPAQuery query = pm.createQuery(theQuery);
            RuntimeTest1 toUpdate = (RuntimeTest1) query.getSingleResult();
            toUpdate.setStringField("testSimple2");
            endTx(pm);
            endEm(pm);

            pm = getPM();
            startTx(pm);
View Full Code Here

Examples of org.apache.openjpa.persistence.kernel.common.apps.RuntimeTest1

    public void setUp() {
        deleteAll(RuntimeTest1.class);

        pm = getPM(true, false);
        startTx(pm);
        a = new RuntimeTest1("foo", 10);
        pm.persist(a);
        oid = pm.getObjectId(a);
    }
View Full Code Here

Examples of org.apache.openjpa.persistence.kernel.common.apps.RuntimeTest1

    }

    public void setUp() {
        deleteAll(RuntimeTest1.class);

        RuntimeTest1 test1 = new RuntimeTest1();
        test1.setIntField(1);
        RuntimeTest2 test2 = new RuntimeTest2();
        test2.setIntField(2);
        test2.setIntField2(2);
        RuntimeTest3 test3 = new RuntimeTest3();
        test3.setIntField(3);
View Full Code Here

Examples of org.apache.openjpa.persistence.kernel.common.apps.RuntimeTest1

        assertEquals(1, test2Count);
        assertEquals(1, test3Count);
    }

    public void testContainsNewlyPersisted() {
        RuntimeTest1 test1 = new RuntimeTest1();
        RuntimeTest1 test2 = new RuntimeTest2();

        OpenJPAEntityManager pm = getPM();

        // pcl: 14 Oct 2003: default in 3.0 is now true, but this test
        // assumes false somewhere.
View Full Code Here

Examples of org.apache.openjpa.persistence.kernel.common.apps.RuntimeTest1

        startTx(pm);
        try {
            RuntimeTest2 test2 =
                (RuntimeTest2) pm.find(RuntimeTest2.class, _oid2);
            pm.remove(test2);
            RuntimeTest1 test1 = new RuntimeTest1();
            pm.persist(test1);
            pm.remove(test1);

            Extent ext = pm.createExtent(RuntimeTest1.class, true);
            boolean foundOid1 = false;
View Full Code Here

Examples of org.apache.openjpa.persistence.kernel.common.apps.RuntimeTest1

        pc2.setLockGroup0IntField(2);

        OpenJPAEntityManager pm3 = getPM(false, false);
        startTx(pm3);
        LockGroupPC pc3 = (LockGroupPC) pm3.find(LockGroupPC.class, oid);
        pc3.setLockGroup1RelationField(new RuntimeTest1());

        endTx(pm1);
        endEm(pm1);

        endTx(pm2);
View Full Code Here

Examples of org.apache.openjpa.persistence.kernel.common.apps.RuntimeTest1

        pc1.setLockGroup0IntField(1);

        OpenJPAEntityManager pm2 = getPM(false, false);
        startTx(pm2);
        LockGroupPC pc2 = (LockGroupPC) pm2.find(LockGroupPC.class, oid);
        pc2.setLockGroup1RelationField(new RuntimeTest1());

        endTx(pm2);
        endEm(pm2);

        endTx(pm1);
View Full Code Here

Examples of org.apache.openjpa.persistence.kernel.common.apps.RuntimeTest1

    public void setUp() {
        deleteAll(RuntimeTest1.class);
        OpenJPAEntityManager pm = getPM();
        startTx(pm);
        RuntimeTest1 rt1 = new RuntimeTest1("TestInitialValueFetching", 10);
        pm.persist(rt1);

        rt1.setDateField(new Date());
        endTx(pm);
        endEm(pm);
    }
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.