Package com.google.enterprise.connector.filenet4.filewrap

Examples of com.google.enterprise.connector.filenet4.filewrap.IUserContext


        + "}";
    assertCheckpointEquals(expectedCheckpoint, docList.checkpoint());
  }

  public void testCheckpointWithoutNextDocument() throws Exception {
    @SuppressWarnings("unchecked") IObjectStore os =
        newObjectStore("MockObjectStore", DatabaseType.MSSQL,
            new HashMap<IId, IBaseObject>());
    DocumentList docList = getObjectUnderTest(os, newEmptyObjectSet(),
        newEmptyObjectSet(), newEmptyObjectSet());
View Full Code Here


   * documents. That's silly, of course, since it means the repository
   * is empty, but it describes the behavior of the checkpoint strings
   * in that case.
   */
  public void testEmptyCheckpointWithoutNextDocument() throws Exception {
    @SuppressWarnings("unchecked") IObjectStore os =
        newObjectStore("MockObjectStore", DatabaseType.MSSQL,
            new HashMap<IId, IBaseObject>());
    DocumentList docList = new FileDocumentList(newEmptyObjectSet(),
        newEmptyObjectSet(), newEmptyObjectSet(), os, connec, new Checkpoint());
    Checkpoint cp = new Checkpoint(docList.checkpoint());
View Full Code Here

    }
    assertEquals(10, counter);
  }

  public void testEmptyObjectStoreMock() throws Exception {
    IObjectStore os = createNiceMock(IObjectStore.class);
    IObjectSet objectSet = createNiceMock(IObjectSet.class);

    IObjectFactory factory = createMock(IObjectFactory.class);
    ISearch search = createMock(ISearch.class);
    expect(factory.getSearch(os)).andReturn(search);
View Full Code Here

          query.append(configData.get(WHERECLAUSE).trim());
        }

        try {
          if (session != null) {
            ISearch search = session.getSearch();
            search.execute(query.toString());
          }
        } catch (RepositoryException e) {
          if (e.getCause().toString().trim().contains(ACCESS_DENIED_EXCEPTION)) {
            LOGGER.log(Level.SEVERE, e.getLocalizedMessage(), e);
            this.validation = OBJECT_STORE;
            form = makeConfigForm(configData, this.validation);

            return new ConfigureResponse(
                    resource.getString("object_store_access_error"),
                    form);
          } else if (e.getCause().toString().trim().contains(RETRIEVE_SQL_SYNTAX_ERROR)) {

            LOGGER.log(Level.SEVERE, e.getLocalizedMessage(), e);
            this.validation = WHERECLAUSE;
            form = makeConfigForm(configData, this.validation);

            return new ConfigureResponse(
                    resource.getString("additional_where_clause_invalid"),
                    form);
          } else {
            LOGGER.log(Level.SEVERE, e.getLocalizedMessage(), e);
            this.validation = "FileNet exception";
            form = makeConfigForm(configData, this.validation);

            return new ConfigureResponse(e.getLocalizedMessage(),
                    form);
          }
        }

        StringBuffer deleteuery = new StringBuffer();

        if (configData.get(DELETEWHERECLAUSE).trim().toUpperCase()
            .startsWith(SELECT)) {
          if (configData.get(DELETEWHERECLAUSE).trim().toUpperCase()
              .startsWith(QUERYFORMAT)) {
            if (configData.get(DELETEWHERECLAUSE).trim().toUpperCase()
                .contains(((VERSIONQUERY)).toUpperCase())) {
              deleteuery = new StringBuffer(
                      configData.get(DELETEWHERECLAUSE).trim());
              LOGGER.fine("Using Custom Query["
                      + configData.get(DELETEWHERECLAUSE).trim()
                      + "]");
            } else {
              this.validation = DELETEWHERECLAUSE;
              form = makeConfigForm(configData, this.validation);
              return new ConfigureResponse(
                      resource.getString("delete_query_not_having_versionstatus_condition"),
                      form);
            }
          } else {
            this.validation = DELETEWHERECLAUSE;
            form = makeConfigForm(configData, this.validation);
            return new ConfigureResponse(
                    resource.getString("delete_query_not_starting_with_SELECT_Id,DateLastModified_FROM_or_with_AND"),
                    form);
          }
        } else {
          deleteuery.append("SELECT TOP 1 Id, DateLastModified FROM Document WHERE VersionStatus=1 and ContentSize IS NOT NULL ");
          deleteuery.append(configData.get(DELETEWHERECLAUSE).trim());
        }

        try {
          if (session != null) {
            ISearch search = session.getSearch();
            search.execute(deleteuery.toString());
          }
        } catch (RepositoryException e) {
          if (e.getCause().toString().trim().contains(ACCESS_DENIED_EXCEPTION)) {
            LOGGER.log(Level.SEVERE, e.getLocalizedMessage(), e);
            this.validation = OBJECT_STORE;
View Full Code Here

  /*
   * Test method for
   * 'com.google.enterprise.connector.file.filejavawrap.FnObjectFactory.getSearch(IObjectStore)'
   */
  public void testGetSearch() throws RepositoryException {
    ISearch is = iof.getSearch(ios);
    IObjectSet test = is.execute(
        "SELECT TOP 50 d.Id, d.DateLastModified FROM Document AS d WHERE d.Id='"
        + TestConnection.docId1 + "' and VersionStatus=1 "
        + "and ContentSize IS NOT NULL  AND (ISCLASS(d, Document) "
        + "OR ISCLASS(d, WorkflowDefinition))  ORDER BY DateLastModified,Id");
    assertEquals(1, test.getSize());
View Full Code Here

  public void testEmptyObjectStoreMock() throws Exception {
    IObjectStore os = createNiceMock(IObjectStore.class);
    IObjectSet objectSet = createNiceMock(IObjectSet.class);

    IObjectFactory factory = createMock(IObjectFactory.class);
    ISearch search = createMock(ISearch.class);
    expect(factory.getSearch(os)).andReturn(search);
    expect(search.execute(isA(String.class))).andReturn(objectSet).times(2);
    replay(os, factory, search, objectSet);

    FileDocumentTraverser traverser =
        new FileDocumentTraverser(factory, os, connec);
    DocumentList docList = traverser.getDocumentList(new Checkpoint());
View Full Code Here

    // each and every AuthZ request.
    // TODO(tdnguyen) Refactor this method to properly handle pushSubject and
    // popSubject
    handler.pushSubject();

    IUser user = handler.getUser(identity);
    if (user == null) {
      handler.popSubject();
      return null;
    }
View Full Code Here

  public AuthenticationResponse authenticate(AuthenticationIdentity id)
      throws RepositoryException {
    IUserContext uc = conn.getUserContext();
    String username = FileUtil.getUserName(id);
    try {
      IUser user = uc.authenticate(username, id.getPassword());
      List<Principal> principalGroups = FileUtil.getPrincipals(
          PrincipalType.UNKNOWN, globalNamespace, user.getGroupNames(),
          CaseSensitivityType.EVERYTHING_CASE_INSENSITIVE);
      return new AuthenticationResponse(true, "", principalGroups);
    } catch (Throwable e) {
      logger.log(Level.WARNING, "Authentication failed for user "
          + username, e);
View Full Code Here

    Permissions testPerms = new Permissions(perms);
    assertEquals(expectedResult, testPerms.authorize(testUser));
  }

  public void testShortName() {
    IUser jsmith = MockUtil.createUserWithShortName("jsmith");
    testUserAccess(AccessType.ALLOW, VIEW_ACCESS_RIGHTS, jsmith, true);
  }
View Full Code Here

    IUser jsmith = MockUtil.createUserWithShortName("jsmith");
    testUserAccess(AccessType.ALLOW, VIEW_ACCESS_RIGHTS, jsmith, true);
  }

  public void testShortNameWithDifferentDomain() {
    IUser jsmith = MockUtil.createUserWithShortName("jsmith");
    testUserAccess(AccessType.ALLOW, VIEW_ACCESS_RIGHTS, "jsmith@example.com",
        jsmith, false);
  }
View Full Code Here

TOP

Related Classes of com.google.enterprise.connector.filenet4.filewrap.IUserContext

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.