Package com.google.enterprise.connector.spi

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


  public void testLogin() throws RepositoryException {
    conn.login();
  }

  public void testTraversal() throws RepositoryException {
    Session sess = conn.login();

    TraversalManager mgr = sess.getTraversalManager();
    mgr.setBatchHint(20);

    System.out.println("============ startTraversal ============");
    LivelinkDocumentList docList = (LivelinkDocumentList) mgr.startTraversal();
    while (docList != null) {
View Full Code Here


   * of results returned. If the query restriction used in
   * resumeTraversal is not accurate, then the number of results can
   * vary as the batch size changes.
   */
  public void testResumeTraversal() throws RepositoryException {
    Session sess = conn.login();

    TraversalManager mgr = sess.getTraversalManager();

    // If time comparisons aren't working, then a batch size of
    // one will produce one row for each unique timestamp, so a
    // size of 100, or even two, would necessarily include some of
    // those duplicates that were elided.
View Full Code Here

    }

    // First, get an ordinary traversal manager, start it,
    // and see what the first doc is that it returns.
    // Verify that this date is before our sanctioned startDate
    Session sess = conn.login();
    TraversalManager tm = sess.getTraversalManager();
    Document doc = getFirstResult(tm);
    assertNotNull("First doc is null.", doc);
    String dateStr = doc.findProperty("ModifyDate").nextValue().toString();
    try {
      Date docDate = parseDate(dateStr);

      assertTrue("First doc is newer than startDate.",
          docDate.before(startDate));
    }
    catch (ParseException e) {
      fail("Unable to parse document modified date: " + dateStr);
    }

    // Now, get another traversal manager, with a connector
    // with an appropriate start date(SD).  Traverse the
    // repository and ensure that nothing older than the
    // start date is returned.
    LivelinkConnector connSD =
        LivelinkConnectorFactory.getConnector("connector.");
    connSD.setStartDate(startDateString);
    Session sessSD = connSD.login();
    TraversalManager tmSD = sessSD.getTraversalManager();

    // Look for any results that are too old
    LivelinkDocumentList results =
        (LivelinkDocumentList) tmSD.startTraversal();
    while (results != null) {
View Full Code Here

      ;
    return i;
  }

  public void testDuplicates() throws RepositoryException {
    Session sess = conn.login();

    TraversalManager mgr = sess.getTraversalManager();

    HashSet<String> nodes = new HashSet<String>();
    LivelinkDocumentList docList = (LivelinkDocumentList) mgr.startTraversal();
    while (docList != null) {
      assertNoDuplicates(docList, nodes);
View Full Code Here

                + "ACLs cannot be retrieved while crawling. You may still make the connector crawl "
                + "by setting the ACL flag as false in connectorInstance.xml. ",
            e);
      }
    }
    Session socialSession = null;
    if (sharepointClientContext.getSocialOption() != SocialOption.NO) {
      socialSession = socialConnector.login();
    }
    Session adGroupsSession =
        !oldLdapBehavior && pushAcls ? adGroupsConnector.login() : null;
    return new SharepointSession(
        this, sharepointClientContext, socialSession, adGroupsSession);
  }
View Full Code Here

      con.setPort(Integer.toString(TestConfiguration.d1port));
      con.setPrincipal(TestConfiguration.d1principal);
      con.setPassword(TestConfiguration.d1password);

      con.setDataSource(dbType, TestConfiguration.dbs.get(dbType));
      Session s = con.login();
      s.getTraversalManager().startTraversal();
      AuthenticationManager am = s.getAuthenticationManager();

      AuthenticationResponse response = am.authenticate(
          new SimpleAuthenticationIdentity(
              "non-existing user", "wrong password", "wrong domain"));
      assertFalse("Non existing user fails authn", response.isValid());
View Full Code Here

      con.setHostname(TestConfiguration.d1hostname);
      con.setPort(Integer.toString(TestConfiguration.d1port));
      con.setPrincipal(TestConfiguration.d1principal);
      con.setPassword(TestConfiguration.d1password);
      con.setDataSource(dbType, TestConfiguration.dbs.get(dbType));
      Session s = con.login();
      s.getTraversalManager().startTraversal();

      // delete the group
      ad.deleteEntity(group);

      // recrawl the active directory
      s.getTraversalManager().resumeTraversal("");

      // get groups for the created user
      AuthenticationResponse response = s.getAuthenticationManager()
          .authenticate(new SimpleAuthenticationIdentity(user.sAMAccountName));

      @SuppressWarnings("unchecked") Collection<Principal> principals =
          (Collection<Principal>) response.getGroups();
      assertNotNull(principals);
View Full Code Here

      con.setHostname(TestConfiguration.d1hostname);
      con.setPort(Integer.toString(TestConfiguration.d1port));
      con.setPrincipal(TestConfiguration.d1principal);
      con.setPassword(TestConfiguration.d1password);
      con.setDataSource(dbType, TestConfiguration.dbs.get(dbType));
      Session s = con.login();
      s.getTraversalManager().startTraversal();

      // rename user
      ad.renameEntity(user, "new commonName");

      // recrawl AD
      s.getTraversalManager().resumeTraversal("");

      assertTrue("Authentication successful for renamed user",
          s.getAuthenticationManager().authenticate(
              new SimpleAuthenticationIdentity(
                  user.sAMAccountName, TestConfiguration.password)).isValid());
    }
  }
View Full Code Here

      con.setPort(Integer.toString(TestConfiguration.d1port));
      con.setPrincipal(TestConfiguration.d1principal);
      con.setPassword(TestConfiguration.d1password);

      con.setDataSource(dbType, TestConfiguration.dbs.get(dbType));
      Session s = con.login();
      s.getTraversalManager().startTraversal();
      AuthenticationManager am = s.getAuthenticationManager();

      for (AdTestEntity user : ad.users) {
        AuthenticationResponse response = am.authenticate(
            new SimpleAuthenticationIdentity(user.sAMAccountName));
View Full Code Here

      con.setPort(Integer.toString(TestConfiguration.d1port));
      con.setPrincipal(TestConfiguration.d1principal);
      con.setPassword(TestConfiguration.d1password);

      con.setDataSource(dbType, TestConfiguration.dbs.get(dbType));
      Session s = con.login();
      AuthenticationManager am = s.getAuthenticationManager();
      TraversalManager tm = s.getTraversalManager();
      tm.startTraversal();
     
      // four threads which will be crawling the database simultaneously
      List<TestThread> threads = new ArrayList<TestThread>();
      for (int i = 0; i < 4; ++i) {
View Full Code Here

TOP

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

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.