Package org.apache.jackrabbit.ocm.testmodel.uuid

Examples of org.apache.jackrabbit.ocm.testmodel.uuid.B


            log.info("UUID : " + uuidA);

            // --------------------------------------------------------------------------------
            // Create and store an object B in the repository which has a reference to A
            // --------------------------------------------------------------------------------
            B b = new B();
            b.setReference2A(uuidA);
            b.setPath("/testB");
            ocm.insert(b);
            ocm.save();

            // --------------------------------------------------------------------------------
            // Retrieve the object B with an invalid reference
            // --------------------------------------------------------------------------------
            b = (B) ocm.getObject("/testB");
            assertNotNull("b is null", b);
            assertTrue("Invalid uuid property", b.getReference2A().equals(uuidA));

            // --------------------------------------------------------------------------------
            // Update the object B with an invalid reference
            // --------------------------------------------------------------------------------
            b.setReference2A("1245");
            try
            {
              ocm.update(b);
              fail("Exception not throw");
            }
View Full Code Here


            references.add(a2.getUuid());

            // --------------------------------------------------------------------------------
            // Create and store an object B in the repository which has a collection of A
            // --------------------------------------------------------------------------------
            B b = new B();
            b.setPath("/testB");
            b.setMultiReferences(references);
            ocm.insert(b);
            ocm.save();

            // --------------------------------------------------------------------------------
            // Retrieve object B
            // --------------------------------------------------------------------------------
            b = (B) ocm.getObject("/testB");
            Collection allref = b.getMultiReferences();
            assertNotNull("collection is null", allref);
            assertTrue("Invalid number of items in the collection", allref.size() == 2);

            // --------------------------------------------------------------------------------
            // Update object B with invalid uuid
            // --------------------------------------------------------------------------------
            allref.add("12345");
            b.setMultiReferences(allref);
            try
            {
              ocm.update(b);
              fail("Exception not throw");
            }
            catch(Exception e)
            {
              //Throws an exception due to an invalid uuid
              log.info("Invalid uuid value in the collection : " + e);

            }

            // --------------------------------------------------------------------------------
            // Update object B with an null value
            // --------------------------------------------------------------------------------
            b.setMultiReferences(null);
            ocm.update(b);
            ocm.save();

            // --------------------------------------------------------------------------------
            // Retrieve object B
            // --------------------------------------------------------------------------------
            b = (B) ocm.getObject("/testB");
            assertNull("a is not null", b.getMultiReferences());


        }
        catch (Exception e)
        {
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.ocm.testmodel.uuid.B

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.