directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r888740 - in /directory/studio/trunk: apacheds/ test-integration-ui/ test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/ test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/
Date Wed, 09 Dec 2009 09:09:59 GMT
Author: pamarcelot
Date: Wed Dec  9 09:09:58 2009
New Revision: 888740

URL: http://svn.apache.org/viewvc?rev=888740&view=rev
Log:
Added first basic UI test for the Apache DS plugin.

Added:
    directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/ApacheDSPluginTest.java
    directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ApacheDSServersViewBot.java
    directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/NewApacheDSServerWizardBot.java
Modified:
    directory/studio/trunk/apacheds/pom.xml
    directory/studio/trunk/test-integration-ui/pom.xml
    directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ConnectionsViewBot.java
    directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/StudioBot.java

Modified: directory/studio/trunk/apacheds/pom.xml
URL: http://svn.apache.org/viewvc/directory/studio/trunk/apacheds/pom.xml?rev=888740&r1=888739&r2=888740&view=diff
==============================================================================
--- directory/studio/trunk/apacheds/pom.xml (original)
+++ directory/studio/trunk/apacheds/pom.xml Wed Dec  9 09:09:58 2009
@@ -126,8 +126,9 @@
             <Embed-Directory>lib</Embed-Directory>
             <Embed-StripGroup>true</Embed-StripGroup>
             <Embed-Transitive>true</Embed-Transitive>
-            <Export-Package>!*</Export-Package>
-            <Import-Package>!*</Import-Package>
+            <Export-Package>org.apache.directory.studio.apacheds.*</Export-Package>
+            <Import-Package>!</Import-Package>
+            <Private-Package>!</Private-Package>
           </instructions>
         </configuration>
         <executions>

Modified: directory/studio/trunk/test-integration-ui/pom.xml
URL: http://svn.apache.org/viewvc/directory/studio/trunk/test-integration-ui/pom.xml?rev=888740&r1=888739&r2=888740&view=diff
==============================================================================
--- directory/studio/trunk/test-integration-ui/pom.xml (original)
+++ directory/studio/trunk/test-integration-ui/pom.xml Wed Dec  9 09:09:58 2009
@@ -263,6 +263,7 @@
  org.apache.directory.studio.ldapbrowser.common,
  org.apache.directory.studio.ldapbrowser.core,
  org.apache.directory.studio.ldapbrowser.ui,
+ org.apache.directory.studio.apacheds,
  org.junit4,
  org.eclipse.swtbot.junit4_x,
  org.eclipse.swtbot.swt.finder,
@@ -369,6 +370,11 @@
       <artifactId>ldapbrowser.ui</artifactId>
       <scope>provided</scope>
     </dependency>
+    <dependency>
+      <groupId>org.apache.directory.studio</groupId>
+      <artifactId>apacheds</artifactId>
+      <scope>provided</scope>
+    </dependency>
     
     <dependency>
       <groupId>org.eclipse.swtbot.swt</groupId>

