Package org.apache.jackrabbit.ocm.testmodel

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


      ObjectContentManager ocm = this.getObjectContentManager();
      //---------------------------------------------------------------------------------------------------------
      // Insert without the mandatory field
      //---------------------------------------------------------------------------------------------------------     
     
            PropertyTest propertyTest = new PropertyTest();
            propertyTest.setPath("/test");
            propertyTest.setRequiredProp("requiredPropValue");
            propertyTest.setRequiredWithConstraintsProp("abc");
           
            try
            {
                 ocm.insert(propertyTest);
                 fail("Incorrect insert operation - the mandatory fields have no value");
            }
            catch(Exception e)
            {
               // Normal behaviour  
              ocm.refresh(false);
            }
           
      //---------------------------------------------------------------------------------------------------------
      // Insert with the mandatory fields
      //---------------------------------------------------------------------------------------------------------     
            propertyTest.setMandatoryProp("mandatoryValue");
            propertyTest.setMandatoryWithConstaintsProp("xx");
            ocm.insert(propertyTest);
            ocm.save();
           
      //---------------------------------------------------------------------------------------------------------
      // Retrieve
      //---------------------------------------------------------------------------------------------------------     
            propertyTest = (PropertyTest) ocm.getObject("/test");
            assertTrue("Invalid required property", propertyTest.getRequiredProp().equals("requiredPropValue"));
            assertTrue("Invalid required property with constraints", propertyTest.getRequiredWithConstraintsProp().equals("abc"));           
            assertTrue("Invalid autocreated property", propertyTest.getAutoCreatedProp().equals("aaa"));
            assertTrue("Invalid autocreated property", propertyTest.getAutoCreatedWithConstraintsProp().equals("ccc"));
            assertTrue("Invalid protected property", propertyTest.getProtectedWithDefaultValueProp().equals("protectedValue"));
           
            //---------------------------------------------------------------------------------------------------------
      // update the property requiredWithConstraintsProp with bad value
      //---------------------------------------------------------------------------------------------------------     
            propertyTest = (PropertyTest) ocm.getObject("/test");
            propertyTest.setRequiredWithConstraintsProp("invalid value");
            try
            {
              ocm.update(propertyTest);
              ocm.save();
              fail("Invalid value was accepted for requiredWithConstraintsProp");
            }
            catch(Exception e)
            {                 
               // Do nothing - normal behaviour, the value                
            }
           
            //---------------------------------------------------------------------------------------------------------
      // update the property AutoCreatedWithConstraintsProp with bad value
      //---------------------------------------------------------------------------------------------------------     
            propertyTest = (PropertyTest) ocm.getObject("/test");
            propertyTest.setAutoCreatedWithConstraintsProp("invalid value");
            try
            {
              ocm.update(propertyTest);
              ocm.save();
              fail("Invalid value was accepted for autoCreatedWithConstraintsProp ");
            }
            catch(Exception e)
            {              
               // Do nothing - normal behaviour, the value is not valid
                
            }
           
            //---------------------------------------------------------------------------------------------------------
      // update the property mandatoryWithConstaintsProp with bad value
      //---------------------------------------------------------------------------------------------------------     
            propertyTest = (PropertyTest) ocm.getObject("/test");
            propertyTest.setMandatoryWithConstaintsProp("yy");
            try
            {
              ocm.update(propertyTest);
              ocm.save();
              fail("Invalid value was accepted for mandatoryWithConstaintsProp");
View Full Code Here


      ObjectContentManager ocm = this.getObjectContentManager();
      //---------------------------------------------------------------------------------------------------------
      // Insert without the mandatory field
      //---------------------------------------------------------------------------------------------------------     
     
            PropertyTest propertyTest = new PropertyTest();
            propertyTest.setPath("/test");
            propertyTest.setRequiredProp("requiredPropValue");
            propertyTest.setRequiredWithConstraintsProp("abc");
           
            try
            {
                 ocm.insert(propertyTest);
                 fail("Incorrect insert operation - the mandatory fields have no value");
            }
            catch(Exception e)
            {
               // Normal behaviour  
              ocm.refresh(false);
            }
           
      //---------------------------------------------------------------------------------------------------------
      // Insert with the mandatory fields
      //---------------------------------------------------------------------------------------------------------     
            propertyTest.setMandatoryProp("mandatoryValue");
            propertyTest.setMandatoryWithConstaintsProp("xx");
            ocm.insert(propertyTest);
            ocm.save();
           
      //---------------------------------------------------------------------------------------------------------
      // Retrieve
      //---------------------------------------------------------------------------------------------------------     
            propertyTest = (PropertyTest) ocm.getObject("/test");
            assertTrue("Invalid required property", propertyTest.getRequiredProp().equals("requiredPropValue"));
            assertTrue("Invalid required property with constraints", propertyTest.getRequiredWithConstraintsProp().equals("abc"));           
            assertTrue("Invalid autocreated property", propertyTest.getAutoCreatedProp().equals("aaa"));
            assertTrue("Invalid autocreated property", propertyTest.getAutoCreatedWithConstraintsProp().equals("ccc"));
            assertTrue("Invalid protected property", propertyTest.getProtectedWithDefaultValueProp().equals("protectedValue"));
           
            //---------------------------------------------------------------------------------------------------------
      // update the property requiredWithConstraintsProp with bad value
      //---------------------------------------------------------------------------------------------------------     
            propertyTest = (PropertyTest) ocm.getObject("/test");
            propertyTest.setRequiredWithConstraintsProp("invalid value");
            try
            {
              ocm.update(propertyTest);
              ocm.save();
              fail("Invalid value was accepted for requiredWithConstraintsProp");
            }
            catch(Exception e)
            {                 
               // Do nothing - normal behaviour, the value                
            }
           
            //---------------------------------------------------------------------------------------------------------
      // update the property AutoCreatedWithConstraintsProp with bad value
      //---------------------------------------------------------------------------------------------------------     
            propertyTest = (PropertyTest) ocm.getObject("/test");
            propertyTest.setAutoCreatedWithConstraintsProp("invalid value");
            try
            {
              ocm.update(propertyTest);
              ocm.save();
              fail("Invalid value was accepted for autoCreatedWithConstraintsProp ");
            }
            catch(Exception e)
            {              
               // Do nothing - normal behaviour, the value is not valid
                
            }
           
            //---------------------------------------------------------------------------------------------------------
      // update the property mandatoryWithConstaintsProp with bad value
      //---------------------------------------------------------------------------------------------------------     
            propertyTest = (PropertyTest) ocm.getObject("/test");
            propertyTest.setMandatoryWithConstaintsProp("yy");
            try
            {
              ocm.update(propertyTest);
              ocm.save();
              fail("Invalid value was accepted for mandatoryWithConstaintsProp");
View Full Code Here

      ObjectContentManager ocm = this.getObjectContentManager();
      //---------------------------------------------------------------------------------------------------------
      // Insert without the mandatory field
      //---------------------------------------------------------------------------------------------------------     
     
            PropertyTest propertyTest = new PropertyTest();
            propertyTest.setPath("/test");
            propertyTest.setRequiredProp("requiredPropValue");
            propertyTest.setRequiredWithConstraintsProp("abc");

            try
            {
                 ocm.insert(propertyTest);
                 fail("Incorrect insert operation - the mandatory fields have no value");
            }
            catch(Exception e)
            {
               // Normal behaviour  
              ocm.refresh(false);
            }

      //---------------------------------------------------------------------------------------------------------
      // Insert with the mandatory fields
      //---------------------------------------------------------------------------------------------------------     
            propertyTest.setMandatoryProp("mandatoryValue");
            propertyTest.setMandatoryWithConstaintsProp("xx");
            ocm.insert(propertyTest);
            ocm.save();

      //---------------------------------------------------------------------------------------------------------
      // Retrieve
      //---------------------------------------------------------------------------------------------------------     
            propertyTest = (PropertyTest) ocm.getObject("/test");
            assertTrue("Invalid required property", propertyTest.getRequiredProp().equals("requiredPropValue"));
            assertTrue("Invalid required property with constraints", propertyTest.getRequiredWithConstraintsProp().equals("abc"));
            assertTrue("Invalid autocreated property", propertyTest.getAutoCreatedProp().equals("aaa"));
            assertTrue("Invalid autocreated property", propertyTest.getAutoCreatedWithConstraintsProp().equals("ccc"));
            assertTrue("Invalid protected property", propertyTest.getProtectedWithDefaultValueProp().equals("protectedValue"));

            //---------------------------------------------------------------------------------------------------------
      // update the property requiredWithConstraintsProp with bad value
      //---------------------------------------------------------------------------------------------------------     
            propertyTest = (PropertyTest) ocm.getObject("/test");
            propertyTest.setRequiredWithConstraintsProp("invalid value");
            try
            {
              ocm.update(propertyTest);
              ocm.save();
              fail("Invalid value was accepted for requiredWithConstraintsProp");
            }
            catch(Exception e)
            {                 
               // Do nothing - normal behaviour, the value                
            }

            //---------------------------------------------------------------------------------------------------------
      // update the property AutoCreatedWithConstraintsProp with bad value
      //---------------------------------------------------------------------------------------------------------     
            propertyTest = (PropertyTest) ocm.getObject("/test");
            propertyTest.setAutoCreatedWithConstraintsProp("invalid value");
            try
            {
              ocm.update(propertyTest);
              ocm.save();
              fail("Invalid value was accepted for autoCreatedWithConstraintsProp ");
            }
            catch(Exception e)
            {              
               // Do nothing - normal behaviour, the value is not valid
                
            }

            //---------------------------------------------------------------------------------------------------------
      // update the property mandatoryWithConstaintsProp with bad value
      //---------------------------------------------------------------------------------------------------------     
            propertyTest = (PropertyTest) ocm.getObject("/test");
            propertyTest.setMandatoryWithConstaintsProp("yy");
            try
            {
              ocm.update(propertyTest);
              ocm.save();
              fail("Invalid value was accepted for mandatoryWithConstaintsProp");
View Full Code Here

      ObjectContentManager ocm = this.getObjectContentManager();
      //---------------------------------------------------------------------------------------------------------
      // Insert without the mandatory field
      //---------------------------------------------------------------------------------------------------------     
     
            PropertyTest propertyTest = new PropertyTest();
            propertyTest.setPath("/test");
            propertyTest.setRequiredProp("requiredPropValue");
            propertyTest.setRequiredWithConstraintsProp("abc");

            try
            {
                 ocm.insert(propertyTest);
                 fail("Incorrect insert operation - the mandatory fields have no value");
            }
            catch(Exception e)
            {
               // Normal behaviour  
              ocm.refresh(false);
            }

      //---------------------------------------------------------------------------------------------------------
      // Insert with the mandatory fields
      //---------------------------------------------------------------------------------------------------------     
            propertyTest.setMandatoryProp("mandatoryValue");
            propertyTest.setMandatoryWithConstaintsProp("xx");
            ocm.insert(propertyTest);
            ocm.save();

      //---------------------------------------------------------------------------------------------------------
      // Retrieve
      //---------------------------------------------------------------------------------------------------------     
            propertyTest = (PropertyTest) ocm.getObject("/test");
            assertTrue("Invalid required property", propertyTest.getRequiredProp().equals("requiredPropValue"));
            assertTrue("Invalid required property with constraints", propertyTest.getRequiredWithConstraintsProp().equals("abc"));
            assertTrue("Invalid autocreated property", propertyTest.getAutoCreatedProp().equals("aaa"));
            assertTrue("Invalid autocreated property", propertyTest.getAutoCreatedWithConstraintsProp().equals("ccc"));
            assertTrue("Invalid protected property", propertyTest.getProtectedWithDefaultValueProp().equals("protectedValue"));

            //---------------------------------------------------------------------------------------------------------
      // update the property requiredWithConstraintsProp with bad value
      //---------------------------------------------------------------------------------------------------------     
            propertyTest = (PropertyTest) ocm.getObject("/test");
            propertyTest.setRequiredWithConstraintsProp("invalid value");
            try
            {
              ocm.update(propertyTest);
              ocm.save();
              fail("Invalid value was accepted for requiredWithConstraintsProp");
            }
            catch(Exception e)
            {                 
               // Do nothing - normal behaviour, the value                
            }

            //---------------------------------------------------------------------------------------------------------
      // update the property AutoCreatedWithConstraintsProp with bad value
      //---------------------------------------------------------------------------------------------------------     
            propertyTest = (PropertyTest) ocm.getObject("/test");
            propertyTest.setAutoCreatedWithConstraintsProp("invalid value");
            try
            {
              ocm.update(propertyTest);
              ocm.save();
              fail("Invalid value was accepted for autoCreatedWithConstraintsProp ");
            }
            catch(Exception e)
            {              
               // Do nothing - normal behaviour, the value is not valid
                
            }

            //---------------------------------------------------------------------------------------------------------
      // update the property mandatoryWithConstaintsProp with bad value
      //---------------------------------------------------------------------------------------------------------     
            propertyTest = (PropertyTest) ocm.getObject("/test");
            propertyTest.setMandatoryWithConstaintsProp("yy");
            try
            {
              ocm.update(propertyTest);
              ocm.save();
              fail("Invalid value was accepted for mandatoryWithConstaintsProp");
View Full Code Here

TOP

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

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.