LocalBackendWorkflowElementTest.java revision 9aa1482c49865483f798f91ef7d16f03cc3ec811
/*
* 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
* 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 2006-2010 Sun Microsystems, Inc.
* Portions Copyright 2011-2015 ForgeRock AS.
*/
/**
* This set of tests test the LocalBackendWorkflowElement.
*/
@SuppressWarnings("javadoc")
public class LocalBackendWorkflowElementTest extends DirectoryServerTestCase
{
{
}
/**
* This test checks that workflows are updated as appropriate when backend
* base DNs are added or removed.
* <p>
* When a new backend base DN is added, the new suffix should be accessible
* for the route process - ie. a workflow should be created and be a potential
* candidate for the route process.
* <p>
* Similarly, when a backend base DN is removed its associated workflow should
* be removed; subsequently, any request targeting the removed suffix should
* be rejected and a no such entry status code be returned.
*/
@Test
public void testBackendBaseDNModification() throws Exception
{
// Initialize a backend with a base entry.
// Check that suffix is accessible while suffix2 is not.
// Add a new suffix in the backend and create a base entry for the new suffix
// Both old and new suffix should be accessible.
// Remove the new suffix...
// ...and check that the removed suffix is no more accessible.
// Replace the suffix with suffix2 in the backend
// Now none of the suffixes are accessible: this means the entries
// under the old suffix are not moved to the new suffix.
// Add a base entry for the new suffix
// The new suffix is accessible while the old one is not.
// Reset the configuration with previous suffix
}
/**
* This test checks that the workflow takes into account the subordinate
* naming context defined in the RootDSEBackend.
*/
@Test
public void testNonRootDseSubordinateNamingContext() throws Exception
{
// Backends for the test
try
{
// At this point, the list of subordinate naming context is not defined
// yet (null): any public backend should be visible. Create a backend
// with a base entry and check that the test naming context is visible.
// Create another test backend and check that the new backend is visible
}
finally
{
// Clean the test backends. There is no more naming context.
}
}
/**
* This test checks that the workflow takes into account the subordinate
* naming context defined in the RootDSEBackend.
*/
@Test
public void testRootDseSubordinateNamingContext() throws Exception
{
// Backends for the test
try
{
// At this point, the list of subordinate naming context is not defined
// yet (null): any public backend should be visible. Create a backend
// with a base entry and check that the test naming context is visible.
// Create another test backend and check that the new backend is visible
// Now put in the list of subordinate naming context the backend1 naming context.
// This white list will prevent the backend2 to be visible.
"set-root-dse-backend-prop",
// === Cleaning
// Reset the subordinate naming context list.
// Both naming context should be visible again.
"set-root-dse-backend-prop",
"--reset", "subordinate-base-dn");
}
finally
{
// Clean the test backends. There is no more naming context.
}
}
/**
* Searches the list of naming contexts.
*
* @param expectedRC the expected result code
* @param expectedNamingContexts the number of expected naming contexts
*/
private void searchPublicNamingContexts(ResultCode expectedRC, int expectedNamingContexts) throws Exception
{
}
private void searchEntries(String baseDN, ResultCode expectedRC, int expectedNbEntries) throws DirectoryException
{
{
}
}
/**
* Searches an entry on a given connection.
*
* @param baseDN the request base DN string
* @param expectedRC the expected result code
*/
{
}
/**
* Creates a base entry for the given suffix.
*
* @param suffix the suffix for which the base entry is to be created
*/
{
"dn: " + suffix,
"objectClass: top",
"objectClass: organization",
"o: " + namingAttribute);
}
/**
*
* @param baseDN the request base DN string
*/
private void modifyAttribute(String baseDN, ModificationType modType, String attributeName, String attributeValue)
throws Exception
{
}
}