Add a number of test cases that cover the plugin API.
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying * information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2006 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.api.plugin; |
| | | |
| | | |
| | | |
| | | import java.util.HashSet; |
| | | |
| | | import org.testng.annotations.Test; |
| | | |
| | | import org.opends.server.plugins.NullPlugin; |
| | | import org.opends.server.types.DisconnectReason; |
| | | import org.opends.server.types.DN; |
| | | import org.opends.server.types.operation.*; |
| | | |
| | | import static org.testng.Assert.*; |
| | | |
| | | |
| | | |
| | | /** |
| | | * A set of generic test cases for the Directory Server plugin API. |
| | | */ |
| | | public class DirectoryServerPluginTestCase |
| | | extends PluginAPITestCase |
| | | { |
| | | /** |
| | | * Tests the <CODE>getPluginEntryDN</CODE> method. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | public void testGetPluginEntryDN() |
| | | throws Exception |
| | | { |
| | | NullPlugin nullPlugin = new NullPlugin(); |
| | | DN pluginEntryDN = DN.decode("cn=Null Plugin,cn=Plugins,cn=config"); |
| | | |
| | | HashSet<PluginType> pluginTypes = new HashSet<PluginType>(); |
| | | for (PluginType t : PluginType.values()) |
| | | { |
| | | pluginTypes.add(t); |
| | | } |
| | | |
| | | nullPlugin.initializeInternal(pluginEntryDN, pluginTypes); |
| | | assertEquals(nullPlugin.getPluginEntryDN(), pluginEntryDN); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>getPluginTypes</CODE> method. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | public void testGetPluginTypes() |
| | | throws Exception |
| | | { |
| | | NullPlugin nullPlugin = new NullPlugin(); |
| | | DN pluginEntryDN = DN.decode("cn=Null Plugin,cn=Plugins,cn=config"); |
| | | |
| | | HashSet<PluginType> pluginTypes = new HashSet<PluginType>(); |
| | | for (PluginType t : PluginType.values()) |
| | | { |
| | | pluginTypes.add(t); |
| | | } |
| | | |
| | | nullPlugin.initializeInternal(pluginEntryDN, pluginTypes); |
| | | assertEquals(nullPlugin.getPluginTypes(), pluginTypes); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Invokes the default plugin finalizer. |
| | | */ |
| | | @Test() |
| | | public void testDefaultFinalizer() |
| | | { |
| | | new NullPlugin().finalizePlugin(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Ensures that the default <CODE>doStartup</CODE> method throws an |
| | | * exception. |
| | | */ |
| | | @Test(expectedExceptions = { UnsupportedOperationException.class }) |
| | | public void testDoStartup() |
| | | { |
| | | new NullPlugin().doStartup(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Ensures that the default <CODE>doShutdown</CODE> method throws an |
| | | * exception. |
| | | */ |
| | | @Test(expectedExceptions = { UnsupportedOperationException.class }) |
| | | public void testDoShutdown() |
| | | { |
| | | new NullPlugin().doShutdown(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Ensures that the default <CODE>doPostConnect</CODE> method throws an |
| | | * exception. |
| | | */ |
| | | @Test(expectedExceptions = { UnsupportedOperationException.class }) |
| | | public void testDoPostConnect() |
| | | { |
| | | new NullPlugin().doPostConnect(null); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Ensures that the default <CODE>doPostDisconnect</CODE> method throws an |
| | | * exception. |
| | | */ |
| | | @Test(expectedExceptions = { UnsupportedOperationException.class }) |
| | | public void testDoPostDisconnect() |
| | | { |
| | | new NullPlugin().doPostDisconnect(null, DisconnectReason.CLOSED_BY_PLUGIN, |
| | | -1, null); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Ensures that the default <CODE>doLDIFImport</CODE> method throws an |
| | | * exception. |
| | | */ |
| | | @Test(expectedExceptions = { UnsupportedOperationException.class }) |
| | | public void testDoLDIFImport() |
| | | { |
| | | new NullPlugin().doLDIFImport(null, null); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Ensures that the default <CODE>doLDIFExport</CODE> method throws an |
| | | * exception. |
| | | */ |
| | | @Test(expectedExceptions = { UnsupportedOperationException.class }) |
| | | public void testDoLDIFExport() |
| | | { |
| | | new NullPlugin().doLDIFExport(null, null); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Ensures that the default <CODE>doPreParse</CODE> method throws an |
| | | * exception for abandon operations. |
| | | */ |
| | | @Test(expectedExceptions = { UnsupportedOperationException.class }) |
| | | public void testDoPreParseAbandon() |
| | | { |
| | | new NullPlugin().doPreParse((PreParseAbandonOperation) null); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Ensures that the default <CODE>doPreParse</CODE> method throws an |
| | | * exception for add operations. |
| | | */ |
| | | @Test(expectedExceptions = { UnsupportedOperationException.class }) |
| | | public void testDoPreParseAdd() |
| | | { |
| | | new NullPlugin().doPreParse((PreParseAddOperation) null); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Ensures that the default <CODE>doPreParse</CODE> method throws an |
| | | * exception for bind operations. |
| | | */ |
| | | @Test(expectedExceptions = { UnsupportedOperationException.class }) |
| | | public void testDoPreParseBind() |
| | | { |
| | | new NullPlugin().doPreParse((PreParseBindOperation) null); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Ensures that the default <CODE>doPreParse</CODE> method throws an |
| | | * exception for compare operations. |
| | | */ |
| | | @Test(expectedExceptions = { UnsupportedOperationException.class }) |
| | | public void testDoPreParseCompare() |
| | | { |
| | | new NullPlugin().doPreParse((PreParseCompareOperation) null); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Ensures that the default <CODE>doPreParse</CODE> method throws an |
| | | * exception for delete operations. |
| | | */ |
| | | @Test(expectedExceptions = { UnsupportedOperationException.class }) |
| | | public void testDoPreParseDelete() |
| | | { |
| | | new NullPlugin().doPreParse((PreParseDeleteOperation) null); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Ensures that the default <CODE>doPreParse</CODE> method throws an |
| | | * exception for extended operations. |
| | | */ |
| | | @Test(expectedExceptions = { UnsupportedOperationException.class }) |
| | | public void testDoPreParseExtended() |
| | | { |
| | | new NullPlugin().doPreParse((PreParseExtendedOperation) null); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Ensures that the default <CODE>doPreParse</CODE> method throws an |
| | | * exception for modify operations. |
| | | */ |
| | | @Test(expectedExceptions = { UnsupportedOperationException.class }) |
| | | public void testDoPreParseModify() |
| | | { |
| | | new NullPlugin().doPreParse((PreParseModifyOperation) null); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Ensures that the default <CODE>doPreParse</CODE> method throws an |
| | | * exception for modify DN operations. |
| | | */ |
| | | @Test(expectedExceptions = { UnsupportedOperationException.class }) |
| | | public void testDoPreParseModifyDN() |
| | | { |
| | | new NullPlugin().doPreParse((PreParseModifyDNOperation) null); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Ensures that the default <CODE>doPreParse</CODE> method throws an |
| | | * exception for search operations. |
| | | */ |
| | | @Test(expectedExceptions = { UnsupportedOperationException.class }) |
| | | public void testDoPreParseSearch() |
| | | { |
| | | new NullPlugin().doPreParse((PreParseSearchOperation) null); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Ensures that the default <CODE>doPreParse</CODE> method throws an |
| | | * exception for unbind operations. |
| | | */ |
| | | @Test(expectedExceptions = { UnsupportedOperationException.class }) |
| | | public void testDoPreParseUnbind() |
| | | { |
| | | new NullPlugin().doPreParse((PreParseUnbindOperation) null); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Ensures that the default <CODE>doPreOperation</CODE> method throws an |
| | | * exception for add operations. |
| | | */ |
| | | @Test(expectedExceptions = { UnsupportedOperationException.class }) |
| | | public void testDoPreOperationAdd() |
| | | { |
| | | new NullPlugin().doPreOperation((PreOperationAddOperation) null); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Ensures that the default <CODE>doPreOperation</CODE> method throws an |
| | | * exception for bind operations. |
| | | */ |
| | | @Test(expectedExceptions = { UnsupportedOperationException.class }) |
| | | public void testDoPreOperationBind() |
| | | { |
| | | new NullPlugin().doPreOperation((PreOperationBindOperation) null); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Ensures that the default <CODE>doPreOperation</CODE> method throws an |
| | | * exception for compare operations. |
| | | */ |
| | | @Test(expectedExceptions = { UnsupportedOperationException.class }) |
| | | public void testDoPreOperationCompare() |
| | | { |
| | | new NullPlugin().doPreOperation((PreOperationCompareOperation) null); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Ensures that the default <CODE>doPreOperation</CODE> method throws an |
| | | * exception for delete operations. |
| | | */ |
| | | @Test(expectedExceptions = { UnsupportedOperationException.class }) |
| | | public void testDoPreOperationDelete() |
| | | { |
| | | new NullPlugin().doPreOperation((PreOperationDeleteOperation) null); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Ensures that the default <CODE>doPreOperation</CODE> method throws an |
| | | * exception for extended operations. |
| | | */ |
| | | @Test(expectedExceptions = { UnsupportedOperationException.class }) |
| | | public void testDoPreOperationExtended() |
| | | { |
| | | new NullPlugin().doPreOperation((PreOperationExtendedOperation) null); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Ensures that the default <CODE>doPreOperation</CODE> method throws an |
| | | * exception for modify operations. |
| | | */ |
| | | @Test(expectedExceptions = { UnsupportedOperationException.class }) |
| | | public void testDoPreOperationModify() |
| | | { |
| | | new NullPlugin().doPreOperation((PreOperationModifyOperation) null); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Ensures that the default <CODE>doPreOperation</CODE> method throws an |
| | | * exception for modify DN operations. |
| | | */ |
| | | @Test(expectedExceptions = { UnsupportedOperationException.class }) |
| | | public void testDoPreOperationModifyDN() |
| | | { |
| | | new NullPlugin().doPreOperation((PreOperationModifyDNOperation) null); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Ensures that the default <CODE>doPreOperation</CODE> method throws an |
| | | * exception for search operations. |
| | | */ |
| | | @Test(expectedExceptions = { UnsupportedOperationException.class }) |
| | | public void testDoPreOperationSearch() |
| | | { |
| | | new NullPlugin().doPreOperation((PreOperationSearchOperation) null); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Ensures that the default <CODE>doPostOperation</CODE> method throws an |
| | | * exception for abandon operations. |
| | | */ |
| | | @Test(expectedExceptions = { UnsupportedOperationException.class }) |
| | | public void testDoPostOperationAbandon() |
| | | { |
| | | new NullPlugin().doPostOperation((PostOperationAbandonOperation) null); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Ensures that the default <CODE>doPostOperation</CODE> method throws an |
| | | * exception for add operations. |
| | | */ |
| | | @Test(expectedExceptions = { UnsupportedOperationException.class }) |
| | | public void testDoPostOperationAdd() |
| | | { |
| | | new NullPlugin().doPostOperation((PostOperationAddOperation) null); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Ensures that the default <CODE>doPostOperation</CODE> method throws an |
| | | * exception for bind operations. |
| | | */ |
| | | @Test(expectedExceptions = { UnsupportedOperationException.class }) |
| | | public void testDoPostOperationBind() |
| | | { |
| | | new NullPlugin().doPostOperation((PostOperationBindOperation) null); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Ensures that the default <CODE>doPostOperation</CODE> method throws an |
| | | * exception for compare operations. |
| | | */ |
| | | @Test(expectedExceptions = { UnsupportedOperationException.class }) |
| | | public void testDoPostOperationCompare() |
| | | { |
| | | new NullPlugin().doPostOperation((PostOperationCompareOperation) null); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Ensures that the default <CODE>doPostOperation</CODE> method throws an |
| | | * exception for delete operations. |
| | | */ |
| | | @Test(expectedExceptions = { UnsupportedOperationException.class }) |
| | | public void testDoPostOperationDelete() |
| | | { |
| | | new NullPlugin().doPostOperation((PostOperationDeleteOperation) null); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Ensures that the default <CODE>doPostOperation</CODE> method throws an |
| | | * exception for extended operations. |
| | | */ |
| | | @Test(expectedExceptions = { UnsupportedOperationException.class }) |
| | | public void testDoPostOperationExtended() |
| | | { |
| | | new NullPlugin().doPostOperation((PostOperationExtendedOperation) null); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Ensures that the default <CODE>doPostOperation</CODE> method throws an |
| | | * exception for modify operations. |
| | | */ |
| | | @Test(expectedExceptions = { UnsupportedOperationException.class }) |
| | | public void testDoPostOperationModify() |
| | | { |
| | | new NullPlugin().doPostOperation((PostOperationModifyOperation) null); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Ensures that the default <CODE>doPostOperation</CODE> method throws an |
| | | * exception for modify DN operations. |
| | | */ |
| | | @Test(expectedExceptions = { UnsupportedOperationException.class }) |
| | | public void testDoPostOperationModifyDN() |
| | | { |
| | | new NullPlugin().doPostOperation((PostOperationModifyDNOperation) null); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Ensures that the default <CODE>doPostOperation</CODE> method throws an |
| | | * exception for search operations. |
| | | */ |
| | | @Test(expectedExceptions = { UnsupportedOperationException.class }) |
| | | public void testDoPostOperationSearch() |
| | | { |
| | | new NullPlugin().doPostOperation((PostOperationSearchOperation) null); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Ensures that the default <CODE>doPostOperation</CODE> method throws an |
| | | * exception for unbind operations. |
| | | */ |
| | | @Test(expectedExceptions = { UnsupportedOperationException.class }) |
| | | public void testDoPostOperationUnbind() |
| | | { |
| | | new NullPlugin().doPostOperation((PostOperationUnbindOperation) null); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Ensures that the default <CODE>doPostResponse</CODE> method throws an |
| | | * exception for add operations. |
| | | */ |
| | | @Test(expectedExceptions = { UnsupportedOperationException.class }) |
| | | public void testDoPostResponseAdd() |
| | | { |
| | | new NullPlugin().doPostResponse((PostResponseAddOperation) null); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Ensures that the default <CODE>doPostResponse</CODE> method throws an |
| | | * exception for bind operations. |
| | | */ |
| | | @Test(expectedExceptions = { UnsupportedOperationException.class }) |
| | | public void testDoPostResponseBind() |
| | | { |
| | | new NullPlugin().doPostResponse((PostResponseBindOperation) null); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Ensures that the default <CODE>doPostResponse</CODE> method throws an |
| | | * exception for compare operations. |
| | | */ |
| | | @Test(expectedExceptions = { UnsupportedOperationException.class }) |
| | | public void testDoPostResponseCompare() |
| | | { |
| | | new NullPlugin().doPostResponse((PostResponseCompareOperation) null); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Ensures that the default <CODE>doPostResponse</CODE> method throws an |
| | | * exception for delete operations. |
| | | */ |
| | | @Test(expectedExceptions = { UnsupportedOperationException.class }) |
| | | public void testDoPostResponseDelete() |
| | | { |
| | | new NullPlugin().doPostResponse((PostResponseDeleteOperation) null); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Ensures that the default <CODE>doPostResponse</CODE> method throws an |
| | | * exception for extended operations. |
| | | */ |
| | | @Test(expectedExceptions = { UnsupportedOperationException.class }) |
| | | public void testDoPostResponseExtended() |
| | | { |
| | | new NullPlugin().doPostResponse((PostResponseExtendedOperation) null); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Ensures that the default <CODE>doPostResponse</CODE> method throws an |
| | | * exception for modify operations. |
| | | */ |
| | | @Test(expectedExceptions = { UnsupportedOperationException.class }) |
| | | public void testDoPostResponseModify() |
| | | { |
| | | new NullPlugin().doPostResponse((PostResponseModifyOperation) null); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Ensures that the default <CODE>doPostResponse</CODE> method throws an |
| | | * exception for modify DN operations. |
| | | */ |
| | | @Test(expectedExceptions = { UnsupportedOperationException.class }) |
| | | public void testDoPostResponseModifyDN() |
| | | { |
| | | new NullPlugin().doPostResponse((PostResponseModifyDNOperation) null); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Ensures that the default <CODE>doPostResponse</CODE> method throws an |
| | | * exception for search operations. |
| | | */ |
| | | @Test(expectedExceptions = { UnsupportedOperationException.class }) |
| | | public void testDoPostResponseSearch() |
| | | { |
| | | new NullPlugin().doPostResponse((PostResponseSearchOperation) null); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Ensures that the default <CODE>processSearchEntry</CODE> method throws an |
| | | * exception. |
| | | */ |
| | | @Test(expectedExceptions = { UnsupportedOperationException.class }) |
| | | public void testProcessSearchEntry() |
| | | { |
| | | new NullPlugin().processSearchEntry(null, null); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Ensures that the default <CODE>processSearchReference</CODE> method throws |
| | | * an exception. |
| | | */ |
| | | @Test(expectedExceptions = { UnsupportedOperationException.class }) |
| | | public void testProcessSearchReference() |
| | | { |
| | | new NullPlugin().processSearchReference(null, null); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Ensures that the default <CODE>processIntermediateResponse</CODE> method |
| | | * throws an exception. |
| | | */ |
| | | @Test(expectedExceptions = { UnsupportedOperationException.class }) |
| | | public void testProcessIntermediateResponse() |
| | | { |
| | | new NullPlugin().processIntermediateResponse(null); |
| | | } |
| | | } |
| | | |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying * information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2006 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.api.plugin; |
| | | |
| | | |
| | | |
| | | import org.testng.annotations.Test; |
| | | import org.testng.annotations.DataProvider; |
| | | |
| | | import static org.testng.Assert.*; |
| | | |
| | | |
| | | |
| | | /** |
| | | * A set of test cases for the intermediate response plugin result type. |
| | | */ |
| | | public class IntermediateResponsePluginResultTestCase |
| | | extends PluginAPITestCase |
| | | { |
| | | /** |
| | | * Retrieves a set of intermediate response plugin result instances. |
| | | * |
| | | * @return A set of intermediate response plugin result instances. |
| | | */ |
| | | @DataProvider(name = "instances") |
| | | public Object[][] getInstances() |
| | | { |
| | | return new Object[][] |
| | | { |
| | | new Object[] { IntermediateResponsePluginResult.SUCCESS }, |
| | | new Object[] { new IntermediateResponsePluginResult(false, false, false, |
| | | false) }, |
| | | new Object[] { new IntermediateResponsePluginResult(true, false, false, |
| | | false) }, |
| | | new Object[] { new IntermediateResponsePluginResult(false, true, false, |
| | | false) }, |
| | | new Object[] { new IntermediateResponsePluginResult(false, false, true, |
| | | false) }, |
| | | new Object[] { new IntermediateResponsePluginResult(false, false, false, |
| | | true) }, |
| | | new Object[] { new IntermediateResponsePluginResult(true, true, false, |
| | | false) }, |
| | | new Object[] { new IntermediateResponsePluginResult(true, false, true, |
| | | false) }, |
| | | new Object[] { new IntermediateResponsePluginResult(true, false, false, |
| | | true) }, |
| | | new Object[] { new IntermediateResponsePluginResult(false, true, true, |
| | | false) }, |
| | | new Object[] { new IntermediateResponsePluginResult(false, true, false, |
| | | true) }, |
| | | new Object[] { new IntermediateResponsePluginResult(false, false, true, |
| | | true) }, |
| | | new Object[] { new IntermediateResponsePluginResult(true, true, true, |
| | | false) }, |
| | | new Object[] { new IntermediateResponsePluginResult(true, true, false, |
| | | true) }, |
| | | new Object[] { new IntermediateResponsePluginResult(true, false, true, |
| | | true) }, |
| | | new Object[] { new IntermediateResponsePluginResult(false, true, true, |
| | | true) }, |
| | | new Object[] { new IntermediateResponsePluginResult(true, true, true, |
| | | true) } |
| | | }; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>connectionTerminated</CODE> method. |
| | | * |
| | | * @param result The result instance to test. |
| | | */ |
| | | @Test(dataProvider = "instances") |
| | | public void testConnectionTerminated(IntermediateResponsePluginResult result) |
| | | { |
| | | result.connectionTerminated(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>continuePluginProcessing</CODE> method. |
| | | * |
| | | * @param result The result instance to test. |
| | | */ |
| | | @Test(dataProvider = "instances") |
| | | public void testContinuePluginProcessing(IntermediateResponsePluginResult |
| | | result) |
| | | { |
| | | result.continuePluginProcessing(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>sendIntermediateResponse</CODE> method. |
| | | * |
| | | * @param result The result instance to test. |
| | | */ |
| | | @Test(dataProvider = "instances") |
| | | public void testSendIntermediateResponse(IntermediateResponsePluginResult |
| | | result) |
| | | { |
| | | result.sendIntermediateResponse(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>continueOperation</CODE> method. |
| | | * |
| | | * @param result The result instance to test. |
| | | */ |
| | | @Test(dataProvider = "instances") |
| | | public void testContinueOperation(IntermediateResponsePluginResult result) |
| | | { |
| | | result.continueOperation(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>toString</CODE> method. |
| | | * |
| | | * @param result The result instance to test. |
| | | */ |
| | | @Test(dataProvider = "instances") |
| | | public void testToString(IntermediateResponsePluginResult result) |
| | | { |
| | | assertNotNull(result.toString()); |
| | | } |
| | | } |
| | | |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying * information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2006 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.api.plugin; |
| | | |
| | | |
| | | |
| | | import java.util.HashSet; |
| | | |
| | | import org.testng.annotations.Test; |
| | | import org.testng.annotations.DataProvider; |
| | | |
| | | import org.opends.server.plugins.NullPlugin; |
| | | import org.opends.server.types.DisconnectReason; |
| | | import org.opends.server.types.DN; |
| | | import org.opends.server.types.operation.*; |
| | | |
| | | import static org.testng.Assert.*; |
| | | |
| | | |
| | | |
| | | /** |
| | | * A set of test cases for the LDIF plugin result type. |
| | | */ |
| | | public class LDIFPluginResultTestCase |
| | | extends PluginAPITestCase |
| | | { |
| | | /** |
| | | * Retrieves a set of LDIF plugin result instances. |
| | | * |
| | | * @return A set of LDIF plugin result instances. |
| | | */ |
| | | @DataProvider(name = "instances") |
| | | public Object[][] getInstances() |
| | | { |
| | | return new Object[][] |
| | | { |
| | | new Object[] { LDIFPluginResult.SUCCESS }, |
| | | new Object[] { new LDIFPluginResult(false, false) }, |
| | | new Object[] { new LDIFPluginResult(true, false) }, |
| | | new Object[] { new LDIFPluginResult(false, true) }, |
| | | new Object[] { new LDIFPluginResult(true, true) } |
| | | }; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>continuePluginProcessing</CODE> method. |
| | | * |
| | | * @param result The result instance to test. |
| | | */ |
| | | @Test(dataProvider = "instances") |
| | | public void testContinuePluginProcessing(LDIFPluginResult result) |
| | | { |
| | | result.continuePluginProcessing(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>continueEntryProcessing</CODE> method. |
| | | * |
| | | * @param result The result instance to test. |
| | | */ |
| | | @Test(dataProvider = "instances") |
| | | public void testContinueEntryProcessing(LDIFPluginResult result) |
| | | { |
| | | result.continueEntryProcessing(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>toString</CODE> method. |
| | | * |
| | | * @param result The result instance to test. |
| | | */ |
| | | @Test(dataProvider = "instances") |
| | | public void testToString(LDIFPluginResult result) |
| | | { |
| | | assertNotNull(result.toString()); |
| | | } |
| | | } |
| | | |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying * information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2006 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.api.plugin; |
| | | |
| | | |
| | | |
| | | import org.testng.annotations.Test; |
| | | |
| | | import org.opends.server.DirectoryServerTestCase; |
| | | |
| | | |
| | | |
| | | /** |
| | | * An abstract base class for all plugin API test cases. |
| | | */ |
| | | @Test(groups = { "precommit", "pluginapi" }) |
| | | public abstract class PluginAPITestCase |
| | | extends DirectoryServerTestCase |
| | | { |
| | | // No implementation required. |
| | | } |
| | | |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying * information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2006 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.api.plugin; |
| | | |
| | | |
| | | |
| | | import org.testng.annotations.Test; |
| | | import org.testng.annotations.DataProvider; |
| | | |
| | | import static org.testng.Assert.*; |
| | | |
| | | |
| | | |
| | | /** |
| | | * A set of test cases for the post-connect plugin result type. |
| | | */ |
| | | public class PostConnectPluginResultTestCase |
| | | extends PluginAPITestCase |
| | | { |
| | | /** |
| | | * Retrieves a set of post-connect plugin result instances. |
| | | * |
| | | * @return A set of post-connect plugin result instances. |
| | | */ |
| | | @DataProvider(name = "instances") |
| | | public Object[][] getInstances() |
| | | { |
| | | return new Object[][] |
| | | { |
| | | new Object[] { PostConnectPluginResult.SUCCESS }, |
| | | new Object[] { new PostConnectPluginResult(false, false) }, |
| | | new Object[] { new PostConnectPluginResult(true, false) }, |
| | | new Object[] { new PostConnectPluginResult(false, true) }, |
| | | new Object[] { new PostConnectPluginResult(true, true) } |
| | | }; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>connectionTerminated</CODE> method. |
| | | * |
| | | * @param result The result instance to test. |
| | | */ |
| | | @Test(dataProvider = "instances") |
| | | public void testConnectionTerminated(PostConnectPluginResult result) |
| | | { |
| | | result.connectionTerminated(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>continuePluginProcessing</CODE> method. |
| | | * |
| | | * @param result The result instance to test. |
| | | */ |
| | | @Test(dataProvider = "instances") |
| | | public void testContinuePluginProcessing(PostConnectPluginResult result) |
| | | { |
| | | result.continuePluginProcessing(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>toString</CODE> method. |
| | | * |
| | | * @param result The result instance to test. |
| | | */ |
| | | @Test(dataProvider = "instances") |
| | | public void testToString(PostConnectPluginResult result) |
| | | { |
| | | assertNotNull(result.toString()); |
| | | } |
| | | } |
| | | |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying * information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2006 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.api.plugin; |
| | | |
| | | |
| | | |
| | | import org.testng.annotations.Test; |
| | | import org.testng.annotations.DataProvider; |
| | | |
| | | import static org.testng.Assert.*; |
| | | |
| | | |
| | | |
| | | /** |
| | | * A set of test cases for the post-disconnect plugin result type. |
| | | */ |
| | | public class PostDisconnectPluginResultTestCase |
| | | extends PluginAPITestCase |
| | | { |
| | | /** |
| | | * Retrieves a set of post-disconnect plugin result instances. |
| | | * |
| | | * @return A set of post-disconnect plugin result instances. |
| | | */ |
| | | @DataProvider(name = "instances") |
| | | public Object[][] getInstances() |
| | | { |
| | | return new Object[][] |
| | | { |
| | | new Object[] { PostDisconnectPluginResult.SUCCESS }, |
| | | new Object[] { new PostDisconnectPluginResult(false) }, |
| | | new Object[] { new PostDisconnectPluginResult(true) } |
| | | }; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>continuePluginProcessing</CODE> method. |
| | | * |
| | | * @param result The result instance to test. |
| | | */ |
| | | @Test(dataProvider = "instances") |
| | | public void testContinuePluginProcessing(PostDisconnectPluginResult result) |
| | | { |
| | | result.continuePluginProcessing(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>toString</CODE> method. |
| | | * |
| | | * @param result The result instance to test. |
| | | */ |
| | | @Test(dataProvider = "instances") |
| | | public void testToString(PostDisconnectPluginResult result) |
| | | { |
| | | assertNotNull(result.toString()); |
| | | } |
| | | } |
| | | |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying * information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2006 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.api.plugin; |
| | | |
| | | |
| | | |
| | | import org.testng.annotations.Test; |
| | | import org.testng.annotations.DataProvider; |
| | | |
| | | import static org.testng.Assert.*; |
| | | |
| | | |
| | | |
| | | /** |
| | | * A set of test cases for the post-operation plugin result type. |
| | | */ |
| | | public class PostOperationPluginResultTestCase |
| | | extends PluginAPITestCase |
| | | { |
| | | /** |
| | | * Retrieves a set of post-operation plugin result instances. |
| | | * |
| | | * @return A set of post-operation plugin result instances. |
| | | */ |
| | | @DataProvider(name = "instances") |
| | | public Object[][] getInstances() |
| | | { |
| | | return new Object[][] |
| | | { |
| | | new Object[] { PostOperationPluginResult.SUCCESS }, |
| | | new Object[] { new PostOperationPluginResult(false, false) }, |
| | | new Object[] { new PostOperationPluginResult(true, false) }, |
| | | new Object[] { new PostOperationPluginResult(false, true) }, |
| | | new Object[] { new PostOperationPluginResult(true, true) }, |
| | | }; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>connectionTerminated</CODE> method. |
| | | * |
| | | * @param result The result instance to test. |
| | | */ |
| | | @Test(dataProvider = "instances") |
| | | public void testConnectionTerminated(PostOperationPluginResult result) |
| | | { |
| | | result.connectionTerminated(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>continuePluginProcessing</CODE> method. |
| | | * |
| | | * @param result The result instance to test. |
| | | */ |
| | | @Test(dataProvider = "instances") |
| | | public void testContinuePluginProcessing(PostOperationPluginResult result) |
| | | { |
| | | result.continuePluginProcessing(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>toString</CODE> method. |
| | | * |
| | | * @param result The result instance to test. |
| | | */ |
| | | @Test(dataProvider = "instances") |
| | | public void testToString(PostOperationPluginResult result) |
| | | { |
| | | assertNotNull(result.toString()); |
| | | } |
| | | } |
| | | |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying * information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2006 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.api.plugin; |
| | | |
| | | |
| | | |
| | | import org.testng.annotations.Test; |
| | | import org.testng.annotations.DataProvider; |
| | | |
| | | import static org.testng.Assert.*; |
| | | |
| | | |
| | | |
| | | /** |
| | | * A set of test cases for the post-response plugin result type. |
| | | */ |
| | | public class PostResponsePluginResultTestCase |
| | | extends PluginAPITestCase |
| | | { |
| | | /** |
| | | * Retrieves a set of post-resposne plugin result instances. |
| | | * |
| | | * @return A set of post-response plugin result instances. |
| | | */ |
| | | @DataProvider(name = "instances") |
| | | public Object[][] getInstances() |
| | | { |
| | | return new Object[][] |
| | | { |
| | | new Object[] { PostResponsePluginResult.SUCCESS }, |
| | | new Object[] { new PostResponsePluginResult(false, false) }, |
| | | new Object[] { new PostResponsePluginResult(true, false) }, |
| | | new Object[] { new PostResponsePluginResult(false, true) }, |
| | | new Object[] { new PostResponsePluginResult(true, true) }, |
| | | }; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>connectionTerminated</CODE> method. |
| | | * |
| | | * @param result The result instance to test. |
| | | */ |
| | | @Test(dataProvider = "instances") |
| | | public void testConnectionTerminated(PostResponsePluginResult result) |
| | | { |
| | | result.connectionTerminated(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>continuePluginProcessing</CODE> method. |
| | | * |
| | | * @param result The result instance to test. |
| | | */ |
| | | @Test(dataProvider = "instances") |
| | | public void testContinuePluginProcessing(PostResponsePluginResult result) |
| | | { |
| | | result.continuePluginProcessing(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>toString</CODE> method. |
| | | * |
| | | * @param result The result instance to test. |
| | | */ |
| | | @Test(dataProvider = "instances") |
| | | public void testToString(PostResponsePluginResult result) |
| | | { |
| | | assertNotNull(result.toString()); |
| | | } |
| | | } |
| | | |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying * information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2006 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.api.plugin; |
| | | |
| | | |
| | | |
| | | import org.testng.annotations.Test; |
| | | import org.testng.annotations.DataProvider; |
| | | |
| | | import static org.testng.Assert.*; |
| | | |
| | | |
| | | |
| | | /** |
| | | * A set of test cases for the pre-operation plugin result type. |
| | | */ |
| | | public class PreOperationPluginResultTestCase |
| | | extends PluginAPITestCase |
| | | { |
| | | /** |
| | | * Retrieves a set of pre-operation plugin result instances. |
| | | * |
| | | * @return A set of pre-operation plugin result instances. |
| | | */ |
| | | @DataProvider(name = "instances") |
| | | public Object[][] getInstances() |
| | | { |
| | | return new Object[][] |
| | | { |
| | | new Object[] { PreOperationPluginResult.SUCCESS }, |
| | | new Object[] { new PreOperationPluginResult(false, false, false) }, |
| | | new Object[] { new PreOperationPluginResult(true, false, false) }, |
| | | new Object[] { new PreOperationPluginResult(false, true, false) }, |
| | | new Object[] { new PreOperationPluginResult(false, false, true) }, |
| | | new Object[] { new PreOperationPluginResult(true, true, false) }, |
| | | new Object[] { new PreOperationPluginResult(true, false, true) }, |
| | | new Object[] { new PreOperationPluginResult(false, true, true) }, |
| | | new Object[] { new PreOperationPluginResult(true, true, true) }, |
| | | }; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>connectionTerminated</CODE> method. |
| | | * |
| | | * @param result The result instance to test. |
| | | */ |
| | | @Test(dataProvider = "instances") |
| | | public void testConnectionTerminated(PreOperationPluginResult result) |
| | | { |
| | | result.connectionTerminated(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>continuePluginProcessing</CODE> method. |
| | | * |
| | | * @param result The result instance to test. |
| | | */ |
| | | @Test(dataProvider = "instances") |
| | | public void testContinuePluginProcessing(PreOperationPluginResult result) |
| | | { |
| | | result.continuePluginProcessing(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>sendResponseImmediately</CODE> method. |
| | | * |
| | | * @param result The result instance to test. |
| | | */ |
| | | @Test(dataProvider = "instances") |
| | | public void testSendResponseImmediately(PreOperationPluginResult result) |
| | | { |
| | | result.sendResponseImmediately(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>toString</CODE> method. |
| | | * |
| | | * @param result The result instance to test. |
| | | */ |
| | | @Test(dataProvider = "instances") |
| | | public void testToString(PreOperationPluginResult result) |
| | | { |
| | | assertNotNull(result.toString()); |
| | | } |
| | | } |
| | | |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying * information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2006 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.api.plugin; |
| | | |
| | | |
| | | |
| | | import org.testng.annotations.Test; |
| | | import org.testng.annotations.DataProvider; |
| | | |
| | | import static org.testng.Assert.*; |
| | | |
| | | |
| | | |
| | | /** |
| | | * A set of test cases for the pre-parse plugin result type. |
| | | */ |
| | | public class PreParsePluginResultTestCase |
| | | extends PluginAPITestCase |
| | | { |
| | | /** |
| | | * Retrieves a set of pre-parse plugin result instances. |
| | | * |
| | | * @return A set of pre-parse plugin result instances. |
| | | */ |
| | | @DataProvider(name = "instances") |
| | | public Object[][] getInstances() |
| | | { |
| | | return new Object[][] |
| | | { |
| | | new Object[] { PreParsePluginResult.SUCCESS }, |
| | | new Object[] { new PreParsePluginResult(false, false, false) }, |
| | | new Object[] { new PreParsePluginResult(true, false, false) }, |
| | | new Object[] { new PreParsePluginResult(false, true, false) }, |
| | | new Object[] { new PreParsePluginResult(false, false, true) }, |
| | | new Object[] { new PreParsePluginResult(true, true, false) }, |
| | | new Object[] { new PreParsePluginResult(true, false, true) }, |
| | | new Object[] { new PreParsePluginResult(false, true, true) }, |
| | | new Object[] { new PreParsePluginResult(true, true, true) }, |
| | | }; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>connectionTerminated</CODE> method. |
| | | * |
| | | * @param result The result instance to test. |
| | | */ |
| | | @Test(dataProvider = "instances") |
| | | public void testConnectionTerminated(PreParsePluginResult result) |
| | | { |
| | | result.connectionTerminated(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>continuePluginProcessing</CODE> method. |
| | | * |
| | | * @param result The result instance to test. |
| | | */ |
| | | @Test(dataProvider = "instances") |
| | | public void testContinuePluginProcessing(PreParsePluginResult result) |
| | | { |
| | | result.continuePluginProcessing(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>sendResponseImmediately</CODE> method. |
| | | * |
| | | * @param result The result instance to test. |
| | | */ |
| | | @Test(dataProvider = "instances") |
| | | public void testSendResponseImmediately(PreParsePluginResult result) |
| | | { |
| | | result.sendResponseImmediately(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>toString</CODE> method. |
| | | * |
| | | * @param result The result instance to test. |
| | | */ |
| | | @Test(dataProvider = "instances") |
| | | public void testToString(PreParsePluginResult result) |
| | | { |
| | | assertNotNull(result.toString()); |
| | | } |
| | | } |
| | | |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying * information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2006 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.api.plugin; |
| | | |
| | | |
| | | |
| | | import org.testng.annotations.Test; |
| | | import org.testng.annotations.DataProvider; |
| | | |
| | | import static org.testng.Assert.*; |
| | | |
| | | |
| | | |
| | | /** |
| | | * A set of test cases for the search entry plugin result type. |
| | | */ |
| | | public class SearchEntryPluginResultTestCase |
| | | extends PluginAPITestCase |
| | | { |
| | | /** |
| | | * Retrieves a set of search entry plugin result instances. |
| | | * |
| | | * @return A set of search entry plugin result instances. |
| | | */ |
| | | @DataProvider(name = "instances") |
| | | public Object[][] getInstances() |
| | | { |
| | | return new Object[][] |
| | | { |
| | | new Object[] { SearchEntryPluginResult.SUCCESS }, |
| | | new Object[] { new SearchEntryPluginResult(false, false, false, false) }, |
| | | new Object[] { new SearchEntryPluginResult(true, false, false, false) }, |
| | | new Object[] { new SearchEntryPluginResult(false, true, false, false) }, |
| | | new Object[] { new SearchEntryPluginResult(false, false, true, false) }, |
| | | new Object[] { new SearchEntryPluginResult(false, false, false, true) }, |
| | | new Object[] { new SearchEntryPluginResult(true, true, false, false) }, |
| | | new Object[] { new SearchEntryPluginResult(true, false, true, false) }, |
| | | new Object[] { new SearchEntryPluginResult(true, false, false, true) }, |
| | | new Object[] { new SearchEntryPluginResult(false, true, true, false) }, |
| | | new Object[] { new SearchEntryPluginResult(false, true, false, true) }, |
| | | new Object[] { new SearchEntryPluginResult(false, false, true, true) }, |
| | | new Object[] { new SearchEntryPluginResult(true, true, true, false) }, |
| | | new Object[] { new SearchEntryPluginResult(true, true, false, true) }, |
| | | new Object[] { new SearchEntryPluginResult(true, false, true, true) }, |
| | | new Object[] { new SearchEntryPluginResult(false, true, true, true) }, |
| | | new Object[] { new SearchEntryPluginResult(true, true, true, true) } |
| | | }; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>connectionTerminated</CODE> method. |
| | | * |
| | | * @param result The result instance to test. |
| | | */ |
| | | @Test(dataProvider = "instances") |
| | | public void testConnectionTerminated(SearchEntryPluginResult result) |
| | | { |
| | | result.connectionTerminated(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>continuePluginProcessing</CODE> method. |
| | | * |
| | | * @param result The result instance to test. |
| | | */ |
| | | @Test(dataProvider = "instances") |
| | | public void testContinuePluginProcessing(SearchEntryPluginResult result) |
| | | { |
| | | result.continuePluginProcessing(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>sendEntry</CODE> method. |
| | | * |
| | | * @param result The result instance to test. |
| | | */ |
| | | @Test(dataProvider = "instances") |
| | | public void testSendEntry(SearchEntryPluginResult result) |
| | | { |
| | | result.sendEntry(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>continueSearch</CODE> method. |
| | | * |
| | | * @param result The result instance to test. |
| | | */ |
| | | @Test(dataProvider = "instances") |
| | | public void testContinueSearch(SearchEntryPluginResult result) |
| | | { |
| | | result.continueSearch(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>toString</CODE> method. |
| | | * |
| | | * @param result The result instance to test. |
| | | */ |
| | | @Test(dataProvider = "instances") |
| | | public void testToString(SearchEntryPluginResult result) |
| | | { |
| | | assertNotNull(result.toString()); |
| | | } |
| | | } |
| | | |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying * information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2006 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.api.plugin; |
| | | |
| | | |
| | | |
| | | import org.testng.annotations.Test; |
| | | import org.testng.annotations.DataProvider; |
| | | |
| | | import static org.testng.Assert.*; |
| | | |
| | | |
| | | |
| | | /** |
| | | * A set of test cases for the search reference plugin result type. |
| | | */ |
| | | public class SearchReferencePluginResultTestCase |
| | | extends PluginAPITestCase |
| | | { |
| | | /** |
| | | * Retrieves a set of search reference plugin result instances. |
| | | * |
| | | * @return A set of search reference plugin result instances. |
| | | */ |
| | | @DataProvider(name = "instances") |
| | | public Object[][] getInstances() |
| | | { |
| | | return new Object[][] |
| | | { |
| | | new Object[] { SearchReferencePluginResult.SUCCESS }, |
| | | new Object[] { new SearchReferencePluginResult(false, false, false, |
| | | false) }, |
| | | new Object[] { new SearchReferencePluginResult(true, false, false, |
| | | false) }, |
| | | new Object[] { new SearchReferencePluginResult(false, true, false, |
| | | false) }, |
| | | new Object[] { new SearchReferencePluginResult(false, false, true, |
| | | false) }, |
| | | new Object[] { new SearchReferencePluginResult(false, false, false, |
| | | true) }, |
| | | new Object[] { new SearchReferencePluginResult(true, true, false, |
| | | false) }, |
| | | new Object[] { new SearchReferencePluginResult(true, false, true, |
| | | false) }, |
| | | new Object[] { new SearchReferencePluginResult(true, false, false, |
| | | true) }, |
| | | new Object[] { new SearchReferencePluginResult(false, true, true, |
| | | false) }, |
| | | new Object[] { new SearchReferencePluginResult(false, true, false, |
| | | true) }, |
| | | new Object[] { new SearchReferencePluginResult(false, false, true, |
| | | true) }, |
| | | new Object[] { new SearchReferencePluginResult(true, true, true, |
| | | false) }, |
| | | new Object[] { new SearchReferencePluginResult(true, true, false, |
| | | true) }, |
| | | new Object[] { new SearchReferencePluginResult(true, false, true, |
| | | true) }, |
| | | new Object[] { new SearchReferencePluginResult(false, true, true, |
| | | true) }, |
| | | new Object[] { new SearchReferencePluginResult(true, true, true, |
| | | true) } |
| | | }; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>connectionTerminated</CODE> method. |
| | | * |
| | | * @param result The result instance to test. |
| | | */ |
| | | @Test(dataProvider = "instances") |
| | | public void testConnectionTerminated(SearchReferencePluginResult result) |
| | | { |
| | | result.connectionTerminated(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>continuePluginProcessing</CODE> method. |
| | | * |
| | | * @param result The result instance to test. |
| | | */ |
| | | @Test(dataProvider = "instances") |
| | | public void testContinuePluginProcessing(SearchReferencePluginResult result) |
| | | { |
| | | result.continuePluginProcessing(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>sendReference</CODE> method. |
| | | * |
| | | * @param result The result instance to test. |
| | | */ |
| | | @Test(dataProvider = "instances") |
| | | public void testSendReference(SearchReferencePluginResult result) |
| | | { |
| | | result.sendReference(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>continueSearch</CODE> method. |
| | | * |
| | | * @param result The result instance to test. |
| | | */ |
| | | @Test(dataProvider = "instances") |
| | | public void testContinueSearch(SearchReferencePluginResult result) |
| | | { |
| | | result.continueSearch(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>toString</CODE> method. |
| | | * |
| | | * @param result The result instance to test. |
| | | */ |
| | | @Test(dataProvider = "instances") |
| | | public void testToString(SearchReferencePluginResult result) |
| | | { |
| | | assertNotNull(result.toString()); |
| | | } |
| | | } |
| | | |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying * information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2006 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.api.plugin; |
| | | |
| | | |
| | | |
| | | import org.testng.annotations.Test; |
| | | import org.testng.annotations.DataProvider; |
| | | |
| | | import static org.testng.Assert.*; |
| | | |
| | | |
| | | |
| | | /** |
| | | * A set of test cases for the startup plugin result type. |
| | | */ |
| | | public class StartupPluginResultTestCase |
| | | extends PluginAPITestCase |
| | | { |
| | | /** |
| | | * Retrieves a set of startup plugin result instances. |
| | | * |
| | | * @return A set of startup plugin result instances. |
| | | */ |
| | | @DataProvider(name = "instances") |
| | | public Object[][] getInstances() |
| | | { |
| | | return new Object[][] |
| | | { |
| | | new Object[] { StartupPluginResult.SUCCESS }, |
| | | new Object[] { new StartupPluginResult(false, false, 0, null) }, |
| | | new Object[] { new StartupPluginResult(true, false, 0, null) }, |
| | | new Object[] { new StartupPluginResult(false, true, 0, null) }, |
| | | new Object[] { new StartupPluginResult(true, true, 0, null) }, |
| | | new Object[] { new StartupPluginResult(false, false, 1, null) }, |
| | | new Object[] { new StartupPluginResult(true, false, 1, null) }, |
| | | new Object[] { new StartupPluginResult(false, true, 1, null) }, |
| | | new Object[] { new StartupPluginResult(true, true, 1, null) }, |
| | | new Object[] { new StartupPluginResult(false, false, 0, "foo") }, |
| | | new Object[] { new StartupPluginResult(true, false, 0, "foo") }, |
| | | new Object[] { new StartupPluginResult(false, true, 0, "foo") }, |
| | | new Object[] { new StartupPluginResult(true, true, 0, "foo") }, |
| | | new Object[] { new StartupPluginResult(false, false, 1, "foo") }, |
| | | new Object[] { new StartupPluginResult(true, false, 1, "foo") }, |
| | | new Object[] { new StartupPluginResult(false, true, 1, "foo") }, |
| | | new Object[] { new StartupPluginResult(true, true, 1, "foo") }, |
| | | }; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>completedSuccessfully</CODE> method. |
| | | * |
| | | * @param result The result instance to test. |
| | | */ |
| | | @Test(dataProvider = "instances") |
| | | public void testCompletedSuccessfully(StartupPluginResult result) |
| | | { |
| | | result.completedSuccessfully(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>continueStartup</CODE> method. |
| | | * |
| | | * @param result The result instance to test. |
| | | */ |
| | | @Test(dataProvider = "instances") |
| | | public void testContinueStartup(StartupPluginResult result) |
| | | { |
| | | result.continueStartup(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>getErrorID</CODE> method. |
| | | * |
| | | * @param result The result instance to test. |
| | | */ |
| | | @Test(dataProvider = "instances") |
| | | public void testGetErrorID(StartupPluginResult result) |
| | | { |
| | | result.getErrorID(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>getErrorMessage</CODE> method. |
| | | * |
| | | * @param result The result instance to test. |
| | | */ |
| | | @Test(dataProvider = "instances") |
| | | public void testGetErrorMessage(StartupPluginResult result) |
| | | { |
| | | result.getErrorMessage(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>toString</CODE> method. |
| | | * |
| | | * @param result The result instance to test. |
| | | */ |
| | | @Test(dataProvider = "instances") |
| | | public void testToString(StartupPluginResult result) |
| | | { |
| | | assertNotNull(result.toString()); |
| | | } |
| | | } |
| | | |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying * information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2006 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.plugins; |
| | | |
| | | |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | import org.opends.server.api.plugin.DirectoryServerPlugin; |
| | | import org.opends.server.api.plugin.PluginType; |
| | | import org.opends.server.api.plugin.PreOperationPluginResult; |
| | | import org.opends.server.config.ConfigEntry; |
| | | import org.opends.server.config.ConfigException; |
| | | import org.opends.server.protocols.asn1.ASN1Long; |
| | | import org.opends.server.protocols.asn1.ASN1OctetString; |
| | | import org.opends.server.protocols.ldap.LDAPControl; |
| | | import org.opends.server.types.Control; |
| | | import org.opends.server.types.ResultCode; |
| | | import org.opends.server.types.operation.*; |
| | | |
| | | |
| | | |
| | | /** |
| | | * This class defines a Directory Server plugin that doesn't do anything. It |
| | | * just passes through all non-abstract methods to the superclass |
| | | * implementation (which will throw exceptions for all plugin operations). |
| | | */ |
| | | public class NullPlugin |
| | | extends DirectoryServerPlugin |
| | | { |
| | | /** |
| | | * Creates a new instance of this Directory Server plugin. Every |
| | | * plugin must implement a default constructor (it is the only one |
| | | * that will be used to create plugins defined in the |
| | | * configuration), and every plugin constructor must call |
| | | * <CODE>super()</CODE> as its first element. |
| | | */ |
| | | public NullPlugin() |
| | | { |
| | | super(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override() |
| | | public void initializePlugin(Set<PluginType> pluginTypes, |
| | | ConfigEntry configEntry) |
| | | { |
| | | // No implementation required. |
| | | } |
| | | } |
| | | |