Package net.sf.swtbot.widgets

Examples of net.sf.swtbot.widgets.SWTBotTree


   * @param treeLabel the label of the tree.
   * @return a wrapper around an tree with the specified label.
   * @throws WidgetNotFoundException if the widget is not found.
   */
  public SWTBotTree treeWithLabel(String treeLabel) throws WidgetNotFoundException {
    return new SWTBotTree(finder, treeLabel);
  }
View Full Code Here


   */
  public SWTBotTree tree(int index) throws WidgetNotFoundException {
    List findControls = finder.findControls(new ClassMatcher(Tree.class));
    if (findControls.isEmpty())
      throw new WidgetNotFoundException("Could not find any tree");
    return new SWTBotTree((Tree) findControls.get(index));
  }
View Full Code Here

   * @param treeLabel the label of the tree.
   * @return a wrapper around an tree with the specified label.
   * @throws WidgetNotFoundException if the widget is not found.
   */
  public SWTBotTree treeWithLabel(String treeLabel) throws WidgetNotFoundException {
    return new SWTBotTree(finder, treeLabel);
  }
View Full Code Here

   */
  public SWTBotTree tree(int index) throws WidgetNotFoundException {
    List findControls = finder.findControls(new ClassMatcher(Tree.class));
    if (findControls.isEmpty())
      throw new WidgetNotFoundException("Could not find any tree");
    return new SWTBotTree((Tree) findControls.get(index));
  }
View Full Code Here

     *
     * @throws Exception the exception
     */
    public static Connection createTestConnection( SWTEclipseBot bot, String name, int port ) throws Exception
    {
        SWTBotTree connectionsTree = getConnectionsTree( bot );

        ConnectionManager connectionManager = ConnectionCorePlugin.getDefault().getConnectionManager();
        ConnectionParameter connectionParameter = new ConnectionParameter();
        connectionParameter.setName( name );
        connectionParameter.setHost( "localhost" );
        connectionParameter.setPort( port );
        connectionParameter.setEncryptionMethod( EncryptionMethod.NONE );
        connectionParameter.setAuthMethod( AuthenticationMethod.SIMPLE );
        connectionParameter.setBindPrincipal( "uid=admin,ou=system" );
        connectionParameter.setBindPassword( "secret" );
        Connection connection = new Connection( connectionParameter );
        connectionManager.addConnection( connection );

        ConnectionFolderManager connectionFolderManager = ConnectionCorePlugin.getDefault()
            .getConnectionFolderManager();
        ConnectionFolder rootConnectionFolder = connectionFolderManager.getRootConnectionFolder();
        rootConnectionFolder.addConnectionId( connection.getId() );

        connectionsTree.select( name );
        //new OpenConnectionsJob( connection ).execute();

        Thread.sleep( 1000 );
        return connection;
    }
View Full Code Here

        List<Tree> findControls = new ControlFinder().findControls( view.widget, new ClassMatcher( Tree.class ), true );
        if ( findControls.isEmpty() )
        {
            throw new WidgetNotFoundException( "Could not find Connections tree" );
        }
        return new SWTBotTree( findControls.get( 0 ) );
    }
View Full Code Here

        List<Tree> findControls = new ControlFinder().findControls( view.widget, new ClassMatcher( Tree.class ), true );
        if ( findControls.isEmpty() )
        {
            throw new WidgetNotFoundException( "Could not find LDAP Browser tree" );
        }
        return new SWTBotTree( findControls.get( 0 ) );
    }
View Full Code Here

                    new ClassMatcher( Tree.class ), true );
                if ( findControls.isEmpty() )
                {
                    throw new WidgetNotFoundException( "Could not find Entry Editor tree" );
                }
                return new SWTBotTree( findControls.get( 0 ) );
            }
        }
        throw new WidgetNotFoundException( "Could not find Entry Editor tree" );
    }
View Full Code Here

    public void testExportImportLdifWithGermanUmlautInDN() throws Exception
    {
        URL url = Platform.getInstanceLocation().getURL();
        String file = url.getFile() + "ImportExportTest.ldif";

        final SWTBotTree browserTree = SWTBotUtils.getLdapBrowserTree( bot );

        SWTBotUtils.selectEntry( bot, browserTree, false, "DIT", "Root DSE", "ou=system", "ou=users",
            "cn=Wolfgang K\u00f6lbel" );

        // export LDIF
        SWTBotUtils.asyncClick( bot, browserTree.contextMenu( "LDIF Export..." ), new DefaultCondition()
        {
            public boolean test() throws Exception
            {
                return bot.shell( "LDIF Export" ) != null;
            }


            public String getFailureMessage()
            {
                return "Could not find dialog 'LDIF Export'";
            }
        } );
        bot.button( "Next >" ).click();
        bot.comboBoxWithLabel( "LDIF File:" ).setText( file );
        bot.button( "Finish" ).click();

        // verify that exported LDIF starts with the Base64 encoded DN
        String content = FileUtils.readFileToString( new File( file ) );
        assertTrue( "LDIF must start with Base64 encoded DN.", content
            .startsWith( "dn:: Y249V29sZmdhbmcgS8O2bGJlbCxvdT11c2VycyxvdT1zeXN0ZW0=" ) );

        // 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 LDIF
        SWTBotUtils.asyncClick( bot, browserTree.contextMenu( "LDIF Import..." ), new DefaultCondition()
        {
            public boolean test() throws Exception
            {
                return bot.shell( "LDIF Import" ) != null;
            }
View Full Code Here

    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;
            }
View Full Code Here

TOP

Related Classes of net.sf.swtbot.widgets.SWTBotTree

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.