Author: vpakan(a)redhat.com
Date: 2010-01-05 14:42:42 -0500 (Tue, 05 Jan 2010)
New Revision: 19652
Added:
trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/.classpath
trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/.project
trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/META-INF/
trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/META-INF/MANIFEST.MF
trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/bin/
trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/build.properties
trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/resources/
trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/resources/project.properties
trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/src/
trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/src/org/
trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/src/org/jboss/
trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/src/org/jboss/tools/
trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/src/org/jboss/tools/struts/
trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/src/org/jboss/tools/struts/ui/
trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/src/org/jboss/tools/struts/ui/bot/
trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/src/org/jboss/tools/struts/ui/bot/test/
trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/src/org/jboss/tools/struts/ui/bot/test/Activator.java
trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/src/org/jboss/tools/struts/ui/bot/test/StrutsAllBotTests.java
trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/src/org/jboss/tools/struts/ui/bot/test/smoke/
trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/src/org/jboss/tools/struts/ui/bot/test/smoke/CreateNewStrutsProjectTest.java
Modified:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTEclipseExt.java
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTTestExt.java
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/EntityType.java
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/ViewType.java
Log:
Added SWTBot tests for Struts
Modified:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTEclipseExt.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTEclipseExt.java 2010-01-05
19:36:48 UTC (rev 19651)
+++
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTEclipseExt.java 2010-01-05
19:42:42 UTC (rev 19652)
@@ -15,6 +15,7 @@
import static org.junit.Assert.fail;
import java.io.File;
+import java.util.Iterator;
import org.apache.log4j.Logger;
import org.eclipse.swt.widgets.Shell;
@@ -23,7 +24,10 @@
import org.eclipse.swtbot.eclipse.finder.waits.Conditions;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor;
import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
import org.hamcrest.Matcher;
import org.jboss.tools.ui.bot.ext.entity.JavaClassEntity;
@@ -32,6 +36,7 @@
import org.jboss.tools.ui.bot.ext.types.IDELabel;
import org.jboss.tools.ui.bot.ext.types.PerspectiveType;
import org.jboss.tools.ui.bot.ext.types.ViewType;
+import org.jboss.tools.ui.bot.ext.types.IDELabel.PreferencesDialog;
/**
* Provides Eclipse common operation based on SWTBot element operations
@@ -238,13 +243,23 @@
*/
public void createNew(EntityType entityType) {
- String groupLabel = entityType.getGroupLabel();
- String entityLabel = entityType.getEntityLabel();
-
bot.menu(IDELabel.Menu.FILE).menu(IDELabel.Menu.NEW).menu(IDELabel.Menu.OTHER).click();
waitForShell(IDELabel.Shell.NEW);
-
- bot.tree().expandNode(groupLabel).select(entityLabel);
+
+ String entityLabel = entityType.getEntityLabel();
+ SWTBotTree tree = bot.tree();
+ Iterator<String> itGroupsNodes = entityType.getGroupsLabels().iterator();
+ // if there are group labels defined expand groups nodes
+ if (itGroupsNodes.hasNext()){
+ SWTBotTreeItem groupTreeItem = tree.expandNode(itGroupsNodes.next());
+ while (itGroupsNodes.hasNext()){
+ groupTreeItem = groupTreeItem.expandNode(itGroupsNodes.next());
+ }
+ groupTreeItem.select(entityLabel);
+ }
+ else{
+ tree.select(entityLabel);
+ }
bot.button(IDELabel.Button.NEXT).click();
}
@@ -324,5 +339,57 @@
if (save)
editor.save();
}
-
+ /**
+ * Define new Server Runtime only if it's not specified yet
+ * @param runtimeName
+ * @param runtimeGroup
+ * @param runtimeType
+ * @param runtimeHomeDir
+ */
+ public void addServerRuntime (String runtimeName, String runtimeGroup,
+ String runtimeType, String runtimeHomeDir){
+
+ bot.menu(IDELabel.Menu.WINDOW).menu(IDELabel.Menu.PREFERENCES).click();
+ bot.shell(IDELabel.Shell.PREFERENCES).activate();
+ bot.tree().expandNode(IDELabel.PreferencesDialog.SERVER_GROUP)
+ .select(PreferencesDialog.RUNTIME_ENVIRONMENTS);
+ SWTBotTable tbRuntimeEnvironments = bot.table();
+ boolean createRuntime = true;
+ // first check if Environment doesn't exist
+ int numRows = tbRuntimeEnvironments.rowCount();
+ if (numRows > 0){
+ int currentRow = 0;
+ while (createRuntime && numRows < currentRow){
+ if
(tbRuntimeEnvironments.getTableItem(currentRow).getText(0).equalsIgnoreCase(runtimeName)){
+ createRuntime = false;
+ }
+ else {
+ currentRow++;
+ }
+ }
+ }
+ // create Server Runtime
+ if (createRuntime){
+ bot.button(IDELabel.Button.ADD).click();
+ bot.shell(IDELabel.Shell.NEW_SERVER_RUNTIME_ENVIRONMENT).activate();
+ bot.tree().expandNode(runtimeGroup).select(runtimeType);
+ bot.button("Next >").click();
+ bot.textWithLabel(IDELabel.JBossServerRuntimeDialog.NAME).setText(runtimeName);
+
bot.textWithLabel(IDELabel.JBossServerRuntimeDialog.HOME_DIRECTORY).setText(runtimeHomeDir);
+ bot.button(IDELabel.Button.FINISH).click();
+ bot.button(IDELabel.Button.OK).click();
+ }
+
+ }
+
+ public static boolean treeContainsItemWithLabel(SWTBotTree tree, String itemLabel){
+ boolean containsItem = false;
+ try {
+ tree.getTreeItem(itemLabel);
+ containsItem = true;
+ } catch (WidgetNotFoundException e) {
+ }
+ return containsItem;
+ }
+
}
Modified:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTTestExt.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTTestExt.java 2010-01-05
19:36:48 UTC (rev 19651)
+++
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTTestExt.java 2010-01-05
19:42:42 UTC (rev 19652)
@@ -30,7 +30,7 @@
// Views
public static final PackageExplorer packageExplorer = new PackageExplorer();
- private static Properties properties;
+ public static Properties properties;
/**
* Get properties for hibernate tests
Modified:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/EntityType.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/EntityType.java 2010-01-05
19:36:48 UTC (rev 19651)
+++
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/EntityType.java 2010-01-05
19:42:42 UTC (rev 19652)
@@ -12,25 +12,28 @@
import static org.junit.Assert.fail;
+import java.util.LinkedList;
+import java.util.List;
+
/**
* Provides functionality for evaluation particular entity location like projects types,
file types, etc.
* @author jpeterka
*/
public enum EntityType {
HIBERNATE_MAPPING_FILE, JAVA_PROJECT, JAVA_CLASS, HIBERNATE_REVERSE_FILE,
HIBERNATE_CONSOLE,
- HIBERNATE_CONFIGURATION_FILE;
+ HIBERNATE_CONFIGURATION_FILE, STRUTS_PROJECT;
- public String getGroupLabel() {
- String groupLabel = "";
+ public List<String> getGroupsLabels() {
+ List<String> groupLabel = new LinkedList<String>();
-
switch (this) {
- case HIBERNATE_MAPPING_FILE: groupLabel = IDELabel.EntityGroup.HIBERNATE; break;
- case JAVA_PROJECT: groupLabel = IDELabel.EntityGroup.JAVA; break;
- case JAVA_CLASS: groupLabel = IDELabel.EntityGroup.JAVA; break;
- case HIBERNATE_REVERSE_FILE: groupLabel = IDELabel.EntityGroup.HIBERNATE; break;
- case HIBERNATE_CONFIGURATION_FILE: groupLabel = IDELabel.EntityGroup.HIBERNATE; break;
- case HIBERNATE_CONSOLE: groupLabel = IDELabel.EntityGroup.HIBERNATE; break;
+ case HIBERNATE_MAPPING_FILE: groupLabel.add(IDELabel.EntityGroup.HIBERNATE); break;
+ case JAVA_PROJECT: groupLabel.add(IDELabel.EntityGroup.JAVA); break;
+ case JAVA_CLASS: groupLabel.add(IDELabel.EntityGroup.JAVA); break;
+ case HIBERNATE_REVERSE_FILE: groupLabel.add(IDELabel.EntityGroup.HIBERNATE); break;
+ case HIBERNATE_CONFIGURATION_FILE: groupLabel.add(IDELabel.EntityGroup.HIBERNATE);
break;
+ case HIBERNATE_CONSOLE: groupLabel.add(IDELabel.EntityGroup.HIBERNATE); break;
+ case STRUTS_PROJECT: groupLabel.add(IDELabel.EntityGroup.JBOSS_TOOLS_WEB);
groupLabel.add(IDELabel.EntityGroup.STRUTS);break;
default: fail("Unknown Entity Type");
}
@@ -51,6 +54,7 @@
case HIBERNATE_CONSOLE: entityLabel = IDELabel.EntityLabel.HIBERNATE_CONSOLE; break;
case JAVA_PROJECT: entityLabel = IDELabel.EntityLabel.JAVA_PROJECT; break;
case JAVA_CLASS: entityLabel = IDELabel.EntityLabel.JAVA_CLASS; break;
+ case STRUTS_PROJECT: entityLabel = IDELabel.EntityLabel.STRUTS_PROJECT; break;
default: fail("Unknown Entity Type");
}
Modified:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java 2010-01-05
19:36:48 UTC (rev 19651)
+++
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java 2010-01-05
19:42:42 UTC (rev 19652)
@@ -54,6 +54,8 @@
public static final String JBT_REMOVE_JSF_CAPABILITIES = "Remove JSF
Capabilities";
public static final String START = "Start";
public static final String STOP = "Stop";
+ public static final String STRUTS_PROJECT = "Struts Project";
+ public static final String PREFERENCES = "Preferences";
}
@@ -68,6 +70,7 @@
public static final String CLOSE = "Close";
public static final String RUN = "Run";
public static final String APPLY = "Apply";
+ public static final String ADD = "Add...";
}
public class Shell {
@@ -86,12 +89,18 @@
public static final String IMPORT_JSF_PROJECT = "Import JSF Project";
public static final String IMPORT = "Import";
public static final String DELETE_SERVER = "Delete Server";
+ public static final String NEW_STRUTS_PROJECT = "New Struts Project";
+ public static final String PREFERENCES = "Preferences";
+ public static final String NEW_SERVER_RUNTIME_ENVIRONMENT = "New Server Runtime
Environment";
+ public static final String OPEN_ASSOCIATED_PERSPECTIVE = "Open Associated
Perspective?";
}
public class EntityGroup {
public static final String HIBERNATE = "Hibernate";
public static final String JAVA = "Java";
public static final String SEAM = "Seam";
+ public static final String STRUTS = "Struts";
+ public static final String JBOSS_TOOLS_WEB = "JBoss Tools Web";
}
public class EntityLabel {
@@ -102,6 +111,7 @@
public static final String JAVA_PROJECT = "Java Project";
public static final String SEAM_PROJECT = "Seam Web Project";
public static final String HIBERNATE_CONFIGURATION_FILE = "Hibernate Configuration
File (cfg.xml)";
+ public static final String STRUTS_PROJECT = "Struts Project";
}
public class JavaProjectWizard {
@@ -125,6 +135,7 @@
public static final String PACKAGE_EXPLORER = "Package Explorer";
public static final String DATA_SOURCE_EXPLORER = "Data Source Explorer";
public static final String SERVERS = "Servers";
+ public static final String WEB_PROJECTS = "Web Projects";
}
public class ViewGroup {
@@ -132,6 +143,7 @@
public static final String JAVA = "Java";
public static final String DATA_MANAGEMENT = "Data Management";
public static final String SERVER = "Server";
+ public static final String JBOSS_TOOLS_WEB = "JBoss Tools Web";
}
public class SelectPerspectiveDialog {
@@ -246,4 +258,37 @@
public static final String CHOICE_LIST_IS_EMPTY = "Choice list is
empty.";
}
+
+ public class NewStrutsProjectDialog{
+
+ public static final String NAME = "Project Name*";
+ public static final String TEMPLATE = "Template*";
+ public static final String TEMPLATE_KICK_START = "KickStart";
+
+ }
+
+ public static class PreferencesDialog {
+
+ public static final String SERVER_GROUP = "Server";
+ public static final String RUNTIME_ENVIRONMENTS = "Runtime Environments";
+
+ }
+
+ public static class JBossServerRuntimeDialog {
+
+ public static final String NAME = "Name";
+ public static final String HOME_DIRECTORY = "Home Directory";
+
+ }
+ public static final class ServerGroup {
+
+ public static final String JBOSS_EAP_4_3 = "JBoss Enterprise Middleware";
+
+ }
+ public static final class ServerType {
+
+ public static final String JBOSS_EAP_4_3 = "JBoss Enterprise Application
Platform 4.3 Runtime";
+
+ }
+
}
Modified:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/ViewType.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/ViewType.java 2010-01-05
19:36:48 UTC (rev 19651)
+++
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/ViewType.java 2010-01-05
19:42:42 UTC (rev 19652)
@@ -18,7 +18,7 @@
*
*/
public enum ViewType {
- PACKAGE_EXPLORER, PROJECT_EXPLORER, WELCOME, DATA_SOURCE_EXPLORER,SERVERS;
+ PACKAGE_EXPLORER, PROJECT_EXPLORER, WELCOME, DATA_SOURCE_EXPLORER,SERVERS,WEB_PROJECTS;
public String getGroupLabel() {
@@ -28,6 +28,7 @@
case PACKAGE_EXPLORER: viewLabel = IDELabel.ViewGroup.JAVA; break;
case DATA_SOURCE_EXPLORER: viewLabel = IDELabel.ViewGroup.DATA_MANAGEMENT; break;
case SERVERS: viewLabel = IDELabel.ViewGroup.SERVER; break;
+ case WEB_PROJECTS: viewLabel = IDELabel.ViewGroup.JBOSS_TOOLS_WEB; break;
default: fail("Unknown View Type");
}
return viewLabel;
@@ -40,6 +41,7 @@
case PACKAGE_EXPLORER: viewLabel = IDELabel.View.PACKAGE_EXPLORER; break;
case DATA_SOURCE_EXPLORER: viewLabel = IDELabel.View.DATA_SOURCE_EXPLORER; break;
case SERVERS: viewLabel = IDELabel.View.SERVERS; break;
+ case WEB_PROJECTS: viewLabel = IDELabel.View.WEB_PROJECTS; break;
default: fail("Unknown View Type");
}
return viewLabel;
Added: trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/.classpath
===================================================================
--- trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/.classpath
(rev 0)
+++ trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/.classpath 2010-01-05 19:42:42
UTC (rev 19652)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con"
path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" path="resources"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Property changes on: trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/.classpath
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/.project
===================================================================
--- trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/.project
(rev 0)
+++ trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/.project 2010-01-05 19:42:42 UTC
(rev 19652)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.struts.ui.bot.test</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Property changes on: trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/.project
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/META-INF/MANIFEST.MF
(rev 0)
+++ trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/META-INF/MANIFEST.MF 2010-01-05
19:42:42 UTC (rev 19652)
@@ -0,0 +1,19 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Struts UI SWTBot Tests
+Bundle-SymbolicName: org.jboss.tools.struts.ui.bot.test
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.jboss.tools.struts.ui.bot.test.Activator
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.jboss.tools.jst.ui.bot.test;bundle-version="1.0.0",
+ org.eclipse.swtbot.eclipse.core;bundle-version="2.0.0",
+ org.eclipse.swtbot.eclipse.finder;bundle-version="2.0.0",
+ org.eclipse.swtbot.eclipse.spy;bundle-version="2.0.0",
+ org.eclipse.swtbot.eclipse.ui;bundle-version="2.0.0",
+ org.eclipse.swtbot.swt.finder;bundle-version="2.0.0",
+ org.junit4;bundle-version="4.5.0",
+ org.jboss.tools.ui.bot.ext;bundle-version="1.0.0"
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-Vendor: JBoss by Red Hat
Property changes on:
trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/META-INF/MANIFEST.MF
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/build.properties
===================================================================
--- trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/build.properties
(rev 0)
+++ trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/build.properties 2010-01-05
19:42:42 UTC (rev 19652)
@@ -0,0 +1,4 @@
+source.. = src/,resources/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
Property changes on:
trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/build.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/resources/project.properties
===================================================================
--- trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/resources/project.properties
(rev 0)
+++
trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/resources/project.properties 2010-01-05
19:42:42 UTC (rev 19652)
@@ -0,0 +1 @@
+JBossEap4.3Home=/opt/jboss-eap-4.3/jboss-as
Property changes on:
trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/resources/project.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/src/org/jboss/tools/struts/ui/bot/test/Activator.java
===================================================================
---
trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/src/org/jboss/tools/struts/ui/bot/test/Activator.java
(rev 0)
+++
trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/src/org/jboss/tools/struts/ui/bot/test/Activator.java 2010-01-05
19:42:42 UTC (rev 19652)
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.struts.ui.bot.test;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ *
+ * @author Vladimir Pakan
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.jboss.tools.struts.ui.bot.test";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
Property changes on:
trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/src/org/jboss/tools/struts/ui/bot/test/Activator.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/src/org/jboss/tools/struts/ui/bot/test/StrutsAllBotTests.java
===================================================================
---
trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/src/org/jboss/tools/struts/ui/bot/test/StrutsAllBotTests.java
(rev 0)
+++
trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/src/org/jboss/tools/struts/ui/bot/test/StrutsAllBotTests.java 2010-01-05
19:42:42 UTC (rev 19652)
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.struts.ui.bot.test;
+
+import org.jboss.tools.struts.ui.bot.test.smoke.CreateNewStrutsProjectTest;
+import org.jboss.tools.ui.bot.ext.SWTTestExt;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+
+/**
+ *
+ * This is struts swtbot testcase for JBoss Tools.
+ *
+ * @author Vladimir Pakan
+ *
+ */
+(a)RunWith(Suite.class)
+@SuiteClasses( {CreateNewStrutsProjectTest.class})
+public class StrutsAllBotTests extends SWTTestExt {
+ @BeforeClass
+ public static void setUp() {
+ properties = util.loadProperties(Activator.PLUGIN_ID);
+ eclipse.closeView(IDELabel.View.WELCOME);
+ }
+
+ @AfterClass
+ public static void tearDown() {
+ // Ready for later usage
+ }
+}
\ No newline at end of file
Property changes on:
trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/src/org/jboss/tools/struts/ui/bot/test/StrutsAllBotTests.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/src/org/jboss/tools/struts/ui/bot/test/smoke/CreateNewStrutsProjectTest.java
===================================================================
---
trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/src/org/jboss/tools/struts/ui/bot/test/smoke/CreateNewStrutsProjectTest.java
(rev 0)
+++
trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/src/org/jboss/tools/struts/ui/bot/test/smoke/CreateNewStrutsProjectTest.java 2010-01-05
19:42:42 UTC (rev 19652)
@@ -0,0 +1,62 @@
+ /*******************************************************************************
+ * Copyright (c) 2007-2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.struts.ui.bot.test.smoke;
+
+import static org.junit.Assert.assertTrue;
+
+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
+import org.jboss.tools.ui.bot.ext.SWTEclipseExt;
+import org.jboss.tools.ui.bot.ext.SWTTestExt;
+import org.jboss.tools.ui.bot.ext.types.EntityType;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
+import org.jboss.tools.ui.bot.ext.types.ViewType;
+import org.junit.Test;
+import org.jboss.tools.struts.ui.bot.test.StrutsAllBotTests;
+/**
+ * Test creating new Struts Project
+ * @author Vladimir Pakan
+ *
+ */
+public class CreateNewStrutsProjectTest extends SWTTestExt{
+
+ public static final String STRUTS_PROJECT_NAME = "strutsTest";
+
+ @Test
+ public void testCreateNewStrutsProject() {
+
+ // Test create new Struts Project
+ eclipse.showView(ViewType.WEB_PROJECTS);
+ eclipse.addServerRuntime(IDELabel.ServerRuntimeName.JBOSS_EAP_4_3,
+ IDELabel.ServerGroup.JBOSS_EAP_4_3,
+ IDELabel.ServerType.JBOSS_EAP_4_3,
+ StrutsAllBotTests.getProperty("JBossEap4.3Home"));
+ eclipse.createNew(EntityType.STRUTS_PROJECT);
+ bot.shell(IDELabel.Shell.NEW_STRUTS_PROJECT).activate();
+ bot.textWithLabel(IDELabel.NewStrutsProjectDialog.NAME).setText(STRUTS_PROJECT_NAME);
+
bot.comboBoxWithLabel(IDELabel.NewStrutsProjectDialog.TEMPLATE).setSelection(IDELabel.NewStrutsProjectDialog.TEMPLATE_KICK_START);
+ bot.button(IDELabel.Button.NEXT).click();
+ bot.button(IDELabel.Button.NEXT).click();
+ bot.button(IDELabel.Button.FINISH).click();
+ // if Open Associated Perspective Shell is opened close it
+ try{
+ bot.shell(IDELabel.Shell.OPEN_ASSOCIATED_PERSPECTIVE).activate();
+ bot.button(IDELabel.Button.NO).click();
+ } catch (WidgetNotFoundException wnfe){
+ // do nothing
+ }
+
+ assertTrue("Project "+ STRUTS_PROJECT_NAME + " was not created
properly.",
+
SWTEclipseExt.treeContainsItemWithLabel(bot.viewByTitle(IDELabel.View.WEB_PROJECTS).bot().tree(),STRUTS_PROJECT_NAME));
+
+ }
+
+}
Property changes on:
trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/src/org/jboss/tools/struts/ui/bot/test/smoke/CreateNewStrutsProjectTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain