Package org.nasutekds.server.types

Examples of org.nasutekds.server.types.ByteString


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

    // normalize the 2 provided values
    ByteString normalizedValue1 =
      ruleInstance.normalizeValue(ByteString.valueOf(value1));
    ByteString normalizedValue2 =
      ruleInstance.normalizeValue(ByteString.valueOf(value2));

    // check that the approximatelyMatch return the expected result.
    Boolean liveResult = ruleInstance.approximatelyMatch(normalizedValue1,
        normalizedValue2);
View Full Code Here


      DirectoryServer.getAttributeSyntax("1.3.6.1.4.1.1466.115.121.1.3", false);
    assertNotNull(attrTypeSyntax);


    // Create an attribute type definition and verify that it is acceptable.
    ByteString definition = ByteString.valueOf(
      "( testxapproxtype-oid NAME 'testXApproxType' " +
           "SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 " +
           "X-APPROX 'equalLengthApproximateMatch' )");
    MessageBuilder invalidReason = new MessageBuilder();
    assertTrue(attrTypeSyntax.valueIsAcceptable(definition, invalidReason),
View Full Code Here

    return new Object[][] {};
  }

  private Object[] generateValues(String password) throws Exception
  {
    ByteString bytePassword = ByteString.valueOf(password);
    SaltedMD5PasswordStorageScheme scheme = new SaltedMD5PasswordStorageScheme();

    ConfigEntry configEntry =
       DirectoryServer.getConfigEntry(
           DN.decode("cn=Salted MD5,cn=Password Storage Schemes,cn=config"));

    SaltedMD5PasswordStorageSchemeCfg configuration =
      AdminTestCaseUtils.getConfiguration(
          SaltedMD5PasswordStorageSchemeCfgDefn.getInstance(),
          configEntry.getEntry()
          );

    scheme.initializePasswordStorageScheme(configuration);

    ByteString encodedAuthPassword =
         scheme.encodePasswordWithScheme(bytePassword);

     return new Object[] {
         encodedAuthPassword.toString(), password, true};
  }
View Full Code Here

    // 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)
View Full Code Here

  public void testAcceptableValues(String value, Boolean result) throws Exception
  {
    BitStringSyntax syntax = new BitStringSyntax();
    syntax.initializeSyntax(null);

    ByteString byteStringValue = ByteString.valueOf(value);

    MessageBuilder reason = new MessageBuilder();
    Boolean liveResult =
      syntax.valueIsAcceptable(byteStringValue, reason);
View Full Code Here

    for(int i = 0; i < 5; i+=2)
    {
      byte[] bsb = new byte[3];
      System.arraycopy(b, i, bsb, 0, 3);
      ByteString bs = ByteString.wrap(bsb);
      getWriter().writeOctetString(b, i, 3);

      ASN1Reader r = getReader(getEncodedBytes());
      assertEquals(r.peekLength(), 3);
      assertEquals(r.peekType(), UNIVERSAL_OCTET_STRING_TYPE);
      assertTrue(bs.equals(r.readOctetString()));
    }
  }
View Full Code Here

   * Tests the <CODE>write/readOctetString</CODE> methods.
   */
  @Test(dataProvider = "binaryValues")
  public void testEncodeDecodeOctetString(byte[] b) throws Exception
  {
    ByteString bs = ByteString.wrap(b);

    getWriter().writeOctetString(bs);

    ASN1Reader r = getReader(getEncodedBytes());
    assertEquals(r.peekLength(), b.length);
    assertEquals(r.peekType(), UNIVERSAL_OCTET_STRING_TYPE);
    assertTrue(bs.equals(r.readOctetString()));


    getWriter().writeOctetString(b, 0, b.length);

    r = getReader(getEncodedBytes());
    assertEquals(r.peekLength(), b.length);
    assertEquals(r.peekType(), UNIVERSAL_OCTET_STRING_TYPE);
    assertTrue(bs.equals(r.readOctetString()));
  }
View Full Code Here

   * Tests the <CODE>write/readOctetString</CODE> methods.
   */
  @Test(dataProvider = "binaryValues")
  public void testEncodeDecodeOctetStringType(byte[] b) throws Exception
  {
    ByteString bs = ByteString.wrap(b);
    ByteStringBuilder bsb = new ByteStringBuilder();

    for(byte type : testTypes)
    {
      bsb.clear();
      getWriter().writeOctetString(type, bs);

      ASN1Reader r = getReader(getEncodedBytes());
      assertEquals(r.peekLength(), b.length);
      assertEquals(r.peekType(), type);
      r.readOctetString(bsb);
      assertTrue(bs.equals(bsb));

      bsb.clear();
      getWriter().writeOctetString(type, b, 0, b.length);

      r = getReader(getEncodedBytes());
      assertEquals(r.peekLength(), b.length);
      assertEquals(r.peekType(), type);
      r.readOctetString(bsb);
      assertTrue(bs.equals(bsb));
    }
  }
View Full Code Here

  @Test(dataProvider="partialDateTimeValues")
  public void testPartialDateNTimeMatch(long attributeValue,String assertionValue) throws Exception
  {
    MatchingRule partialTimeRule = DirectoryServer.getMatchingRule(
            EXT_PARTIAL_DATE_TIME_NAME.toLowerCase());
    ByteString str = partialTimeRule.normalizeAssertionValue(ByteString.valueOf(assertionValue));
    assertTrue(partialTimeRule.valuesMatch(ByteString.valueOf(attributeValue), str) ==
            ConditionResult.TRUE);
  }
View Full Code Here

      String value, String[] middleSubs, Boolean result) throws Exception
  {
    SubstringMatchingRule rule = getRule();

    // normalize the 2 provided values and check that they are equals
    ByteString normalizedValue =
      rule.normalizeValue(ByteString.valueOf(value));

    StringBuilder printableMiddleSubs = new StringBuilder();
    List<ByteSequence> middleList =
        new ArrayList<ByteSequence>(middleSubs.length);
View Full Code Here

TOP

Related Classes of org.nasutekds.server.types.ByteString

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.