Package org.nasutekds.server.protocols.ldap

Examples of org.nasutekds.server.protocols.ldap.CompareResponseProtocolOp


    connection.getLDAPWriter().writeMessage(msg);

    // Read and decode the LDAP response from the server.
    LDAPMessage responseMessage = connection.getLDAPReader().readMessage();

    CompareResponseProtocolOp compareOp =
          responseMessage.getCompareResponseProtocolOp();
    int resultCode = compareOp.getResultCode();
    Message errorMessage = compareOp.getErrorMessage();

    // Set the response code and error message for the DSML response.
    compareResponse.setErrorMessage(
            errorMessage != null ? errorMessage.toString() : null);
    ResultCode code = objFactory.createResultCode();
    code.setCode(resultCode);
    compareResponse.setResultCode(code);

    if(compareOp.getMatchedDN() != null)
    {
      compareResponse.setMatchedDN(compareOp.getMatchedDN().toString());
    }

    return compareResponse;
  }
View Full Code Here


    // Normally, abandoned operations don't receive a response.  However, the
    // testing configuration has been updated to ensure that if an operation
    // does get abandoned, the server will return a response for it with a
    // result code of "cancelled".
    message = r.readMessage();
    CompareResponseProtocolOp compareResponse =
         message.getCompareResponseProtocolOp();
    assertEquals(compareResponse.getResultCode(), LDAPResultCode.CANCELED);

    assertEquals(ldapStatistics.getAbandonRequests(), abandonRequests+1);
    waitForAbandon(abandonsCompleted+1);

    s.close();
View Full Code Here

          err.println(wrapText(ae.getMessage(), MAX_LINE_WIDTH));
          return;
        }
      }

      CompareResponseProtocolOp op =
        responseMessage.getCompareResponseProtocolOp();
      int resultCode = op.getResultCode();
      Message errorMessage = op.getErrorMessage();

      if(resultCode != COMPARE_TRUE && resultCode != COMPARE_FALSE
         && !compareOptions.continueOnError())
      {
        Message msg = INFO_OPERATION_FAILED.get("COMPARE");
        throw new LDAPException(resultCode, errorMessage, msg,
                                op.getMatchedDN(), null);
      } else
      {
        if(resultCode == COMPARE_FALSE)
        {
          if (isScriptFriendly())
          {
            out.println(line+": "+COMPARE_FALSE);
          }
          else
          {
            out.println(INFO_COMPARE_OPERATION_RESULT_FALSE.get(line));
          }
        } else if(resultCode == COMPARE_TRUE)
        {
          if (isScriptFriendly())
          {
            out.println(line+": "+COMPARE_TRUE);
          }
          else
          {
            out.println(INFO_COMPARE_OPERATION_RESULT_TRUE.get(line));
          }
        } else
        {

          Message msg = INFO_OPERATION_FAILED.get("COMPARE");
          LDAPToolUtils.printErrorMessage(err, msg, resultCode, errorMessage,
                                          op.getMatchedDN());
        }
      }
    }
  }
View Full Code Here

    {
      message = r.readMessage();
      switch (message.getProtocolOpType())
      {
        case OP_TYPE_COMPARE_RESPONSE:
          CompareResponseProtocolOp compareResponse =
               message.getCompareResponseProtocolOp();
          assertEquals(compareResponse.getResultCode(),
                       LDAPResultCode.CANCELED);
          break;
        case OP_TYPE_EXTENDED_RESPONSE:
          ExtendedResponseProtocolOp extendedResponse =
               message.getExtendedResponseProtocolOp();
View Full Code Here

TOP

Related Classes of org.nasutekds.server.protocols.ldap.CompareResponseProtocolOp

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.