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

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


            references.add(a2);

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

            // --------------------------------------------------------------------------------
            // Retrieve object B
            // --------------------------------------------------------------------------------
            b = (B2) ocm.getObject("/testB2");
            Collection allref = b.getMultiReferences();
            assertNotNull("collection is null", allref);
            assertTrue("Invalid number of items in the collection", allref.size() == 2);
            this.contains(allref, "/a1" , A.class);
            this.contains(allref, "/a2" , A.class);

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

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


        }
        catch (Exception e)
        {
View Full Code Here


            ocm.insert(a1);

            // --------------------------------------------------------------------------------
            // Create and store an object B in the repository without references to A
            // --------------------------------------------------------------------------------
            B2 b = new B2();
            b.setPath("/testB2");

            ocm.insert(b);
            ocm.save();

            // --------------------------------------------------------------------------------
            // Retrieve object B
            // --------------------------------------------------------------------------------
            b = (B2) ocm.getObject("/testB2");
            Collection allref = b.getMultiReferences();
            assertNull("collection is not null", allref);

            // --------------------------------------------------------------------------------
            // Update object B with a collection of A (UUID on A)
            // --------------------------------------------------------------------------------
            ArrayList<A> list =  new ArrayList<A>();
            list.add(a1);
            b.setMultiReferences(list);
            ocm.update(b);
            ocm.save();

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


        }
        catch (Exception e)
        {
View Full Code Here

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

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

            // --------------------------------------------------------------------------------
            // Retrieve object B
            // --------------------------------------------------------------------------------
            b = (B2) ocm.getObject("/testB2");
            a = b.getA();
            assertNotNull("a is null", a);
            assertTrue("Invalid object a", a.getStringData().equals("testdata"));
            assertTrue("Invalid uuid property", a.getUuid().equals(uuidA));

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

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


        }
        catch (Exception e)
View Full Code Here

            references.add(a2);

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

            // --------------------------------------------------------------------------------
            // Retrieve object B
            // --------------------------------------------------------------------------------
            b = (B2) ocm.getObject("/testB2");
            Collection allref = b.getMultiReferences();
            assertNotNull("collection is null", allref);
            assertTrue("Invalid number of items in the collection", allref.size() == 2);
            this.contains(allref, "/a1" , A.class);
            this.contains(allref, "/a2" , A.class);

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

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


        }
        catch (Exception e)
        {
View Full Code Here

TOP

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

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.