Package org.apache.jackrabbit.ocm.testmodel

Examples of org.apache.jackrabbit.ocm.testmodel.Paragraph


      page.setPath("/test/node1/page1");
      page.setTitle("Page 1 Title");
     
      ArrayList paragraphs = new ArrayList();
     
      paragraphs.add(new Paragraph("Para 1"));
      paragraphs.add(new Paragraph("Para 2"));
      paragraphs.add(new Paragraph("Para 3"));
      paragraphs.add(new Paragraph("Another Para "));
      page.setParagraphs(paragraphs);
     
      ocm.insert(page);
           
     
      page = new Page();
      page.setPath("/test/node1/page2");
      page.setTitle("Page 2 Title");
     
      paragraphs = new ArrayList();
     
      paragraphs.add(new Paragraph("Para 1"));
      paragraphs.add(new Paragraph("Para 2"));
      paragraphs.add(new Paragraph("Para 5"));
      paragraphs.add(new Paragraph("Another Para"));
      page.setParagraphs(paragraphs);
     
      ocm.insert(page);
     
      page = new Page();
      page.setPath("/test/node2/page1");
      page.setTitle("Page 3 Title");
     
      paragraphs = new ArrayList();
     
      paragraphs.add(new Paragraph("Para 1"));
      paragraphs.add(new Paragraph("Para 4"));
      paragraphs.add(new Paragraph("Para 5"));
      paragraphs.add(new Paragraph("Another Para"));
      page.setParagraphs(paragraphs);
     
      ocm.insert(page);

      page = new Page();
      page.setPath("/test/node2/page2");
      page.setTitle("Page 4 Title");
     
      paragraphs = new ArrayList();
     
      paragraphs.add(new Paragraph("Para 6"));
      paragraphs.add(new Paragraph("Para 7"));
      paragraphs.add(new Paragraph("Para 8"));
      paragraphs.add(new Paragraph("Another Para"));
      page.setParagraphs(paragraphs);
     
      ocm.insert(page);
     
      ocm.save();
View Full Code Here


      page.setPath("/test/node1/page1");
      page.setTitle("Page 1 Title");
     
      ArrayList paragraphs = new ArrayList();
     
      paragraphs.add(new Paragraph("Para 1"));
      paragraphs.add(new Paragraph("Para 2"));
      paragraphs.add(new Paragraph("Para 3"));
      paragraphs.add(new Paragraph("Another Para "));
      page.setParagraphs(paragraphs);
     
      ocm.insert(page);
           
     
      page = new Page();
      page.setPath("/test/node1/page2");
      page.setTitle("Page 2 Title");
     
      paragraphs = new ArrayList();
     
      paragraphs.add(new Paragraph("Para 1"));
      paragraphs.add(new Paragraph("Para 2"));
      paragraphs.add(new Paragraph("Para 5"));
      paragraphs.add(new Paragraph("Another Para"));
      page.setParagraphs(paragraphs);
     
      ocm.insert(page);
     
      page = new Page();
      page.setPath("/test/node2/page1");
      page.setTitle("Page 3 Title");
     
      paragraphs = new ArrayList();
     
      paragraphs.add(new Paragraph("Para 1"));
      paragraphs.add(new Paragraph("Para 4"));
      paragraphs.add(new Paragraph("Para 5"));
      paragraphs.add(new Paragraph("Another Para"));
      page.setParagraphs(paragraphs);
     
      ocm.insert(page);

      page = new Page();
      page.setPath("/test/node2/page2");
      page.setTitle("Page 4 Title");
     
      paragraphs = new ArrayList();
     
      paragraphs.add(new Paragraph("Para 6"));
      paragraphs.add(new Paragraph("Para 7"));
      paragraphs.add(new Paragraph("Para 8"));
      paragraphs.add(new Paragraph("Another Para"));
      page.setParagraphs(paragraphs);
     
      ocm.insert(page);
     
      ocm.save();
