Package org.apache.jdo.tck.pc.mylib

Examples of org.apache.jdo.tck.pc.mylib.PCPoint


        Query q = pm.newQuery (PCPoint.class);
        q.declareParameters ("int px, int py");
        q.setFilter ("x == px & y == py");
        Collection results = (Collection)q.execute (new Integer(x), new Integer(y));
        Iterator it = results.iterator();
        PCPoint ret = (PCPoint)it.next();
        return ret;
    }
View Full Code Here


    /** */
    private void createObjects(PersistenceManager pm) {
        Transaction tx = pm.currentTransaction();
        try {
            tx.begin();
            p1 = new PCPoint(1,3);
            p2 = new PCPoint(2,4);
            p3 = new PCPoint(3,5);
            p4 = new PCPoint(4,6);
            p5 = new PCPoint(5,7);
           
            pm.makePersistent(p1);
            pm.makePersistent(p2);
            pm.makePersistent(p3);
            pm.makePersistent(p4);
View Full Code Here

    private void createObjects(PersistenceManager pm) {
        Transaction tx =  pm.currentTransaction();
        try {
            tx.begin();
            p1 = new PCPoint(1,3);
            p2 = new PCPoint(2,4);
            p3 = new PCPoint(3,5);
            p4 = new PCPoint(4,6);
            p5 = new PCPoint(5,7);

            pm.makePersistent(p1);
            pm.makePersistent(p2);
            pm.makePersistent(p3);
            pm.makePersistent(p4);
View Full Code Here

        pm = getPM();
        Transaction tx = pm.currentTransaction();
        try {
            tx.begin();

            PCPoint p1 = new PCPoint (1,3);
            pm.makePersistent(p1);
            int curr = currentState(p1);

            Object oid = pm.getObjectId(p1);
            tx.commit();
View Full Code Here

     * In setup, create a persistent instance and get its oid.
     * The oid is a valid parameter to the cache APIs.
     */
    protected void localSetUp() {
        addTearDownClass(PCPoint.class);
        PCPoint point = new PCPoint(50, 100);
        getPM().currentTransaction().begin();
        pm.makePersistent(point);
        pointoid = pm.getObjectId(point);
        pointoidCollection = new HashSet();
        pointoidCollection.add(pointoid);
View Full Code Here

            tx.begin();
   
            // Construct "count" persistent instances, and save them in a
            // hashset.
            for (int i = 0; i < count; ++i) {
                PCPoint p = new PCPoint (i, count-i);
                pm.makePersistent(p);
                instances.add(p);
            }
   
            // For all new persistent instances, get the object ids and
View Full Code Here

    public void test() {
        pm = getPM();
        Transaction tx = pm.currentTransaction();
        tx.setRestoreValues(false); //This should cause eviction of transactional instances when transaction is later rolled back.
        tx.begin();   
        PCPoint p1 = new PCPoint (1,3);
        pm.makePersistent(p1);
        Object oid = pm.getObjectId(p1);
        tx.rollback();

        tx.begin();
        try {
            PCPoint p2 = (PCPoint) pm.getObjectById(oid, true);
            fail(ASSERTION_FAILED, "pm.getObjectById(oid, true) should throw JDOObjectNotFoundException, if oid refers to an non existing object");
        }
        catch (JDOObjectNotFoundException ex) {
            // expected exception
        }
View Full Code Here

        pm = getPM();
        Transaction tx = pm.currentTransaction();
        try {
            tx.begin();

            PCPoint p1 = new PCPoint (1,3);
            pm.makePersistent(p1);
            Object oid = pm.getObjectId(p1);
            pm.deletePersistent(p1);
            tx.commit();
           
            tx.begin();
            try {
                PCPoint p2 = (PCPoint) pm.getObjectById(oid, true);
                fail(ASSERTION_FAILED,
                     "pm.getObjectById(oid, true) should throw JDOObjectNotFoundException, if oid refers to an non existing object");
            }
            catch (JDOObjectNotFoundException ex) {
                // expected exception
View Full Code Here

        pm = null;
    }

    /** */
    private void createObjects(PersistenceManager pm) {
        p1 = new PCPoint(1,3);
        p2 = new PCPoint(2,4);
        p3 = new PCPoint(3,5);
        p4 = new PCPoint(4,6);
        p5 = new PCPoint (5,7);
       
        col1.add(p2);
        col1.add(p3);
       
        col2.add(p4);
View Full Code Here

    /** */
    private void runTestTransientTransactional1(PersistenceManager pm) {
        Transaction tx = pm.currentTransaction();
        if (debug) logger.debug(" ** in runTestTransientTransactional1() ");
        try {
            PCPoint p1 = new PCPoint(8,8);
            p1.setX(100);
            tx.begin();
            p1.setX(200);
            pm.makeTransactional(p1);
            p1.setX(300);
            tx.commit();
            tx = null;

            assertGetX (p1, 300, ASSERTION_FAILED, "runTestTransientTransactional1");
        }
View Full Code Here

TOP

Related Classes of org.apache.jdo.tck.pc.mylib.PCPoint

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.