use of org.apache.directory.api.ldap.model.ldif.LdifAttributesReader in project directory-ldap-api by apache.
the class LdifAttributesReaderTest method testLdifParserBase64.
@Test
public void testLdifParserBase64() throws LdapLdifException, IOException {
String ldif = "#comment\n" + "cn:: RW1tYW51ZWwgTMOpY2hhcm55\n" + "objectClass: top\n" + "objectClass: apApplication\n" + "displayName: app1\n" + "serviceType: http\n" + "dependencies:\n" + "httpHeaders:\n" + "startupOptions:\n" + "envVars:";
LdifAttributesReader reader = new LdifAttributesReader();
Entry entry = reader.parseEntry(ldif);
assertNotNull(entry);
Attribute attr = entry.get("cn");
assertTrue(attr.contains("Emmanuel L\u00e9charny".getBytes(StandardCharsets.UTF_8)));
attr = entry.get("objectclass");
assertTrue(attr.contains("top"));
assertTrue(attr.contains("apApplication"));
attr = entry.get("displayname");
assertTrue(attr.contains("app1"));
attr = entry.get("dependencies");
assertEquals("", attr.get().getValue());
attr = entry.get("envvars");
assertEquals("", attr.get().getValue());
reader.close();
}
Aggregations