View Full Code Here

         {
         
           Page page = new Page();
           page.setPath("/page");
           page.setTitle("Page Title");             
           page.addParagraph(new Paragraph("para1"));
           page.addParagraph(new Paragraph("para2"));
           ocm.insert(page);
           ocm.save();
         
           page.addParagraph(new Paragraph("para3"));
           page.setTitle("Page Title 2");
           ocm.checkout("/page");
           ocm.update(page);
           ocm.save();
           ocm.checkin("/page");
         
           page.addParagraph(new Paragraph("para4"));
           page.setTitle("Page Title 3");
           ocm.checkout("/page");
           ocm.update(page);
           ocm.save();
           ocm.checkin("/page");             
View Full Code Here

             {
             
               Page page = new Page();
               page.setPath("/page");
               page.setTitle("Page Title");             
               page.addParagraph(new Paragraph("para1"));
               page.addParagraph(new Paragraph("para2"));
               ocm.insert(page);
               ocm.save();
             

               page.addParagraph(new Paragraph("para3"));
               ocm.checkout("/page");
               ocm.update(page);
               ocm.save();
               ocm.checkin("/page", new String[] {"A", "B"});
             
               page.addParagraph(new Paragraph("para4"));
               ocm.checkout("/page");
               ocm.update(page);
               ocm.save();
               ocm.checkin("/page", new String[] {"C", "D"});          
View Full Code Here

             {

               Page page = new Page();
               page.setPath("/page");
               page.setTitle("Page Title");
               page.addParagraph(new Paragraph("para1"));
               page.addParagraph(new Paragraph("para2"));
               ocm.insert(page);
               ocm.save();

               page.addParagraph(new Paragraph("para3"));
               page.setTitle("Page Title 2");
               ocm.checkout("/page");
               ocm.update(page);
               ocm.save();
               ocm.checkin("/page");

               page.addParagraph(new Paragraph("para4"));
               page.setTitle("Page Title 3");
               ocm.checkout("/page");
               ocm.update(page);
               ocm.save();
               ocm.checkin("/page");
View Full Code Here

             {

               Page page = new Page();
               page.setPath("/page");
               page.setTitle("Page Title");
               page.addParagraph(new Paragraph("para1"));
               page.addParagraph(new Paragraph("para2"));
               ocm.insert(page);
               ocm.save();


               page.addParagraph(new Paragraph("para3"));
               ocm.checkout("/page");
               ocm.update(page);
               ocm.save();
               ocm.checkin("/page", new String[] {"A", "B"});

               page.addParagraph(new Paragraph("para4"));
               ocm.checkout("/page");
               ocm.update(page);
               ocm.save();
               ocm.checkin("/page", new String[] {"C", "D"});
View Full Code Here

            // --------------------------------------------------------------------------------
            residual = new Residual.ResidualNodes();
            residual.setPath("/test");

            HashMap<String,Paragraph> map = new HashMap<String,Paragraph>();
            map.put("value1", new Paragraph("Value1"));
            map.put("value2", new Paragraph("Value2"));
            map.put("value3", new Paragraph("Value3"));
            map.put("value4", new Paragraph("Value4"));
            residual.setElements(map);

            ocm.update(residual);
            ocm.save();

            // --------------------------------------------------------------------------------
            // Get the object
            // --------------------------------------------------------------------------------
            residual = (Residual) ocm.getObject( "/test");
            assertNotNull("Object is null", residual);
            assertTrue("Incorrect number of values", residual.getElements().size() == 4);
            assertTrue("Incorrect collection element type", (residual.getElements().get("value2") instanceof Paragraph));
            assertEquals("Incorrect collection element text", ((Paragraph) residual.getElements().get("value2")).getText(), "Value2");

            // --------------------------------------------------------------------------------
            // Update the object
            // --------------------------------------------------------------------------------
            map = new HashMap<String,Paragraph>();
            map.put("value11", new Paragraph("Value11"));
            map.put("value12", new Paragraph("Value12"));
            map.put("value13", new Paragraph("Value13"));
            map.put("value14", new Paragraph("Value14"));
            map.put("value15", new Paragraph("Value15"));
            residual.setElements(map);

            ocm.update(residual);
            ocm.save();
View Full Code Here

               page.setPath("/page");
               page.setTitle("Page Title");             
               ocm.insert(page);
               ocm.save();
             
               Paragraph p1 = new Paragraph("para1");
               p1.setPath("/page/paragraph");
               ocm.insert(p1);
             
               Paragraph p2 = new Paragraph("para1");
               p2.setPath("/page/paragraph");
               ocm.insert(p2);
             fail();             
             
             }
             catch(Exception e)
View Full Code Here

     
     
            Query query = queryManager.createQuery(filter);
     
            ObjectContentManager ocm = this.getObjectContentManager();
            Paragraph paragraph = (Paragraph) ocm.getObject(query);
            assertNotNull("Object is null", paragraph);     
            assertTrue("Invalid paragraph found" , paragraph.getText().equals("Para 1"));

        }
        catch (Exception e)
        {
            e.printStackTrace();
View Full Code Here

            Query query = queryManager.createQuery(filter);
     
            ObjectContentManager ocm = this.getObjectContentManager();
            Collection result = ocm.getObjects(query);
            assertEquals("Invalid number of objects - should be = 1", 1, result.size());
            Paragraph paragraph = (Paragraph) result.iterator().next();
            assertTrue("Invalid paragraph found" , paragraph.getText().equals("Para 1"));

        }
        catch (Exception e)
        {
            e.printStackTrace();
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.ocm.testmodel.Paragraph

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.