public void testExportImportDsmlWithGermanUmlautInDN() throws Exception
{
URL url = Platform.getInstanceLocation().getURL();
String file = url.getFile() + "ImportExportTest.dsml";
final SWTBotTree browserTree = SWTBotUtils.getLdapBrowserTree( bot );
SWTBotUtils.selectEntry( bot, browserTree, false, "DIT", "Root DSE", "ou=system", "ou=users",
"cn=Wolfgang K\u00f6lbel" );
bot.sleep( 2000 );
// export DSML
SWTBotUtils.asyncClick( bot, browserTree.contextMenu( "DSML Export..." ), new DefaultCondition()
{
public boolean test() throws Exception
{
return bot.shell( "DSML Export" ) != null;
}
public String getFailureMessage()
{
return "Could not find dialog 'DSML Export'";
}
} );
bot.button( "Next >" ).click();
bot.comboBoxWithLabel( "DSML File:" ).setText( file );
bot.radio( "DSML Request" ).click();
bot.button( "Finish" ).click();
// verify that exported DSML contains the Base64 encoded DN
String content = FileUtils.readFileToString( new File( file ) );
assertTrue( "DSML must contain DN with umlaut.", content
.contains( "dn=\"cn=Wolfgang Kölbel,ou=users,ou=system\"" ) );
// delete entry
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=users" );
}
public String getFailureMessage()
{
return "Could not select 'ou=system'";
}
} );
// import DSML
SWTBotUtils.asyncClick( bot, browserTree.contextMenu( "DSML Import..." ), new DefaultCondition()
{
public boolean test() throws Exception
{
return bot.shell( "DSML Import" ) != null;
}