private void createAndDeleteEntry( final SWTBotTree browserTree, final String name ) throws Exception
{
SWTBotUtils.selectEntry( bot, browserTree, true, "DIT", "Root DSE", "ou=system" );
SWTBotUtils.asyncClick( bot, browserTree.contextMenu( "New Entry..." ), new DefaultCondition()
{
public boolean test() throws Exception
{
return bot.shell( "New Entry" ) != null;
}
public String getFailureMessage()
{
return "Could not find dialog 'New Entry'";
}
} );
bot.radio( "Create entry from scratch" ).click();
bot.button( "Next >" ).click();
bot.table( 0 ).select( "organization" );
bot.button( "Add" ).click();
bot.button( "Next >" ).click();
SWTBotCombo typeCombo = bot.comboBox( "" );
typeCombo.setText( "o" );
SWTBotText valueText = bot.text( "" );
valueText.setText( name );
SWTBotUtils.asyncClick( bot, bot.button( "Next >" ), new DefaultCondition()
{
public boolean test() throws Exception
{
return bot.button( "Finish" ).isEnabled();
}
public String getFailureMessage()
{
return "Finish button is not enabled";
}
} );
// click finish to create the entry
SWTBotUtils.asyncClick( bot, bot.button( "Finish" ), new DefaultCondition()
{
public boolean test() throws Exception
{
return browserTree.selection().get( 0 ).get( 0 ).startsWith( "o=" + name );
}
public String getFailureMessage()
{
return "Could not select 'o=" + name + "'";
}
} );
// delete the entry
SWTBotUtils.selectEntry( bot, browserTree, false, "DIT", "Root DSE", "ou=system", "o=" + name );
SWTBotUtils.asyncClick( bot, browserTree.contextMenu( "Delete Entry" ), new DefaultCondition()
{
public boolean test() throws Exception
{
return bot.shell( "Delete Entry" ) != null;
}
public String getFailureMessage()
{
return "Could not find dialog 'New Entry'";
}
} );
SWTBotUtils.asyncClick( bot, bot.button( "OK" ), new DefaultCondition()
{
public boolean test() throws Exception
{
return browserTree.selection().get( 0 ).get( 0 ).startsWith( "ou=system" );
}