Package com.google.enterprise.connector.spi

Examples of com.google.enterprise.connector.spi.Document


  }

  public void testNextDocument() throws SkippedDocumentException {
    System.out.println("Testing nextDocument()...");
    this.docs.setFQDNConversion(true);
    final Document doc = this.docs.nextDocument();
    assertNotNull(doc);
    System.out.println("[ nextDocument() ] Test Passed.");
  }
View Full Code Here


    if (docList == null) {
      System.out.println("No results.");
      return;
    }

    Document doc;
    while ((doc = docList.nextDocument()) != null) {
      System.out.println();
      for (String name: doc.getPropertyNames()) {
        Property prop = doc.findProperty(name);
        Value value;
        while ((value = prop.nextValue()) != null) {
          String printableValue;
          if (value instanceof BinaryValue) {
            try {
View Full Code Here

    }

    private void pushResultSet(DocumentList docList)
        throws RepositoryException, PushException, FeedException {

        Document doc;

        while ((doc = docList.nextDocument()) != null) {
            // TODO: make the feed name a property, along with the feed server and port
            pusher.take(doc);
        }
View Full Code Here

   
    try {
      GdConnector gdc = new GdConnector();
      gdc.setService(alwaysOneEntryService);
      DocumentList resultSet = gdc.startTraversal();
      Document docA = resultSet.nextDocument();
      Document docB = resultSet.nextDocument();
      assertNotNull(docA);
      assertEquals("\u9762",
          getFirstStringValue(docA, SpiConstants.PROPNAME_DOCID));
      assertNull(docB);
    } catch (RepositoryException re) {
View Full Code Here

    entry.setUpdated(dt);
    entry.addHtmlLink(uri, "en", "example");
    entry.setContent(
        TextConstruct.create(TextConstruct.Type.TEXT, contentNonce, null));
   
    Document doc = null;
    try {
      doc = GdConnector.makeDocument(entry);
    } catch (RepositoryException re) {
      fail(re.toString());
    }
View Full Code Here

    LinkedList items = new LinkedList();
    items.add(makeDocument("a while ago"));
    items.add(makeDocument("just the other day"));
   
    DocumentList docList = new GdDocumentList(items, "right now");
    Document ignoredDocument = null;
   
    ignoredDocument = docList.nextDocument();
    assertEquals("a while ago", docList.checkpoint());
    ignoredDocument = docList.nextDocument();
    assertEquals("just the other day", docList.checkpoint());
View Full Code Here

    assertEquals("right now", docList.checkpoint());
  }
 
  public void testTraversesDocumentsGivenToConstructor()
  throws RepositoryException {
    Document docA = makeDocument();
    Document docB = makeDocument();
    Document docC = makeDocument();
   
    LinkedList items = new LinkedList();
    items.add(docA);
    items.add(docB);
    items.add(docC);
View Full Code Here

    traverser.setBatchHint(100);
    // Under live test and the test account, the deletion events weren't
    // returned from FileNet.
    boolean tested = false;
    DocumentList docList = traverser.getDocumentList(new Checkpoint());
    Document doc;
    while ((doc = docList.nextDocument()) != null) {
      assertTrue(checkpointContains(docList.checkpoint(),
          doc.findProperty(SpiConstants.PROPNAME_LASTMODIFIED),
          JsonField.LAST_MODIFIED_TIME));
      tested = true;
    }
    assertTrue(tested);
  }
View Full Code Here

  public void testLiveNextDocument() throws Exception {
    Traverser traverser = getObjectUnderTest();
    boolean isTested = false;
    DocumentList docList = traverser.getDocumentList(new Checkpoint());
    assertNotNull("Document list is null", docList);
    Document doc = docList.nextDocument();
    while (doc != null && doc instanceof FileDocument) {
      Property lastModifiedProp =
          doc.findProperty(SpiConstants.PROPNAME_LASTMODIFIED);
      Value lastModifiedValue = lastModifiedProp.nextValue();
      Calendar cal = Value.iso8601ToCalendar(lastModifiedValue.toString());

      Document nextDoc = docList.nextDocument();
      if (nextDoc != null && nextDoc instanceof FileDocument) {
        Property nextDocLastModifiedProp =
            nextDoc.findProperty(SpiConstants.PROPNAME_LASTMODIFIED);
        Value nextDocLastModifiedValue = nextDocLastModifiedProp.nextValue();
        Calendar nextCal =
            Value.iso8601ToCalendar(nextDocLastModifiedValue.toString());
        assertTrue(cal.compareTo(nextCal) <= 0);
        isTested = true;
View Full Code Here

            getCustomDeletion(os.getObjects()),
            getDeletionEvents(os.getObjects()));

    // Test the order
    for (int index : expectedOrder) {
      Document doc = docList.nextDocument();
      Property fid = doc.findProperty(SpiConstants.PROPNAME_DOCID);
      assertEquals("[" + dbType + "] Incorrect id sorting order",
          "{" + entries[index][0] + "}", fid.nextValue().toString());
    }
  }
View Full Code Here

TOP

Related Classes of com.google.enterprise.connector.spi.Document

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.