Package org.objectweb.speedo.pobjects.tck

Examples of org.objectweb.speedo.pobjects.tck.InstanceCallbackClass$KeyClass


    Calendar cal = Calendar.getInstance();
    cal.set(1999, 1, 15, 12, 0);
    Date createTime = cal.getTime();
    cal.set(2002, 1, 15, 12, 0);
    Date laterDate = cal.getTime();
    InstanceCallbackClass secondaryObj = new InstanceCallbackClass("secondaryObj", createTime, 2, 2.2, (short)-20, '2', null);
    InstanceCallbackClass primaryObj = new InstanceCallbackClass("primaryObj", laterDate, 1, 1.1, (short)-10, '1', secondaryObj);
    pm.makePersistent(primaryObj);
    pm.makePersistent(secondaryObj);
    Object secondaryObjId = pm.getObjectId(secondaryObj);
    Object primaryObjId = pm.getObjectId(primaryObj);
    t.commit();

    InstanceCallbackClass.performPreClearTests = true;
    t.begin();
    try {
      primaryObj = (InstanceCallbackClass)pm.getObjectById(primaryObjId, true);
      touchFields(primaryObj); // load fields of primaryObj (make it persistent-clean)
     
    } catch (JDOUserException e) {
      logger.log(BasicLevel.ERROR, "Failed to find primaryObj created in previous transaction.  Got JDOUserException " + e);
      fail("CallingJdoPreclear: Failed to find primaryObj created in previous transaction.");

    } catch (JDODataStoreException e) {
      logger.log(BasicLevel.ERROR, "Failed to find primaryObj created in previous transaction.  Got JDOUserException " + e);
      fail("CallingJdoPreclear: Failed to find primaryObj created in previous transaction.");
    }
   
    secondaryObj = primaryObj.nextObj;
    if(secondaryObj == null) {
      logger.log(BasicLevel.ERROR, "Failed to find secondaryObj created in previous transaction using reference from primaryObj.");
      fail("CallingJdoPreclear: Failed to find secondaryObj created in previous transaction.");
    }
    touchFields(secondaryObj);
   
    primaryObj.addChild(secondaryObj)// primaryObj contains one child;  secondaryObj contains none. primaryObj is now dirty
   
    cal.set(2005, 6, 28, 0, 0);
    Date stillLaterDate = cal.getTime();
    InstanceCallbackClass ternaryObj = new InstanceCallbackClass("ternaryObj", stillLaterDate, 3, 3.3, (short)-30, '3', null);
    pm.makePersistent(ternaryObj);
    ternaryObj.addChild(secondaryObj);
    ternaryObj.addChild(primaryObj);
    t.commit();
   
    // verify attributes in what was persistent-clean object--secondaryObj
    checkFieldValues("jdoPreClear attribute access:  ", 2"secondaryObj", createTime, 2.2, (short)-20, '2');
View Full Code Here

TOP

Related Classes of org.objectweb.speedo.pobjects.tck.InstanceCallbackClass$KeyClass

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.