use of org.apache.directory.api.ldap.model.schema.parsers.LdapComparatorDescription in project directory-ldap-api by apache.
the class ComparatorDescriptionSchemaParserTest method testBytecode.
@Test
public void testBytecode() throws ParseException {
String value = null;
LdapComparatorDescription ldapComparatorDescription = null;
// FQCN simple p
value = "( 1.1 FQCN org.apache.directory.SimpleComparator BYTECODE ABCDEFGHIJKLMNOPQRSTUVWXYZ+/abcdefghijklmnopqrstuvwxyz0123456789==== )";
ldapComparatorDescription = parser.parseComparatorDescription(value);
assertNotNull(ldapComparatorDescription.getBytecode());
assertEquals("ABCDEFGHIJKLMNOPQRSTUVWXYZ+/abcdefghijklmnopqrstuvwxyz0123456789====", ldapComparatorDescription.getBytecode());
// FQCN simple, no spaces
value = "(1.1 FQCNorg.apache.directory.SimpleComparator BYTECODEABCDEFGHIJKLMNOPQRSTUVWXYZ+/abcdefghijklmnopqrstuvwxyz0123456789====)";
ldapComparatorDescription = parser.parseComparatorDescription(value);
assertNotNull(ldapComparatorDescription.getBytecode());
assertEquals("ABCDEFGHIJKLMNOPQRSTUVWXYZ+/abcdefghijklmnopqrstuvwxyz0123456789====", ldapComparatorDescription.getBytecode());
// FQCN simple, tabs
value = "\t(\t1.1\tFQCN\torg.apache.directory.SimpleComparator\tBYTECODE\tABCDEFGHIJKLMNOPQRSTUVWXYZ+/abcdefghijklmnopqrstuvwxyz0123456789====\t)\t";
ldapComparatorDescription = parser.parseComparatorDescription(value);
assertNotNull(ldapComparatorDescription.getBytecode());
assertEquals("ABCDEFGHIJKLMNOPQRSTUVWXYZ+/abcdefghijklmnopqrstuvwxyz0123456789====", ldapComparatorDescription.getBytecode());
}
use of org.apache.directory.api.ldap.model.schema.parsers.LdapComparatorDescription in project directory-ldap-api by apache.
the class ComparatorDescriptionSchemaParserTest method testFqcn.
@Test
public void testFqcn() throws ParseException {
String value = null;
LdapComparatorDescription ldapComparatorDescription = null;
// FQCN simple
value = "( 1.1 FQCN org.apache.directory.SimpleComparator )";
ldapComparatorDescription = parser.parseComparatorDescription(value);
assertNotNull(ldapComparatorDescription.getFqcn());
assertEquals("org.apache.directory.SimpleComparator", ldapComparatorDescription.getFqcn());
}
use of org.apache.directory.api.ldap.model.schema.parsers.LdapComparatorDescription in project directory-ldap-api by apache.
the class DefaultSchemaLoader method loadComparators.
/**
* {@inheritDoc}
*/
@Override
public List<Entry> loadComparators(Schema... schemas) throws LdapException, IOException {
List<Entry> comparatorEntries = new ArrayList<>();
if (schemas == null) {
return comparatorEntries;
}
for (Schema schema : schemas) {
Set<SchemaObjectWrapper> schemaObjectWrappers = schema.getContent();
for (SchemaObjectWrapper schemaObjectWrapper : schemaObjectWrappers) {
SchemaObject schemaObject = schemaObjectWrapper.get();
if (schemaObject instanceof LdapComparatorDescription) {
LdapComparatorDescription ldapComparatorDescription = (LdapComparatorDescription) schemaObject;
Entry lcEntry = getEntry(ldapComparatorDescription);
comparatorEntries.add(lcEntry);
}
}
}
return comparatorEntries;
}
use of org.apache.directory.api.ldap.model.schema.parsers.LdapComparatorDescription in project directory-ldap-api by apache.
the class DefaultSchemaLoader method loadComparators.
private void loadComparators(Attribute comparators) throws LdapException {
if (comparators == null) {
return;
}
for (Value value : comparators) {
String desc = value.getValue();
try {
LdapComparatorDescription comparator = C_DESCR_SCHEMA_PARSER.parseComparatorDescription(desc);
updateSchemas(comparator);
} catch (ParseException pe) {
throw new LdapException(pe);
}
}
}
Aggregations