use of org.apache.directory.api.ldap.model.schema.parsers.SyntaxCheckerDescription in project directory-ldap-api by apache.
the class SyntaxCheckerDescriptionSchemaParserTest method testRealByteCodeExample.
@Test
public void testRealByteCodeExample() throws ParseException {
String simple = "( 1.3.6.1.4.1.18060.0.4.1.0.10002 DESC 'bogus desc' " + "FQCN DummySyntaxChecker BYTECODE yv66vgAAADEAHgoABAAYCQADABkHABoHABsHABwBAANvaWQBABJMam" + "F2YS9sYW5nL1N0cmluZzsBAAY8aW5pdD4BABUoTGphdmEvbGFuZy9TdHJpbmc7KVYBAARDb2RlAQAPTGluZU51b" + "WJlclRhYmxlAQADKClWAQAMc2V0U3ludGF4T2lkAQAMZ2V0U3ludGF4T2lkAQAUKClMamF2YS9sYW5nL1N0cmlu" + "ZzsBAA1pc1ZhbGlkU3ludGF4AQAVKExqYXZhL2xhbmcvT2JqZWN0OylaAQAMYXNzZXJ0U3ludGF4AQAVKExqYXZ" + "hL2xhbmcvT2JqZWN0OylWAQAKRXhjZXB0aW9ucwcAHQEAClNvdXJjZUZpbGUBABdEdW1teVN5bnRheENoZWNrZX" + "IuamF2YQwACAAMDAAGAAcBABJEdW1teVN5bnRheENoZWNrZXIBABBqYXZhL2xhbmcvT2JqZWN0AQA8b3JnL2FwY" + "WNoZS9kaXJlY3Rvcnkvc2hhcmVkL2xkYXAvc2NoZW1hL3N5bnRheC9TeW50YXhDaGVja2VyAQAcamF2YXgvbmFt" + "aW5nL05hbWluZ0V4Y2VwdGlvbgAhAAMABAABAAUAAQACAAYABwAAAAYAAQAIAAkAAQAKAAAAKgACAAIAAAAKKrc" + "AASortQACsQAAAAEACwAAAA4AAwAAAAsABAAMAAkADQABAAgADAABAAoAAAAhAAEAAQAAAAUqtwABsQAAAAEACw" + "AAAAoAAgAAABEABAASAAEADQAJAAEACgAAACIAAgACAAAABiortQACsQAAAAEACwAAAAoAAgAAABcABQAYAAEAD" + "gAPAAEACgAAAB0AAQABAAAABSq0AAKwAAAAAQALAAAABgABAAAAHQABABAAEQABAAoAAAAaAAEAAgAAAAIErAAA" + "AAEACwAAAAYAAQAAACMAAQASABMAAgAKAAAAGQAAAAIAAAABsQAAAAEACwAAAAYAAQAAACkAFAAAAAQAAQAVAAE" + "AFgAAAAIAFw== X-SCHEMA 'nis' )";
SyntaxCheckerDescription syntaxCheckerDescription = parser.parseSyntaxCheckerDescription(simple);
assertNotNull(syntaxCheckerDescription);
assertEquals("1.3.6.1.4.1.18060.0.4.1.0.10002", syntaxCheckerDescription.getOid());
assertEquals("DummySyntaxChecker", syntaxCheckerDescription.getFqcn());
assertNotNull(syntaxCheckerDescription.getBytecode());
assertEquals("bogus desc", syntaxCheckerDescription.getDescription());
}
use of org.apache.directory.api.ldap.model.schema.parsers.SyntaxCheckerDescription in project directory-ldap-api by apache.
the class SyntaxCheckerDescriptionSchemaParserTest method testSyntaxCheckerWithDescAndByteCode.
@Test
public void testSyntaxCheckerWithDescAndByteCode() throws ParseException {
String simple = "( " + OID + " DESC '" + DESC + "' FQCN " + FQCN + " BYTECODE " + BYTECODE + " )";
SyntaxCheckerDescription syntaxCheckerDescription = parser.parseSyntaxCheckerDescription(simple);
assertNotNull(syntaxCheckerDescription);
assertEquals(OID, syntaxCheckerDescription.getOid());
assertEquals(FQCN, syntaxCheckerDescription.getFqcn());
assertEquals(BYTECODE, syntaxCheckerDescription.getBytecode());
assertEquals(DESC, syntaxCheckerDescription.getDescription());
}
use of org.apache.directory.api.ldap.model.schema.parsers.SyntaxCheckerDescription in project directory-ldap-api by apache.
the class DefaultSchemaLoader method loadSyntaxCheckers.
private void loadSyntaxCheckers(Attribute syntaxCheckers) throws LdapException {
if (syntaxCheckers == null) {
return;
}
for (Value value : syntaxCheckers) {
String desc = value.getValue();
try {
SyntaxCheckerDescription syntaxChecker = SC_DESCR_SCHEMA_PARSER.parseSyntaxCheckerDescription(desc);
updateSchemas(syntaxChecker);
} catch (ParseException pe) {
throw new LdapException(pe);
}
}
}
use of org.apache.directory.api.ldap.model.schema.parsers.SyntaxCheckerDescription in project directory-ldap-api by apache.
the class DefaultSchemaLoader method loadSyntaxCheckers.
/**
* {@inheritDoc}
*/
@Override
public List<Entry> loadSyntaxCheckers(Schema... schemas) throws LdapException, IOException {
List<Entry> syntaxCheckerEntries = new ArrayList<>();
if (schemas == null) {
return syntaxCheckerEntries;
}
for (Schema schema : schemas) {
Set<SchemaObjectWrapper> schemaObjectWrappers = schema.getContent();
for (SchemaObjectWrapper schemaObjectWrapper : schemaObjectWrappers) {
SchemaObject schemaObject = schemaObjectWrapper.get();
if (schemaObject instanceof SyntaxCheckerDescription) {
SyntaxCheckerDescription syntaxCheckerDescription = (SyntaxCheckerDescription) schemaObject;
Entry syntaxCheckerEntry = getEntry(syntaxCheckerDescription);
syntaxCheckerEntries.add(syntaxCheckerEntry);
}
}
}
return syntaxCheckerEntries;
}
Aggregations