@Test public void testConvertEntryOneControl() throws Exception { LdifReader reader = new LdifReader(); String expected = "dn: ou=test\n" + "control: 2.16.840.1.113730.3.4.2 false\n" + "changetype: add\n" + "ObjectClass: top\n" + "ObjectClass: metaTop\n" + "ObjectClass: metaSyntax\n" + "m-oid: 1.2.3.4\n" + "m-description: description\n\n"; List<LdifEntry> entries = reader.parseLdif( expected ); LdifEntry expectedEntry = entries.get( 0 ); LdifEntry entry = new LdifEntry(); entry.setDn( "ou=test" ); entry.addAttribute( "ObjectClass", "top", "metaTop", "metaSyntax" ); entry.addAttribute( "m-oid", "1.2.3.4" ); entry.addAttribute( "m-description", "description" ); ManageDsaITImpl control = new ManageDsaITImpl(); entry.addControl( control ); String converted = LdifUtils.convertToLdif( entry ); assertNotNull( converted ); entries = reader.parseLdif( converted ); LdifEntry convertedEntry = entries.get( 0 ); assertEquals( expectedEntry, convertedEntry ); reader.close(); }
public static String convertToLdif( Attributes attrs ) throws LdapException { return convertAttributesToLdif( AttributeUtils.toEntry( attrs, null ), DEFAULT_LINE_LENGTH ); }
LdifUtils { public static String convertToLdif( Attributes attrs ) throws LdapException { return convertAttributesToLdif( AttributeUtils.toEntry( attrs, null ), DEFAULT_LINE_LENGTH ); } }
LdifUtils { public static String convertToLdif( Attributes attrs ) throws LdapException { return convertAttributesToLdif( AttributeUtils.toEntry( attrs, null ), DEFAULT_LINE_LENGTH ); } private  LdifUtils(); }
LdifUtils { public static String convertToLdif( Attributes attrs ) throws LdapException { return convertAttributesToLdif( AttributeUtils.toEntry( attrs, null ), DEFAULT_LINE_LENGTH ); } private  LdifUtils(); static boolean isLDIFSafe( String str ); static String convertToLdif( Attributes attrs ); static String convertToLdif( Attributes attrs, int length ); static String convertToLdif( Attributes attrs, Dn dn, int length ); static String convertToLdif( Attributes attrs, Dn dn ); static String convertToLdif( Entry entry ); static String convertToLdif( Entry entry, boolean includeVersionInfo ); static String convertAttributesToLdif( Entry entry ); static Attributes getJndiAttributesFromLdif( String ldif ); static String convertToLdif( Entry entry, int length ); static String convertAttributesToLdif( Entry entry, int length ); static String convertToLdif( LdifEntry entry ); static String convertToLdif( LdifEntry entry, int length ); static String convertToLdif( Attribute attr ); static String convertToLdif( Attribute attr, int length ); static String stripLineToNChars( String str, int nbChars ); static Attributes createJndiAttributes( Object... avas ); }
LdifUtils { public static String convertToLdif( Attributes attrs ) throws LdapException { return convertAttributesToLdif( AttributeUtils.toEntry( attrs, null ), DEFAULT_LINE_LENGTH ); } private  LdifUtils(); static boolean isLDIFSafe( String str ); static String convertToLdif( Attributes attrs ); static String convertToLdif( Attributes attrs, int length ); static String convertToLdif( Attributes attrs, Dn dn, int length ); static String convertToLdif( Attributes attrs, Dn dn ); static String convertToLdif( Entry entry ); static String convertToLdif( Entry entry, boolean includeVersionInfo ); static String convertAttributesToLdif( Entry entry ); static Attributes getJndiAttributesFromLdif( String ldif ); static String convertToLdif( Entry entry, int length ); static String convertAttributesToLdif( Entry entry, int length ); static String convertToLdif( LdifEntry entry ); static String convertToLdif( LdifEntry entry, int length ); static String convertToLdif( Attribute attr ); static String convertToLdif( Attribute attr, int length ); static String stripLineToNChars( String str, int nbChars ); static Attributes createJndiAttributes( Object... avas );  }