Package org.apache.jdo.tck.pc.shoppingcart

Examples of org.apache.jdo.tck.pc.shoppingcart.Cart$Oid


        BatchTestRunner.run(DetachAttach.class);
    }

    /** */
    public void testAttachClean() {
        Cart detachedCart = createDetachedInstance(ASSERTION_FAILED);
        pm.currentTransaction().begin();
        Cart attachedCart = (Cart)pm.makePersistent(detachedCart);
        checkCartValues(ASSERTION_FAILED +
                "after attach," + NL, attachedCart, true);
        pm.currentTransaction().commit();
        failOnError();
    }
View Full Code Here


    public void testNullTransientAndUndetachableIsDetachedFalse() {
        pm = getPM();
        pm.currentTransaction().begin();

        assertFalse(ASSERTION_FAILED + "null object is detached", JDOHelper.isDetached(null));
        assertFalse(ASSERTION_FAILED + "transient object is detached", JDOHelper.isDetached(new Cart("bob")));
        assertFalse(ASSERTION_FAILED + "object of class marked not detachabled is detached", JDOHelper.isDetached(new Undetachable()));

        pm.currentTransaction().commit();
    }
View Full Code Here

    public void testDetachableIsDetachedTrue() {
        pm = getPM();
        Transaction txn = pm.currentTransaction();

        Cart c, detached;
        Object oid;
        txn.begin();
        {
            c = new Cart("bob");
            pm.makePersistent(c);
            oid = pm.getObjectId(c);
        }
        txn.commit();
View Full Code Here

    public void testNullTransientAndUndetachableIsDetachedFalse() {
        pm = getPM();
        pm.currentTransaction().begin();

        assertFalse(ASSERTION_FAILED + "null object is detached", JDOHelper.isDetached(null));
        assertFalse(ASSERTION_FAILED + "transient object is detached", JDOHelper.isDetached(new Cart("bob")));
        assertFalse(ASSERTION_FAILED + "object of class marked not detachabled is detached", JDOHelper.isDetached(new Undetachable()));

        pm.currentTransaction().commit();
    }
View Full Code Here

    public void testDetachableIsDetachedTrue() {
        pm = getPM();
        Transaction txn = pm.currentTransaction();

        Cart c, detached;
        Object oid;
        txn.begin();
        {
            c = new Cart("bob");
            pm.makePersistent(c);
            oid = pm.getObjectId(c);
        }
        txn.commit();
View Full Code Here

        BatchTestRunner.run(DetachAttach.class);
    }

    /** */
    public void testAttachDirty() {
        Cart detachedCart = createDetachedInstance(ASSERTION_FAILED);
        pm.currentTransaction().begin();
        cartEntry1.setQuantity(500);
        goldenCartEntry.setQuantity(500);
        Cart attachedCart = (Cart)pm.makePersistent(detachedCart);
        checkCartValues(ASSERTION_FAILED +
                "after attach," + NL, attachedCart, true);
        pm.currentTransaction().commit();
        pm.currentTransaction().begin();
        Cart persistentCart = (Cart)pm.getObjectById(cart1oid);
        checkCartValues(ASSERTION_FAILED +
                "after attach, commit, begin, getObjectById," + NL,
                persistentCart, true);
        pm.currentTransaction().commit();
        failOnError();
View Full Code Here

    /** */
    public void testDetachSerialize() {
        getPM().currentTransaction().begin();
        setCartFetchGroups();
        //pm.retrieveAll(cartClosure);
        Cart cartDetached = (Cart)detachClosure(cart1);
        checkCartValues(ASSERTION_FAILED + "after deserializing cart," + NL,
                cartDetached);
        pm.currentTransaction().commit();
        failOnError();
    }
View Full Code Here

        addTearDownClass(Cart.class);
        addTearDownClass(Product.class);
        addTearDownClass(Undetachable.class);
       
        Product goldenProduct = new Product("PRODUCT1", "Product 1");
        goldenCart = new Cart("142857");
        goldenCartEntry =
                goldenCart.newCartEntry(goldenProduct, 100);

        product1 = new Product("PRODUCT1", "Product 1");
        cart1 = new Cart("142857");
        cartEntry1 = new CartEntry(
                cart1, goldenCartEntry.getId(), product1, 100);
        cartClosure = new Object[]
            {cart1, cartEntry1, product1};
       
View Full Code Here

        while (cartEntries.hasNext()) {
            CartEntry goldenCartEntry = (CartEntry)goldenCartEntries.next();
            CartEntry cartEntry = (CartEntry)cartEntries.next();
            checkState(location + "CartEntry instance", cartEntry,
                    persistent);
            Cart cartEntryCart = cartEntry.getCart();
            if (cartEntryCart != cart) {
                reportDifference(location +
                        " incorrect value for cartEntry.cart",
                        cart, cartEntryCart);
            }
View Full Code Here

    /** */
    public void testDetachCopy() {
        getPM().currentTransaction().begin();
        setCartFetchGroups();
        //pm.retrieveAll(cartClosure);
        Cart cartDetached = (Cart)pm.detachCopy(cart1);
        checkCartValues(ASSERTION_FAILED +
                "after detachCopy," + NL, cartDetached);
        pm.currentTransaction().commit();
        failOnError();
    }
View Full Code Here

TOP

Related Classes of org.apache.jdo.tck.pc.shoppingcart.Cart$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.