Package org.nasutekds.server.api

Examples of org.nasutekds.server.api.OrderingMatchingRule


  @Test(dataProvider= "Orderingmatchingrules")
  public void OrderingMatchingRules(String value1,String value2, int result)
         throws Exception
  {
    // Make sure that the specified class can be instantiated as a task.
    OrderingMatchingRule ruleInstance = getRule();

    // we should call initializeMatchingRule but they all seem empty at the
    // moment.
    // ruleInstance.initializeMatchingRule(configEntry);

    ByteString normalizedValue1 =
      ruleInstance.normalizeValue(ByteString.valueOf(value1));
    ByteString normalizedValue2 =
      ruleInstance.normalizeValue(ByteString.valueOf(value2));
    int res = ruleInstance.compareValues(normalizedValue1, normalizedValue2);
    if (result == 0)
    {
      if (res != 0)
      {
        fail(ruleInstance + ".compareValues should return 0 for values " +
View Full Code Here


   */
  @Test(dataProvider= "OrderingMatchingRuleInvalidValues")
  public void OrderingMatchingRulesInvalidValues(String value) throws Exception
  {
    // Make sure that the specified class can be instantiated as a task.
    OrderingMatchingRule ruleInstance = getRule();

    // normalize the 2 provided values
    try
    {
      ruleInstance.normalizeValue(ByteString.valueOf(value));
    } catch (DirectoryException e) {
      // that's the expected path : the matching rule has detected that
      // the value is incorrect.
      return;
    }
View Full Code Here

  @Test(dataProvider= "OrderingMatchingRuleInvalidValues")
  public void OrderingMatchingRulesInvalidValuesWarn(String value)
         throws Exception
  {
    // Make sure that the specified class can be instantiated as a task.
    OrderingMatchingRule ruleInstance = getRule();

    AcceptRejectWarn accept = DirectoryServer.getSyntaxEnforcementPolicy();
    DirectoryServer.setSyntaxEnforcementPolicy(AcceptRejectWarn.WARN);
    // normalize the 2 provided values
    try
    {
      ruleInstance.normalizeValue(ByteString.valueOf(value));
    } catch (Exception e)
    {
      fail(ruleInstance + " in warn mode should not reject value " + value + e);
      return;
    }
View Full Code Here

     * {@inheritDoc}
     */
    public final ConditionResult greaterThanOrEqualTo(
        AttributeValue value)
    {
      OrderingMatchingRule matchingRule = attributeType
          .getOrderingMatchingRule();
      if (matchingRule == null)
      {
        return ConditionResult.UNDEFINED;
      }

      ByteString normalizedValue;
      try
      {
        normalizedValue =
                matchingRule.normalizeValue(value.getValue());
      }
      catch (Exception e)
      {
        if (debugEnabled())
        {
          TRACER.debugCaught(DebugLogLevel.ERROR, e);
        }

        // We couldn't normalize the provided value. We should return
        // "undefined".
        return ConditionResult.UNDEFINED;
      }

      ConditionResult result = ConditionResult.FALSE;
      for (AttributeValue v : values)
      {
        try
        {
          ByteString nv =
                  matchingRule.normalizeValue(v.getValue());
          int comparisonResult = matchingRule
              .compareValues(nv, normalizedValue);
          if (comparisonResult >= 0)
          {
            return ConditionResult.TRUE;
          }
View Full Code Here

     * {@inheritDoc}
     */
    public final ConditionResult lessThanOrEqualTo(
        AttributeValue value)
    {
      OrderingMatchingRule matchingRule = attributeType
          .getOrderingMatchingRule();
      if (matchingRule == null)
      {
        return ConditionResult.UNDEFINED;
      }

      ByteString normalizedValue;
      try
      {
        normalizedValue =
                matchingRule.normalizeValue(value.getValue());
      }
      catch (Exception e)
      {
        if (debugEnabled())
        {
          TRACER.debugCaught(DebugLogLevel.ERROR, e);
        }

        // We couldn't normalize the provided value. We should return
        // "undefined".
        return ConditionResult.UNDEFINED;
      }

      ConditionResult result = ConditionResult.FALSE;
      for (AttributeValue v : values)
      {
        try
        {
          ByteString nv = matchingRule.normalizeValue(v.getValue());
          int comparisonResult = matchingRule
              .compareValues(nv, normalizedValue);
          if (comparisonResult <= 0)
          {
            return ConditionResult.TRUE;
          }
View Full Code Here

            configAcceptable = false;
            continue;
          }

          OrderingMatchingRule omr = at.getOrderingMatchingRule();
          if ((omr != null) && oid.equals(omr.getOID()))
          {
            Message message =
                    WARN_CONFIG_SCHEMA_CANNOT_DELETE_MR_IN_USE_BY_AT.get(
                            matchingRule.getName(),
                            at.getNameOrOID());
View Full Code Here

              configAcceptable = false;
              continue;
            }

            OrderingMatchingRule omr = at.getOrderingMatchingRule();
            if ((omr != null) && oid.equals(omr.getOID()))
            {
              Message message =
                      WARN_CONFIG_SCHEMA_CANNOT_DISABLE_MR_IN_USE_BY_AT.get(
                              matchingRule.getName(),
                              at.getNameOrOID());
View Full Code Here

TOP

Related Classes of org.nasutekds.server.api.OrderingMatchingRule

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.