Added: directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/ApacheDSPluginTest.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/ApacheDSPluginTest.java?rev=888740&view=auto
==============================================================================
--- directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/ApacheDSPluginTest.java
(added)
+++ directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/ApacheDSPluginTest.java
Wed Dec  9 09:09:58 2009
@@ -0,0 +1,79 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.studio.test.integration.ui;
+
+
+import org.apache.directory.studio.test.integration.ui.bots.ApacheDSServersViewBot;
+import org.apache.directory.studio.test.integration.ui.bots.NewApacheDSServerWizardBot;
+import org.apache.directory.studio.test.integration.ui.bots.StudioBot;
+import org.junit.Before;
+import org.junit.Test;
+
+
+/**
+ * Tests the Apache DS Plugin's UI.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ApacheDSPluginTest
+{
+    private StudioBot studioBot;
+    private ApacheDSServersViewBot serversViewBot;
+
+
+    @Before
+    public void setUp() throws Exception
+    {
+        studioBot = new StudioBot();
+        studioBot.resetLdapPerspective();
+        serversViewBot = studioBot.getApacheDSServersViewBot();
+    }
+
+
+    @Test
+    public void basicTest() throws InterruptedException
+    {
+        // Showing view
+        serversViewBot.show();
+
+        // Opening wizard
+        NewApacheDSServerWizardBot wizardBot = serversViewBot.openNewServerWizard();
+
+        // Filling fields of the wizard
+        String serverName = "NewServerWizardTest";
+        wizardBot.typeServerName( serverName );
+
+        // Closing wizard
+        wizardBot.clickFinishButton();
+        serversViewBot.waitForServer( serverName );
+
+        // Starting the server
+        serversViewBot.runServer( serverName );
+        serversViewBot.waitForServerStart( serverName );
+
+        // Stopping the server
+        serversViewBot.stopServer( serverName );
+        serversViewBot.waitForServerStop( serverName );
+
+        // Ensure the server was created
+    }
+}

Added: directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ApacheDSServersViewBot.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ApacheDSServersViewBot.java?rev=888740&view=auto
==============================================================================
--- directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ApacheDSServersViewBot.java
(added)
+++ directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ApacheDSServersViewBot.java
Wed Dec  9 09:09:58 2009
@@ -0,0 +1,182 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.studio.test.integration.ui.bots;
+
+
+import org.apache.directory.studio.apacheds.model.Server;
+import org.apache.directory.studio.apacheds.model.ServerStateEnum;
+import org.apache.directory.studio.apacheds.model.ServersHandler;
+import org.apache.directory.studio.test.integration.ui.ContextMenuHelper;
+import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
+import org.eclipse.swtbot.swt.finder.waits.DefaultCondition;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+
+
+public class ApacheDSServersViewBot
+{
+    private SWTWorkbenchBot bot = new SWTWorkbenchBot();
+
+    private SWTBotView view;
+
+
+    public ApacheDSServersViewBot()
+    {
+        view = new SWTWorkbenchBot().viewByTitle( "Servers" );
+    }
+
+
+    public void show()
+    {
+        view.show();
+    }
+
+
+    public NewApacheDSServerWizardBot openNewServerWizard()
+    {
+        ContextMenuHelper.clickContextMenu( getServersTree(), "New", "New &Server" );
+        return new NewApacheDSServerWizardBot();
+    }
+
+
+    private SWTBotTree getServersTree()
+    {
+        view.show();
+        SWTBotTree tree = view.bot().tree();
+        return tree;
+    }
+
+
+    private SWTBotTable getServersTable()
+    {
+        view.show();
+        SWTBotTable table = view.bot().table();
+        return table;
+    }
+
+
+    public void selectServer( String serverName )
+    {
+        getServersTree().select( serverName );
+    }
+
+
+    public void runServer( String serverName )
+    {
+        getServersTree().select( serverName );
+        ContextMenuHelper.clickContextMenu( getServersTree(), "&Run" );
+    }
+    
+    public void stopServer( String serverName )
+    {
+        getServersTree().select( serverName );
+        ContextMenuHelper.clickContextMenu( getServersTree(), "S&top" );
+    }
+
+
+    public void waitForServer( final String serverName )
+    {
+        bot.waitUntil( new DefaultCondition()
+        {
+            public boolean test() throws Exception
+            {
+                for ( SWTBotTreeItem item : getServersTree().getAllItems() )
+                {
+                    String text = item.getText();
+                    if ( text.startsWith( serverName ) )
+                    {
+                        return true;
+                    }
+                }
+                return false;
+            }
+
+
+            public String getFailureMessage()
+            {
+                return "Server " + serverName + " not visible in servers view.";
+            }
+        } );
+    }
+
+
+    public void waitForServerStart( final String serverName )
+    {
+        bot.waitUntil( new DefaultCondition()
+        {
+            public boolean test() throws Exception
+            {
+                Server server = getServer( serverName );
+                if ( server != null )
+                {
+                    return ( ServerStateEnum.STARTED == server.getState() );
+                }
+
+                return false;
+            }
+
+
+            public String getFailureMessage()
+            {
+                return "Server " + serverName + " not started in servers view.";
+            }
+        }, 20000 );
+    }
+
+
+    public void waitForServerStop( final String serverName )
+    {
+        bot.waitUntil( new DefaultCondition()
+        {
+            public boolean test() throws Exception
+            {
+                Server server = getServer( serverName );
+                if ( server != null )
+                {
+                    return ( ServerStateEnum.STOPPED == server.getState() );
+                }
+
+                return false;
+            }
+
+
+            public String getFailureMessage()
+            {
+                return "Server " + serverName + " not stopped in servers view.";
+            }
+        }, 10000 );
+    }
+
+
+    private Server getServer( String serverName )
+    {
+        for ( Server server : ServersHandler.getDefault().getServersList() )
+        {
+            if ( serverName.equals( server.getName() ) )
+            {
+                return server;
+            }
+        }
+
+        return null;
+    }
+}

Modified: directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ConnectionsViewBot.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ConnectionsViewBot.java?rev=888740&r1=888739&r2=888740&view=diff
==============================================================================
--- directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ConnectionsViewBot.java
(original)
+++ directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ConnectionsViewBot.java
Wed Dec  9 09:09:58 2009
@@ -95,7 +95,6 @@
     {
         bot.waitUntil( new DefaultCondition()
         {
-
             public boolean test() throws Exception
             {
                 for ( SWTBotTreeItem item : getConnectionsTree().getAllItems() )
@@ -112,10 +111,9 @@
 
             public String getFailureMessage()
             {
-                return "Connection " + connectionName + " not visible in connectoins view.";
+                return "Connection " + connectionName + " not visible in connections view.";
             }
         } );
-
     }
 
 

Added: directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/NewApacheDSServerWizardBot.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/NewApacheDSServerWizardBot.java?rev=888740&view=auto
==============================================================================
--- directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/NewApacheDSServerWizardBot.java
(added)
+++ directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/NewApacheDSServerWizardBot.java
Wed Dec  9 09:09:58 2009
@@ -0,0 +1,37 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.studio.test.integration.ui.bots;
+
+
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;
+
+
+public class NewApacheDSServerWizardBot extends WizardBot
+{
+
+    private static final String NAME = "Name:";
+
+
+    public void typeServerName( String serverName )
+    {
+        SWTBotText connText = bot.textWithLabel( NAME );
+        connText.setText( serverName );
+    }
+}

Modified: directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/StudioBot.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/StudioBot.java?rev=888740&r1=888739&r2=888740&view=diff
==============================================================================
--- directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/StudioBot.java
(original)
+++ directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/StudioBot.java
Wed Dec  9 09:09:58 2009
@@ -58,6 +58,7 @@
         return new ModificationLogsViewBot();
     }
     
+
     public ApacheDSServersViewBot getApacheDSServersViewBot()
     {
         return new ApacheDSServersViewBot();



Mime
View raw message