You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2008/08/08 03:33:04 UTC
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/
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 <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @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;
+ }
+ }
+
+}