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

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


        // 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


        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

    public void testDetachCopyAccessUnloadedField() {
        // datastore transaction, retainValues=false
        getPM().currentTransaction().begin();
        // 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

        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

        addTearDownClass(CartEntry.class);
        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

                    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 +
                    " differences in product.description",
                    goldenProduct.getDescription(), product.getDescription());
        }
    }
View Full Code Here

        addTearDownClass(CartEntry.class);
        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

                    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 +
                    " differences in product.description",
                    goldenProduct.getDescription(), product.getDescription());
        }
    }
View Full Code Here

TOP

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

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.