use of org.apache.directory.api.ldap.model.schema.normalizers.DeepTrimToLowerNormalizer in project directory-ldap-api by apache.
the class SearchRequestSubstringTest method setUp.
@BeforeClass
public static void setUp() throws Exception {
// DC normalizer
OidNormalizer dcOidNormalizer = new OidNormalizer("dc", new DeepTrimToLowerNormalizer(SchemaConstants.DOMAIN_COMPONENT_AT_OID));
oids.put("dc", dcOidNormalizer);
oids.put("domaincomponent", dcOidNormalizer);
oids.put("0.9.2342.19200300.100.1.25", dcOidNormalizer);
// OU normalizer
OidNormalizer ouOidNormalizer = new OidNormalizer("ou", new DeepTrimToLowerNormalizer(SchemaConstants.OU_AT_OID));
oids.put("ou", ouOidNormalizer);
oids.put("organizationalUnitName", ouOidNormalizer);
oids.put("2.5.4.11", ouOidNormalizer);
// ObjectClass normalizer
OidNormalizer objectClassOidNormalizer = new OidNormalizer("objectClass", new DeepTrimToLowerNormalizer(SchemaConstants.OBJECT_CLASS_AT_OID));
oids.put("objectclass", objectClassOidNormalizer);
oids.put("2.5.4.0", objectClassOidNormalizer);
}
use of org.apache.directory.api.ldap.model.schema.normalizers.DeepTrimToLowerNormalizer in project directory-ldap-api by apache.
the class SearchRequestTest method setUp.
@Before
public void setUp() throws Exception {
// DC normalizer
OidNormalizer dcOidNormalizer = new OidNormalizer("dc", new DeepTrimToLowerNormalizer(SchemaConstants.DOMAIN_COMPONENT_AT_OID));
oids.put("dc", dcOidNormalizer);
oids.put("domaincomponent", dcOidNormalizer);
oids.put("0.9.2342.19200300.100.1.25", dcOidNormalizer);
// OU normalizer
OidNormalizer ouOidNormalizer = new OidNormalizer("ou", new DeepTrimToLowerNormalizer(SchemaConstants.OU_AT_OID));
oids.put("ou", ouOidNormalizer);
oids.put("organizationalUnitName", ouOidNormalizer);
oids.put("2.5.4.11", ouOidNormalizer);
// ObjectClass normalizer
OidNormalizer objectClassOidNormalizer = new OidNormalizer("objectClass", new DeepTrimToLowerNormalizer(SchemaConstants.OBJECT_CLASS_AT_OID));
oids.put("objectclass", objectClassOidNormalizer);
oids.put("2.5.4.0", objectClassOidNormalizer);
}
use of org.apache.directory.api.ldap.model.schema.normalizers.DeepTrimToLowerNormalizer in project directory-ldap-api by apache.
the class SearchRequestMatchingRuleAssertionTest method setUp.
@BeforeClass
public static void setUp() throws Exception {
// DC normalizer
OidNormalizer dcOidNormalizer = new OidNormalizer("dc", new DeepTrimToLowerNormalizer(SchemaConstants.DOMAIN_COMPONENT_AT_OID));
oids.put("dc", dcOidNormalizer);
oids.put("domaincomponent", dcOidNormalizer);
oids.put("0.9.2342.19200300.100.1.25", dcOidNormalizer);
// OU normalizer
OidNormalizer ouOidNormalizer = new OidNormalizer("ou", new DeepTrimToLowerNormalizer(SchemaConstants.OU_AT_OID));
oids.put("ou", ouOidNormalizer);
oids.put("organizationalUnitName", ouOidNormalizer);
oids.put("2.5.4.11", ouOidNormalizer);
// ObjectClass normalizer
OidNormalizer objectClassOidNormalizer = new OidNormalizer("objectClass", new DeepTrimToLowerNormalizer(SchemaConstants.OBJECT_CLASS_AT_OID));
oids.put("objectclass", objectClassOidNormalizer);
oids.put("2.5.4.0", objectClassOidNormalizer);
}
use of org.apache.directory.api.ldap.model.schema.normalizers.DeepTrimToLowerNormalizer in project directory-ldap-api by apache.
the class EntryUtils method getIA5StringAttributeType.
/* no protection*/
static AttributeType getIA5StringAttributeType() {
MutableAttributeType attributeType = new MutableAttributeType("1.1");
attributeType.addName("1.1");
LdapSyntax syntax = new LdapSyntax("1.1.1", "", true);
syntax.setSyntaxChecker(new SyntaxChecker("1.1.2") {
public static final long serialVersionUID = 1L;
public boolean isValidSyntax(Object value) {
String strValue = Strings.deepTrim((String) value);
return (strValue == null) || (strValue.length() < 7);
}
});
MutableMatchingRule matchingRule = new MutableMatchingRule("1.1.2");
matchingRule.setSyntax(syntax);
matchingRule.setLdapComparator(new LdapComparator<String>(matchingRule.getOid()) {
public static final long serialVersionUID = 1L;
public int compare(String o1, String o2) {
return ((o1 == null) ? (o2 == null ? 0 : -1) : (o2 == null ? 1 : o1.compareTo(o2)));
}
});
matchingRule.setNormalizer(new DeepTrimToLowerNormalizer(matchingRule.getOid()));
attributeType.setEquality(matchingRule);
attributeType.setSyntax(syntax);
return attributeType;
}
use of org.apache.directory.api.ldap.model.schema.normalizers.DeepTrimToLowerNormalizer in project directory-ldap-api by apache.
the class DeepTrimToLowerNormalizerTest method testSpeed.
@Test
@Ignore
public void testSpeed() throws Exception {
Normalizer normalizer = new DeepTrimToLowerNormalizer();
String t = "xs crvtbynU Jikl7897A90";
normalizer.normalize(t);
long t0 = System.currentTimeMillis();
for (int i = 0; i < 100000000; i++) {
normalizer.normalize(t);
}
long t1 = System.currentTimeMillis();
System.out.println(t1 - t0);
Strings.deepTrimToLower(t);
t0 = System.currentTimeMillis();
for (int i = 0; i < 100000000; i++) {
Strings.deepTrimToLower(t);
}
t1 = System.currentTimeMillis();
System.out.println(t1 - t0);
}
Aggregations