From 2434d746823cf70eece4fe2221ae2f3e2902bc1b Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Tue, 04 Nov 2014 11:00:49 +0000
Subject: [PATCH] OPENDJ-1545 Remove Workflow, NetworkGroups and related attempts at building a proxy
---
/dev/null | 131 -------------
opendj3-server-dev/src/server/org/opends/server/workflowelement/localbackend/LocalBackendWorkflowElement.java | 158 ++++++++++++++-
opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/core/WorkflowTopologyTest.java | 46 +---
opendj3-server-dev/src/server/org/opends/server/workflowelement/ObservableWorkflowElementState.java | 8
opendj3-server-dev/src/server/org/opends/server/core/WorkflowImpl.java | 135 ++++---------
opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/core/networkgroups/NetworkGroupTest.java | 27 --
opendj3-server-dev/src/server/org/opends/server/core/networkgroups/NetworkGroup.java | 81 --------
7 files changed, 212 insertions(+), 374 deletions(-)
diff --git a/opendj3-server-dev/src/server/org/opends/server/core/WorkflowImpl.java b/opendj3-server-dev/src/server/org/opends/server/core/WorkflowImpl.java
index 9ed429e..6d06bc4 100644
--- a/opendj3-server-dev/src/server/org/opends/server/core/WorkflowImpl.java
+++ b/opendj3-server-dev/src/server/org/opends/server/core/WorkflowImpl.java
@@ -26,7 +26,6 @@
*/
package org.opends.server.core;
-import java.util.Collection;
import java.util.Observable;
import java.util.Observer;
import java.util.TreeMap;
@@ -38,7 +37,7 @@
import org.opends.server.types.DirectoryException;
import org.opends.server.types.Operation;
import org.opends.server.workflowelement.ObservableWorkflowElementState;
-import org.opends.server.workflowelement.WorkflowElement;
+import org.opends.server.workflowelement.localbackend.LocalBackendWorkflowElement;
import static org.forgerock.util.Reject.*;
import static org.opends.messages.CoreMessages.*;
@@ -54,43 +53,46 @@
*/
public class WorkflowImpl implements Workflow, Observer
{
- // The workflow identifier used by the configuration.
+ /** The workflow identifier used by the configuration. */
private final String workflowID;
- // The root of the workflow task tree.
- private WorkflowElement rootWorkflowElement = null;
+ /** The root of the workflow task tree. */
+ private LocalBackendWorkflowElement rootWorkflowElement;
- // The root workflow element identifier.
- private String rootWorkflowElementID = null;
+ /** The root workflow element identifier. */
+ private final String rootWorkflowElementID;
- // The base DN of the data handled by the workflow.
+ /** The base DN of the data handled by the workflow. */
private final DN baseDN;
- // Flag indicating whether the workflow root node of the task tree is
- // handling a private local backend.
- //
- // A private local backend is used by the server to store "private data"
- // such as schemas, tasks, monitoring data, configuration data... Such
- // private data are not returned upon a subtree search on the root DSE.
- // Also it is not planned to have anything but a single node task tree
- // to handle private local backend. So workflows used for proxy and
- // virtual will always be made public (ie. not private). So, unless the
- // rootWorkflowElement is handling a private local backend, the isPrivate
- // flag will always return false.
- private boolean isPrivate = false;
+ /**
+ * Flag indicating whether the workflow root node of the task tree is
+ * handling a private local backend.
+ * A private local backend is used by the server to store "private data"
+ * such as schemas, tasks, monitoring data, configuration data... Such
+ * private data are not returned upon a subtree search on the root DSE.
+ * Also it is not planned to have anything but a single node task tree
+ * to handle private local backend. So workflows used for proxy and
+ * virtual will always be made public (ie. not private). So, unless the
+ * rootWorkflowElement is handling a private local backend, the isPrivate
+ * flag will always return false.
+ */
+ private final boolean isPrivate;
- // The set of workflows registered with the server.
+ /** The set of workflows registered with the server. */
private static TreeMap<String, Workflow> registeredWorkflows =
new TreeMap<String, Workflow>();
- // A lock to protect concurrent access to the registeredWorkflows.
- private static Object registeredWorkflowsLock = new Object();
+ /** A lock to protect concurrent access to the registeredWorkflows. */
+ private final static Object registeredWorkflowsLock = new Object();
- // A reference counter used to count the number of workflow nodes that
- // were registered with a network group. A workflow can be disabled or
- // deleted only when its reference counter value is 0.
- private int referenceCounter = 0;
- private Object referenceCounterLock = new Object();
+ /**
+ * A reference counter used to count the number of workflow nodes that
+ * were registered with a network group. A workflow can be disabled or
+ * deleted only when its reference counter value is 0.
+ */
+ private int referenceCounter;
+ private final Object referenceCounterLock = new Object();
/**
@@ -109,7 +111,7 @@
String workflowId,
DN baseDN,
String rootWorkflowElementID,
- WorkflowElement rootWorkflowElement
+ LocalBackendWorkflowElement rootWorkflowElement
)
{
this.workflowID = workflowId;
@@ -122,31 +124,20 @@
// The workflow wants to be notified when the workflow element state
// is changing from enabled to disabled and vice versa.
- WorkflowElement.registereForStateUpdate(
- rootWorkflowElement, null, this);
+ LocalBackendWorkflowElement.registerForStateUpdate(rootWorkflowElement, null, this);
}
else
{
+ this.isPrivate = false;
+ this.rootWorkflowElementID = null;
+
// The root workflow element has not been loaded, let's register
// the workflow with the list of objects that want to be notify
// when the workflow element is created.
- WorkflowElement.registereForStateUpdate(
- null, rootWorkflowElementID, this);
+ LocalBackendWorkflowElement.registerForStateUpdate(null, rootWorkflowElementID, this);
}
}
-
- /**
- * Performs any finalization that might be required when this
- * workflow is unloaded. No action is taken in the default
- * implementation.
- */
- public void finalizeWorkflow()
- {
- // No action is required by default.
- }
-
-
/**
* Gets the base DN of the data set being handled by the workflow.
*
@@ -250,8 +241,7 @@
// Deregister the workflow with the list of objects to notify when
// a workflow element is created or deleted.
- WorkflowElement.deregisterForStateUpdate(
- null, rootWorkflowElementID, this);
+ LocalBackendWorkflowElement.deregisterForStateUpdate(null, rootWorkflowElementID, this);
// Deregister the workflow with the list of registered workflows.
synchronized (registeredWorkflowsLock)
@@ -265,33 +255,6 @@
/**
- * Deregisters a workflow with the server. The workflow to deregister
- * is identified with its identifier.
- *
- * @param workflowID the identifier of the workflow to deregister
- *
- * @return the workflow that has been deregistered,
- * <code>null</code> if no workflow has been found.
- */
- public WorkflowImpl deregister(String workflowID)
- {
- WorkflowImpl workflowToDeregister = null;
-
- synchronized (registeredWorkflowsLock)
- {
- if (registeredWorkflows.containsKey(workflowID))
- {
- workflowToDeregister =
- (WorkflowImpl) registeredWorkflows.get(workflowID);
- workflowToDeregister.deregister();
- }
- }
-
- return workflowToDeregister;
- }
-
-
- /**
* Deregisters all Workflows that have been registered. This should be
* called when the server is shutting down.
*/
@@ -317,31 +280,17 @@
return registeredWorkflows.get(workflowID);
}
-
- /**
- * Gets all the workflows that were registered with the server.
- *
- * @return the list of registered workflows
- */
- public static Collection<Workflow> getWorkflows()
- {
- return registeredWorkflows.values();
- }
-
-
/**
* Gets the root workflow element for test purpose only.
*
* @return the root workflow element.
*/
- WorkflowElement getRootWorkflowElement()
+ LocalBackendWorkflowElement getRootWorkflowElement()
{
return rootWorkflowElement;
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
@Override
public void update(Observable observable, Object arg)
{
@@ -387,7 +336,7 @@
{
// Check that the workflow element maps the root workflow element.
// If not then ignore the workflow element.
- WorkflowElement we = weState.getObservedWorkflowElement();
+ LocalBackendWorkflowElement we = weState.getObservedWorkflowElement();
String newWorkflowElementID = we.getWorkflowElementID();
if (! rootWorkflowElementID.equalsIgnoreCase(newWorkflowElementID))
{
@@ -398,8 +347,8 @@
// don't forget to register the workflow with the list of objects to notify
// when the root workflow element is disabled...
rootWorkflowElement = weState.getObservedWorkflowElement();
- WorkflowElement.registereForStateUpdate(rootWorkflowElement, null, this);
- WorkflowElement.deregisterForStateUpdate(null, rootWorkflowElementID, this);
+ LocalBackendWorkflowElement.registerForStateUpdate(rootWorkflowElement, null, this);
+ LocalBackendWorkflowElement.deregisterForStateUpdate(null, rootWorkflowElementID, this);
}
diff --git a/opendj3-server-dev/src/server/org/opends/server/core/networkgroups/ANDConnectionCriteria.java b/opendj3-server-dev/src/server/org/opends/server/core/networkgroups/ANDConnectionCriteria.java
deleted file mode 100644
index 19b19f3..0000000
--- a/opendj3-server-dev/src/server/org/opends/server/core/networkgroups/ANDConnectionCriteria.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * 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 legal-notices/CDDLv1_0.txt
- * or http://forgerock.org/license/CDDLv1.0.html.
- * 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 legal-notices/CDDLv1_0.txt.
- * 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
- *
- *
- * Copyright 2009 Sun Microsystems, Inc.
- */
-package org.opends.server.core.networkgroups;
-
-
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import org.opends.server.api.ClientConnection;
-import org.opends.server.types.AuthenticationType;
-import org.opends.server.types.DN;
-
-
-
-/**
- * A connection criteria which matches connections if and only if all
- * the sub-criteria match. If there are no sub-criteria then the
- * connection criteria will always match.
- */
-final class ANDConnectionCriteria implements ConnectionCriteria
-{
-
- // The list of underlying connection criteria.
- private final List<ConnectionCriteria> subCriteria;
-
-
-
- /**
- * Creates a new AND connection criteria using the provided
- * sub-criteria.
- *
- * @param subCriteria
- * The sub-criteria.
- */
- public ANDConnectionCriteria(
- Collection<? extends ConnectionCriteria> subCriteria)
- {
- this.subCriteria = new ArrayList<ConnectionCriteria>(subCriteria);
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public boolean matches(ClientConnection connection)
- {
- for (ConnectionCriteria filter : subCriteria)
- {
- if (!filter.matches(connection))
- {
- return false;
- }
- }
-
- return true;
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public boolean willMatchAfterBind(ClientConnection connection,
- DN bindDN, AuthenticationType authType, boolean isSecure)
- {
- for (ConnectionCriteria filter : subCriteria)
- {
- if (!filter.willMatchAfterBind(connection, bindDN, authType,
- isSecure))
- {
- return false;
- }
- }
-
- return true;
- }
-}
diff --git a/opendj3-server-dev/src/server/org/opends/server/core/networkgroups/BindDNConnectionCriteria.java b/opendj3-server-dev/src/server/org/opends/server/core/networkgroups/BindDNConnectionCriteria.java
deleted file mode 100644
index 74d51cf..0000000
--- a/opendj3-server-dev/src/server/org/opends/server/core/networkgroups/BindDNConnectionCriteria.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * 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 legal-notices/CDDLv1_0.txt
- * or http://forgerock.org/license/CDDLv1.0.html.
- * 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 legal-notices/CDDLv1_0.txt.
- * 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
- *
- *
- * Copyright 2009 Sun Microsystems, Inc.
- * Portions copyright 2014 ForgeRock AS.
- */
-package org.opends.server.core.networkgroups;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import org.opends.server.api.ClientConnection;
-import org.opends.server.authorization.dseecompat.PatternDN;
-import org.opends.server.types.AuthenticationType;
-import org.opends.server.types.DN;
-import org.opends.server.types.DirectoryException;
-
-/**
- * A connection criteria which matches connections authenticated using a
- * permitted bind DN.
- */
-final class BindDNConnectionCriteria implements ConnectionCriteria
-{
-
- /**
- * Creates a new bind DN connection criteria using the provided DN
- * pattern string representations.
- *
- * @param patternStrings
- * The string representation of the DN patterns.
- * @return The new bind DN connection criteria.
- * @throws DirectoryException
- * If one of the pattern strings is not valid.
- */
- public static BindDNConnectionCriteria decode(
- Collection<String> patternStrings) throws DirectoryException
- {
- List<PatternDN> patterns =
- new ArrayList<PatternDN>(patternStrings.size());
-
- for (String s : patternStrings)
- {
- patterns.add(PatternDN.decode(s));
- }
-
- return new BindDNConnectionCriteria(patterns);
- }
-
-
-
- // The list of permitted bind DN patterns.
- private final List<PatternDN> patterns;
-
-
-
- /**
- * Creates a new bind DN connection criteria using the provided DN patterns.
- *
- * @param patterns
- * The DN patterns.
- */
- BindDNConnectionCriteria(List<PatternDN> patterns)
- {
- this.patterns = patterns;
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean matches(ClientConnection connection)
- {
- DN dn = connection.getAuthenticationInfo().getAuthenticationDN();
- return willMatchAfterBind(connection, dn, null, false);
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean willMatchAfterBind(ClientConnection connection,
- DN bindDN, AuthenticationType authType, boolean isSecure)
- {
- if (bindDN == null)
- {
- return false;
- }
-
- for (PatternDN pattern : patterns)
- {
- if (pattern.matchesDN(bindDN))
- {
- return true;
- }
- }
-
- return false;
- }
-}
diff --git a/opendj3-server-dev/src/server/org/opends/server/core/networkgroups/ConnectionCriteria.java b/opendj3-server-dev/src/server/org/opends/server/core/networkgroups/ConnectionCriteria.java
deleted file mode 100644
index bdfd186..0000000
--- a/opendj3-server-dev/src/server/org/opends/server/core/networkgroups/ConnectionCriteria.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * 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 legal-notices/CDDLv1_0.txt
- * or http://forgerock.org/license/CDDLv1.0.html.
- * 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 legal-notices/CDDLv1_0.txt.
- * 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
- *
- *
- * Copyright 2008-2009 Sun Microsystems, Inc.
- */
-package org.opends.server.core.networkgroups;
-
-
-
-import org.opends.server.api.ClientConnection;
-import org.opends.server.types.AuthenticationType;
-import org.opends.server.types.DN;
-
-
-
-/**
- * An interface for filtering connections based on implementation
- * specific criteria. Connection criteria are used by network groups to
- * determine whether a client connection should be associated with a
- * network group or not.
- */
-interface ConnectionCriteria
-{
-
- /**
- * A connection criteria which does not match any connections.
- */
- public static final ConnectionCriteria FALSE =
- new ConnectionCriteria()
- {
-
- /**
- * {@inheritDoc}
- */
- public boolean matches(ClientConnection connection)
- {
- return false;
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public boolean willMatchAfterBind(
- ClientConnection connection, DN bindDN,
- AuthenticationType authType, boolean isSecure)
- {
- return false;
- }
-
- };
-
- /**
- * A connection criteria which matches all connections.
- */
- public static final ConnectionCriteria TRUE =
- new ConnectionCriteria()
- {
-
- /**
- * {@inheritDoc}
- */
- public boolean matches(ClientConnection connection)
- {
- return true;
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public boolean willMatchAfterBind(
- ClientConnection connection, DN bindDN,
- AuthenticationType authType, boolean isSecure)
- {
- return true;
- }
-
- };
-
-
-
- /**
- * Indicates whether or not the provided client connection matches
- * this connection criteria.
- *
- * @param connection
- * The client connection.
- * @return <code>true</code> if the provided client connection matches
- * this connection criteria.
- */
- boolean matches(ClientConnection connection);
-
-
-
- /**
- * Indicates whether or not the provided client connection will match
- * this connection criteria using the provided authentication
- * parameters.
- *
- * @param connection
- * The client connection.
- * @param bindDN
- * The bind DN which will be used to authenticate.
- * @param authType
- * The type of authentication which will be performed.
- * @param isSecure
- * <code>true</code> if the connection will be secured.
- * @return <code>true</code> if the provided client connection will
- * match this connection criteria using the provided
- * authentication parameters.
- */
- boolean willMatchAfterBind(ClientConnection connection, DN bindDN,
- AuthenticationType authType, boolean isSecure);
-
-}
diff --git a/opendj3-server-dev/src/server/org/opends/server/core/networkgroups/IPConnectionCriteria.java b/opendj3-server-dev/src/server/org/opends/server/core/networkgroups/IPConnectionCriteria.java
deleted file mode 100644
index ee2aedf..0000000
--- a/opendj3-server-dev/src/server/org/opends/server/core/networkgroups/IPConnectionCriteria.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * 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 legal-notices/CDDLv1_0.txt
- * or http://forgerock.org/license/CDDLv1.0.html.
- * 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 legal-notices/CDDLv1_0.txt.
- * 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
- *
- *
- * Copyright 2009 Sun Microsystems, Inc.
- * Portions copyright 2011-2013 ForgeRock AS.
- */
-package org.opends.server.core.networkgroups;
-
-
-
-import java.net.InetAddress;
-import java.util.Collection;
-
-import org.forgerock.opendj.ldap.AddressMask;
-import org.opends.server.api.ClientConnection;
-import org.opends.server.types.AuthenticationType;
-import org.opends.server.types.DN;
-
-
-
-/**
- * A connection criteria which matches connections coming from a allowed
- * client address.
- */
-final class IPConnectionCriteria implements ConnectionCriteria
-{
-
- /** The collection of allowed client address masks. */
- private final Collection<AddressMask> allowedClients;
-
- /** The collection of denied client address masks. */
- private final Collection<AddressMask> deniedClients;
-
-
-
- /**
- * Creates a new IP connection criteria using the provided allowed and
- * denied address masks.
- *
- * @param allowedClients
- * The list of allowed client address masks.
- * @param deniedClients
- * The list of denied client address masks.
- */
- public IPConnectionCriteria(Collection<AddressMask> allowedClients,
- Collection<AddressMask> deniedClients)
- {
- this.allowedClients = allowedClients;
- this.deniedClients = deniedClients;
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public boolean matches(ClientConnection connection)
- {
- InetAddress ipAddr = connection.getRemoteAddress();
-
- if (!deniedClients.isEmpty()
- && AddressMask.matchesAny(deniedClients, ipAddr))
- {
- return false;
- }
-
- if (!allowedClients.isEmpty()
- && !AddressMask.matchesAny(allowedClients, ipAddr))
- {
- return false;
- }
-
- return true;
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public boolean willMatchAfterBind(ClientConnection connection,
- DN bindDN, AuthenticationType authType, boolean isSecure)
- {
- return matches(connection);
- }
-}
diff --git a/opendj3-server-dev/src/server/org/opends/server/core/networkgroups/NetworkGroup.java b/opendj3-server-dev/src/server/org/opends/server/core/networkgroups/NetworkGroup.java
index 67ebf5b..1bd6ea9 100644
--- a/opendj3-server-dev/src/server/org/opends/server/core/networkgroups/NetworkGroup.java
+++ b/opendj3-server-dev/src/server/org/opends/server/core/networkgroups/NetworkGroup.java
@@ -39,7 +39,6 @@
import org.opends.server.core.Workflow;
import org.opends.server.core.WorkflowImpl;
import org.opends.server.core.WorkflowTopologyNode;
-import org.opends.server.types.AuthenticationType;
import org.opends.server.types.DN;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.InitializationException;
@@ -125,29 +124,6 @@
}
}
-
- /**
- * Gets the highest priority matching network group.
- *
- * @param connection
- * the client connection
- * @return matching network group
- */
- static NetworkGroup findMatchingNetworkGroup(
- ClientConnection connection)
- {
- for (NetworkGroup ng : orderedNetworkGroups)
- {
- if (ng.match(connection))
- {
- return ng;
- }
- }
- return defaultNetworkGroup;
- }
-
-
-
/**
* Returns the admin network group.
*
@@ -200,9 +176,6 @@
return registeredNetworkGroups.get(networkGroupID);
}
- // The network group connection criteria.
- private final ConnectionCriteria criteria = ConnectionCriteria.TRUE;
-
private final boolean isAdminNetworkGroup;
private final boolean isDefaultNetworkGroup;
private final boolean isInternalNetworkGroup;
@@ -744,60 +717,6 @@
registeredWorkflowNodes = null;
}
-
-
- /**
- * Checks whether the connection matches the network group criteria.
- *
- * @param connection
- * the client connection
- * @return a boolean indicating the match
- */
- private boolean match(ClientConnection connection)
- {
- if (criteria != null)
- {
- return criteria.matches(connection);
- }
- else
- {
- return true;
- }
- }
-
-
-
- /**
- * Checks whether the client connection matches the criteria after
- * bind.
- *
- * @param connection
- * the ClientConnection
- * @param bindDN
- * the DN used to bind
- * @param authType
- * the authentication type
- * @param isSecure
- * a boolean indicating whether the connection is secure
- * @return a boolean indicating whether the connection matches the
- * criteria
- */
- private boolean matchAfterBind(ClientConnection connection,
- DN bindDN, AuthenticationType authType, boolean isSecure)
- {
- if (criteria != null)
- {
- return criteria.willMatchAfterBind(connection, bindDN, authType,
- isSecure);
- }
- else
- {
- return true;
- }
- }
-
-
-
/**
* Rebuilds the list of naming contexts handled by the network group.
* This operation should be performed whenever a workflow topology has
diff --git a/opendj3-server-dev/src/server/org/opends/server/core/networkgroups/SecurityConnectionCriteria.java b/opendj3-server-dev/src/server/org/opends/server/core/networkgroups/SecurityConnectionCriteria.java
deleted file mode 100644
index 512395c..0000000
--- a/opendj3-server-dev/src/server/org/opends/server/core/networkgroups/SecurityConnectionCriteria.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * 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 legal-notices/CDDLv1_0.txt
- * or http://forgerock.org/license/CDDLv1.0.html.
- * 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 legal-notices/CDDLv1_0.txt.
- * 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
- *
- *
- * Copyright 2009 Sun Microsystems, Inc.
- */
-package org.opends.server.core.networkgroups;
-
-
-
-import org.opends.server.api.ClientConnection;
-import org.opends.server.types.AuthenticationType;
-import org.opends.server.types.DN;
-
-
-
-/**
- * A connection criteria which matches connections which are secured
- * using SSL or TLS.
- */
-final class SecurityConnectionCriteria implements ConnectionCriteria
-{
-
- /**
- * A connection criteria which does not require a secured connection.
- */
- public static final SecurityConnectionCriteria SECURITY_NOT_REQUIRED =
- new SecurityConnectionCriteria(false);
-
- /**
- * A connection criteria which requires a secured connection.
- */
- public static final SecurityConnectionCriteria SECURITY_REQUIRED =
- new SecurityConnectionCriteria(true);
-
- // Indicates whether or not the connection must be secured.
- private final boolean mustBeSecured;
-
-
-
- /**
- * Creates a new security connection criteria.
- *
- * @param mustBeSecured
- * Indicates whether or not the connection must be secured.
- */
- private SecurityConnectionCriteria(boolean mustBeSecured)
- {
- this.mustBeSecured = mustBeSecured;
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public boolean matches(ClientConnection connection)
- {
- return willMatchAfterBind(null, null, null, connection.isSecure());
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public boolean willMatchAfterBind(ClientConnection connection,
- DN bindDN, AuthenticationType authType, boolean isSecure)
- {
- if (mustBeSecured)
- {
- return isSecure;
- }
- else
- {
- return true;
- }
- }
-}
diff --git a/opendj3-server-dev/src/server/org/opends/server/workflowelement/ObservableWorkflowElementState.java b/opendj3-server-dev/src/server/org/opends/server/workflowelement/ObservableWorkflowElementState.java
index aa9114f..2d88c52 100644
--- a/opendj3-server-dev/src/server/org/opends/server/workflowelement/ObservableWorkflowElementState.java
+++ b/opendj3-server-dev/src/server/org/opends/server/workflowelement/ObservableWorkflowElementState.java
@@ -28,6 +28,8 @@
import java.util.Observable;
+import org.opends.server.workflowelement.localbackend.LocalBackendWorkflowElement;
+
/**
* This class implements an observable workflow element state.
* The observable workflow element state notifies observers when the
@@ -36,7 +38,7 @@
*/
public class ObservableWorkflowElementState extends Observable
{
- private final WorkflowElement observedWorkflowElement;
+ private final LocalBackendWorkflowElement observedWorkflowElement;
/**
* Creates an instance of an observable object for a given workflow
@@ -45,7 +47,7 @@
* @param observedWorkflowElement
* The workflow element to observe.
*/
- ObservableWorkflowElementState(WorkflowElement observedWorkflowElement)
+ public ObservableWorkflowElementState(LocalBackendWorkflowElement observedWorkflowElement)
{
this.observedWorkflowElement = observedWorkflowElement;
}
@@ -55,7 +57,7 @@
*
* @return the observed workflow element.
*/
- public WorkflowElement getObservedWorkflowElement()
+ public LocalBackendWorkflowElement getObservedWorkflowElement()
{
return observedWorkflowElement;
}
diff --git a/opendj3-server-dev/src/server/org/opends/server/workflowelement/WorkflowElement.java b/opendj3-server-dev/src/server/org/opends/server/workflowelement/WorkflowElement.java
deleted file mode 100644
index 5a8aae9..0000000
--- a/opendj3-server-dev/src/server/org/opends/server/workflowelement/WorkflowElement.java
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- * 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 legal-notices/CDDLv1_0.txt
- * or http://forgerock.org/license/CDDLv1.0.html.
- * 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 legal-notices/CDDLv1_0.txt.
- * 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
- *
- *
- * Copyright 2008-2010 Sun Microsystems, Inc.
- * Portions copyright 2013-2014 ForgeRock AS.
- */
-package org.opends.server.workflowelement;
-
-import java.util.List;
-import java.util.Observable;
-import java.util.Observer;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-import org.opends.server.types.CanceledOperationException;
-import org.opends.server.types.Operation;
-
-/**
- * This class defines the super class for all the workflow elements. A workflow
- * element is a task in a workflow. A workflow element can wrap a physical
- * repository such as a local backend, a remote LDAP server or a local LDIF
- * file. A workflow element can also be used to route operations. This is the
- * case for load balancing and distribution. And workflow element can be used
- * in a virtual environment to transform data (DN and attribute renaming,
- * attribute value renaming...).
- */
-public abstract class WorkflowElement implements Observer
-{
-
- /** The observable state of the workflow element. */
- private ObservableWorkflowElementState observableState =
- new ObservableWorkflowElementState(this);
-
-
- /**
- * The list of observers who want to be notified when a workflow element
- * required by the observer is created. The key of the map is a string that
- * identifies the newly created workflow element.
- */
- private static ConcurrentMap<String, List<Observer>>
- newWorkflowElementNotificationList =
- new ConcurrentHashMap<String, List<Observer>>();
-
- /**
- * Provides the observable state of the workflow element.
- * This method is intended to be called by the WorkflowElementConfigManager
- * that wants to notify observers that the workflow element state has
- * changed (in particular when a workflow element has been disabled).
- *
- * @return the observable state of the workflow element
- */
- protected final ObservableWorkflowElementState getObservableState()
- {
- return observableState;
- }
-
- /**
- * Registers with a specific workflow element to be notified when the
- * workflow element state has changed. This notification system is
- * mainly used to be warned when a workflow element is enabled or
- * disabled.
- * <p>
- * If the workflow element <code>we</code> is not <code>null</code>
- * then the <code>observer</code> is registered with the list of objects
- * to notify when <code>we</code> has changed.
- * <p>
- * If the workflow element <code>we</code> is <code>null</code> then
- * the <code>observer</code> is registered with a static list of objects
- * to notify when a workflow element named <code>weid</code> is created.
- *
- * @param we the workflow element. If <code>null</code> then observer
- * is registered with a list of workflow element
- * identifiers.
- * @param weid the identifier of the workflow element. This parameter
- * is useless when <code>we</code> is not <code>null</code>
- * @param observer the observer to notify when the workflow element state
- * has been modified
- */
- public static void registereForStateUpdate(WorkflowElement we, String weid, Observer observer)
- {
- // If the workflow element "we" exists then register the observer with "we"
- // else register the observer with a static list of workflow element
- // identifiers
- if (we != null)
- {
- ObservableWorkflowElementState westate = we.getObservableState();
- westate.addObserver(observer);
- }
- else
- {
- if (weid == null)
- {
- return;
- }
-
- List<Observer> observers = newWorkflowElementNotificationList.get(weid);
- if (observers == null)
- {
- // create the list of observers
- observers = new CopyOnWriteArrayList<Observer>();
- observers.add(observer);
- newWorkflowElementNotificationList.put(weid, observers);
- }
- else
- {
- // update the observer list
- observers.add(observer);
- }
- }
- }
-
-
- /**
- * Deregisters an observer that was registered with a specific workflow
- * element.
- * <p>
- * If the workflow element <code>we</code> is not <code>null</code>
- * then the <code>observer</code> is deregistered with the list of objects
- * to notify when <code>we</code> has changed.
- * <p>
- * If the workflow element <code>we</code> is <code>null</code> then
- * the <code>observer</code> is deregistered with a static list of objects
- * to notify when a workflow element named <code>weid</code> is created.
- *
- * @param we the workflow element. If <code>null</code> then observer
- * is deregistered with a list of workflow element
- * identifiers.
- * @param weid the identifier of the workflow element. This parameter
- * is useless when <code>we</code> is not <code>null</code>
- * @param observer the observer to deregister
- */
- public static void deregisterForStateUpdate(WorkflowElement we, String weid, Observer observer)
- {
- // If the workflow element "we" exists then deregister the observer
- // with "we" else deregister the observer with a static list of
- // workflow element identifiers
- if (we != null)
- {
- we.getObservableState().deleteObserver(observer);
- }
-
- if (weid != null)
- {
- List<Observer> observers = newWorkflowElementNotificationList.get(weid);
- if (observers != null)
- {
- observers.remove(observer);
- }
- }
- }
-
- /** {@inheritDoc} */
- @Override
- public final void update(Observable o, Object arg)
- {
- // By default, do nothing when notification hits the workflow element.
- }
-
- /**
- * Performs any finalization that might be required when this
- * workflow element is unloaded. No action is taken in the default
- * implementation.
- */
- public abstract void finalizeWorkflowElement();
-
- /**
- * Executes the workflow element for an operation.
- *
- * @param operation the operation to execute
- *
- * @throws CanceledOperationException if this operation should be
- * canceled
- */
- public abstract void execute(Operation operation)
- throws CanceledOperationException;
-
-
- /**
- * Indicates whether the workflow element encapsulates a private
- * local backend.
- *
- * @return <code>true</code> if the workflow element encapsulates a private
- * local backend, <code>false</code> otherwise
- */
- public abstract boolean isPrivate();
-
- /**
- * Provides the workflow element identifier.
- *
- * @return the workflow element identifier
- */
- public abstract String getWorkflowElementID();
-}
diff --git a/opendj3-server-dev/src/server/org/opends/server/workflowelement/localbackend/LocalBackendWorkflowElement.java b/opendj3-server-dev/src/server/org/opends/server/workflowelement/localbackend/LocalBackendWorkflowElement.java
index 2ef9bf3..2159b42 100644
--- a/opendj3-server-dev/src/server/org/opends/server/workflowelement/localbackend/LocalBackendWorkflowElement.java
+++ b/opendj3-server-dev/src/server/org/opends/server/workflowelement/localbackend/LocalBackendWorkflowElement.java
@@ -29,7 +29,12 @@
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+import java.util.Observable;
+import java.util.Observer;
import java.util.TreeMap;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.CopyOnWriteArrayList;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.LocalizableMessageDescriptor;
@@ -42,15 +47,26 @@
import org.opends.server.controls.LDAPPreReadResponseControl;
import org.opends.server.core.*;
import org.opends.server.types.*;
-import org.opends.server.workflowelement.WorkflowElement;
+import org.opends.server.workflowelement.ObservableWorkflowElementState;
import static org.opends.messages.CoreMessages.*;
/**
+ * This class defines a workflow element, i.e. a task in a workflow.
+ *
+ * [outdated]
+ * A workflow element can wrap a physical
+ * repository such as a local backend, a remote LDAP server or a local LDIF
+ * file. A workflow element can also be used to route operations.
+ * This is the case for load balancing and distribution.
+ * And workflow element can be used in a virtual environment to transform data
+ * (DN and attribute renaming, attribute value renaming...).
+ * [/outdated]
+ *
* This class defines a local backend workflow element; e-g an entity that
* handle the processing of an operation against a local backend.
*/
-public class LocalBackendWorkflowElement extends WorkflowElement
+public class LocalBackendWorkflowElement implements Observer
{
private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
@@ -82,14 +98,120 @@
private static final String BACKEND_WORKFLOW_ELEMENT = "Backend";
+ /** The observable state of the workflow element. */
+ private ObservableWorkflowElementState observableState = new ObservableWorkflowElementState(this);
+
/**
- * Creates a new instance of the local backend workflow element.
+ * The list of observers who want to be notified when a workflow element
+ * required by the observer is created. The key of the map is a string that
+ * identifies the newly created workflow element.
*/
- public LocalBackendWorkflowElement()
+ private static ConcurrentMap<String, List<Observer>> newWorkflowElementNotificationList =
+ new ConcurrentHashMap<String, List<Observer>>();
+
+ /**
+ * Registers with a specific workflow element to be notified when the workflow
+ * element state has changed. This notification system is mainly used to be
+ * warned when a workflow element is enabled or disabled.
+ * <p>
+ * If the workflow element <code>we</code> is not <code>null</code> then the
+ * <code>observer</code> is registered with the list of objects to notify when
+ * <code>we</code> has changed.
+ * <p>
+ * If the workflow element <code>we</code> is <code>null</code> then the
+ * <code>observer</code> is registered with a static list of objects to notify
+ * when a workflow element named <code>weid</code> is created.
+ *
+ * @param we
+ * the workflow element. If <code>null</code> then observer is
+ * registered with a list of workflow element identifiers.
+ * @param weid
+ * the identifier of the workflow element. This parameter is useless
+ * when <code>we</code> is not <code>null</code>
+ * @param observer
+ * the observer to notify when the workflow element state has been
+ * modified
+ */
+ // TODO JNR rename
+ public static void registerForStateUpdate(LocalBackendWorkflowElement we, String weid, Observer observer)
{
- // There is nothing to do in this constructor.
+ // If the workflow element "we" exists then register the observer with "we"
+ // else register the observer with a static list of workflow element
+ // identifiers
+ if (we != null)
+ {
+ we.observableState.addObserver(observer);
+ }
+ else
+ {
+ if (weid == null)
+ {
+ return;
+ }
+
+ List<Observer> observers = newWorkflowElementNotificationList.get(weid);
+ if (observers == null)
+ {
+ // create the list of observers
+ observers = new CopyOnWriteArrayList<Observer>();
+ observers.add(observer);
+ newWorkflowElementNotificationList.put(weid, observers);
+ }
+ else
+ {
+ // update the observer list
+ observers.add(observer);
+ }
+ }
}
+ /**
+ * Deregisters an observer that was registered with a specific workflow
+ * element.
+ * <p>
+ * If the workflow element <code>we</code> is not <code>null</code> then the
+ * <code>observer</code> is deregistered with the list of objects to notify
+ * when <code>we</code> has changed.
+ * <p>
+ * If the workflow element <code>we</code> is <code>null</code> then the
+ * <code>observer</code> is deregistered with a static list of objects to
+ * notify when a workflow element named <code>weid</code> is created.
+ *
+ * @param we
+ * the workflow element. If <code>null</code> then observer is
+ * deregistered with a list of workflow element identifiers.
+ * @param weid
+ * the identifier of the workflow element. This parameter is useless
+ * when <code>we</code> is not <code>null</code>
+ * @param observer
+ * the observer to deregister
+ */
+ public static void deregisterForStateUpdate(LocalBackendWorkflowElement we, String weid, Observer observer)
+ {
+ // If the workflow element "we" exists then deregister the observer
+ // with "we" else deregister the observer with a static list of
+ // workflow element identifiers
+ if (we != null)
+ {
+ we.observableState.deleteObserver(observer);
+ }
+
+ if (weid != null)
+ {
+ List<Observer> observers = newWorkflowElementNotificationList.get(weid);
+ if (observers != null)
+ {
+ observers.remove(observer);
+ }
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public final void update(Observable o, Object arg)
+ {
+ // By default, do nothing when notification hits the workflow element.
+ }
/**
* Initializes a new instance of the local backend workflow element.
@@ -108,15 +230,22 @@
this.backend = backend;
}
- /** {@inheritDoc} */
- @Override
+ /**
+ * Indicates whether the workflow element encapsulates a private local
+ * backend.
+ *
+ * @return <code>true</code> if the workflow element encapsulates a private
+ * local backend, <code>false</code> otherwise
+ */
public boolean isPrivate()
{
return this.backend != null && this.backend.isPrivateBackend();
}
- /** {@inheritDoc} */
- @Override
+ /**
+ * Performs any finalization that might be required when this workflow element
+ * is unloaded. No action is taken in the default implementation.
+ */
public void finalizeWorkflowElement()
{
// null all fields so that any use of the finalized object will raise a NPE
@@ -521,8 +650,14 @@
}
}
- /** {@inheritDoc} */
- @Override
+ /**
+ * Executes the workflow element for an operation.
+ *
+ * @param operation
+ * the operation to execute
+ * @throws CanceledOperationException
+ * if this operation should be canceled
+ */
public void execute(Operation operation) throws CanceledOperationException {
switch (operation.getOperationType())
{
@@ -617,7 +752,6 @@
*
* @return the workflow element identifier
*/
- @Override
public String getWorkflowElementID()
{
return workflowElementID;
diff --git a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/core/WorkflowTopologyTest.java b/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/core/WorkflowTopologyTest.java
index edab473..898d4c6 100644
--- a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/core/WorkflowTopologyTest.java
+++ b/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/core/WorkflowTopologyTest.java
@@ -35,7 +35,6 @@
import org.opends.server.types.DirectoryException;
import org.opends.server.util.StaticUtils;
import org.opends.server.util.UtilTestCase;
-import org.opends.server.workflowelement.WorkflowElement;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@@ -352,7 +351,6 @@
* result code.
*
* @return set of result codes to test
- * @throws Exception
*/
@DataProvider(name = "ResultCodes_1")
public Object[][] initResultCodes_1()
@@ -412,10 +410,7 @@
DN dummyDN
)
{
- // create a DIT set with the baseDN (no workflow element in the DIT).
- WorkflowElement nullWE = null;
- WorkflowImpl workflow =
- new WorkflowImpl (baseDN.toString(), baseDN, null, nullWE);
+ WorkflowImpl workflow = new WorkflowImpl(baseDN.toString(), baseDN, null, null);
// Create a worflow with the dit, no pre/post-workflow element.
WorkflowTopologyNode workflowNode = new WorkflowTopologyNode(workflow);
@@ -457,7 +452,7 @@
*
* There is no worklfow element attached to the DITs.
*
- * @param baseDn base DN for the parent workflow (W1)
+ * @param baseDN base DN for the parent workflow (W1)
* @param subordinateDN base DN for the subordinate workflow (W2)
* @param unrelatedDN base DN with no hierarchical relationship with any
* of the two baseDNs; parameter may be null
@@ -476,14 +471,11 @@
WorkflowImpl subWorkflow = null;
WorkflowImpl unrelatedWorkflow = null;
{
- WorkflowElement nullWE = null;
- workflow = new WorkflowImpl (baseDN.toString(), baseDN, null, nullWE);
- subWorkflow = new WorkflowImpl (
- subordinateDN.toString(), subordinateDN, null, nullWE);
+ workflow = new WorkflowImpl(baseDN.toString(), baseDN, null, null);
+ subWorkflow = new WorkflowImpl(subordinateDN.toString(), subordinateDN, null, null);
if (unrelatedDN != null)
{
- unrelatedWorkflow = new WorkflowImpl (
- unrelatedDN.toString(), unrelatedDN, null, nullWE);
+ unrelatedWorkflow = new WorkflowImpl(unrelatedDN.toString(), unrelatedDN, null, null);
}
}
@@ -594,7 +586,7 @@
*
* There is no worklfow element attached to the DITs.
*
- * @param baseDn1 base DN for the top workflow (W1)
+ * @param baseDN1 base DN for the top workflow (W1)
* @param baseDN2 base DN for the first subordinate workflow (W2)
* @param baseDN3 base DN for the second subordinate workflow (W3)
* @param subordinateDN1 subordinate DN of baseDN1
@@ -623,10 +615,9 @@
WorkflowImpl workflow2;
WorkflowImpl workflow3;
{
- WorkflowElement nullWE = null;
- workflow1 = new WorkflowImpl(baseDN1.toString(), baseDN1, null, nullWE);
- workflow2 = new WorkflowImpl(baseDN2.toString(), baseDN2, null, nullWE);
- workflow3 = new WorkflowImpl(baseDN3.toString(), baseDN3, null, nullWE);
+ workflow1 = new WorkflowImpl(baseDN1.toString(), baseDN1, null, null);
+ workflow2 = new WorkflowImpl(baseDN2.toString(), baseDN2, null, null);
+ workflow3 = new WorkflowImpl(baseDN3.toString(), baseDN3, null, null);
}
w1 = new WorkflowTopologyNode(workflow1);
@@ -775,7 +766,7 @@
*
* There is no worklfow element attached to the DITs.
*
- * @param baseDn1 base DN for the top workflow (W1)
+ * @param baseDN1 base DN for the top workflow (W1)
* @param baseDN2 base DN for the first subordinate workflow (W2)
* @param baseDN3 base DN for the second subordinate workflow (W3)
* @param subordinateDN1 subordinate DN of baseDN1
@@ -804,11 +795,9 @@
WorkflowImpl workflow2;
WorkflowImpl workflow3;
{
- WorkflowElement nullWE = null;
-
- workflow1 = new WorkflowImpl(baseDN1.toString(), baseDN1, null, nullWE);
- workflow2 = new WorkflowImpl(baseDN2.toString(), baseDN2, null, nullWE);
- workflow3 = new WorkflowImpl(baseDN3.toString(), baseDN3, null, nullWE);
+ workflow1 = new WorkflowImpl(baseDN1.toString(), baseDN1, null, null);
+ workflow2 = new WorkflowImpl(baseDN2.toString(), baseDN2, null, null);
+ workflow3 = new WorkflowImpl(baseDN3.toString(), baseDN3, null, null);
}
w1 = new WorkflowTopologyNode(workflow1);
@@ -929,11 +918,8 @@
)
throws DirectoryException
{
- WorkflowElement nullWE = null;
-
// Create a workflow to handle the baseDN with no workflow element
- WorkflowImpl workflow = new WorkflowImpl(
- baseDN.toString(), baseDN, null, nullWE);
+ WorkflowImpl workflow = new WorkflowImpl(baseDN.toString(), baseDN, null, null);
// Register the workflow with the server. Don't catch the
// DirectoryException that could be thrown by the register() method.
@@ -941,17 +927,15 @@
// Register the same workflow twice and catch the expected
// DirectoryException.
- boolean exceptionRaised = false;
try
{
workflow.register();
+ fail("Expected DirectoryException to br thrown");
}
catch (DirectoryException e)
{
- exceptionRaised = true;
assertTrue(StaticUtils.hasDescriptor(e.getMessageObject(),
ERR_REGISTER_WORKFLOW_ALREADY_EXISTS));
}
- assertEquals(exceptionRaised, true);
}
}
diff --git a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/core/networkgroups/ANDConnectionCriteriaTest.java b/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/core/networkgroups/ANDConnectionCriteriaTest.java
deleted file mode 100644
index 4e527df..0000000
--- a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/core/networkgroups/ANDConnectionCriteriaTest.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * 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 legal-notices/CDDLv1_0.txt
- * or http://forgerock.org/license/CDDLv1.0.html.
- * 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 legal-notices/CDDLv1_0.txt.
- * 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
- *
- *
- * Copyright 2009 Sun Microsystems, Inc.
- */
-package org.opends.server.core.networkgroups;
-
-
-
-import java.util.Arrays;
-import java.util.Collection;
-
-import org.opends.server.DirectoryServerTestCase;
-import org.opends.server.TestCaseUtils;
-import org.opends.server.api.ClientConnection;
-import org.opends.server.protocols.internal.InternalClientConnection;
-import org.opends.server.types.AuthenticationType;
-import org.opends.server.types.DN;
-import org.testng.Assert;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
-
-
-/**
- * Unit tests for ANDConnectionCriteria.
- */
-public class ANDConnectionCriteriaTest extends DirectoryServerTestCase
-{
- /**
- * Sets up the environment for performing the tests in this suite.
- *
- * @throws Exception
- * if the environment could not be set up.
- */
- @BeforeClass
- public void setUp() throws Exception
- {
- TestCaseUtils.startServer();
- }
-
-
-
- /**
- * Returns test data for the following test cases.
- *
- * @return The test data for the following test cases.
- */
- @DataProvider(name = "testData")
- public Object[][] createTestData()
- {
- return new Object[][] {
- { Arrays.<ConnectionCriteria> asList(), true },
- { Arrays.asList(ConnectionCriteria.TRUE), true },
- {
- Arrays.asList(ConnectionCriteria.TRUE,
- ConnectionCriteria.TRUE), true },
- { Arrays.asList(ConnectionCriteria.FALSE), false },
- {
- Arrays.asList(ConnectionCriteria.TRUE,
- ConnectionCriteria.FALSE), false },
- {
- Arrays.asList(ConnectionCriteria.FALSE,
- ConnectionCriteria.TRUE), false },
- {
- Arrays.asList(ConnectionCriteria.FALSE,
- ConnectionCriteria.FALSE), false }, };
- }
-
-
-
- /**
- * Tests the matches method.
- *
- * @param subCriteria
- * The sub criteria.
- * @param expectedResult
- * The expected result.
- * @throws Exception
- * If an unexpected exception occurred.
- */
- @Test(dataProvider = "testData")
- public void testMatches(Collection<ConnectionCriteria> subCriteria,
- boolean expectedResult) throws Exception
- {
- ANDConnectionCriteria criteria =
- new ANDConnectionCriteria(subCriteria);
- ClientConnection connection =
- new InternalClientConnection(DN.NULL_DN);
- Assert.assertEquals(criteria.matches(connection), expectedResult);
- }
-
-
-
- /**
- * Tests the willMatchAfterBind method.
- *
- * @param subCriteria
- * The sub criteria.
- * @param expectedResult
- * The expected result.
- * @throws Exception
- * If an unexpected exception occurred.
- */
- @Test(dataProvider = "testData")
- public void testWillMatchAfterBind(
- Collection<ConnectionCriteria> subCriteria, boolean expectedResult)
- throws Exception
- {
- ANDConnectionCriteria criteria =
- new ANDConnectionCriteria(subCriteria);
- ClientConnection connection =
- new InternalClientConnection(DN.NULL_DN);
- Assert.assertEquals(criteria.willMatchAfterBind(connection,
- DN.NULL_DN, AuthenticationType.SIMPLE, false), expectedResult);
- }
-
-}
diff --git a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/core/networkgroups/BindDNConnectionCriteriaTest.java b/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/core/networkgroups/BindDNConnectionCriteriaTest.java
deleted file mode 100644
index fe56990..0000000
--- a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/core/networkgroups/BindDNConnectionCriteriaTest.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * 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 legal-notices/CDDLv1_0.txt
- * or http://forgerock.org/license/CDDLv1.0.html.
- * 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 legal-notices/CDDLv1_0.txt.
- * 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
- *
- *
- * Copyright 2009 Sun Microsystems, Inc.
- * Portions Copyright 2014 ForgeRock AS
- */
-package org.opends.server.core.networkgroups;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-
-import org.opends.server.DirectoryServerTestCase;
-import org.opends.server.TestCaseUtils;
-import org.opends.server.api.ClientConnection;
-import org.opends.server.authorization.dseecompat.PatternDN;
-import org.opends.server.types.AuthenticationType;
-import org.opends.server.types.DN;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
-import static org.testng.Assert.*;
-
-/**
- * Unit tests for BindDNConnectionCriteria.
- */
-public class BindDNConnectionCriteriaTest extends
- DirectoryServerTestCase
-{
-
- /**
- * Sets up the environment for performing the tests in this suite.
- *
- * @throws Exception
- * if the environment could not be set up.
- */
- @BeforeClass
- public void setUp() throws Exception
- {
- TestCaseUtils.startServer();
- }
-
-
-
- /**
- * Returns test data for the following test cases.
- *
- * @return The test data for the following test cases.
- * @throws Exception
- * If an unexpected exception occurred.
- */
- @DataProvider(name = "testData")
- public Object[][] createTestData() throws Exception
- {
- DN anonymousUser = DN.rootDN();
- DN rootUser =
- DN.valueOf("cn=Directory Manager, cn=Root DNs, cn=config");
- PatternDN rootMatch = PatternDN.decode("*, cn=Root DNs, cn=config");
- PatternDN rootNoMatch =
- PatternDN.decode("cn=Dirx*, cn=Root DNs, cn=config");
-
- return new Object[][] {
- { anonymousUser, Collections.<PatternDN> emptySet(), false },
- { rootUser, Collections.<PatternDN> emptySet(), false },
- { anonymousUser, Collections.singleton(rootMatch), false },
- { rootUser, Collections.singleton(rootMatch), true },
- { anonymousUser, Collections.singleton(rootNoMatch), false },
- { rootUser, Collections.singleton(rootNoMatch), false },
- { anonymousUser, Arrays.asList(rootMatch, rootNoMatch), false },
- { rootUser, Arrays.asList(rootMatch, rootNoMatch), true }, };
- }
-
-
-
- /**
- * Tests the matches method.
- *
- * @param clientBindDN
- * The client bind DN.
- * @param allowedDNPatterns
- * The set of allowed DN patterns.
- * @param expectedResult
- * The expected result.
- * @throws Exception
- * If an unexpected exception occurred.
- */
- @Test(dataProvider = "testData")
- public void testMatches(DN clientBindDN,
- Collection<PatternDN> allowedDNPatterns, boolean expectedResult)
- throws Exception
- {
- ClientConnection client = new MockClientConnection(12345, false, clientBindDN);
-
- BindDNConnectionCriteria criteria = new BindDNConnectionCriteria(new ArrayList<PatternDN>(allowedDNPatterns));
- assertEquals(criteria.matches(client), expectedResult);
- }
-
-
-
- /**
- * Tests the willMatchAfterBind method.
- *
- * @param clientBindDN
- * The client bind DN.
- * @param allowedDNPatterns
- * The set of allowed DN patterns.
- * @param expectedResult
- * The expected result.
- * @throws Exception
- * If an unexpected exception occurred.
- */
- @Test(dataProvider = "testData")
- public void testWillMatchAfterBind(DN clientBindDN,
- Collection<PatternDN> allowedDNPatterns, boolean expectedResult)
- throws Exception
- {
- ClientConnection client = new MockClientConnection(12345, false, null);
-
- BindDNConnectionCriteria criteria = new BindDNConnectionCriteria(new ArrayList<PatternDN>(allowedDNPatterns));
- assertEquals(criteria.willMatchAfterBind(client, clientBindDN,
- AuthenticationType.SIMPLE, false), expectedResult);
- }
-
-}
diff --git a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/core/networkgroups/IPConnectionCriteriaTest.java b/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/core/networkgroups/IPConnectionCriteriaTest.java
deleted file mode 100644
index 8940c8c..0000000
--- a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/core/networkgroups/IPConnectionCriteriaTest.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * 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 legal-notices/CDDLv1_0.txt
- * or http://forgerock.org/license/CDDLv1.0.html.
- * 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 legal-notices/CDDLv1_0.txt.
- * 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
- *
- *
- * Copyright 2009 Sun Microsystems, Inc.
- * Portions Copyright 2014 ForgeRock AS
- */
-package org.opends.server.core.networkgroups;
-
-
-
-import java.util.Collection;
-import java.util.Collections;
-
-import org.forgerock.opendj.ldap.AddressMask;
-import org.opends.server.DirectoryServerTestCase;
-import org.opends.server.TestCaseUtils;
-import org.opends.server.api.ClientConnection;
-import org.opends.server.types.AuthenticationType;
-import org.opends.server.types.DN;
-import org.testng.Assert;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
-
-
-/**
- * Unit tests for IPConnectionCriteria.
- */
-public class IPConnectionCriteriaTest extends DirectoryServerTestCase
-{
-
- /**
- * Sets up the environment for performing the tests in this suite.
- *
- * @throws Exception
- * if the environment could not be set up.
- */
- @BeforeClass
- public void setUp() throws Exception
- {
- TestCaseUtils.startServer();
- }
-
-
-
- /**
- * Returns test data for the following test cases.
- *
- * @return The test data for the following test cases.
- * @throws Exception
- * If an unexpected exception occurred.
- */
- @DataProvider(name = "testData")
- public Object[][] createTestData() throws Exception
- {
- AddressMask matchAnything = AddressMask.valueOf("*.*.*.*");
- AddressMask matchNothing = AddressMask.valueOf("0.0.0.0");
- ClientConnection client = new MockClientConnection(12345, false, null);
-
- Collection<AddressMask> emptyMasks = Collections.emptySet();
-
- return new Object[][] {
- { emptyMasks, emptyMasks, client, true },
-
- { Collections.singleton(matchAnything), emptyMasks, client,
- true },
- { emptyMasks, Collections.singleton(matchAnything), client,
- false },
- { Collections.singleton(matchAnything),
- Collections.singleton(matchAnything), client, false },
-
- { Collections.singleton(matchNothing), emptyMasks, client,
- false },
- { emptyMasks, Collections.singleton(matchNothing), client, true },
- { Collections.singleton(matchNothing),
- Collections.singleton(matchNothing), client, false }, };
- }
-
-
-
- /**
- * Tests the matches method.
- *
- * @param allowedClients
- * The set of allowed client address masks.
- * @param deniedClients
- * The set of denied client address masks.
- * @param client
- * The test client.
- * @param expectedResult
- * The expected result.
- * @throws Exception
- * If an unexpected exception occurred.
- */
- @Test(dataProvider = "testData")
- public void testMatches(Collection<AddressMask> allowedClients,
- Collection<AddressMask> deniedClients, ClientConnection client,
- boolean expectedResult) throws Exception
- {
- IPConnectionCriteria criteria =
- new IPConnectionCriteria(allowedClients, deniedClients);
- Assert.assertEquals(criteria.matches(client), expectedResult);
- }
-
-
-
- /**
- * Tests the willMatchAfterBind method.
- *
- * @param allowedClients
- * The set of allowed client address masks.
- * @param deniedClients
- * The set of denied client address masks.
- * @param client
- * The test client.
- * @param expectedResult
- * The expected result.
- * @throws Exception
- * If an unexpected exception occurred.
- */
- @Test(dataProvider = "testData")
- public void testWillMatchAfterBind(
- Collection<AddressMask> allowedClients,
- Collection<AddressMask> deniedClients, ClientConnection client,
- boolean expectedResult) throws Exception
- {
- IPConnectionCriteria criteria =
- new IPConnectionCriteria(allowedClients, deniedClients);
- Assert.assertEquals(criteria.willMatchAfterBind(client, DN.NULL_DN,
- AuthenticationType.SIMPLE, false), expectedResult);
- }
-
-}
diff --git a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/core/networkgroups/MockClientConnection.java b/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/core/networkgroups/MockClientConnection.java
deleted file mode 100644
index e2768f7..0000000
--- a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/core/networkgroups/MockClientConnection.java
+++ /dev/null
@@ -1,320 +0,0 @@
-/*
- * 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 legal-notices/CDDLv1_0.txt
- * or http://forgerock.org/license/CDDLv1.0.html.
- * 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 legal-notices/CDDLv1_0.txt.
- * 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
- *
- *
- * Copyright 2009 Sun Microsystems, Inc.
- * Portions Copyright 2013-2014 ForgeRock AS
- */
-package org.opends.server.core.networkgroups;
-
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.Collection;
-
-import org.forgerock.i18n.LocalizableMessage;
-import org.opends.server.api.ClientConnection;
-import org.opends.server.api.ConnectionHandler;
-import org.opends.server.core.DirectoryServer;
-import org.opends.server.core.SearchOperation;
-import org.opends.server.types.*;
-
-/**
- * A mock connection for connection criteria testing.
- */
-@SuppressWarnings("javadoc")
-public final class MockClientConnection extends ClientConnection
-{
- private final int clientPort;
- private final boolean isSecure;
- private final AuthenticationInfo authInfo;
-
- /**
- * Creates a new mock client connection.
- *
- * @param clientPort
- * The client port.
- * @param isSecure
- * Is the client using a secure connection.
- * @param bindDN
- * The client bind DN.
- * @throws Exception
- * If an unexpected exception occurred.
- */
- public MockClientConnection(int clientPort, boolean isSecure, DN bindDN) throws Exception
- {
- this.clientPort = clientPort;
- this.isSecure = isSecure;
- if (bindDN != null)
- {
- Entry simpleUser = DirectoryServer.getEntry(bindDN);
- this.authInfo = new AuthenticationInfo(simpleUser, bindDN, true);
- }
- else
- {
- this.authInfo = new AuthenticationInfo();
- }
- }
-
-
-
- @Override
- public AuthenticationInfo getAuthenticationInfo()
- {
- return authInfo;
- }
-
-
-
- @Override
- public void cancelAllOperations(CancelRequest cancelRequest)
- {
- // Stub.
- }
-
-
-
- @Override
- public void cancelAllOperationsExcept(CancelRequest cancelRequest,
- int messageID)
- {
- // Stub.
- }
-
-
-
- @Override
- public CancelResult cancelOperation(int messageID,
- CancelRequest cancelRequest)
- {
- // Stub.
- return null;
- }
-
-
-
- @Override
- public void disconnect(DisconnectReason disconnectReason,
- boolean sendNotification, LocalizableMessage message)
- {
- // Stub.
- }
-
-
-
- @Override
- public String getClientAddress()
- {
- return "127.0.0.1";
- }
-
-
-
- @Override
- public int getClientPort()
- {
- return clientPort;
- }
-
-
-
- @Override
- public ConnectionHandler<?> getConnectionHandler()
- {
- // Stub.
- return null;
- }
-
-
-
- @Override
- public long getConnectionID()
- {
- // Stub.
- return 0;
- }
-
-
-
- @Override
- public InetAddress getLocalAddress()
- {
- // Stub.
- return null;
- }
-
-
-
- @Override
- public String getMonitorSummary()
- {
- // Stub.
- return null;
- }
-
-
-
- @Override
- public long getNumberOfOperations()
- {
- // Stub.
- return 0;
- }
-
-
-
- @Override
- public Operation getOperationInProgress(int messageID)
- {
- // Stub.
- return null;
- }
-
-
-
- @Override
- public Collection<Operation> getOperationsInProgress()
- {
- // Stub.
- return null;
- }
-
-
-
- @Override
- public String getProtocol()
- {
- // Stub.
- return null;
- }
-
-
-
- @Override
- public InetAddress getRemoteAddress()
- {
- try
- {
- return InetAddress.getByAddress(new byte[] { 127, 0, 0, 1 });
- }
- catch (UnknownHostException e)
- {
- throw new RuntimeException(e);
- }
- }
-
-
-
- @Override
- public String getServerAddress()
- {
- // Stub.
- return null;
- }
-
-
-
- @Override
- public int getServerPort()
- {
- // Stub.
- return 0;
- }
-
- @Override
- public boolean isConnectionValid()
- {
- // This connection is always valid
- return true;
- }
-
- @Override
- public boolean isSecure()
- {
- return isSecure;
- }
-
-
-
- @Override
- public boolean removeOperationInProgress(int messageID)
- {
- // Stub.
- return false;
- }
-
-
-
- @Override
- protected boolean sendIntermediateResponseMessage(
- IntermediateResponse intermediateResponse)
- {
- // Stub.
- return false;
- }
-
-
-
- @Override
- public void sendResponse(Operation operation)
- {
- // Stub.
- }
-
-
-
- @Override
- public void sendSearchEntry(SearchOperation searchOperation,
- SearchResultEntry searchEntry) throws DirectoryException
- {
- // Stub.
- }
-
-
-
- @Override
- public boolean sendSearchReference(SearchOperation searchOperation,
- SearchResultReference searchReference) throws DirectoryException
- {
- // Stub.
- return false;
- }
-
-
-
- @Override
- public void toString(StringBuilder buffer)
- {
- // Stub.
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int getSSF()
- {
- // Stub.
- return 0;
- }
-}
diff --git a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/core/networkgroups/NetworkGroupTest.java b/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/core/networkgroups/NetworkGroupTest.java
index ff3c846..47c9bf8 100644
--- a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/core/networkgroups/NetworkGroupTest.java
+++ b/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/core/networkgroups/NetworkGroupTest.java
@@ -33,7 +33,6 @@
import org.forgerock.opendj.ldap.SearchScope;
import org.opends.server.DirectoryServerTestCase;
import org.opends.server.TestCaseUtils;
-import org.opends.server.api.ClientConnection;
import org.opends.server.core.ModifyOperation;
import org.opends.server.core.SearchOperation;
import org.opends.server.core.Workflow;
@@ -47,7 +46,6 @@
import org.opends.server.types.InitializationException;
import org.opends.server.types.Modification;
import org.opends.server.util.StaticUtils;
-import org.opends.server.workflowelement.WorkflowElement;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@@ -317,9 +315,7 @@
// Create a workflow -- the workflow ID is the string representation
// of the workflow base DN.
- WorkflowElement nullWE = null;
- WorkflowImpl workflow = new WorkflowImpl(
- workflowBaseDN.toString(), workflowBaseDN, null, nullWE);
+ WorkflowImpl workflow = new WorkflowImpl(workflowBaseDN.toString(), workflowBaseDN, null, null);
// Register the workflow with the network group.
networkGroup.registerWorkflow(workflow);
@@ -729,25 +725,13 @@
// Create a workflow -- the workflow ID is the string representation
// of the workflow base DN.
- WorkflowElement nullWE = null;
- WorkflowImpl workflow1 = new WorkflowImpl(
- dn1.toString(), dn1, null, nullWE);
- WorkflowImpl workflow2 = new WorkflowImpl(
- dn2.toString(), dn2, null, nullWE);
+ WorkflowImpl workflow1 = new WorkflowImpl(dn1.toString(), dn1, null, null);
+ WorkflowImpl workflow2 = new WorkflowImpl(dn2.toString(), dn2, null, null);
// Register the workflow with the network group.
networkGroup1.registerWorkflow(workflow1);
networkGroup2.registerWorkflow(workflow2);
- // Create a new ClientConnection
- ClientConnection connection = new InternalClientConnection(DN.NULL_DN);
-
- // Find a networkGroup for this connection
- // As the network groups define no criteria, the highest priority
- // must be chosen
- NetworkGroup ng = NetworkGroup.findMatchingNetworkGroup(connection);
- assertEquals(ng, prio1 < prio2 ? networkGroup1 : networkGroup2);
-
// Clean the network group
networkGroup1.deregisterWorkflow(workflow1.getWorkflowId());
networkGroup1.deregister();
@@ -966,10 +950,7 @@
// Create a workflow with no task inside. The workflow identifier
// is the a string representation of the workflow base DN.
- WorkflowElement rootWE = null;
- String workflowId = workflowBaseDN.toString();
- WorkflowImpl workflow = new WorkflowImpl(
- workflowId, workflowBaseDN, null, rootWE);
+ WorkflowImpl workflow = new WorkflowImpl(workflowBaseDN.toString(), workflowBaseDN, null, null);
assertNotNull(workflow);
// Register the workflow with the network group.
diff --git a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/core/networkgroups/SecurityConnectionCriteriaTest.java b/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/core/networkgroups/SecurityConnectionCriteriaTest.java
deleted file mode 100644
index 6c075d2..0000000
--- a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/core/networkgroups/SecurityConnectionCriteriaTest.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * 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 legal-notices/CDDLv1_0.txt
- * or http://forgerock.org/license/CDDLv1.0.html.
- * 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 legal-notices/CDDLv1_0.txt.
- * 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
- *
- *
- * Copyright 2009 Sun Microsystems, Inc.
- * Portions Copyright 2014 ForgeRock AS
- */
-package org.opends.server.core.networkgroups;
-
-
-
-import org.opends.server.DirectoryServerTestCase;
-import org.opends.server.TestCaseUtils;
-import org.opends.server.api.ClientConnection;
-import org.opends.server.types.AuthenticationType;
-import org.opends.server.types.DN;
-import org.testng.Assert;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
-
-
-/**
- * Unit tests for ProtocolConnectionCriteria.
- */
-public class SecurityConnectionCriteriaTest extends
- DirectoryServerTestCase
-{
-
- /**
- * Sets up the environment for performing the tests in this suite.
- *
- * @throws Exception
- * if the environment could not be set up.
- */
- @BeforeClass
- public void setUp() throws Exception
- {
- TestCaseUtils.startServer();
- }
-
-
-
- /**
- * Returns test data for the following test cases.
- *
- * @return The test data for the following test cases.
- * @throws Exception
- * If an unexpected exception occurred.
- */
- @DataProvider(name = "testData")
- public Object[][] createTestData() throws Exception
- {
- return new Object[][] {
- { false, SecurityConnectionCriteria.SECURITY_NOT_REQUIRED, true },
- { false, SecurityConnectionCriteria.SECURITY_REQUIRED, false },
- { true, SecurityConnectionCriteria.SECURITY_NOT_REQUIRED, true },
- { true, SecurityConnectionCriteria.SECURITY_REQUIRED, true }, };
- }
-
-
-
- /**
- * Tests the matches method.
- *
- * @param isSecure
- * Indicates if the client is using a secured connection.
- * @param criteria
- * The security criteria.
- * @param expectedResult
- * The expected result.
- * @throws Exception
- * If an unexpected exception occurred.
- */
- @Test(dataProvider = "testData")
- public void testMatches(boolean isSecure,
- SecurityConnectionCriteria criteria, boolean expectedResult)
- throws Exception
- {
- ClientConnection client = new MockClientConnection(12345, isSecure, null);
-
- Assert.assertEquals(criteria.matches(client), expectedResult);
- }
-
-
-
- /**
- * Tests the willMatchAfterBind method.
- *
- * @param isSecure
- * Indicates if the client is using a secured connection.
- * @param criteria
- * The security criteria.
- * @param expectedResult
- * The expected result.
- * @throws Exception
- * If an unexpected exception occurred.
- */
- @Test(dataProvider = "testData")
- public void testWillMatchAfterBind(boolean isSecure,
- SecurityConnectionCriteria criteria, boolean expectedResult)
- throws Exception
- {
- ClientConnection client = new MockClientConnection(12345, false, null);
-
- Assert.assertEquals(criteria.willMatchAfterBind(client,
- DN.rootDN(), AuthenticationType.SIMPLE, isSecure),
- expectedResult);
- }
-
-}
--
Gitblit v1.10.0