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

            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();
            fail("Exception occurs during the unit test : " + e);
        }
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();
            fail("Exception occurs during the unit test : " + e);
        }
View Full Code Here

                assertEquals("Invalid number of objects - should be = 3", 3, result.size());

                //Text is Descending
                Paragraph[] paragraphs = (Paragraph[]) result.toArray(new Paragraph[result.size()]);
                Iterator iterator = result.iterator();
                Paragraph para = (Paragraph)iterator.next();
                assertEquals("Para 3",para.getText());
                para = (Paragraph)iterator.next();
                assertEquals("Para 2",para.getText());
                para = (Paragraph)iterator.next();
                assertEquals("Para 1",para.getText());

                //Text is Ascending
                query = queryManager.createQuery(filter);
                query.addOrderByAscending("text");

                ocm = this.getObjectContentManager();
                result = ocm.getObjects(query);
                assertEquals("Invalid number of objects - should be = 3", 3, result.size());
                iterator = result.iterator();
                para = (Paragraph)iterator.next();
                assertEquals("Para 1",para.getText());
                para = (Paragraph)iterator.next();
                assertEquals("Para 2",para.getText());
                para = (Paragraph)iterator.next();
                assertEquals("Para 3",para.getText());

                //Text is Descending
                query = queryManager.createQuery(filter);
                ((QueryImpl)query).addJCRExpression(strQueryBuilderStringWithDescending);
                ocm = this.getObjectContentManager();
                result = ocm.getObjects(query);
                assertEquals("Invalid number of objects - should be = 3", 3, result.size());
                iterator = result.iterator();
                para = (Paragraph)iterator.next();
                assertEquals("Para 3",para.getText());
                para = (Paragraph)iterator.next();
                assertEquals("Para 2",para.getText());
                para = (Paragraph)iterator.next();
                assertEquals("Para 1",para.getText());
               
           
            } catch (Exception e) {
                e.printStackTrace();
                fail("Exception occurs during the unit test : " + 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

        page.setPath("/test");
        page.setTitle("Page 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);
        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

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.