Package com.google.enterprise.connector.traversal

Examples of com.google.enterprise.connector.traversal.FileSizeLimitInfo


   * to continue feeding docs.
   */
  public void testNotLowMemory() throws Exception {
    Document document = getTestDocument();
    FeedConnection feedConnection = new MockFeedConnection();
    FileSizeLimitInfo limit = new FileSizeLimitInfo();
    limit.setMaxFeedSize(32);
    limit.setMaxDocumentSize(64 * 1024);

    Runtime rt = Runtime.getRuntime();
    rt.gc();

    // If plenty of memory is available, DocPusher should indicate it is
View Full Code Here


    Runtime rt = Runtime.getRuntime();
    rt.gc();
    long memAvailable = rt.maxMemory() - (rt.totalMemory() - rt.freeMemory());

    FileSizeLimitInfo limit = new FileSizeLimitInfo();
    // With these limits, the largest possible feed will be about 7/12 of
    // available memory - there should not be room for a second one.
    limit.setMaxDocumentSize(memAvailable/4);
    limit.setMaxFeedSize(memAvailable/3);

    DocPusher dpusher =
        new DocPusher(feedConnection, dataSource, limit, dfc);
    Map<String, Object> config = getTestDocumentConfig();
    config.put(SpiConstants.PROPNAME_CONTENT,
               new HugeInputStream(limit.maxDocumentSize() - 10));
    Document bigDocument = ConnectorTestUtils.createSimpleDocument(config);
    assertEquals(PusherStatus.LOW_MEMORY, dpusher.take(bigDocument, null));
    dpusher.flush();
    assertFalse(feedConnection.isBacklogged());
  }
View Full Code Here

  public void testSwitchGSAs() throws Exception {
    SwitchableFeedConnection feedConnection = new SwitchableFeedConnection();
    feedConnection.setSupportsInheritedAcls(true);

    // Set artificially low feedsize to force 1 document per feed.
    FileSizeLimitInfo fileSizeLimit = new FileSizeLimitInfo();
    fileSizeLimit.setMaxFeedSize(32);
    fileSizeLimit.setMaxDocumentSize(1024 * 1024);

    DocPusher dpusher =
        new DocPusher(feedConnection, dataSource, fileSizeLimit, dfc);

    String parentId = "parent-doc";
View Full Code Here

    checkACISReadByte(new ByteArrayInputStream(CONTENT.getBytes()), CONTENT);
  }

  /** Returns a new XmlFeed */
  private XmlFeed newFeed() throws IOException {
    return new XmlFeed("test", FeedType.CONTENT, new FileSizeLimitInfo(),
                       null, new MockFeedConnection());
  }
View Full Code Here

TOP

Related Classes of com.google.enterprise.connector.traversal.FileSizeLimitInfo

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.