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

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


        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 testAttachClean() {
        Cart detachedCart = createDetachedInstance(ASSERTION_FAILED);
        pm.setCopyOnAttach(false);
        pm.currentTransaction().begin();
        Cart attachedCart = (Cart)pm.makePersistent(detachedCart);
        assertTrue("Expected attached object to == detached object.",
                attachedCart == detachedCart);
        pm.currentTransaction().commit();
    }
View Full Code Here

        pm.currentTransaction().commit();
    }

    /** */
    public void testAttachDirty() {
        Cart detachedCart = createDetachedInstance(ASSERTION_FAILED);
        pm.setCopyOnAttach(false);
        pm.currentTransaction().begin();
        cartEntry1.setQuantity(500);
        goldenCartEntry.setQuantity(500);
        Cart attachedCart = (Cart)pm.makePersistent(detachedCart);
        assertTrue("Expected attached object to == detached object.",
                attachedCart == detachedCart);
        pm.currentTransaction().commit();
    }
View Full Code Here

    }

    /**
     */
    public void testNegativeAttachClean() {
        Cart detachedCart = createDetachedInstance(ASSERTION_FAILED);
        pm.setCopyOnAttach(false);
        pm.currentTransaction().begin();
        // Obtain new instance of cart1
        pm.getObjectById(cart1oid, false);
        try {
            Cart attachedCart = (Cart)pm.makePersistent(detachedCart);
            fail("Expected JDOUserException. Object with same identity as "
                    + "attached object is already in the cache.");
        } catch (JDOUserException jdoe) {
            // expected exception
        }
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

        setCartFetchGroups();
        //pm.retrieveAll(cartClosure);
        Collection instances = new HashSet();
        instances.add(cart1);
        Collection detached = pm.detachCopyAll(instances);
        Cart cartDetached = (Cart)detached.iterator().next();
        checkCartValues(ASSERTION_FAILED +
                "after detachCopyAll(Collection)," + NL, cartDetached);
        pm.currentTransaction().commit();
        failOnError();
    }
View Full Code Here

        getPM().currentTransaction().begin();
        setCartFetchGroups();
        //pm.retrieveAll(cartClosure);
        Object[] instances = new Object[]{cart1};
        Object[] detached = pm.detachCopyAll(instances);
        Cart cartDetached = (Cart)detached[0];
        checkCartValues(ASSERTION_FAILED +
                "after detachCopyAll(Object[])," + NL, cartDetached);
        pm.currentTransaction().commit();
        failOnError();
    }
View Full Code Here

TOP

Related Classes of org.apache.jdo.tck.pc.shoppingcart.Cart

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.