DsconfigLdapConnectionTestCase.java revision ea1068c292e9b341af6d6b563cd8988a96be20a9
/*
* 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-2008 Sun Microsystems, Inc.
* Portions Copyright 2014-2015 ForgeRock AS
*/
/**
* A set of test cases for the DS service tool.
*/
public class DsconfigLdapConnectionTestCase extends DirectoryServerTestCase {
// The path to a file containing an invalid bind password.
private String invalidPasswordFile;
// The path to a file containing a valid bind password.
private String validPasswordFile;
/**
* Ensures that the Directory Server is running and performs other necessary
* setup.
*
* @throws Exception If an unexpected problem occurs.
*/
public void before()
throws Exception
{
fileWriter.close();
fileWriter.close();
}
/**
* Ensures ADS is removed.
* @throws Exception If an unexpected problem occurs.
*/
public void afterClass()
throws Exception
{
}
/**
* Tests list-list-connection-handlers with a malformed bind DN.
*/
@Test
public void testMalformedBindDN()
{
{
"-n",
"--noPropertiesFile",
"-Q",
"list-connection-handlers",
"-D", "malformed",
"-w", "password",
"-X"
};
}
/**
* Tests list-connection-handlers with a nonexistent bind DN.
*/
@Test
public void testNonExistentBindDN()
{
{
"-n",
"--noPropertiesFile",
"-Q",
"list-connection-handlers",
"-D", "cn=Does Not Exist",
"-w", "password",
"-X"
};
}
/**
* --bindPassword and the --bindPasswordFile arguments can not be provided
* together.
*/
@Test
public void testConflictualArgumentsPasswordAndFilePassword()
{
{
"-n",
"--noPropertiesFile",
"-Q",
"list-connection-handlers",
"-D", "cn=Directory Manager",
"-w", "password",
"-j", validPasswordFile,
"-X"
};
}
/**
* Quiet mode and verbose arguments can not be provided
* together.
*/
@Test
public void testConflictualArgumentsQuietAndVerbose()
{
{
"-n",
"--noPropertiesFile",
"-Q",
"list-connection-handlers",
"-D", "cn=Directory Manager",
"-w", "password",
"-v",
"-X"
};
}
/**
* Tests list-connection-handlers with an invalid password.
*/
@Test
public void testInvalidBindPassword()
{
{
"-n",
"--noPropertiesFile",
"-Q",
"list-connection-handlers",
"-D", "cn=Directory Manager",
"-w", "wrongPassword",
"-X"
};
}
/**
* Tests list-connection-handlers with an valid password.
*/
@Test
public void testValidBindPassword()
{
{
"-n",
"--noPropertiesFile",
"-Q",
"list-connection-handlers",
"-D", "cn=Directory Manager",
"-w", "password",
"-X"
};
}
/**
* Tests list-connection-handlers with a valid password read from a file.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testValidPasswordFromFile()
throws Exception
{
{
"-n",
"--noPropertiesFile",
"-Q",
"list-connection-handlers",
"-D", "cn=Directory Manager",
"-j", validPasswordFile,
"-X"
};
}
/**
* Tests list-connection-handlers with an invalid password read from a file.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testInvalidPasswordFromFile()
throws Exception
{
{
"-n",
"--noPropertiesFile",
"-Q",
"list-connection-handlers",
"-D", "cn=Directory Manager",
"-j",invalidPasswordFile,
"-X"
};
}
/**
* Tests list-connection-handlers over SSL using a trust store.
*/
@Test
public void testListConnectionHandlersSSLTrustStore()
{
{
"-n",
"--noPropertiesFile",
"-Q",
"list-connection-handlers",
"-D", "cn=Directory Manager",
"-w", "password",
"-P", trustStorePath
};
}
/**
* Tests the dsconfig with the "--help" option.
*/
@Test
public void testHelp()
{
}
}