Examples of JCRWebdavConnection


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

   protected void setUp() throws Exception
   {
      super.setUp();

      connections =
         new JCRWebdavConnection[]{new JCRWebdavConnection("localhost", 8080, "root", "exo", realm, workspacePath)
         /**,
         new JCRWebdavConnection("localhost", 8082, "root", "exo", realm, workspacePath),
         new JCRWebdavConnection("localhost", 8083, "root", "exo", realm, workspacePath),
         new JCRWebdavConnection("localhost", 8084, "root", "exo", realm, workspacePath)
         */
 
View Full Code Here

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

public class WebdavVersionTest
   extends BaseClusteringFunctionalTest
{
   public void testVersioning() throws Exception
   {
      JCRWebdavConnection conn = getConnection();
     
      conn.addNode(nodeName, "v1".getBytes());
     
      conn.addVersionControl(nodeName);
     
      conn.checkIn(nodeName);
      conn.checkOut(nodeName);
     
      // check
      for (JCRWebdavConnection connection : getConnections())
      {
         HTTPResponse response = connection.getNode(nodeName);
         assertEquals(200, response.getStatusCode());
         assertTrue("v1".equals(new String(response.getData())));
      }
     
      // create version
      conn.checkOut(nodeName);
      conn.addNode(nodeName, "v2".getBytes());
      conn.checkIn(nodeName);
     
      // create version     
      conn.checkOut(nodeName);
      conn.addNode(nodeName, "v3".getBytes());
      conn.checkIn(nodeName);
     
      // create version
      conn.checkOut(nodeName);
      conn.addNode(nodeName, "v4".getBytes());
      conn.checkIn(nodeName);
     
      // check
      for (JCRWebdavConnection connection : getConnections())
      {
         HTTPResponse response = connection.getNode(nodeName);
View Full Code Here

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

public class WebdavLockNodeTest
   extends BaseClusteringFunctionalTest
{
   public void testLock() throws Exception
   {
      JCRWebdavConnection conn = getConnection();
     
      // prepare
      String lockedNodeName = "locked_node";
     
      conn.addDir(nodeName);
      conn.addNode(nodeName + "/" + lockedNodeName, "".getBytes());
     
      // lock
      String lockToken =  conn.lock(nodeName + "/" + lockedNodeName);
     
      // check
      for (JCRWebdavConnection connection : getConnections())
      {
         HTTPResponse response = connection.removeNode(nodeName + "/" + lockedNodeName);
         assertEquals(HTTPStatus.LOCKED, response.getStatusCode());
      }
     
      // unloc
      conn.unlock(nodeName + "/" + lockedNodeName, lockToken);
     
      HTTPResponse resp = getConnection().removeNode(nodeName + "/" + lockedNodeName);
      assertEquals(HTTPStatus.NO_CONTENT, resp.getStatusCode());
     
      // ckeck
View Full Code Here

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

      // make a test blob
      byte[] data = new byte[sizeInMb * 1024 * 1024];
      Random random = new Random();
      random.nextBytes(data);

      JCRWebdavConnection conn = getConnection();
     
      // add node with blob data
      HttpOutputStream stream = new HttpOutputStream();
      HTTPResponse response = conn.addNode(nodeName, stream);
      loadStream(stream, new ByteArrayInputStream(data));
      stream.close();
      response.getStatusCode();

      // check results
View Full Code Here

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

   extends BaseClusteringFunctionalTest
{

   public void testCreatePropertyTest() throws Exception
   {
      JCRWebdavConnection conn = getConnection();
     
      String property = "D:testProp";
     
      conn.addNode(nodeName, "nt:untstructured","".getBytes());
      conn.addProperty(nodeName, property);
     
      // check is property exist
      for (JCRWebdavConnection connection : getConnections())
      {
         HTTPResponse response = connection.getProperty(nodeName, property);
View Full Code Here

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

   /**
    * Full-text query tests
    */
   public void testFullTextSearch() throws Exception
   {
      JCRWebdavConnection conn = getConnection();
      // Nodes with some text, with unique words in each one in form of <name><content>
      Map<String, String> nodes = new HashMap<String, String>();
      nodes
         .put(
            "JCR_Overview",
            "A JCR is a type of Object Database tailored to the storage, searching, and retrieval of hierarchical data. The JCR API grew o"
               + "ut of the needs of content management systems, which require storage of documents and other binary objects with associated me"
               + "tadata; however, the API is applicable to many additional types of application. In addition to object storage, the JCR provid"
               + "es: APIs for versioning of data; transactions; observation of changes in data; and import or export of data to XML in a standard way.");
      nodes
         .put(
            "JCR_Structure",
            "The data in a JCR consists of a tree of Nodes with associated Properties. Data is stored in the Properties, which may hold simple "
               + "values such as numbers and strings or binary data of arbitrary length. Nodes may optionally have one or more types associated with"
               + " them which dictate the kinds of properties, number and type of child nodes, and certain behavioral characteristics of the nodes. API");

      nodes
         .put(
            "JCR_Queries",
            "A JCR can be queried with XPathQuery, can export portions of its tree to XML in two standard formats and can import hierarchies directly"
               + " from XML. A JCR may optionally support a standardized form of SQL for queries. The Apache Jackrabbit reference implementation of "
               + "JCR also supports the integration of the Apache Lucene search engine to give full text searches of data in the repository.");

      nodes.put("JCR_Impl",
         "eXo Platform JCR implementation on the company wiki. eXo Platform 2 article on theserverside");
      // add nodes
      for (Entry<String, String> entry : nodes.entrySet())
      {
         conn.addNode(entry.getKey(), entry.getValue().getBytes(), MIME_TEXT_PLAIN);
      }
      // wait for indexer to flush volatile index
      sleep();

      // map containing test-case: <SQL query> : <expected nodes>
      Map<String, String[]> sqlCases = new HashMap<String, String[]>();
      sqlCases.put("SELECT * FROM nt:base WHERE CONTAINS(*,'tailored')", new String[]{"JCR_Overview"});
      sqlCases.put("SELECT * FROM nt:base WHERE CONTAINS(*,'XPathQuery')", new String[]{"JCR_Queries"});
      sqlCases.put("SELECT * FROM nt:resource WHERE CONTAINS(*,'API')", new String[]{"JCR_Structure", "JCR_Overview"});
      assertQuery(sqlCases, Query.SQL);

      // map containing test-case: <XPATH query> : <expected nodes>
      Map<String, String[]> xpathCases = new HashMap<String, String[]>();
      xpathCases.put("//element(*, nt:base)[jcr:contains(.,'tailored')]", new String[]{"JCR_Overview"});
      xpathCases.put("//element(*, nt:base)[jcr:contains(.,'XPathQuery')]", new String[]{"JCR_Queries"});
      xpathCases.put("//element(*, nt:resource)[jcr:contains(.,'API')]", new String[]{"JCR_Structure", "JCR_Overview"});
      assertQuery(xpathCases, Query.XPATH);
      // remove created nodes
      for (Entry<String, String> entry : nodes.entrySet())
      {
         conn.removeNode(entry.getKey());
      }
   }
View Full Code Here

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

    * Simple test, searching nodes by given path and concrete name.
    */
   public void testPathSearch() throws Exception
   {
      String testLocalRootName = "testPathSearch";
      JCRWebdavConnection conn = getConnection();
      conn.addDir(testLocalRootName);
      List<String> expected = new ArrayList<String>();
      expected.add("exoString");
      expected.add("exoBoolean");
      expected.add("exoInteger");
      expected.add("exoLong");
      expected.add("exoFloat");
      expected.add("exoDouble");

      for (String name : expected)
      {
         conn.addNode(testLocalRootName + "/" + name, "_data_".getBytes());
      }
      // wait for indexer to flush volatile index
      sleep();

      // map containing test-case: <SQL query> : <expected nodes>
      Map<String, String[]> sqlCases = new HashMap<String, String[]>();
      sqlCases.put("SELECT * FROM nt:base WHERE jcr:path LIKE '/" + testLocalRootName
         + "[%]/%' AND NOT jcr:path LIKE '/" + testLocalRootName + "[%]/%/%' ", expected.toArray(new String[expected
         .size()]));
      sqlCases.put("SELECT * FROM nt:base WHERE fn:name() = 'exoString'", new String[]{"exoString"});
      assertQuery(sqlCases, Query.SQL);

      // map containing test-case: <XPATH query> : <expected nodes>
      Map<String, String[]> xpathCases = new HashMap<String, String[]>();
      xpathCases.put("/jcr:root/" + testLocalRootName + "/ element(*, nt:base)", expected.toArray(new String[expected
         .size()]));
      xpathCases.put("//element(*,nt:file)[fn:name() = 'exoString']", new String[]{"exoString"});
      assertQuery(xpathCases, Query.XPATH);

      conn.removeNode(testLocalRootName);
   }
View Full Code Here

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

    * Test, searching over the repository nodes with concrete value of concrete property.
    * jcr:mimeType is used for querying purposes.
    */
   public void testPropertyValueSearch() throws Exception
   {
      JCRWebdavConnection conn = getConnection();
      // Nodes with concrete mimetype in form of <name><content>
      Map<String, String> nodes = new HashMap<String, String>();
      // text/plain
      nodes.put("TextDescription", MIME_TEXT_PLAIN);
      nodes.put("SmallNote", MIME_TEXT_PLAIN);
      nodes.put("CalendarMemo", MIME_TEXT_PLAIN);
      nodes.put("GetThisDone", MIME_TEXT_PLAIN);
      // text/patch
      nodes.put("CriticalPath", MIME_TEXT_PATCH);
      nodes.put("BrokenPatch", MIME_TEXT_PATCH);
      // text/html
      nodes.put("FirstPage", MIME_TEXT_HTML);
      nodes.put("AboutGateIn", MIME_TEXT_HTML);
      nodes.put("LicenseAgreement", MIME_TEXT_HTML);
      nodes.put("HomePage", MIME_TEXT_HTML);
      nodes.put("StrangePage", MIME_TEXT_HTML);

      // add nodes
      for (Entry<String, String> entry : nodes.entrySet())
      {
         conn.addNode(entry.getKey(), "content".getBytes(), entry.getValue());
      }
      // wait for indexer to flush volatile index
      sleep();

      // map containing test-case: <SQL query> : <expected nodes>
      Map<String, String[]> sqlCases = new HashMap<String, String[]>();
      sqlCases.put("SELECT * FROM nt:resource WHERE jcr:mimeType ='" + MIME_TEXT_PLAIN + "'", getNodesByMime(nodes,
         MIME_TEXT_PLAIN));
      sqlCases.put("SELECT * FROM nt:resource WHERE jcr:mimeType ='" + MIME_TEXT_HTML + "'", getNodesByMime(nodes,
         MIME_TEXT_HTML));
      sqlCases.put("SELECT * FROM nt:resource WHERE jcr:mimeType LIKE 'text%'", nodes.keySet().toArray(
         new String[nodes.size()]));
      assertQuery(sqlCases, Query.SQL);

      // map containing test-case: <XPATH query> : <expected nodes>
      Map<String, String[]> xpathCases = new HashMap<String, String[]>();
      xpathCases.put("//element(*,nt:resource)[@jcr:mimeType='" + MIME_TEXT_PLAIN + "']", getNodesByMime(nodes,
         MIME_TEXT_PLAIN));
      xpathCases.put("//element(*,nt:resource)[@jcr:mimeType='" + MIME_TEXT_HTML + "']", getNodesByMime(nodes,
         MIME_TEXT_HTML));
      xpathCases.put("//element(*,nt:resource)[jcr:like(@jcr:mimeType, 'text%')]", nodes.keySet().toArray(
         new String[nodes.size()]));
      assertQuery(xpathCases, Query.XPATH);

      // remove created nodes
      for (Entry<String, String> entry : nodes.entrySet())
      {
         conn.removeNode(entry.getKey());
      }
   }
View Full Code Here

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

public class WebdavRemovePropertyTest
   extends BaseClusteringFunctionalTest
{
   public void testRemoveProperty() throws Exception
   {
      JCRWebdavConnection conn = getConnection();
     
      // prepare
      conn.addNode(nodeName, "nt:untstructured", "".getBytes());
      conn.setProperty(nodeName, "D:testProp", "the_value");
     
      //check
      for (JCRWebdavConnection connection : getConnections())
      {
         HTTPResponse response = connection.getProperty(nodeName, "D:testProp");
         assertEquals(207, response.getStatusCode());
      }
     
      //remove
      conn.removeProperty(nodeName, "D:testProp");
     
      //check
      for (JCRWebdavConnection connection : getConnections())
      {
         HTTPResponse response = connection.getProperty(nodeName, "D:testProp");
View Full Code Here

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

public class WebdavSetPropertyTest
   extends BaseClusteringFunctionalTest
{
   public void testSetProperty() throws Exception
   {
      JCRWebdavConnection conn = getConnection();

      // prepare
      conn.addNode(nodeName, "nt:untstructured", "".getBytes());
      conn.addProperty(nodeName, "D:testProp");

      // check
      for (JCRWebdavConnection connection : getConnections())
      {
         HTTPResponse response = connection.getProperty(nodeName, "D:testProp");
         assertEquals(207, response.getStatusCode());
      }

      // set property
      conn.setProperty(nodeName, "D:testProp", "testValue_new");

      // check
      for (JCRWebdavConnection connection : getConnections())
      {
         HTTPResponse response = connection.getProperty(nodeName, "D:testProp");
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.