directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r406312 - /directory/branches/elecharny/shared/ldap/src/test/java/org/apache/directory/shared/ldap/ldif/LdifReaderTest.java
Date Sun, 14 May 2006 10:53:32 GMT
Author: elecharny
Date: Sun May 14 03:53:29 2006
New Revision: 406312

URL: http://svn.apache.org/viewcvs?rev=406312&view=rev
Log:
Added 4 tests to check that we can't mix changes and entries in the same ldif file

Modified:
    directory/branches/elecharny/shared/ldap/src/test/java/org/apache/directory/shared/ldap/ldif/LdifReaderTest.java

Modified: directory/branches/elecharny/shared/ldap/src/test/java/org/apache/directory/shared/ldap/ldif/LdifReaderTest.java
URL: http://svn.apache.org/viewcvs/directory/branches/elecharny/shared/ldap/src/test/java/org/apache/directory/shared/ldap/ldif/LdifReaderTest.java?rev=406312&r1=406311&r2=406312&view=diff
==============================================================================
--- directory/branches/elecharny/shared/ldap/src/test/java/org/apache/directory/shared/ldap/ldif/LdifReaderTest.java
(original)
+++ directory/branches/elecharny/shared/ldap/src/test/java/org/apache/directory/shared/ldap/ldif/LdifReaderTest.java
Sun May 14 03:53:29 2006
@@ -164,6 +164,160 @@
 
     }
 
+	/**
+	 * Changes and entries should not be mixed
+	 * @throws NamingException
+	 * @throws ParsingException
+	 */
+    public void testLdifParserCombinedEntriesChanges() throws NamingException
+    {
+        String ldif = 
+        		"version:   1\n" +
+        		"dn: cn=app1,ou=applications,ou=conf,dc=apache,dc=org\n" + 
+        		"cn: app1\n" + 
+        		"objectClass: top\n" +
+        		"objectClass: apApplication\n" + 
+        		"displayName:   app1   \n" + 
+        		"dependencies:\n" +
+        		"envVars:\n" +
+        		"\n" +
+		    	"# Delete an entry. The operation will attach the LDAPv3\n" +
+		    	"# Tree Delete Control defined in [9]. The criticality\n" +
+		    	"# field is \"true\" and the controlValue field is\n" +
+		    	"# absent, as required by [9].\n" +
+		    	"dn: ou=Product Development, dc=airius, dc=com\n" +
+		    	"control: 1.2.840.11A556.1.4.805 true\n" +
+		    	"changetype: delete\n";
+        
+        
+        LdifReader reader = new LdifReader();
+        
+        try
+        {
+        	reader.parseLdif( ldif );
+        	fail();
+        }
+        catch ( NamingException ne )
+        {
+        	assertTrue( true );
+        }
+    }
+
+	/**
+	 * Changes and entries should not be mixed
+	 * @throws NamingException
+	 * @throws ParsingException
+	 */
+    public void testLdifParserCombinedEntriesChanges2() throws NamingException
+    {
+        String ldif = 
+        		"version:   1\n" +
+        		"dn: cn=app1,ou=applications,ou=conf,dc=apache,dc=org\n" + 
+        		"cn: app1\n" + 
+        		"objectClass: top\n" +
+        		"objectClass: apApplication\n" + 
+        		"displayName:   app1   \n" + 
+        		"dependencies:\n" +
+        		"envVars:\n" +
+        		"\n" +
+		    	"# Delete an entry. The operation will attach the LDAPv3\n" +
+		    	"# Tree Delete Control defined in [9]. The criticality\n" +
+		    	"# field is \"true\" and the controlValue field is\n" +
+		    	"# absent, as required by [9].\n" +
+		    	"dn: ou=Product Development, dc=airius, dc=com\n" +
+		    	"changetype: delete\n";
+        
+        
+        LdifReader reader = new LdifReader();
+        
+        try
+        {
+        	reader.parseLdif( ldif );
+        	fail();
+        }
+        catch ( NamingException ne )
+        {
+        	assertTrue( true );
+        }
+    }
+
+	/**
+	 * Changes and entries should not be mixed
+	 * @throws NamingException
+	 * @throws ParsingException
+	 */
+    public void testLdifParserCombinedChangesEntries() throws NamingException
+    {
+        String ldif = 
+        		"version:   1\n" +
+		    	"# Delete an entry. The operation will attach the LDAPv3\n" +
+		    	"# Tree Delete Control defined in [9]. The criticality\n" +
+		    	"# field is \"true\" and the controlValue field is\n" +
+		    	"# absent, as required by [9].\n" +
+		    	"dn: ou=Product Development, dc=airius, dc=com\n" +
+		    	"control: 1.2.840.11A556.1.4.805 true\n" +
+		    	"changetype: delete\n" +
+        		"\n" +
+        		"dn: cn=app1,ou=applications,ou=conf,dc=apache,dc=org\n" + 
+        		"cn: app1\n" + 
+        		"objectClass: top\n" +
+        		"objectClass: apApplication\n" + 
+        		"displayName:   app1   \n" + 
+        		"dependencies:\n" +
+        		"envVars:\n";
+        
+        
+        LdifReader reader = new LdifReader();
+        
+        try
+        {
+        	reader.parseLdif( ldif );
+        	fail();
+        }
+        catch ( NamingException ne )
+        {
+        	assertTrue( true );
+        }
+    }
+
+	/**
+	 * Changes and entries should not be mixed
+	 * @throws NamingException
+	 * @throws ParsingException
+	 */
+    public void testLdifParserCombinedChangesEntries2() throws NamingException
+    {
+        String ldif = 
+        		"version:   1\n" +
+		    	"# Delete an entry. The operation will attach the LDAPv3\n" +
+		    	"# Tree Delete Control defined in [9]. The criticality\n" +
+		    	"# field is \"true\" and the controlValue field is\n" +
+		    	"# absent, as required by [9].\n" +
+		    	"dn: ou=Product Development, dc=airius, dc=com\n" +
+		    	"changetype: delete\n" +
+        		"\n" +
+        		"dn: cn=app1,ou=applications,ou=conf,dc=apache,dc=org\n" + 
+        		"cn: app1\n" + 
+        		"objectClass: top\n" +
+        		"objectClass: apApplication\n" + 
+        		"displayName:   app1   \n" + 
+        		"dependencies:\n" +
+        		"envVars:\n";
+        
+        
+        LdifReader reader = new LdifReader();
+        
+        try
+        {
+        	reader.parseLdif( ldif );
+        	fail();
+        }
+        catch ( NamingException ne )
+        {
+        	assertTrue( true );
+        }
+    }
+
     public void testLdifParser() throws NamingException
     {
         String ldif = 



Mime
View raw message