Examples of JCRWebdavConnection


Examples of org.exoplatform.services.jcr.cluster.JCRWebdavConnection

public class WebdavAddNodeTest extends BaseClusteringFunctionalTest
{

   public void testAddNode() throws Exception
   {
      JCRWebdavConnection conn = getConnection();
     
      // add node
      conn.addNode(nodeName, "_data_".getBytes());

      // check is node exist
      for (JCRWebdavConnection connection : getConnections())
      {
         HTTPResponse response = connection.getNode(nodeName);
View Full Code Here

Examples of org.exoplatform.services.jcr.cluster.JCRWebdavConnection

*/
public class WebdavMoveNodeTest extends BaseClusteringFunctionalTest
{
   public void testMoveNode() throws Exception
   {
      JCRWebdavConnection conn = getConnection();
     
      String newNodeName = nodeName + "new";

      // add node
      conn.addNode(nodeName, "".getBytes());

      // check is node exist
      for (JCRWebdavConnection connection : getConnections())
      {
         HTTPResponse response = connection.getNode(nodeName);
         assertEquals(200, response.getStatusCode());
      }

      // move node
      conn = getConnection();
     
      HTTPResponse response = conn.moveNode(nodeName, newNodeName);
      assertEquals(201, response.getStatusCode());

      // check is node not exist
      for (JCRWebdavConnection connection : getConnections())
      {
View Full Code Here

Examples of org.exoplatform.services.jcr.cluster.JCRWebdavConnection

            readNodePath = nodeInfo.getPath();

         }
         long start = System.currentTimeMillis();
         JCRWebdavConnection conn = null;
         try
         {
            conn = getNewConnection();
            HTTPResponse response = conn.getNode(readNodePath);
            if (response.getStatusCode() == HTTPStatus.OK)
            {
               resultCollector.addResult(true, System.currentTimeMillis() - start);
            }
            else
            {
               System.out.println("Can not get (response code " + response.getStatusCode()
                  + new String(response.getData()) + " ) node with path : " + readNodePath);

            }

         }
         catch (Exception e)
         {
            System.out.println(e.getLocalizedMessage());
         }
         finally
         {
            if (conn != null)
            {
               conn.stop();
            }
         }

      }
   }
View Full Code Here

Examples of org.exoplatform.services.jcr.cluster.JCRWebdavConnection

    */
   @Override
   public void doWrite(List<NodeInfo> nodesPath, ResultCollector resultCollector)
   {

      JCRWebdavConnection connection = null;
      try
      {
         connection = getNewConnection();
         String putFile = testRoot + "/" + UUID.randomUUID().toString();

         long start = System.currentTimeMillis();
         HTTPResponse response = connection.addNode(putFile, ("__the_data_in_nt+file__").getBytes(), "text/plain");

         if (response.getStatusCode() == HTTPStatus.CREATED)
         {
            resultCollector.addResult(false, System.currentTimeMillis() - start);
            nodesPath.add(new NodeInfo(putFile, System.currentTimeMillis()));
         }
         else
         {
            System.out.println(Thread.currentThread().getName() + " : Can not add (response code "
               + response.getStatusCode() + new String(response.getData()) + " ) file with path : " + putFile);

         }

      }
      catch (Exception e)
      {
         System.out.println(e.getLocalizedMessage());
      }
      finally
      {
         if (connection != null)
         {
            connection.stop();
         }
      }
   }
View Full Code Here

Examples of org.exoplatform.services.jcr.cluster.JCRWebdavConnection

    * @return
    */
   public String createDirIfAbsent(String root, String name, ResultCollector resultCollector)
   {
      String path = root.length() == 0 ? name : root + "/" + name;
      JCRWebdavConnection connection = null;
      try
      {
         connection = getNewConnection();

         long start = System.currentTimeMillis();
         HTTPResponse nodeResponce = connection.getNode(path);
         //add information about read

         resultCollector.addResult(true, System.currentTimeMillis() - start);
         if (nodeResponce.getStatusCode() != HTTPStatus.OK)
         {
            start = System.currentTimeMillis();
            HTTPResponse addResponce = connection.addDir(path);
            //add information about write

            if (addResponce.getStatusCode() == HTTPStatus.CREATED)
            {
               resultCollector.addResult(false, System.currentTimeMillis() - start);
            }
            else
            {
               System.out.println(Thread.currentThread().getName() + " : Can not add (response code "
                  + addResponce.getStatusCode() + new String(addResponce.getData()) + " ) node with path : " + path);

            }
         }
      }
      catch (Exception e)
      {
         System.out.println(e.getLocalizedMessage());
      }
      finally
      {
         if (connection != null)
         {
            connection.stop();
         }
      }
      return path;
   }
View Full Code Here

Examples of org.exoplatform.services.jcr.cluster.JCRWebdavConnection

      super(nodesPath, resultCollector, startSignal, READ_VALUE, random, isReadThread);
   }

   protected JCRWebdavConnection getNewConnection()
   {
      return new JCRWebdavConnection("192.168.0.129", 80, "root", "exo", WEBDAV_REALM, WEBDAV_DEFAULT_PATH);
   }
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.