You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2007/08/23 03:58:58 UTC
svn commit: r568805 -
/directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/DeleteIllegalDNITest.java
Author: elecharny
Date: Wed Aug 22 18:58:57 2007
New Revision: 568805
URL: http://svn.apache.org/viewvc?rev=568805&view=rev
Log:
Added Martin's testCase for the server freeze.
Added:
directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/DeleteIllegalDNITest.java
Added: directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/DeleteIllegalDNITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/DeleteIllegalDNITest.java?rev=568805&view=auto
==============================================================================
--- directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/DeleteIllegalDNITest.java (added)
+++ directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/DeleteIllegalDNITest.java Wed Aug 22 18:58:57 2007
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.directory.server;
+
+import javax.naming.InvalidNameException;
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.directory.SearchControls;
+import javax.naming.directory.SearchResult;
+import javax.naming.ldap.LdapContext;
+
+import org.apache.directory.server.unit.AbstractServerTest;
+
+/**
+ * Test reading an illegal DN followed by some other operation.
+ *
+ * This test will never complete due to
+ * <a href="https://issues.apache.org/jira/browse/DIRSERVER-942">DIRSERVER-942</a>.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class DeleteIllegalDNITest extends AbstractServerTest
+{
+
+ public void testSearch() throws Exception
+ {
+ LdapContext ctx = getWiredContext();
+ SearchControls controls = new SearchControls();
+ controls.setSearchScope( SearchControls.OBJECT_SCOPE );
+ controls.setTimeLimit( 10 );
+
+ try
+ {
+ NamingEnumeration<SearchResult> result = ctx.search( "myBadDN", "(objectClass=*)", controls );
+
+ fail(); // We should get an exception here
+ }
+ catch ( InvalidNameException ine )
+ {
+ System.out.println( "INE Error : " + ine.getMessage() );
+ // Expected.
+ }
+ catch ( NamingException ne )
+ {
+ System.out.println( "NE Error : " + ne );
+ }
+ catch( Exception e )
+ {
+ System.out.println( "E Error : " + e.getMessage() );
+ }
+
+ try
+ {
+ controls = new SearchControls();
+ controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
+ controls.setTimeLimit( 10 );
+
+ NamingEnumeration<SearchResult> result = ctx.search( "ou=system", "(objectClass=*)", controls );
+
+ while ( result.hasMore() )
+ {
+ SearchResult sr = result.next();
+ }
+ }
+ catch ( InvalidNameException ine )
+ {
+ ine.printStackTrace();
+ // Expected.
+ }
+ catch ( NamingException ne )
+ {
+ ne.printStackTrace();
+ }
+ }
+}