Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 6201 invoked from network); 8 Aug 2008 01:33:25 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 8 Aug 2008 01:33:25 -0000 Received: (qmail 51156 invoked by uid 500); 8 Aug 2008 01:33:24 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 51118 invoked by uid 500); 8 Aug 2008 01:33:24 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 51109 invoked by uid 99); 8 Aug 2008 01:33:24 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Aug 2008 18:33:24 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 08 Aug 2008 01:32:36 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 659E2238898B; Thu, 7 Aug 2008 18:33:04 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r683789 - in /directory/apacheds/branches/bigbang: server-integ/src/test/java/org/apache/directory/server/operations/extended/ server-unit/src/test/java/org/apache/directory/server/ Date: Fri, 08 Aug 2008 01:33:04 -0000 To: commits@directory.apache.org From: akarasulu@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080808013304.659E2238898B@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: akarasulu Date: Thu Aug 7 18:33:03 2008 New Revision: 683789 URL: http://svn.apache.org/viewvc?rev=683789&view=rev Log: moved some extended operation tests over to server-integ Added: directory/apacheds/branches/bigbang/server-integ/src/test/java/org/apache/directory/server/operations/extended/ directory/apacheds/branches/bigbang/server-integ/src/test/java/org/apache/directory/server/operations/extended/ExtendedIT.java Removed: directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/UnknownExtendedOperationTest.java Added: directory/apacheds/branches/bigbang/server-integ/src/test/java/org/apache/directory/server/operations/extended/ExtendedIT.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/server-integ/src/test/java/org/apache/directory/server/operations/extended/ExtendedIT.java?rev=683789&view=auto ============================================================================== --- directory/apacheds/branches/bigbang/server-integ/src/test/java/org/apache/directory/server/operations/extended/ExtendedIT.java (added) +++ directory/apacheds/branches/bigbang/server-integ/src/test/java/org/apache/directory/server/operations/extended/ExtendedIT.java Thu Aug 7 18:33:03 2008 @@ -0,0 +1,106 @@ +/* + * 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.operations.extended; + + +import javax.naming.CommunicationException; +import javax.naming.NamingException; +import javax.naming.ldap.ExtendedRequest; +import javax.naming.ldap.ExtendedResponse; +import javax.naming.ldap.LdapContext; + +import static org.apache.directory.server.integ.ServerIntegrationUtils.getWiredContext; + +import org.apache.directory.server.core.integ.Level; +import org.apache.directory.server.core.integ.annotations.CleanupLevel; +import org.apache.directory.server.integ.SiRunner; +import org.apache.directory.server.newldap.LdapServer; +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.fail; + + +/** + * Various extended operation tests. + * + * @author Apache Directory Project + * @version $Rev: 545029 $ + */ +@RunWith ( SiRunner.class ) +@CleanupLevel ( Level.SUITE ) +public class ExtendedIT +{ + public static LdapServer ldapServer; + + + /** + * Calls an extended exception, which does not exist. Expected behaviour is + * a CommunicationException. + * Check the behaviour of the server for an unknown extended operation. Created + * to demonstrate DIREVE-256 ("Extended operation causes client to hang."). + * + * @throws NamingException + */ + @Test + public void testUnknownExtendedOperation() throws Exception + { + LdapContext ctx = ( LdapContext ) getWiredContext( ldapServer ).lookup( "ou=system" ); + try + { + ctx.extendedOperation( new UnknownExtendedOperationRequest() ); + fail( "Calling an unknown extended operation should fail." ); + } + catch ( CommunicationException ce ) + { + // expected behaviour + } + } + + + /** + * Class for the request of an extended operation which does not exist. + */ + private class UnknownExtendedOperationRequest implements ExtendedRequest + { + + private static final long serialVersionUID = 1L; + + + public String getID() + { + return "1.1"; // Never an OID for an extended operation + } + + + public byte[] getEncodedValue() + { + return null; + } + + + public ExtendedResponse createExtendedResponse( String id, byte[] berValue, int offset, int length ) + throws NamingException + { + return null; + } + } + +}