use of org.apache.directory.api.ldap.model.schema.comparators.StringComparator in project directory-ldap-api by apache.
the class StringValueAttributeTypeTest method initAT.
/**
* Initialize an AttributeType and the associated MatchingRule
* and Syntax
*/
@Before
public void initAT() {
s = new EntryUtils.S("1.1.1.1", true);
s.setSyntaxChecker(OctetStringSyntaxChecker.INSTANCE);
mr = new EntryUtils.MR("1.1.2.1");
mr.setSyntax(s);
mr.setLdapComparator(new StringComparator("1.1.2.1"));
mr.setNormalizer(new DeepTrimToLowerNormalizer("1.1.2.1"));
at = new EntryUtils.AT("1.1.3.1");
at.setEquality(mr);
at.setOrdering(mr);
at.setSubstring(mr);
at.setSyntax(s);
}
use of org.apache.directory.api.ldap.model.schema.comparators.StringComparator in project directory-ldap-api by apache.
the class StringValueTest method initAT.
/**
* Initialize an AttributeType and the associated MatchingRule
* and Syntax
*/
@BeforeClass
public static void initAT() {
s = new EntryUtils.S("1.1.1.1", true);
s.setSyntaxChecker(DirectoryStringSyntaxChecker.INSTANCE);
mr = new EntryUtils.MR("1.1.2.1");
mr.setSyntax(s);
mr.setLdapComparator(new StringComparator("1.1.2.1"));
mr.setNormalizer(new DeepTrimToLowerNormalizer("1.1.2.1"));
at = new EntryUtils.AT("1.1.3.1");
at.setEquality(mr);
at.setOrdering(mr);
at.setSubstring(mr);
at.setSyntax(s);
}
use of org.apache.directory.api.ldap.model.schema.comparators.StringComparator in project directory-ldap-api by apache.
the class ValueSerializationTest method initAT.
/**
* Initialize an AttributeType and the associated MatchingRule
* and Syntax
*/
@Before
public void initAT() {
sb = new EntryUtils.S("1.1.1.1", false);
sb.setSyntaxChecker(OctetStringSyntaxChecker.INSTANCE);
mrb = new EntryUtils.MR("1.1.2.1");
mrb.setSyntax(sb);
mrb.setLdapComparator(new ByteArrayComparator("1.1.1"));
mrb.setNormalizer(new Normalizer("1.1.1") {
public static final long serialVersionUID = 1L;
public String normalize(String value) throws LdapException {
return normalize(value, PrepareString.AssertionType.ATTRIBUTE_VALUE);
}
public String normalize(String value, PrepareString.AssertionType assertionType) throws LdapException {
byte[] val = Strings.getBytesUtf8(value);
// each byte will be changed to be > 0, and spaces will be trimmed
byte[] newVal = new byte[val.length];
int i = 0;
for (byte b : val) {
newVal[i++] = (byte) (b & 0x007F);
}
return Strings.utf8ToString(Strings.trim(newVal));
}
});
atb = new EntryUtils.AT("1.1.3.1");
atb.setEquality(mrb);
atb.setOrdering(mrb);
atb.setSubstring(mrb);
atb.setSyntax(sb);
ss = new EntryUtils.S("1.1.1.1", true);
ss.setSyntaxChecker(OctetStringSyntaxChecker.INSTANCE);
mrs = new EntryUtils.MR("1.1.2.1");
mrs.setSyntax(ss);
mrs.setLdapComparator(new StringComparator("1.1.2.1"));
mrs.setNormalizer(new DeepTrimToLowerNormalizer("1.1.2.1"));
ats = new EntryUtils.AT("1.1.3.1");
ats.setEquality(mrs);
ats.setOrdering(mrs);
ats.setSubstring(mrs);
ats.setSyntax(ss);
}
Aggregations