Package org.exoplatform.services.jcr.dataflow

Examples of org.exoplatform.services.jcr.dataflow.SharedDataManager


   @Override
   protected void tearDown() throws Exception
   {
      SessionDataManager sdm = session.getTransientNodesManager();
      TransactionableDataManager trm = sdm.getTransactManager();
      SharedDataManager wdm = trm.getStorageDataManager();

      CompositeChangesLog clog = new TransactionChangesLog();
      PlainChangesLogImpl changes = new PlainChangesLogImpl();
      for (int i = cleanUpList.size(); i > 0;)
      {
         changes.add(ItemState.createDeletedState(cleanUpList.get(--i)));
      }

      clog.addLog(changes);
      wdm.save(clog);

      super.tearDown();
   }
View Full Code Here


   public void testItemAdd_Connection() throws Exception
   {
      SessionDataManager sdm = session.getTransientNodesManager();
      TransactionableDataManager trm = sdm.getTransactManager();
      SharedDataManager wdm = trm.getStorageDataManager();

      NodeData rootData = (NodeData)wdm.getItemData(Constants.ROOT_UUID);

      InternalQName nodeName = InternalQName.parse("[]testNode");
      QPath path = QPath.makeChildPath(rootData.getQPath(), nodeName, 1);

      AccessControlList acl = rootData.getACL();
View Full Code Here

   public void testItemAdd_DataManager() throws Exception
   {
      SessionDataManager sdm = session.getTransientNodesManager();
      TransactionableDataManager trm = sdm.getTransactManager();
      SharedDataManager wdm = trm.getStorageDataManager();

      NodeData rootData = (NodeData)wdm.getItemData(Constants.ROOT_UUID);

      InternalQName nodeName = InternalQName.parse("[]testNode");
      QPath path = QPath.makeChildPath(rootData.getQPath(), nodeName, 1);

      AccessControlList acl = rootData.getACL();

      TransientNodeData nodeData =
         new TransientNodeData(path, IdGenerator.generate(), -1, Constants.NT_UNSTRUCTURED, new InternalQName[0], 0,
            rootData.getIdentifier(), acl);

      // jcr:primaryType
      TransientPropertyData ptData =
         TransientPropertyData.createPropertyData(nodeData, Constants.JCR_PRIMARYTYPE, PropertyType.NAME, false,
            new TransientValueData(Constants.NT_UNSTRUCTURED));

      // jcr:mixinTypes
      TransientPropertyData mtData =
         TransientPropertyData.createPropertyData(nodeData, Constants.JCR_MIXINTYPES, PropertyType.NAME, true,
            new TransientValueData(Constants.MIX_REFERENCEABLE));

      // jcr:uuid
      TransientPropertyData uuidData =
         TransientPropertyData.createPropertyData(nodeData, Constants.JCR_UUID, PropertyType.STRING, false,
            new TransientValueData(nodeData.getIdentifier()));

      // add
      CompositeChangesLog clog = new TransactionChangesLog();
      PlainChangesLogImpl changes = new PlainChangesLogImpl();
      try
      {
         changes.add(ItemState.createAddedState(nodeData));
         changes.add(ItemState.createAddedState(ptData));
         changes.add(ItemState.createAddedState(mtData));
         changes.add(ItemState.createAddedState(uuidData));
         clog.addLog(changes);
         wdm.save(clog);
      }
      finally
      {
         cleanUpList.add(nodeData);
         cleanUpList.add(ptData);
         cleanUpList.add(mtData);
         cleanUpList.add(uuidData);
      }

      // get
      try
      {
         NodeData storedNode = (NodeData)wdm.getItemData(rootData, new QPathEntry(nodeName, 1), ItemType.NODE);
         assertEquals(path, storedNode.getQPath());
      }
      catch (Exception e)
      {
         throw e;
View Full Code Here

   @Override
   protected void tearDown() throws Exception
   {
      SessionDataManager sdm = session.getTransientNodesManager();
      TransactionableDataManager trm = sdm.getTransactManager();
      SharedDataManager wdm = trm.getStorageDataManager();

      CompositeChangesLog clog = new TransactionChangesLog();
      PlainChangesLogImpl changes = new PlainChangesLogImpl();
      for (int i = cleanUpList.size(); i > 0;)
      {
         changes.add(ItemState.createDeletedState(cleanUpList.get(--i)));
      }

      clog.addLog(changes);
      wdm.save(clog);

      super.tearDown();
   }
View Full Code Here

   public void testItemAdd_Connection() throws Exception
   {
      SessionDataManager sdm = session.getTransientNodesManager();
      TransactionableDataManager trm = sdm.getTransactManager();
      SharedDataManager wdm = trm.getStorageDataManager();

      NodeData rootData = (NodeData)wdm.getItemData(Constants.ROOT_UUID);

      InternalQName nodeName = InternalQName.parse("[]testNode");
      QPath path = QPath.makeChildPath(rootData.getQPath(), nodeName, 1);

      AccessControlList acl = rootData.getACL();
View Full Code Here

   public void testItemAdd_DataManager() throws Exception
   {
      SessionDataManager sdm = session.getTransientNodesManager();
      TransactionableDataManager trm = sdm.getTransactManager();
      SharedDataManager wdm = trm.getStorageDataManager();

      NodeData rootData = (NodeData)wdm.getItemData(Constants.ROOT_UUID);

      InternalQName nodeName = InternalQName.parse("[]testNode");
      QPath path = QPath.makeChildPath(rootData.getQPath(), nodeName, 1);

      AccessControlList acl = rootData.getACL();

      TransientNodeData nodeData =
         new TransientNodeData(path, IdGenerator.generate(), -1, Constants.NT_UNSTRUCTURED, new InternalQName[0], 0,
            rootData.getIdentifier(), acl);

      // jcr:primaryType
      TransientPropertyData ptData =
         TransientPropertyData.createPropertyData(nodeData, Constants.JCR_PRIMARYTYPE, PropertyType.NAME, false,
            new TransientValueData(Constants.NT_UNSTRUCTURED));

      // jcr:mixinTypes
      TransientPropertyData mtData =
         TransientPropertyData.createPropertyData(nodeData, Constants.JCR_MIXINTYPES, PropertyType.NAME, true,
            new TransientValueData(Constants.MIX_REFERENCEABLE));

      // jcr:uuid
      TransientPropertyData uuidData =
         TransientPropertyData.createPropertyData(nodeData, Constants.JCR_UUID, PropertyType.STRING, false,
            new TransientValueData(nodeData.getIdentifier()));

      // add
      CompositeChangesLog clog = new TransactionChangesLog();
      PlainChangesLogImpl changes = new PlainChangesLogImpl();
      try
      {
         changes.add(ItemState.createAddedState(nodeData));
         changes.add(ItemState.createAddedState(ptData));
         changes.add(ItemState.createAddedState(mtData));
         changes.add(ItemState.createAddedState(uuidData));
         clog.addLog(changes);
         wdm.save(clog);
      }
      finally
      {
         cleanUpList.add(nodeData);
         cleanUpList.add(ptData);
         cleanUpList.add(mtData);
         cleanUpList.add(uuidData);
      }

      // get
      try
      {
         NodeData storedNode = (NodeData)wdm.getItemData(rootData, new QPathEntry(nodeName, 1), ItemType.NODE);
         assertEquals(path, storedNode.getQPath());
      }
      catch (Exception e)
      {
         throw e;
View Full Code Here

TOP

Related Classes of org.exoplatform.services.jcr.dataflow.SharedDataManager

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.