1689N/A * The contents of this file are subject to the terms of the 1689N/A * Common Development and Distribution License, Version 1.0 only 1689N/A * (the "License"). You may not use this file except in compliance 1689N/A * You can obtain a copy of the license at 1689N/A * See the License for the specific language governing permissions 1689N/A * and limitations under the License. 1689N/A * When distributing Covered Code, include this CDDL HEADER in each 1689N/A * file and include the License file at 1689N/A * add the following below this CDDL HEADER, with the fields enclosed 1689N/A * by brackets "[]" replaced with your own identifying information: 1689N/A * Portions Copyright [yyyy] [name of copyright owner] 3232N/A * Copyright 2006-2008 Sun Microsystems, Inc. 1689N/A * This set of tests checks that workflow topology is properly created. 1689N/A * Topology is based on DN hierarchical relationship. Once the topolofy 1689N/A * is created, we check that the route operation returns the best workflow 1689N/A * candidate for a given request base DN. 1689N/A //=========================================================================== 1689N/A //=========================================================================== 1689N/A * Set up the environment for performing the tests in this suite. 1689N/A * @throws Exception if the environment could not be set up. 1689N/A // This test suite depends on having the schema available, 1689N/A // so we'll start the server. 1689N/A //=========================================================================== 1689N/A //=========================================================================== 1689N/A * Provide a set of DNs to create a single workflow. Each set of DNs contains 1689N/A * one baseDN for the new workflow to be created, one subordinateDN and one 1689N/A * unrelatedDN which has no hierarchical relationship with the baseDN. 1689N/A * baseDN + subordinateDN + unrelatedDN 1689N/A * Sample scenario for a test using this set of DNs: 1689N/A * 1) creating a workflow with the baseDN 1689N/A * 2) trying to fetch the workflow using the subordinateDN 1689N/A * 3) checking that the workflow cannot be candidate to route a request 1689N/A * @throws Exception when DN.decode fails 1689N/A // baseDN is null suffix. There is no unrelatedDN because any DN 1689N/A // is descendant of the null suffix. 1689N/A // One baseDN, one subordinateDN and one unrelatedDN 1689N/A * Provide a set of DNs to create a topology of 3 workflows, and the 3 1689N/A * workflows are in the same hierarchy of DNs: baseDN1 is the superior 1689N/A * of baseDN2 which is the superior of baseDN3: 1689N/A * baseDN2 + subordinateDN2 + unrelatedDN 1689N/A * Each baseDN has a subordinateDN: the workflow with the baseDN should be 1689N/A * the candidate for a request when request base DN is the subordinateDN. 1689N/A * There is an unrelatedDN which has no hierarchical relationship with any 1689N/A * of the baseDNs. The unrelatedDN is used to check that none of the 1689N/A * workflow can be candidate for the route when a request is using the 1689N/A * @throws Exception when DN.decode fails 1689N/A // Create the topology of DNs: 1689N/A // o=dummy ou=test1 (==> W1) 1689N/A // ou=subordinate1 ou=test2 (==> W2) 1689N/A // ou=test3 (==> W3) ou=subordinate2 1689N/A // Same than SET 1, but the first baseDN is the null suffix DN. 1689N/A // Hence there is no unrelatedDN as any DN is a subordinate of 1689N/A * Provide a set of DNs to create the following topology: 1689N/A * subordinateDN1 +------+------+ 1689N/A * subordinateDN2 subordinateDN3 1689N/A * @throws Exception when DN.decode fails 1689N/A // Create the topology of DNs: 1689N/A // o=dummy dc=example,dc=com 1689N/A // +--------------+-----------------+ 1689N/A // ou=subordinate1 ou=group ou=people 1689N/A // ou=subordinate2 ou=subordinate3 1689N/A // o=dummy dc=example,dc=com 1689N/A // +--------------+-----------------+ 1689N/A // ou=subordinate1 ou=group ou=people 1689N/A // ou=subordinate2 ou=subordinate3 1689N/A // The top baseDN is the null suffix. Hence there is no unrelatedDN 1689N/A // as any DN is a subordinate of the null suffix. 1689N/A // +--------------+-----------------+ 1689N/A // ou=subordinate1 ou=group ou=people 1689N/A // ou=subordinate2 ou=subordinate3 1689N/A * Provide a set of result codes to test the elaboration of the global 1689N/A * @return set of result codes to test 1689N/A // received current expected 1689N/A // result code result code result code 1689N/A //=========================================================================== 1689N/A //=========================================================================== 1689N/A * Create a single workflow using a baseDN. There is no workflow element 1689N/A * in the workflow nor in the DIT attached to the workflow. Once the 1689N/A * workflow has been created, we are trying to fetch it using the baseDN 1689N/A * @param baseDN baseDN of the workflow to create 1689N/A * @param subordinateDN a subordinate DN of baseDN 1689N/A * @param dummyDN a DN not registered in any workflow 1689N/A // create a DIT set with the baseDN (no workflow element in the DIT). 1689N/A // The base DN in the workflow should match baseDN parameter 1689N/A // There should be no parent workflow. 1689N/A // The workflow should handle the baseDN and subordinateDN. 1689N/A // The workflow should not handle the dummyDN. 1689N/A * Create a topology with 2 workflows. The test case contains creation 1689N/A * of clean topologies as well as bad topologies (same baseDN for the parent 1689N/A * and subordinate, subordinate above parent...). 1689N/A * There is no worklfow element attached to the DITs. 1689N/A * @param baseDn base DN for the parent workflow (W1) 1689N/A * @param subordinateDN base DN for the subordinate workflow (W2) 1689N/A * @param unrelatedDN base DN with no hierarchical relationship with any 1689N/A * of the two baseDNs; parameter may be null 1689N/A // Create one DIT set for baseDN and one DIT set for subordinateDN 1689N/A // (no workflow element in any DIT). Create a dummy DIT as well using 1689N/A // Try to create a topology with unrelated workflows: 1689N/A // Insert should be rejected 1689N/A // Try to create a topology with the very same workflow: 1689N/A // Insert should be rejected 1689N/A // Try to create a topology with a workflow whose baseDN is the same than 1689N/A // Insert should be rejected 1689N/A // Try to create a topology where subordinate is above the parent: 1689N/A // Insert should be rejected 1689N/A // Try to create a clean topology: 1689N/A // - insert should be working 1689N/A // - w1 should be the parent of w2 1689N/A // - w2 should be in the w1 subordinate list 1689N/A // - w2 should have no subordinate 1689N/A }
// createWorkflow_simpleTopology1 1689N/A * Create a topology with 3 workflows and check that we are getting the 1689N/A * right workflow for a given DN. Then remove a workflow in the chain and 1689N/A * There is no worklfow element attached to the DITs. 1689N/A * @param baseDn1 base DN for the top workflow (W1) 1689N/A * @param baseDN2 base DN for the first subordinate workflow (W2) 1689N/A * @param baseDN3 base DN for the second subordinate workflow (W3) 1689N/A * @param subordinateDN1 subordinate DN of baseDN1 1689N/A * @param subordinateDN2 subordinate DN of baseDN2 1689N/A * @param subordinateDN3 subordinate DN of baseDN3 1689N/A * @param unrelatedDN a DN not registered in any workflow 1689N/A // create DITs with the given baseDNs with no workflow element. 1689N/A // Create a first topology with: 1689N/A // Now insert w2 between w1 and w3 1689N/A // - w1 has no parent and has only w2 as subordinate 1689N/A // - w2 has w1 as parent and w3 as subordinate 1689N/A // -w3 has w2 as parent and no subordinate 1689N/A // ====================================================== 1689N/A // Topology is clean, now let's check the route algorithm. 1689N/A // ====================================================== 1689N/A // subordinate1 should be handled by w1 only 1689N/A // subordinate2 should be handled by w2 only 1689N/A // subordinate3 should be handled by w3 only 1689N/A // unrelatedDN should be handled by none of the workflows 1689N/A // ====================================================== 1689N/A // Remove a workflow in the chain and check that 1689N/A // the route algorithm is still working 1689N/A // ====================================================== 1689N/A // subordinate1 and subordinate2 should now be handled by w1 only 1689N/A // subordinate3 should be handled by w3 only 1689N/A // unrelatedDN should be handled by none of the workflows 1689N/A }
// createWorkflow_simpleTopology2 1689N/A * Create a topology of workflows. 1689N/A * There is no worklfow element attached to the DITs. 1689N/A * @param baseDn1 base DN for the top workflow (W1) 1689N/A * @param baseDN2 base DN for the first subordinate workflow (W2) 1689N/A * @param baseDN3 base DN for the second subordinate workflow (W3) 1689N/A * @param subordinateDN1 subordinate DN of baseDN1 1689N/A * @param subordinateDN2 subordinate DN of baseDN2 1689N/A * @param subordinateDN3 subordinate DN of baseDN3 1689N/A * @param unrelatedDN a DN not registered in any workflow 1689N/A // create DITs with the given baseDNs with no workflow element. 1689N/A // Put all the workflows in a pool 1689N/A // Create the workflow topology: to do so, try to insert each workflow 1689N/A // in the other workflows. This is basically how workflow topology is 1689N/A // built by the network group. 1689N/A // makes no sense to try to insert a workflow in itself! 1689N/A // let's do it anyway... but it should fail ;-) 1689N/A // W1 should have 2 subordinates: W2 and W3 1689N/A // W2 and W3 should have no subordinate 1689N/A // W1 should be the parent of W2 and W3 1689N/A // Check the route algorithm 1689N/A // ------------------------- 1689N/A // candidate for baseDN1 and subordinateBaseDN1 should be W1 1689N/A // candidate for baseDN2/3 and subordinateBaseDN2/3 should be W2/3 1689N/A // there should be no candidate for dummyDN 1689N/A }
// createWorkflow_complexTopology1 1689N/A * Test the elaboration of the global result code by the workflow. 1689N/A // Check the function that elaborates the global result code 2037N/A * Tests the workflow registration. 2037N/A // Create a workflow to handle the baseDN with no workflow element 2037N/A // Register the workflow with the server. Don't catch the 2037N/A // DirectoryException that could be thrown by the register() method. 2037N/A // Register the same workflow twice and catch the expected