/*
* 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
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at
* trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
* add the following below this CDDL HEADER, with the fields enclosed
* by brackets "[]" replaced with your own identifying information:
* Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*
*
* Copyright 2006-2008 Sun Microsystems, Inc.
*/
/**
* A set of test cases for the dsservice tool.
*/
// The path to a file containing an invalid bind password.
// The path to a file containing a valid bind password.
/**
* Ensures that the Directory Server is running and performs other necessary
* setup.
*
* @throws Exception If an unexpected problem occurs.
*/
@BeforeClass()
public void before()
throws Exception
{
fileWriter.close();
fileWriter.close();
{
"create-ads",
"--noPropertiesFile",
"-w", "password",
"-X"
};
}
/**
* Ensures ADS is removed.
* @throws Exception If an unexpected problem occurs.
*/
@AfterClass()
public void afterClass()
throws Exception
{
// String[] args =
// {
// "delete-ads",
// "--noPropertiesFile",
// "-p", String.valueOf(TestCaseUtils.getServerAdminPort()),
// "-w", "password",
// "--backendName", "admin"
// };
//
// assertEquals(DsFrameworkCliMain.mainCLI(args, false, System.out,
// System.err), SUCCESSFUL.getReturnCode());
}
/**
* Tests list-groups with a malformed bind DN.
*/
@Test()
public void testMalformedBindDN()
{
{
"list-groups",
"--noPropertiesFile",
"-D", "malformed",
"-w", "password",
"-X"
};
== SUCCESSFUL.getReturnCode());
}
/**
* Tests list-groups with a nonexistent bind DN.
*/
@Test()
public void testNonExistentBindDN()
{
{
"list-groups",
"--noPropertiesFile",
"-D", "cn=Does Not Exist",
"-w", "password",
"-X"
};
== SUCCESSFUL.getReturnCode());
}
/**
* Tests list-groups with an invalid password.
*/
@Test()
public void testInvalidBindPassword()
{
{
"list-groups",
"--noPropertiesFile",
"-D", "cn=Directory Manager",
"-w", "wrongPassword",
"-X"
};
== SUCCESSFUL.getReturnCode());
}
/**
* Tests list-groups with a valid password read from a file.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test()
public void testValidPasswordFromFile()
throws Exception
{
{
"list-groups",
"--noPropertiesFile",
"-D", "cn=Directory Manager",
"-j", validPasswordFile,
"-X"
};
}
/**
* Tests list-groups with an invalid password read from a file.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test()
public void testInvalidPasswordFromFile()
throws Exception
{
{
"list-groups",
"--noPropertiesFile",
"-D", "cn=Directory Manager",
"-j",invalidPasswordFile,
"-X"
};
== SUCCESSFUL.getReturnCode());
}
/**
* Tests a list-groups over SSL using blind trust.
*/
@Test()
public void testListGroupsSSLBlindTrust()
{
{
"list-groups",
"--noPropertiesFile",
"-w", "password",
"-X"
};
}
/**
* Tests a list-groups over SSL using a trust store.
*/
@Test()
public void testListGroupsSSLTrustStore()
{
{
"list-groups",
"--noPropertiesFile",
"-w", "password",
"-P", trustStorePath
};
}
/**
* Tests the dsservice with the "--help" option.
*/
@Test()
public void testHelp()
{
}
}