Examples of NodeTypeValue


Examples of org.exoplatform.services.jcr.core.nodetype.NodeTypeValue

    *
    */
   public TestNodeTypeRegistration()
   {
      super();
      testNodeTypeValue = new NodeTypeValue();

      List<String> superType = new ArrayList<String>();
      superType.add("nt:base");
      testNodeTypeValue.setName("exo:testRegistrationNodeType");
      testNodeTypeValue.setPrimaryItemName("");
      testNodeTypeValue.setDeclaredSupertypeNames(superType);

      testNodeTypeValue2 = new NodeTypeValue();
      List<String> superType2 = new ArrayList<String>();
      superType2.add("nt:base");
      superType2.add(testNodeTypeValue.getName());
      testNodeTypeValue2.setName("exo:testRegistrationNodeType2");
      testNodeTypeValue2.setPrimaryItemName("");
      testNodeTypeValue2.setDeclaredSupertypeNames(superType2);

      testNtFileNodeTypeValue = new NodeTypeValue();
      List<String> superType3 = new ArrayList<String>();
      superType3.add("nt:base");
      testNtFileNodeTypeValue.setName("nt:file");
      testNtFileNodeTypeValue.setPrimaryItemName("");
      testNtFileNodeTypeValue.setDeclaredSupertypeNames(superType3);
View Full Code Here

Examples of org.exoplatform.services.jcr.core.nodetype.NodeTypeValue

    *
    * @throws Exception
    */
   public void testReregisterResidual() throws Exception
   {
      NodeTypeValue testNValue = new NodeTypeValue();

      List<String> superType = new ArrayList<String>();
      superType.add("nt:base");
      testNValue.setName("exo:testRemoveResidual");
      testNValue.setPrimaryItemName("");
      testNValue.setDeclaredSupertypeNames(superType);
      List<PropertyDefinitionValue> props = new ArrayList<PropertyDefinitionValue>();
      props.add(new PropertyDefinitionValue("*", false, false, 1, false, new ArrayList<String>(), false, 0,
         new ArrayList<String>()));
      testNValue.setDeclaredPropertyDefinitionValues(props);

      nodeTypeManager.registerNodeType(testNValue, ExtendedNodeTypeManager.FAIL_IF_EXISTS);

      testNValue = nodeTypeManager.getNodeTypeValue(testNValue.getName());

      assertTrue(nodeTypeManager.getNodeType(testNValue.getName()).getDeclaredPropertyDefinitions().length == 1);

      Node tNode = root.addNode("test", "exo:testRemoveResidual");
      Property prop = tNode.setProperty("tt", "tt");
      session.save();

      testNValue.setDeclaredPropertyDefinitionValues(new ArrayList<PropertyDefinitionValue>());

      try
      {
         nodeTypeManager.registerNodeType(testNValue, ExtendedNodeTypeManager.REPLACE_IF_EXISTS);
         fail();
      }
      catch (RepositoryException e)
      {
         // ok
      }

      prop.remove();
      session.save();
      assertTrue(nodeTypeManager.getNodeType(testNValue.getName()).getDeclaredPropertyDefinitions().length == 1);
      nodeTypeManager.registerNodeType(testNValue, ExtendedNodeTypeManager.REPLACE_IF_EXISTS);
      assertTrue(nodeTypeManager.getNodeType(testNValue.getName()).getDeclaredPropertyDefinitions().length == 0);
      tNode.remove();
      session.save();
      nodeTypeManager.unregisterNodeType(testNValue.getName());
   }
View Full Code Here

Examples of org.exoplatform.services.jcr.core.nodetype.NodeTypeValue

    *
    * @throws Exception
    */
   public void _testReregisterProtected() throws Exception
   {
      NodeTypeValue testNValue = new NodeTypeValue();

      List<String> superType = new ArrayList<String>();
      superType.add("nt:base");
      testNValue.setName("exo:testChangeProtected");
      testNValue.setPrimaryItemName("");
      testNValue.setDeclaredSupertypeNames(superType);
      List<PropertyDefinitionValue> props = new ArrayList<PropertyDefinitionValue>();

      List<String> def = new ArrayList<String>();
      def.add("tt");
      props.add(new PropertyDefinitionValue("tt", true, false, 1, false, def, false, PropertyType.STRING,
         new ArrayList<String>()));
      testNValue.setDeclaredPropertyDefinitionValues(props);
      nodeTypeManager.registerNodeType(testNValue, ExtendedNodeTypeManager.FAIL_IF_EXISTS);

      testNValue = nodeTypeManager.getNodeTypeValue(testNValue.getName());

      Node tNode = root.addNode("test", "exo:testChangeProtected");
      session.save();
      Property property = tNode.getProperty("tt");
      assertEquals("tt", property.getString());

      property.remove();
      session.save();

      tNode.addMixin("mix:versionable");

      // chenge protected
      List<PropertyDefinitionValue> props2 = new ArrayList<PropertyDefinitionValue>();
      props2.add(new PropertyDefinitionValue("tt", true, false, 1, true, def, false, PropertyType.STRING,
         new ArrayList<String>()));
      testNValue.setDeclaredPropertyDefinitionValues(props2);

      nodeTypeManager.registerNodeType(testNValue, ExtendedNodeTypeManager.REPLACE_IF_EXISTS);

      tNode.setProperty("tt", "tt");
      session.save();
View Full Code Here

Examples of org.exoplatform.services.jcr.core.nodetype.NodeTypeValue

    *
    * @throws Exception
    */
   public void testReregisterAddNewProperty() throws Exception
   {
      NodeTypeValue testNTValue = new NodeTypeValue();

      List<String> superType = new ArrayList<String>();
      superType.add("nt:base");
      testNTValue.setName("exo:testReregisterAddNewProperty");
      testNTValue.setPrimaryItemName("");
      testNTValue.setDeclaredSupertypeNames(superType);

      nodeTypeManager.registerNodeType(testNTValue, ExtendedNodeTypeManager.FAIL_IF_EXISTS);

      Node testNode = root.addNode("testNode", testNTValue.getName());
      session.save();

      testNTValue = nodeTypeManager.getNodeTypeValue(testNTValue.getName());
      List<PropertyDefinitionValue> props = new ArrayList<PropertyDefinitionValue>();
      props.add(new PropertyDefinitionValue("tt", true, true, 1, false, new ArrayList<String>(), false,
         PropertyType.STRING, new ArrayList<String>()));
      testNTValue.setDeclaredPropertyDefinitionValues(props);

      try
      {
         nodeTypeManager.registerNodeType(testNTValue, ExtendedNodeTypeManager.REPLACE_IF_EXISTS);
         fail();
      }
      catch (ConstraintViolationException e)
      {
         // ok
      }
      testNTValue = nodeTypeManager.getNodeTypeValue(testNTValue.getName());
      List<String> def = new ArrayList<String>();
      def.add("tt");
      props = new ArrayList<PropertyDefinitionValue>();
      props.add(new PropertyDefinitionValue("tt", true, true, 1, false, def, false, PropertyType.STRING,
         new ArrayList<String>()));
      testNTValue.setDeclaredPropertyDefinitionValues(props);
      nodeTypeManager.registerNodeType(testNTValue, ExtendedNodeTypeManager.REPLACE_IF_EXISTS);

      assertEquals("tt", testNode.getProperty("tt").getString());
      Node test2 = root.addNode("test2", testNTValue.getName());
      assertEquals("tt", test2.getProperty("tt").getString());
   }
View Full Code Here

Examples of org.exoplatform.services.jcr.core.nodetype.NodeTypeValue

    *
    * @throws Exception
    */
   public void testReregisterMandatory() throws Exception
   {
      NodeTypeValue testNValue = new NodeTypeValue();

      List<String> superType = new ArrayList<String>();
      superType.add("nt:base");
      testNValue.setName("exo:testReregisterMandatory");
      testNValue.setPrimaryItemName("");
      testNValue.setDeclaredSupertypeNames(superType);
      List<PropertyDefinitionValue> props = new ArrayList<PropertyDefinitionValue>();

      props.add(new PropertyDefinitionValue("tt", false, false, 1, false, new ArrayList<String>(), false,
         PropertyType.STRING, new ArrayList<String>()));
      testNValue.setDeclaredPropertyDefinitionValues(props);
      nodeTypeManager.registerNodeType(testNValue, ExtendedNodeTypeManager.FAIL_IF_EXISTS);
      testNValue = nodeTypeManager.getNodeTypeValue(testNValue.getName());
      Node tNode = root.addNode("test", "exo:testReregisterMandatory");
      session.save();

      // chenge mandatory
      List<PropertyDefinitionValue> props2 = new ArrayList<PropertyDefinitionValue>();
      props2.add(new PropertyDefinitionValue("tt", false, true, 1, false, new ArrayList<String>(), false,
         PropertyType.STRING, new ArrayList<String>()));
      testNValue.setDeclaredPropertyDefinitionValues(props2);
      try
      {
         nodeTypeManager.registerNodeType(testNValue, ExtendedNodeTypeManager.REPLACE_IF_EXISTS);
         fail();
      }
View Full Code Here

Examples of org.exoplatform.services.jcr.core.nodetype.NodeTypeValue

   }

   public void testReregisterRequiredNodeTypeChangeResidualProperty() throws Exception
   {
      // part1 any to string
      NodeTypeValue testNValue = new NodeTypeValue();

      List<String> superType = new ArrayList<String>();
      superType.add("nt:base");
      testNValue.setName("exo:testReregisterRequiredNodeTypeChangeResidualProperty");
      testNValue.setPrimaryItemName("");
      testNValue.setDeclaredSupertypeNames(superType);
      List<PropertyDefinitionValue> props = new ArrayList<PropertyDefinitionValue>();

      props.add(new PropertyDefinitionValue("*", false, false, 1, false, new ArrayList<String>(), false,
         PropertyType.UNDEFINED, new ArrayList<String>()));
      testNValue.setDeclaredPropertyDefinitionValues(props);
      nodeTypeManager.registerNodeType(testNValue, ExtendedNodeTypeManager.FAIL_IF_EXISTS);
      testNValue = nodeTypeManager.getNodeTypeValue(testNValue.getName());

      Node tNode = root.addNode("test", "exo:testReregisterRequiredNodeTypeChangeResidualProperty");
      tNode.setProperty("tt", "tt");
      tNode.setProperty("t2", 1);
      tNode.setProperty("t3", Calendar.getInstance());
      session.save();

      // chenge mandatory
      List<PropertyDefinitionValue> props2 = new ArrayList<PropertyDefinitionValue>();
      props2.add(new PropertyDefinitionValue("*", false, false, 1, false, new ArrayList<String>(), false,
         PropertyType.STRING, new ArrayList<String>()));
      testNValue.setDeclaredPropertyDefinitionValues(props2);

      try
      {
         nodeTypeManager.registerNodeType(testNValue, ExtendedNodeTypeManager.REPLACE_IF_EXISTS);
         fail();
View Full Code Here

Examples of org.exoplatform.services.jcr.core.nodetype.NodeTypeValue

   }

   public void testReregisterRequiredNodeTypeChangeProperty() throws Exception
   {
      // part1 any to string
      NodeTypeValue testNValue = new NodeTypeValue();

      List<String> superType = new ArrayList<String>();
      superType.add("nt:base");
      testNValue.setName("exo:testReregisterRequiredNodeTypeChangeProperty");
      testNValue.setPrimaryItemName("");
      testNValue.setDeclaredSupertypeNames(superType);
      List<PropertyDefinitionValue> props = new ArrayList<PropertyDefinitionValue>();

      props.add(new PropertyDefinitionValue("tt", false, false, 1, false, new ArrayList<String>(), false,
         PropertyType.UNDEFINED, new ArrayList<String>()));
      testNValue.setDeclaredPropertyDefinitionValues(props);
      nodeTypeManager.registerNodeType(testNValue, ExtendedNodeTypeManager.FAIL_IF_EXISTS);
      testNValue = nodeTypeManager.getNodeTypeValue(testNValue.getName());

      Node tNode = root.addNode("test", "exo:testReregisterRequiredNodeTypeChangeProperty");
      tNode.setProperty("tt", 1);

      session.save();

      // chenge mandatory
      List<PropertyDefinitionValue> props2 = new ArrayList<PropertyDefinitionValue>();
      props2.add(new PropertyDefinitionValue("tt", false, false, 1, false, new ArrayList<String>(), false,
         PropertyType.STRING, new ArrayList<String>()));
      testNValue.setDeclaredPropertyDefinitionValues(props2);

      try
      {
         nodeTypeManager.registerNodeType(testNValue, ExtendedNodeTypeManager.REPLACE_IF_EXISTS);
         fail();
View Full Code Here

Examples of org.exoplatform.services.jcr.core.nodetype.NodeTypeValue

   public void testReregisterValueConstraintChangeResidualProperty() throws Exception
   {

      // part1 any to string
      NodeTypeValue testNValue = new NodeTypeValue();

      List<String> superType = new ArrayList<String>();
      superType.add("nt:base");
      testNValue.setName("exo:testReregisterValueConstraintChangeResidualProperty");
      testNValue.setPrimaryItemName("");
      testNValue.setDeclaredSupertypeNames(superType);
      List<PropertyDefinitionValue> props = new ArrayList<PropertyDefinitionValue>();

      props.add(new PropertyDefinitionValue("*", false, false, 1, false, new ArrayList<String>(), false,
         PropertyType.LONG, new ArrayList<String>()));
      testNValue.setDeclaredPropertyDefinitionValues(props);
      nodeTypeManager.registerNodeType(testNValue, ExtendedNodeTypeManager.FAIL_IF_EXISTS);

      Node tNode = root.addNode("test", "exo:testReregisterValueConstraintChangeResidualProperty");
      tNode.setProperty("tt", 100);
      Property prop = tNode.setProperty("t1", 150);
      tNode.setProperty("t2", 1);
      tNode.setProperty("t3", 200);
      session.save();
      List<String> valueConstraint = new ArrayList<String>();
      valueConstraint.add("(,100]");
      valueConstraint.add("[200,)");
      props = new ArrayList<PropertyDefinitionValue>();
      props.add(new PropertyDefinitionValue("*", false, false, 1, false, new ArrayList<String>(), false,
         PropertyType.LONG, valueConstraint));
      testNValue.setDeclaredPropertyDefinitionValues(props);
      try
      {
         nodeTypeManager.registerNodeType(testNValue, ExtendedNodeTypeManager.REPLACE_IF_EXISTS);
         fail();
      }
View Full Code Here

Examples of org.exoplatform.services.jcr.core.nodetype.NodeTypeValue

   public void testReregisterValueConstraintChangeProperty() throws Exception
   {

      // part1 any to string
      NodeTypeValue testNValue = new NodeTypeValue();

      List<String> superType = new ArrayList<String>();
      superType.add("nt:base");
      testNValue.setName("exo:testReregisterValueConstraintChangeProperty");
      testNValue.setPrimaryItemName("");
      testNValue.setDeclaredSupertypeNames(superType);
      List<PropertyDefinitionValue> props = new ArrayList<PropertyDefinitionValue>();

      props.add(new PropertyDefinitionValue("t1", false, false, 1, false, new ArrayList<String>(), false,
         PropertyType.LONG, new ArrayList<String>()));
      testNValue.setDeclaredPropertyDefinitionValues(props);
      nodeTypeManager.registerNodeType(testNValue, ExtendedNodeTypeManager.FAIL_IF_EXISTS);
      testNValue = nodeTypeManager.getNodeTypeValue(testNValue.getName());

      Node tNode = root.addNode("test", "exo:testReregisterValueConstraintChangeProperty");

      Property prop = tNode.setProperty("t1", 150);
      session.save();
      List<String> valueConstraint = new ArrayList<String>();
      valueConstraint.add("(,100]");
      valueConstraint.add("[200,)");
      props = new ArrayList<PropertyDefinitionValue>();
      props.add(new PropertyDefinitionValue("t1", false, false, 1, false, new ArrayList<String>(), false,
         PropertyType.LONG, valueConstraint));
      testNValue.setDeclaredPropertyDefinitionValues(props);
      try
      {
         nodeTypeManager.registerNodeType(testNValue, ExtendedNodeTypeManager.REPLACE_IF_EXISTS);
         fail();
      }
View Full Code Here

Examples of org.exoplatform.services.jcr.core.nodetype.NodeTypeValue

   public void testReregisterIsMultipleChangeResidualProperty() throws Exception
   {

      // part1 any to string
      NodeTypeValue testNValue = new NodeTypeValue();

      List<String> superType = new ArrayList<String>();
      superType.add("nt:base");
      testNValue.setName("exo:testReregisterIsMultipleChangeResidualProperty");
      testNValue.setPrimaryItemName("");
      testNValue.setDeclaredSupertypeNames(superType);
      List<PropertyDefinitionValue> props = new ArrayList<PropertyDefinitionValue>();

      props.add(new PropertyDefinitionValue("*", false, false, 1, false, new ArrayList<String>(), true,
         PropertyType.STRING, new ArrayList<String>()));
      testNValue.setDeclaredPropertyDefinitionValues(props);
      nodeTypeManager.registerNodeType(testNValue, ExtendedNodeTypeManager.FAIL_IF_EXISTS);
      testNValue = nodeTypeManager.getNodeTypeValue(testNValue.getName());
      Node tNode = root.addNode("test", "exo:testReregisterIsMultipleChangeResidualProperty");
      Property prop = tNode.setProperty("t1", new String[]{"100", "150"});

      session.save();
      props = new ArrayList<PropertyDefinitionValue>();
      props.add(new PropertyDefinitionValue("*", false, false, 1, false, new ArrayList<String>(), false,
         PropertyType.STRING, new ArrayList<String>()));
      testNValue.setDeclaredPropertyDefinitionValues(props);
      try
      {
         nodeTypeManager.registerNodeType(testNValue, ExtendedNodeTypeManager.REPLACE_IF_EXISTS);
         fail();
      }
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.