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

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


        // datastore transaction, retainValues=false
        getPM().currentTransaction().begin();
        // sets fetch group cart, entries, product
        setCartFetchGroups();
        // DETACH_LOAD_FIELDS true by default
        CartEntry cartEntryDetached = (CartEntry)pm.detachCopy(cartEntry1);
        try {
            Product prod = cartEntryDetached.getProduct();
        } catch (JDODetachedFieldAccessException jdoex) {
            fail("Unexpected exception caught: " + jdoex.getMessage());
        }
        pm.currentTransaction().commit();
    }
View Full Code Here


        setCartFetchGroups();
        // loads Product field
        int quantity =  cartEntry1.getQuantity();

        pm.getFetchPlan().setDetachmentOptions(0);
        CartEntry cartEntryDetached = (CartEntry)pm.detachCopy(cartEntry1);
        try {
            Product prodDetached =  cartEntryDetached.getProduct();
        } catch (JDODetachedFieldAccessException jdoex) {
            fail("Unexpected exception caught: " + jdoex.getMessage());
        } finally {
            pm.currentTransaction().commit();
        }
View Full Code Here

        // sets fetch group cart, entries, product
        setCartFetchGroups();
        Product prod =  cartEntry1.getProduct();
        pm.getFetchPlan().removeGroup(CARTENTRY_PRODUCT);
        pm.getFetchPlan().setDetachmentOptions(FetchPlan.DETACH_UNLOAD_FIELDS);
        CartEntry cartEntryDetached = (CartEntry)pm.detachCopy(cartEntry1);
        try {
            Product prodDetached =  cartEntryDetached.getProduct();
            fail("Expected exception on access of unloaded field, " +
                "but none thrown.");
        } catch (JDODetachedFieldAccessException jdoex) {
            // expect exception
        } finally {
View Full Code Here

        FetchPlan fp = pm.getFetchPlan();
        // Product field not in Fetch Plan
        fp.addGroup(CART_ENTRIES);
        fp.addGroup(CARTENTRY_CART);

        CartEntry cartEntryDetached = (CartEntry)pm.detachCopy(cartEntry1);
        try {
            Product prod = cartEntryDetached.getProduct();
            fail("Expected exception on access of field not in fetch plan" +
                " and not loaded, but none thrown.");
        } catch (JDODetachedFieldAccessException jdoex) {
            // expect exception
        } finally {
View Full Code Here

        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};
       
        getPM().currentTransaction().begin();
View Full Code Here

                " differences in cart.customerId",
                goldenCart.getCustomerId(), cart.getCustomerId());
        Iterator goldenCartEntries = goldenCart.getEntries();
        Iterator cartEntries = cart.getEntries();
        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);
            }
            if (goldenCartEntry.getId() != cartEntry.getId())
                reportDifference(location +
                    " differences in cartEntry.id",
                    goldenCartEntry.getId(), cartEntry.getId());
            if (goldenCartEntry.getQuantity() != cartEntry.getQuantity())
                reportDifference(location +
                    " differences in cartEntry.quantity",
                    goldenCartEntry.getQuantity(), cartEntry.getQuantity());
            Product goldenProduct = goldenCartEntry.getProduct();
            Product product = cartEntry.getProduct();
            checkState(location + "Product instance", product,
                    persistent);
            if (!goldenProduct.getDescription()
                    .equals(product.getDescription()))
                reportDifference(location +
View Full Code Here

        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};
       
        getPM().currentTransaction().begin();
View Full Code Here

                " differences in cart.customerId",
                goldenCart.getCustomerId(), cart.getCustomerId());
        Iterator goldenCartEntries = goldenCart.getEntries();
        Iterator cartEntries = cart.getEntries();
        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);
            }
            if (goldenCartEntry.getId() != cartEntry.getId())
                reportDifference(location +
                    " differences in cartEntry.id",
                    goldenCartEntry.getId(), cartEntry.getId());
            if (goldenCartEntry.getQuantity() != cartEntry.getQuantity())
                reportDifference(location +
                    " differences in cartEntry.quantity",
                    goldenCartEntry.getQuantity(), cartEntry.getQuantity());
            Product goldenProduct = goldenCartEntry.getProduct();
            Product product = cartEntry.getProduct();
            checkState(location + "Product instance", product,
                    persistent);
            if (!goldenProduct.getDescription()
                    .equals(product.getDescription()))
                reportDifference(location +
View Full Code Here

TOP

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