Examples of OcmTestProperty


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

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

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

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

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

            //---------------------------------------------------------------------------------------------------------
      // update the property requiredWithConstraintsProp with bad value
      //---------------------------------------------------------------------------------------------------------     
            ocmTestProperty = (OcmTestProperty) ocm.getObject("/test");
            ocmTestProperty.setRequiredWithConstraintsProp("invalid value");
            try
            {
              ocm.update(ocmTestProperty);
              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
      //---------------------------------------------------------------------------------------------------------     
            ocmTestProperty = (OcmTestProperty) ocm.getObject("/test");
            ocmTestProperty.setAutoCreatedWithConstraintsProp("invalid value");
            try
            {
              ocm.update(ocmTestProperty);
              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
      //---------------------------------------------------------------------------------------------------------     
            ocmTestProperty = (OcmTestProperty) ocm.getObject("/test");
            ocmTestProperty.setMandatoryWithConstaintsProp("yy");
            try
            {
              ocm.update(ocmTestProperty);
              ocm.save();
              fail("Invalid value was accepted for mandatoryWithConstaintsProp");
View Full Code Here

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

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

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

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

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

            //---------------------------------------------------------------------------------------------------------
      // update the property requiredWithConstraintsProp with bad value
      //---------------------------------------------------------------------------------------------------------     
            ocmTestProperty = (OcmTestProperty) ocm.getObject("/test");
            ocmTestProperty.setRequiredWithConstraintsProp("invalid value");
            try
            {
              ocm.update(ocmTestProperty);
              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
      //---------------------------------------------------------------------------------------------------------     
            ocmTestProperty = (OcmTestProperty) ocm.getObject("/test");
            ocmTestProperty.setAutoCreatedWithConstraintsProp("invalid value");
            try
            {
              ocm.update(ocmTestProperty);
              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
      //---------------------------------------------------------------------------------------------------------     
            ocmTestProperty = (OcmTestProperty) ocm.getObject("/test");
            ocmTestProperty.setMandatoryWithConstaintsProp("yy");
            try
            {
              ocm.update(ocmTestProperty);
              ocm.save();
              fail("Invalid value was accepted for mandatoryWithConstaintsProp");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.