Package com.google.enterprise.connector.spi

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


      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().resumeTraversal(null);

      // delete the user, create same one with different GUID
      ad.initialize();
      ad.deleteEntity(user);
      ad.createUser(false, user, ou);

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

      AuthenticationResponse response = s.getAuthenticationManager()
          .authenticate(new SimpleAuthenticationIdentity(
              user.sAMAccountName, TestConfiguration.password));

      assertTrue("Authentication must succeed for resurrected user",
          response.isValid());

      assertFalse(
          "New user mustn't belong to the group he belonged to prior deletion",
          response.getGroups().contains(
              new Principal(group.sAMAccountName.toLowerCase())));

      // add new user as member to the group
      ad.initialize();
      group.children.add(user);
      ad.setMembers(false, group);
      s.getTraversalManager().resumeTraversal(null);

      // delete the group, create the same one with different GUID
      ad.deleteEntity(group);
      ad.createGroup(false, group, ou);
      s.getTraversalManager().resumeTraversal(null);

      response = s.getAuthenticationManager().authenticate(
          new SimpleAuthenticationIdentity(
              user.sAMAccountName, TestConfiguration.password));

      assertTrue("User from resurrected group can be authenticated",
          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();
      AuthenticationManager am = s.getAuthenticationManager();

      // verify that each of x members belongs to this group
      String groupName = ad.getnETBIOSName() + AdConstants.BACKSLASH
          + group.sAMAccountName.toLowerCase();
      for (AdTestEntity user : group.children) {
View Full Code Here

    FileAuthorizationManager authz = new FileAuthorizationManager(pathParser);
    FileLister lister = new FileLister(pathParser, context);
    FileRetriever retriever = new FileRetriever(pathParser, context);

    FileConnector connector = new FileConnector(authz, lister, retriever);
    Session session = connector.login();
    assertNotNull(session);
  }
View Full Code Here

   * Registers the supplied {@link Connector} with this {@link Instantiator}.
   */
  public void addConnector(String connectorName, Connector connector) {
    TraversalManager traversalManager;
    try {
      Session session = connector.login();
      traversalManager = session.getTraversalManager();
    } catch (Exception e) {
      // won't happen
      e.printStackTrace();
      throw new RuntimeException();
    }
View Full Code Here

   * @return the authenticationManager
   * @throws InstantiatorException
   */
  AuthenticationManager getAuthenticationManager() throws InstantiatorException {
    if (authenticationManager == null) {
      Session s = getSession();
      try {
        authenticationManager = s.getAuthenticationManager();
        LOGGER.fine("Got AuthenticationManager " + authenticationManager);
      } catch (RepositoryException e) {
        // TODO(ziff): think about how this could be re-tried
        throw new InstantiatorException(e);
      } catch (Exception e) {
View Full Code Here

   * @return the authorizationManager
   * @throws InstantiatorException
   */
  AuthorizationManager getAuthorizationManager() throws InstantiatorException {
    if (authorizationManager == null) {
      Session s = getSession();
      try {
        authorizationManager = s.getAuthorizationManager();
        LOGGER.fine("Got AuthorizationManager " + authorizationManager);
      } catch (RepositoryException e) {
        // TODO(ziff): think about how this could be re-tried
        throw new InstantiatorException(e);
      } catch (Exception e) {
View Full Code Here

   * @throws InstantiatorException if unable to instantiate the requested
   *         {@link Lister}
   */
  Lister getLister() throws InstantiatorException {
    if (!gotLister) {
      Session s = getSession();
      gotLister = true;
      lister = null;
      if (s instanceof ListerAware) {
        try {
          lister = ((ListerAware) s).getLister();
View Full Code Here

   * @throws InstantiatorException if unable to instantiate the requested
   *         {@link Retriever}
   */
  Retriever getRetriever() throws InstantiatorException {
    if (!gotRetriever) {
      Session s = getSession();
      gotRetriever = true;
      retriever = null;
      if (s instanceof RetrieverAware) {
        try {
          retriever = ((RetrieverAware) s).getRetriever();
View Full Code Here

   * @return the traverser
   * @throws InstantiatorException
   */
  TraversalManager getTraversalManager() throws InstantiatorException {
    if (traversalManager == null) {
      Session s = getSession();
      try {
        traversalManager = s.getTraversalManager();
        LOGGER.fine("Got TraversalManager " + traversalManager);
      } catch (RepositoryException ie) {
        throw new InstantiatorException(ie);
      } catch (Exception e) {
        throw new InstantiatorException(e);
View Full Code Here

    }
    return traversalManager;
  }

  private Session getSession() throws InstantiatorException {
    Session s = null;
    try {
      LOGGER.fine("LOGIN: Getting Session from connector " + connectorName);
      s = connector.login();
      LOGGER.fine("Got Session " + s);
    } catch (RepositoryLoginException e) {
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.