Package org.apache.jackrabbit.ocm.testmodel

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


          ObjectContentManager ocm = getObjectContentManager();

            // --------------------------------------------------------------------------------
            // Create and store an object graph in the repository
            // --------------------------------------------------------------------------------
            Atomic a = new Atomic();
            a.setPath("/test");
            a.setIntegerObject(new Integer(100));
            a.setDate(new Date());
            byte[] content = "Test Byte".getBytes();
            a.setByteArray(content);
            a.setCalendar(Calendar.getInstance());
            a.setDoubleObject(new Double(2.12));
            a.setDoublePrimitive(1.23);

            ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream("Test Stream".getBytes());
            a.setInputStream(byteArrayInputStream);

            ocm.insert(a);
            ocm.save();

            // --------------------------------------------------------------------------------
            // Get the object
            // --------------------------------------------------------------------------------
            a = null;
            a = (Atomic) ocm.getObject( "/test");
            assertNotNull("a is null", a);
            assertNull("Boolean object is not null", a.getBooleanObject());

            assertFalse("Incorrect boolean primitive", a.isBooleanPrimitive());
            assertNotNull("Integer Object is null", a.getIntegerObject());
            assertTrue("Incorrect Integer object", a.getIntegerObject().intValue() == 100);
            assertTrue("Incorrect int primitive", a.getIntPrimitive() == 0);
            assertNull("String object is not null", a.getString());
            assertNotNull("Byte array object is null", a.getByteArray());
            assertTrue("Incorrect byte object", new String(a.getByteArray()).equals("Test Byte"));

            assertNotNull("date object is null", a.getDate());
            assertNotNull("calendar object is null", a.getCalendar());

            assertNotNull("Double object is null", a.getDoubleObject());
            assertTrue("Incorrect double object", a.getDoubleObject().doubleValue() == 2.12);
            assertTrue("Incorrect double primitive", a.getDoublePrimitive() == 1.23);

            assertNotNull("Incorrect input stream primitive", a.getInputStream());


        }
        catch (Exception e)
        {
View Full Code Here


      ObjectContentManager ocm = getObjectContentManager();

      for (int i = 1; i <= 100; i++)
      {
        Atomic a = new Atomic();
        a.setPath("/test" + i);
        a.setBooleanObject(new Boolean(i%2==0));
        a.setBooleanPrimitive(true);
        a.setIntegerObject(new Integer(100 * i));
        a.setIntPrimitive(200 + i);
        a.setDate(date);
        Calendar calendar = Calendar.getInstance();
        calendar.set(1976, 4, 20, 15, 40);
        a.setCalendar(calendar);
        a.setDoubleObject(new Double(2.12 + i));
        a.setDoublePrimitive(1.23 + i);
        long now = System.currentTimeMillis();
        a.setTimestamp(new Timestamp(now));
        if ((i % 2) == 0)
        {
           a.setString("Test String JCR " + i);
             a.setByteArray("This is small object stored in a JCR repository".getBytes());
             a.setInputStream(new ByteArrayInputStream("Test inputstream".getBytes()));
             a.setInt2boolean(true);
        }
        else
        {
           a.setByteArray("This is small object stored in the ocm repository".getBytes());
           a.setInputStream(new ByteArrayInputStream("Another Stream".getBytes()));
           a.setString("Test String " + i);
           a.setInt2boolean(false);
        }
        ocm.insert(a);


      }
View Full Code Here

      ObjectContentManager ocm = getObjectContentManager();

      for (int i = 1; i <= 100; i++)
      {
        Atomic a = new Atomic();
        a.setPath("/test" + i);
        a.setBooleanObject(new Boolean(i%2==0));
        a.setBooleanPrimitive(true);
        a.setIntegerObject(new Integer(100 * i));
        a.setIntPrimitive(200 + i);
        a.setDate(date);
        Calendar calendar = Calendar.getInstance();
        calendar.set(1976, 4, 20, 15, 40);
        a.setCalendar(calendar);
        a.setDoubleObject(new Double(2.12 + i));
        a.setDoublePrimitive(1.23 + i);
        long now = System.currentTimeMillis();
        a.setTimestamp(new Timestamp(now));
        if ((i % 2) == 0)
        {
          a.setString("Test String JCR " + i);
            a.setByteArray("This is small object stored in a JCR repository".getBytes());
            a.setInputStream(new ByteArrayInputStream("Test inputstream".getBytes()));
            a.setInt2boolean(true);
        }
        else
        {
           a.setByteArray("This is small object stored in the ocm repository".getBytes());
           a.setInputStream(new ByteArrayInputStream("Another Stream".getBytes()));
           a.setString("Test String " + i);
           a.setInt2boolean(false);
        }
        ocm.insert(a);


      }
View Full Code Here

      ObjectContentManager ocm = getObjectContentManager();

      for (int i = 1; i <= 10; i++)
      {
        Atomic a = new Atomic();
        a.setPath("/test" + i);
        a.setBooleanObject(new Boolean(i % 2 == 0));
        a.setBooleanPrimitive(true);
        a.setIntegerObject(new Integer(100 * i));
        a.setIntPrimitive(200 + i);
        a.setString("Test String " + i);
        a.setDate(date);
        Calendar calendar = Calendar.getInstance();
        calendar.set(1976, 4, 20, 15, 40);
        a.setCalendar(calendar);
        a.setDoubleObject(new Double(2.12 + i));
        a.setDoublePrimitive(1.23 + i);
        long now = System.currentTimeMillis();
        a.setTimestamp(new Timestamp(now));
        if ((i % 2) == 0)
        {
          a.setByteArray("This is small object stored in a JCR repository".getBytes());
          a.setInputStream(new ByteArrayInputStream("Test inputstream".getBytes()));
        }
        else
        {
          a.setByteArray("This is small object stored in the repository".getBytes());
          a.setInputStream(new ByteArrayInputStream("Another Stream".getBytes()));
        }
        ocm.insert(a);

      }
      ocm.save();
View Full Code Here

    anotherDescendant.setAncestorField("ancestorValue5");
    anotherDescendant.setPath("/anotherdescendant3");
    ocm.insert(anotherDescendant);

   
    Atomic a = new Atomic();
    a.setPath("/atomic");
    a.setBooleanPrimitive(true);
    ocm.insert(a);

    ocm.save();

    //--------------------------------------------------------------------------------------------------------- 
View Full Code Here

    anotherDescendant.setAncestorField("ancestorValue5");
    anotherDescendant.setPath("/anotherdescendant3");
    ocm.insert(anotherDescendant);

   
    Atomic a = new Atomic();
    a.setPath("/atomic");
    a.setBooleanPrimitive(true);
    ocm.insert(a);

    ocm.save();

    //--------------------------------------------------------------------------------------------------------- 
View Full Code Here

    anotherDescendant.setAncestorField("ancestorValue5");
    anotherDescendant.setPath("/anotherdescendant3");
    ocm.insert(anotherDescendant);

   
    Atomic a = new Atomic();
    a.setPath("/atomic");
    a.setBooleanPrimitive(true);
    ocm.insert(a);

    ocm.save();

    //--------------------------------------------------------------------------------------------------------- 
View Full Code Here

    folder.addChild(document);
    folder.addChild(subFolder);
    ocm.insert(folder);                  


  Atomic a = new Atomic();
  a.setPath("/atomic");
  a.setBooleanPrimitive(true);
  ocm.insert(a);

  ocm.save();

  //--------------------------------------------------------------------------------------------------------- 
View Full Code Here

    folder.addChild(document);
    folder.addChild(subFolder);
    ocm.insert(folder);                  


  Atomic a = new Atomic();
  a.setPath("/atomic");
  a.setBooleanPrimitive(true);
  ocm.insert(a);

  ocm.save();

  //--------------------------------------------------------------------------------------------------------- 
View Full Code Here

      ObjectContentManager ocm = getObjectContentManager();

      for (int i = 1; i <= 100; i++)
      {
        Atomic a = new Atomic();
        a.setPath("/test" + i);
        a.setBooleanObject(new Boolean(i%2==0));
        a.setBooleanPrimitive(true);
        a.setIntegerObject(new Integer(100 * i));
        a.setIntPrimitive(200 + i);
        a.setDate(date);
        Calendar calendar = Calendar.getInstance();
        calendar.set(1976, 4, 20, 15, 40);
        a.setCalendar(calendar);
        a.setDoubleObject(new Double(2.12 + i));
        a.setDoublePrimitive(1.23 + i);
        long now = System.currentTimeMillis();
        a.setTimestamp(new Timestamp(now));
        if ((i % 2) == 0)
        {
           a.setString("Test String JCR " + i);
             a.setByteArray("This is small object stored in a JCR repository".getBytes());
             a.setInputStream(new ByteArrayInputStream("Test inputstream".getBytes()));
             a.setInt2boolean(true);
        }
        else
        {
           a.setByteArray("This is small object stored in the ocm repository".getBytes());
           a.setInputStream(new ByteArrayInputStream("Another Stream".getBytes()));
           a.setString("Test String " + i);
           a.setInt2boolean(false);
        }
        ocm.insert(a);


      }
View Full Code Here

TOP

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

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.