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

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


    }

    public void testNonDefaultLockGroupFailure1() {
        OpenJPAEntityManager pm1 = getPM(false, false);
        startTx(pm1);
        LockGroupPC pc1 = (LockGroupPC) pm1.find(LockGroupPC.class, oid);
        pc1.setLockGroup0IntField(1);

        OpenJPAEntityManager pm2 = getPM(false, false);
        startTx(pm2);
        LockGroupPC pc2 = (LockGroupPC) pm2.find(LockGroupPC.class, oid);
        pc2.setLockGroup0IntField(2);

        endTx(pm1);
        endEm(pm1);

        try {
View Full Code Here


    }

    public void testNonDefaultLockGroupFailure2() {
        OpenJPAEntityManager pm1 = getPM(false, false);
        startTx(pm1);
        LockGroupPC pc1 = (LockGroupPC) pm1.find(LockGroupPC.class, oid);
        pc1.setLockGroup0IntField(1);

        OpenJPAEntityManager pm2 = getPM(false, false);
        startTx(pm2);
        LockGroupPC pc2 = (LockGroupPC) pm2.find(LockGroupPC.class, oid);
        pc2.setLockGroup0StringField("pm2");

        endTx(pm1);
        endEm(pm1);

        try {
View Full Code Here

    }

    public void testMultipleLockGroupSuccess1() {
        OpenJPAEntityManager pm1 = getPM(false, false);
        startTx(pm1);
        LockGroupPC pc1 = (LockGroupPC) pm1.find(LockGroupPC.class, oid);
        pc1.setDefaultLockGroupStringField("pm1 value");
        pc1.setExplicitDefaultLockGroupIntField(1);

        OpenJPAEntityManager pm2 = getPM(false, false);
        startTx(pm2);
        LockGroupPC pc2 = (LockGroupPC) pm2.find(LockGroupPC.class, oid);
        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

    }

    public void testMultipleLockGroupSuccess2() {
        OpenJPAEntityManager pm1 = getPM(false, false);
        startTx(pm1);
        LockGroupPC pc1 = (LockGroupPC) pm1.find(LockGroupPC.class, oid);
        pc1.setDefaultLockGroupStringField("pm1 value");
        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

//    }

    public void testAttachDetachSuccess()
        throws Exception {
        OpenJPAEntityManager pm1 = getPM(false, false);
        LockGroupPC pc1 = (LockGroupPC) pm1.find(LockGroupPC.class, oid);
        Object detached = pm1.detach(pc1);
        startTx(pm1);
        pc1.setLockGroup0IntField(1);
        pc1.setUnlockedStringField("pm1 changed value");
        endTx(pm1);
        endEm(pm1);

        /*
         // won't work without non-transient detached state
         ByteArrayOutputStream baos = new ByteArrayOutputStream ();
         ObjectOutputStream oos = new ObjectOutputStream (baos);
         oos.writeObject (detached);
         oos.close ();
         baos.close ();

         ByteArrayInputStream bais =
             new ByteArrayInputStream (baos.toByteArray ());
         ObjectInputStream ois = new ObjectInputStream (bais);
         LockGroupPC clone = (LockGroupPC) ois.readObject ();
        */
        LockGroupPC clone = (LockGroupPC) detached;
        clone.setLockGroup1IntField(2);
        clone.setUnlockedStringField("pm2 value");

        OpenJPAEntityManager pm2 = getPM(false, false);
        startTx(pm2);
        pm2.merge(clone);
        endTx(pm2);
View Full Code Here

    }

    public void testAttachDetachFailure()
        throws Exception {
        OpenJPAEntityManager pm1 = getPM(false, false);
        LockGroupPC pc1 = (LockGroupPC) pm1.find(LockGroupPC.class, oid);
        Object detached = pm1.detach(pc1);
        startTx(pm1);
        pc1.setLockGroup0IntField(1);
        endTx(pm1);
        endEm(pm1);

        /*
         // won't work without non-transient detached state
         ByteArrayOutputStream baos = new ByteArrayOutputStream ();
         ObjectOutputStream oos = new ObjectOutputStream (baos);
         oos.writeObject (detached);
         oos.close ();
         baos.close ();

         ByteArrayInputStream bais =
             new ByteArrayInputStream (baos.toByteArray ());
         ObjectInputStream ois = new ObjectInputStream (bais);
         LockGroupPC clone = (LockGroupPC) ois.readObject ();
        */
        LockGroupPC clone = (LockGroupPC) detached;
        clone.setLockGroup0IntField(2);

        OpenJPAEntityManager pm2 = getPM(false, false);
        startTx(pm2);
        boolean failed = false;
        try {
View Full Code Here

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

        OpenJPAEntityManager pm = getPM(false, false);
        startTx(pm);
        Object o = new LockGroupPC();
        pm.persist(o);
        endTx(pm);
        oid = pm.getObjectId(o);
        endEm(pm);
    }
View Full Code Here

    }

    public void testDefaultLockGroupFailure1() {
        OpenJPAEntityManager pm1 = getPM(false, false);
        startTx(pm1);
        LockGroupPC pc1 = (LockGroupPC) pm1.find(LockGroupPC.class, oid);
        pc1.setDefaultLockGroupStringField("pm1 value");

        OpenJPAEntityManager pm2 = getPM(false, false);
        startTx(pm2);
        LockGroupPC pc2 = (LockGroupPC) pm2.find(LockGroupPC.class, oid);
        pc2.setDefaultLockGroupStringField("pm2 value");

        endTx(pm1);
        endEm(pm1);

        try {
View Full Code Here

    }

    public void testDefaultLockGroupFailure2() {
        OpenJPAEntityManager pm1 = getPM(false, false);
        startTx(pm1);
        LockGroupPC pc1 = (LockGroupPC) pm1.find(LockGroupPC.class, oid);
        pc1.setDefaultLockGroupStringField("pm1 value");

        OpenJPAEntityManager pm2 = getPM(false, false);
        startTx(pm2);
        LockGroupPC pc2 = (LockGroupPC) pm2.find(LockGroupPC.class, oid);
        pc2.setExplicitDefaultLockGroupIntField(2);

        endTx(pm1);
        endEm(pm1);

        try {
View Full Code Here

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

        OpenJPAEntityManager pm = getPM(false, false);
        startTx(pm);
        Object o = new LockGroupPC();
        pm.persist(o);
        endTx(pm);
        oid = pm.getObjectId(o);
        endEm(pm);
    }
View Full Code Here

TOP

Related Classes of org.apache.openjpa.persistence.kernel.common.apps.LockGroupPC

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.