| 1 |
/*
|
| 2 |
* Copyright (c) 2005 Your Corporation. All Rights Reserved.
|
| 3 |
*/
|
| 4 |
package org.apache.ldap.common.ldif;
|
| 5 |
|
| 6 |
|
| 7 |
import junit.framework.TestCase;
|
| 8 |
import org.apache.ldap.common.message.LockableAttributesImpl;
|
| 9 |
|
| 10 |
import javax.naming.directory.Attributes;
|
| 11 |
import javax.naming.directory.Attribute;
|
| 12 |
import javax.naming.NamingException;
|
| 13 |
|
| 14 |
|
| 15 |
/**
|
| 16 |
* @author <a href="mailto:akarasulu@safehaus.org">Alex Karasulu</a>
|
| 17 |
* @version $Rev$
|
| 18 |
*/
|
| 19 |
public class LdifParserImplTest extends TestCase
|
| 20 |
{
|
| 21 |
public void testLdifParser() throws NamingException
|
| 22 |
{
|
| 23 |
String ldif = "dn: cn=app1,ou=applications,ou=conf,dc=apache,dc=org\n" +
|
| 24 |
"cn: app1\n" +
|
| 25 |
"objectClass: top\n" +
|
| 26 |
"objectClass: apApplication\n" +
|
| 27 |
"displayName: app1\n" +
|
| 28 |
"serviceType: http\n" +
|
| 29 |
"dependencies:\n" +
|
| 30 |
"httpHeaders:\n" +
|
| 31 |
"startupOptions:\n" +
|
| 32 |
"envVars:";
|
| 33 |
LdifParser parser = new LdifParserImpl();
|
| 34 |
Attributes attrs = new LockableAttributesImpl();
|
| 35 |
parser.parse( attrs, ldif );
|
| 36 |
|
| 37 |
assertNotNull( attrs );
|
| 38 |
|
| 39 |
Attribute attr = attrs.get( "objectClass" );
|
| 40 |
assertTrue( attr.contains( "apApplication" ) );
|
| 41 |
assertTrue( attr.contains( "top" ) );
|
| 42 |
|
| 43 |
}
|
| 44 |
}
|