Package com.google.enterprise.connector.mock

Examples of com.google.enterprise.connector.mock.MockRepositoryDocument


    return "dctmmockwrap";
  }

  @Override
  public ISysObject getObject(IId objectId) throws RepositoryDocumentException {
    MockRepositoryDocument mockRepositoryDocument = mockRep.getRepo()
        .getStore().getDocByID(objectId.toString());
    MockDmObject dctmMockRepositoryDocument = new MockDmObject(
        mockRepositoryDocument);
    return dctmMockRepositoryDocument;
  }
View Full Code Here


  public void testGetStore() {
    MockRepositoryDocumentStore a = null;

    a = ((MockDmSession) sess7).getStore();
    assertNotNull(a);
    MockRepositoryDocument mockDoc = a.getDocByID(DmInitialize.DM_ID1);
    String docID = mockDoc.getDocID();
    assertEquals(docID, DmInitialize.DM_ID1);
  }
View Full Code Here

      throws RepositoryLoginException, RepositoryException {
    String claimant = sessionManager.getIdentity(docbase).getUser();
    MockRepositoryDocumentStore store = ((MockDmSession) sessionManager
        .getSession(docbase)).getStore();
    for (int j = 0; j < ids.length; j++) {
      MockRepositoryDocument doc = store.getDocByID(ids[j]);// if no
      // 'content'
      // defined,
      // doc==null
      if (doc != null) {
        MockRepositoryPropertyList pl = doc.getProplist();
        MockRepositoryProperty p = pl.getProperty("acl");
        if (p != null) { // If doc contains acls
          String[] acl = p.getValues();
          for (int i = 0; i < acl.length; i++) {
            if (claimant.equals(acl[i])) {
View Full Code Here

    String userID = creds.getUserID();
    String password = new String (creds.getPassword());
    if (userID == null || userID.length() < 1) {
      return true;
    }
    MockRepositoryDocument doc = repo.getStore().getDocByID("users");
    if (doc == null) {
      return true;
    }
    MockRepositoryProperty property = doc.getProplist().getProperty("acl");
    if (property == null) {
      return true;
    }
    String[] values = property.getValues();
    for (int i=0; i<values.length; i++) {
View Full Code Here

    return result;
  }

  public Node getNodeByUUID(String uuid) throws ItemNotFoundException,
      RepositoryException {
    MockRepositoryDocument doc = repo.getRepo().getStore().getDocByID(uuid);
    if (doc == null) {
      throw new ItemNotFoundException();
    }
    Node result = new MockJcrNode(doc);
    String userID = getUserID();
View Full Code Here

  /**
   * Sanity test
   * @throws RepositoryException
   */
  public void testSimpleDoc() throws RepositoryException {
    MockRepositoryDocument mrd = new MockRepositoryDocument(
        new MockRepositoryDateTime(50000), "docid2", "now is the time",
        new MockRepositoryPropertyList());
    Node n = new MockJcrNode(mrd);
    Property p = n.getProperty("jcr:content");
    Assert.assertNotNull(p);
View Full Code Here

    try {
      jo = new JSONObject(in);
    } catch (JSONException e) {
      throw new IllegalArgumentException("test input can not be parsed");
    }
    MockRepositoryDocument document = new MockRepositoryDocument(jo);
    MockJcrNode node = new MockJcrNode(document);

    {
      Property p = node.getProperty("jcr:content");
      Assert.assertNotNull(p);
View Full Code Here

    try {
      jo = new JSONObject(jsonString);
    } catch (JSONException e) {
      throw new IllegalArgumentException("test input can not be parsed");
    }
    MockRepositoryDocument mockDocument = new MockRepositoryDocument(jo);
    MockJcrNode node = new MockJcrNode(mockDocument);
    Document document = new JcrDocument(node);
    return document;
  }
View Full Code Here

  public final void testJcrDocumentFromMockRepo() throws RepositoryException {
    MockRepositoryEventList mrel =
        new MockRepositoryEventList("MockRepositoryEventLog3.txt");
    MockRepository r = new MockRepository(mrel);
    MockRepositoryDocument doc = r.getStore().getDocByID("doc1");
    Node node = new MockJcrNode(doc);
    Document document = new JcrDocument(node);
    countProperties(document);
  }
View Full Code Here

  }

  private Document extractJcrDocument(String eventLog, String docid) {
    MockRepositoryEventList mrel = new MockRepositoryEventList(eventLog);
    MockRepository r = new MockRepository(mrel);
    MockRepositoryDocument doc = r.getStore().getDocByID(docid);
    Node node = new MockJcrNode(doc);
    return new JcrDocument(node);
  }
View Full Code Here

TOP

Related Classes of com.google.enterprise.connector.mock.MockRepositoryDocument

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.