/*
* 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.
*/
/**
* A base class for all tasks test cases.
*/
/**
* Add a task definition and check that it completes with the expected state.
* The task is expected to complete quickly and the timeout is set
* accordingly.
* @param taskEntry The task entry.
* @param expectedState The expected completion state of the task.
* @throws Exception If the test fails.
*/
throws Exception
{
}
/**
* Add a task definition and check that it completes with the expected state.
* @param taskEntry The task entry.
* @param expectedState The expected completion state of the task.
* @param timeout The number of seconds to wait for the task to complete.
* @throws Exception If the test fails.
*/
throws Exception
{
// Add the task.
"Add of the task definition was not successful");
// Wait until the task completes.
do
{
filter);
try
{
} catch (Exception e)
{
// FIXME How is this possible? Must be issue 858.
// fail("Task entry was not returned from the search.");
continue;
}
if (completionTime == null)
{
{
break;
}
}
} while (completionTime == null);
if (completionTime == null)
{
}
// Check that the task state is as expected.
"The task completed in an unexpected state");
// Check that the task contains some log messages.
{
fail("No log messages were written to the task entry on a failed task");
}
}
/**
* Retrieves the specified task from the server, regardless of its current
* state.
*
* @param taskEntryDN The DN of the entry for the task to retrieve.
*
* @return The requested task entry.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
{
{
}
}
{
throw new AssertionError("There is no such task " +
taskEntryDN.toString());
}
return task;
}
/**
* Retrieves the specified task from the server, waiting for it to finish all
* the running its going to do before returning.
*
* @param taskEntryDN The DN of the entry for the task to retrieve.
*
* @return The requested task entry.
*
* @throws Exception If an unexpected problem occurs.
*/
throws Exception
{
{
{
}
}
{
" did not complete in a timely manner.");
}
return task;
}
}