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

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


    protected void insertPCPoints(PersistenceManager pm, int numInsert) {
        Transaction tx = pm.currentTransaction();
        try {
            tx.begin();
            for(int i = 0; i<numInsert; i++) {
                Object pc = new PCPoint(i, i);
                pm.makePersistent(pc);
                inserted.add(pc);
            }
            tx.commit();
            tx = null;
View Full Code Here


    protected void printOutput(Object results, Collection expected) {
        if (!debug)
            return;

        Iterator iter = null;
        PCPoint pcp = null;
        if (results == null) {
            logger.debug("Query returns null");
        }
        if (!(results instanceof Collection)) {
            logger.debug("Query result is not a collection: " +
                         results.getClass().getName());
        }
        logger.debug("Retrived Objects are:");
        iter = ((Collection)results).iterator();
        while (iter.hasNext()) {
            pcp = (PCPoint)iter.next();
            logger.debug("X = " + pcp.getX() + "\tY = " + pcp.getY());
        }
           
        logger.debug("Expected Objects are:");
        iter = ((Collection)expected).iterator();
        while (iter.hasNext()) {
            pcp = (PCPoint)iter.next();
            logger.debug("X = " + pcp.getX() + "\tY = " + pcp.getY());
        }
    }
View Full Code Here

    private void createObjects(PersistenceManager pm) {
        Transaction tx = pm.currentTransaction();
        try {
            tx.setRetainValues(false);
            tx.begin();
            p1   = new PCPoint(1,1);
            p1print = p1.toString();
            p2   = new PCPoint(2,2);
            p3   = new PCPoint2(3,3);
            rect = new PCRect(100, p1, p2);
            pm.makePersistent(p1);
            pm.makePersistent(p2);
            pm.makePersistent(p3);
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

    /** */
    public void testThreadSafe() throws Exception  {
        if(debug) logger.debug("\nSTART testThreadSafe");
        pmf = getPMF();

        p1 = new PCPoint(3,3);

        ThreadExceptionHandler group = new ThreadExceptionHandler();
        Thread[] threads = new Thread[totalThreadCount];
        for (int i=0; i < totalThreadCount; i++) {
            Thread t = new Thread(group, new PMThread(pmf, p1));
View Full Code Here

        }
    }

    /** */
    private PCRect getPersistentNewInstance() {
        PCRect obj = new PCRect(0, new PCPoint(1,5), new PCPoint(7,3));
        pm.makePersistent(obj); // obj should transition to persistent-new
        int curr = currentState(obj);
        if( curr != PERSISTENT_NEW ){
            fail(ASSERTION_FAILED,
                 "StateTransitions: Unable to create persistent-new instance " +
View Full Code Here

        Transaction tx = pm.currentTransaction();
        try {
            tx.begin();
            tx2.begin();
           
            PCPoint p11 = new PCPoint(110, 120);
            PCPoint p12 = new PCPoint(120, 140);
            PCRect rect1 = new PCRect (0, p11, p12);
            pm.makePersistent (rect1);
           
            PCPoint p21 = new PCPoint(210, 220);
            PCPoint p22 = new PCPoint(220, 240);
            PCRect rect2 = new PCRect (0, p21, p22);
            pm2.makePersistent (rect2);
           
            tx.commit();
            tx2.commit();
       
            tx.begin();
            tx2.begin();
           
            PCPoint p11a = findPoint (pm, 110, 120);
            if (p11a != p11) {
                fail(ASSERTION_FAILED,
                     "unexpected PCPoint instance, expected: 110, 120, found: " + p11a.getX() + ", " + p11a.getY());
            }
           
            PCPoint p21a = findPoint (pm2, 210, 220);
            if (p21a != p21) {
                fail(ASSERTION_FAILED,
                     "unexpected PCPoint instance, expected: 210, 220, found: " + p21a.getX() + ", " + p21a.getY());
            }
           
            tx.commit();
            tx = null;
            tx2.commit();
View Full Code Here

        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

        pm = null;
    }

    /** */
    private void  createObjects() {
        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);
    }
View Full Code Here

    private void runTestMakePersistent4(PersistenceManager pm) {
        Transaction tx = pm.currentTransaction();
        if (tx.isActive())
            tx.rollback();

        PCPoint np1 = new PCPoint(1,3);
        try {
            pm.makePersistent(np1);
            fail(ASSERTION_FAILED,
                 "pm.makePersistent outside of a tx should throw a JDOUserException");
        }
View Full Code Here

TOP

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

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.