Author: vpakan(a)redhat.com
Date: 2010-04-07 11:39:40 -0400 (Wed, 07 Apr 2010)
New Revision: 21318
Added:
trunk/drools/tests/.classpath
trunk/drools/tests/.project
trunk/drools/tests/.settings/
trunk/drools/tests/.settings/org.eclipse.jdt.core.prefs
trunk/drools/tests/META-INF/
trunk/drools/tests/META-INF/MANIFEST.MF
trunk/drools/tests/build.properties
trunk/drools/tests/screenshots/
trunk/drools/tests/screenshots/screenshot-ManageDroolsProject.testManageDroolsProject.jpeg
trunk/drools/tests/screenshots/screenshot-ManageDroolsRuntime.testManageDroolsRuntime.jpeg
trunk/drools/tests/src/
trunk/drools/tests/src/org/
trunk/drools/tests/src/org/jboss/
trunk/drools/tests/src/org/jboss/tools/
trunk/drools/tests/src/org/jboss/tools/drools/
trunk/drools/tests/src/org/jboss/tools/drools/ui/
trunk/drools/tests/src/org/jboss/tools/drools/ui/bot/
trunk/drools/tests/src/org/jboss/tools/drools/ui/bot/test/
trunk/drools/tests/src/org/jboss/tools/drools/ui/bot/test/Activator.java
trunk/drools/tests/src/org/jboss/tools/drools/ui/bot/test/DroolsAllBotTests.java
trunk/drools/tests/src/org/jboss/tools/drools/ui/bot/test/smoke/
trunk/drools/tests/src/org/jboss/tools/drools/ui/bot/test/smoke/ManageDroolsProject.java
trunk/drools/tests/src/org/jboss/tools/drools/ui/bot/test/smoke/ManageDroolsRuntime.java
Log:
Initial version of Drools SWTBot Tests
Added: trunk/drools/tests/.classpath
===================================================================
--- trunk/drools/tests/.classpath (rev 0)
+++ trunk/drools/tests/.classpath 2010-04-07 15:39:40 UTC (rev 21318)
@@ -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/drools/tests/.classpath
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/drools/tests/.project
===================================================================
--- trunk/drools/tests/.project (rev 0)
+++ trunk/drools/tests/.project 2010-04-07 15:39:40 UTC (rev 21318)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.drools.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/drools/tests/.project
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/drools/tests/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/drools/tests/.settings/org.eclipse.jdt.core.prefs (rev
0)
+++ trunk/drools/tests/.settings/org.eclipse.jdt.core.prefs 2010-04-07 15:39:40 UTC (rev
21318)
@@ -0,0 +1,8 @@
+#Tue Apr 06 13:22:27 CEST 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Property changes on: trunk/drools/tests/.settings/org.eclipse.jdt.core.prefs
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/drools/tests/META-INF/MANIFEST.MF
===================================================================
--- trunk/drools/tests/META-INF/MANIFEST.MF (rev 0)
+++ trunk/drools/tests/META-INF/MANIFEST.MF 2010-04-07 15:39:40 UTC (rev 21318)
@@ -0,0 +1,20 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Drools UI SWTBot Tests
+Bundle-SymbolicName: org.jboss.tools.drools.ui.bot.test
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.jboss.tools.drools.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",
+ org.drools.eclipse;bundle-version="5.1.0"
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-Vendor: JBoss by Red Hat
Property changes on: trunk/drools/tests/META-INF/MANIFEST.MF
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/drools/tests/build.properties
===================================================================
--- trunk/drools/tests/build.properties (rev 0)
+++ trunk/drools/tests/build.properties 2010-04-07 15:39:40 UTC (rev 21318)
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
Property changes on: trunk/drools/tests/build.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/drools/tests/screenshots/screenshot-ManageDroolsProject.testManageDroolsProject.jpeg
===================================================================
(Binary files differ)
Property changes on:
trunk/drools/tests/screenshots/screenshot-ManageDroolsProject.testManageDroolsProject.jpeg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
trunk/drools/tests/screenshots/screenshot-ManageDroolsRuntime.testManageDroolsRuntime.jpeg
===================================================================
(Binary files differ)
Property changes on:
trunk/drools/tests/screenshots/screenshot-ManageDroolsRuntime.testManageDroolsRuntime.jpeg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/drools/tests/src/org/jboss/tools/drools/ui/bot/test/Activator.java
===================================================================
--- trunk/drools/tests/src/org/jboss/tools/drools/ui/bot/test/Activator.java
(rev 0)
+++ trunk/drools/tests/src/org/jboss/tools/drools/ui/bot/test/Activator.java 2010-04-07
15:39:40 UTC (rev 21318)
@@ -0,0 +1,50 @@
+package org.jboss.tools.drools.ui.bot.test;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.jboss.tools.drools.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/drools/tests/src/org/jboss/tools/drools/ui/bot/test/Activator.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/drools/tests/src/org/jboss/tools/drools/ui/bot/test/DroolsAllBotTests.java
===================================================================
--- trunk/drools/tests/src/org/jboss/tools/drools/ui/bot/test/DroolsAllBotTests.java
(rev 0)
+++
trunk/drools/tests/src/org/jboss/tools/drools/ui/bot/test/DroolsAllBotTests.java 2010-04-07
15:39:40 UTC (rev 21318)
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * 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.drools.ui.bot.test;
+
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
+import org.jboss.tools.drools.ui.bot.test.smoke.ManageDroolsRuntime;
+import org.jboss.tools.drools.ui.bot.test.smoke.ManageDroolsProject;
+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)
+(a)SuiteClasses({ManageDroolsRuntime.class,
+ ManageDroolsProject.class})
+public class DroolsAllBotTests extends SWTTestExt {
+ public static final String DROOLS_PROJECT_NAME = "droolsTest";
+ public static final String DROOLS_RUNTIME_NAME = "Drools Test Runtime";
+ public static String DROOLS_RUNTIME_LOCATION = null;
+ @BeforeClass
+ public static void setUpTest() {
+ DROOLS_RUNTIME_LOCATION = System.getProperty("java.io.tmpdir");
+ properties = util.loadProperties(Activator.PLUGIN_ID);
+ try{
+ SWTBotView welcomeView = eclipse.getBot().viewByTitle(IDELabel.View.WELCOME);
+ welcomeView.close();
+ } catch (WidgetNotFoundException wnfe){
+ // Do nothing ignore this error
+ }
+
+ }
+
+ @AfterClass
+ public static void tearDownTest() {
+ // Ready for later usage
+ }
+
+}
\ No newline at end of file
Property changes on:
trunk/drools/tests/src/org/jboss/tools/drools/ui/bot/test/DroolsAllBotTests.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/drools/tests/src/org/jboss/tools/drools/ui/bot/test/smoke/ManageDroolsProject.java
===================================================================
---
trunk/drools/tests/src/org/jboss/tools/drools/ui/bot/test/smoke/ManageDroolsProject.java
(rev 0)
+++
trunk/drools/tests/src/org/jboss/tools/drools/ui/bot/test/smoke/ManageDroolsProject.java 2010-04-07
15:39:40 UTC (rev 21318)
@@ -0,0 +1,78 @@
+ /*******************************************************************************
+ * Copyright (c) 2007-2010 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.drools.ui.bot.test.smoke;
+
+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.JobName;
+import org.jboss.tools.ui.bot.ext.types.ViewType;
+import org.jboss.tools.ui.bot.test.WidgetVariables;
+import org.jboss.tools.drools.ui.bot.test.DroolsAllBotTests;
+import org.junit.Test;
+import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotCheckBox;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
+/**
+ * Test managing of Drools Project
+ * @author Vladimir Pakan
+ *
+ */
+public class ManageDroolsProject extends SWTTestExt{
+ /**
+ * Test manage Drools project
+ */
+ @Test
+ public void testManageDroolsProject() {
+ createDroolsProject (DroolsAllBotTests.DROOLS_PROJECT_NAME);
+ }
+
+ private void createDroolsProject(String droolsProjectName){
+ eclipse.showView(ViewType.PACKAGE_EXPLORER);
+ eclipse.createNew(EntityType.DROOLS_PROJECT);
+ bot.textWithLabel(IDELabel.NewDroolsProjectDialog.NAME).setText(droolsProjectName);
+ bot.button(IDELabel.Button.NEXT).click();
+ // check all buttons
+ int index = 0;
+ boolean checkBoxExists = true;
+ while (checkBoxExists){
+ try{
+ SWTBotCheckBox checkBox = bot.checkBox(index);
+ if (!checkBox.isChecked()){
+ checkBox.click();
+ }
+ index++;
+ }catch (WidgetNotFoundException wnfe){
+ checkBoxExists = false;
+ }catch (IndexOutOfBoundsException ioobe){
+ checkBoxExists = false;
+ }
+ }
+ bot.button(IDELabel.Button.NEXT).click();
+ bot.button(IDELabel.Button.FINISH).click();
+ SWTTestExt.util.waitForAllExcept(100*1000L, new
String[]{JobName.USAGE_DATA_EVENT_CONSUMER});
+ SWTBot innerBot = bot.viewByTitle(WidgetVariables.PACKAGE_EXPLORER).bot();
+ SWTBotTree tree = innerBot.tree();
+ boolean isOk = false;
+ try {
+ tree.getTreeItem(droolsProjectName);
+ isOk = true;
+ } catch (WidgetNotFoundException e) {
+ }
+ assertTrue("Project "
+ + droolsProjectName
+ + " was not created properly.",isOk);
+ }
+
+}
+
Property changes on:
trunk/drools/tests/src/org/jboss/tools/drools/ui/bot/test/smoke/ManageDroolsProject.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/drools/tests/src/org/jboss/tools/drools/ui/bot/test/smoke/ManageDroolsRuntime.java
===================================================================
---
trunk/drools/tests/src/org/jboss/tools/drools/ui/bot/test/smoke/ManageDroolsRuntime.java
(rev 0)
+++
trunk/drools/tests/src/org/jboss/tools/drools/ui/bot/test/smoke/ManageDroolsRuntime.java 2010-04-07
15:39:40 UTC (rev 21318)
@@ -0,0 +1,169 @@
+ /*******************************************************************************
+ * Copyright (c) 2007-2010 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.drools.ui.bot.test.smoke;
+
+import java.io.File;
+
+import org.jboss.tools.ui.bot.ext.SWTEclipseExt;
+import org.jboss.tools.ui.bot.ext.SWTTestExt;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
+import org.jboss.tools.ui.bot.ext.types.IDELabel.PreferencesDialog;
+import org.jboss.tools.drools.ui.bot.test.DroolsAllBotTests;
+import org.junit.Test;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;
+import org.drools.eclipse.util.DroolsRuntimeManager;
+import org.drools.eclipse.util.DroolsRuntime;
+/**
+ * Test managing of Drools Runtime
+ * @author Vladimir Pakan
+ *
+ */
+public class ManageDroolsRuntime extends SWTTestExt{
+ private String testDroolsRuntimeName = null;
+ private String testDroolsRuntimeLocation = null;
+ /**
+ * Test manage Drools Runtime
+ */
+ @Test
+ public void testManageDroolsRuntime() {
+
addDroolsRuntime(DroolsAllBotTests.DROOLS_RUNTIME_NAME,DroolsAllBotTests.DROOLS_RUNTIME_LOCATION);
+ editDroolsRuntime(testDroolsRuntimeName,testDroolsRuntimeLocation, "edited"
, "testedit");
+ removeDroolsRuntime(testDroolsRuntimeName);
+
createDroolsRuntime(DroolsAllBotTests.DROOLS_RUNTIME_NAME,DroolsAllBotTests.DROOLS_RUNTIME_LOCATION);
+ }
+ /**
+ * Adds Drools Runtime
+ * @param runtimeName
+ * @param runtimeLocation
+ */
+ private void addDroolsRuntime(String runtimeName, String runtimeLocation){
+ selectDroolsPreferences();
+ bot.button(IDELabel.Button.ADD).click();
+ bot.shell(IDELabel.Shell.DROOLS_RUNTIME).activate();
+ bot.textWithLabel(IDELabel.DroolsRuntimeDialog.NAME).setText(runtimeName);
+ bot.textWithLabel(IDELabel.DroolsRuntimeDialog.PATH).setText(runtimeLocation);
+ bot.button(IDELabel.Button.OK).click();
+ bot.shell(IDELabel.Shell.PREFERENCES).activate();
+ SWTBotTable table = bot.table();
+ boolean droolsRuntimeAdded =
+
SWTEclipseExt.isItemInTableColumn(table,runtimeName,IDELabel.DroolsRuntimeDialog.COLUMN_NAME_INDEX)
+ &&
SWTEclipseExt.isItemInTableColumn(table,runtimeLocation,IDELabel.DroolsRuntimeDialog.COLUMN_LOCATION_INDEX);
+ bot.button(IDELabel.Button.OK).click();
+ assertTrue("Drools Runtime with name [" + runtimeName +
+ "] and location [" + runtimeLocation +
+ "] was not added properly.",droolsRuntimeAdded);
+ testDroolsRuntimeName = runtimeName;
+ testDroolsRuntimeLocation = runtimeLocation;
+ }
+ /**
+ * Selects Drools Preferences within Preferences Dialog
+ */
+ private void selectDroolsPreferences(){
+ bot.menu(IDELabel.Menu.WINDOW).menu(IDELabel.Menu.PREFERENCES).click();
+ bot.shell(IDELabel.Shell.PREFERENCES).activate();
+ SWTBotTreeItem tiDroolsGroup =
bot.tree().expandNode(IDELabel.PreferencesDialog.DROOLS_GROUP);
+ tiDroolsGroup.select(PreferencesDialog.INSTALLED_DROOLS_RUNTIMES);
+ }
+ /**
+ * Edits Drools Runtime
+ * @param runtimeName
+ * @param runtimeLocation
+ * @param nameSuffix
+ * @param locationSuffix
+ */
+ private void editDroolsRuntime(String runtimeName, String runtimeLocation, String
nameSuffix, String locationSuffix){
+ selectDroolsPreferences();
+ SWTBotTable table = bot.table();
+ table.getTableItem(runtimeName).select();
+ bot.button(IDELabel.Button.EDIT).click();
+ bot.shell(IDELabel.Shell.DROOLS_RUNTIME).activate();
+ SWTBotText txName = bot.textWithLabel(IDELabel.DroolsRuntimeDialog.NAME);
+ SWTBotText txPath = bot.textWithLabel(IDELabel.DroolsRuntimeDialog.PATH);
+ String editedDroolsRuntimeName = txName.getText() + " " + nameSuffix;
+ String editedDroolsRuntimeLocation = txPath.getText() + File.separator +
nameSuffix;
+ new File(editedDroolsRuntimeLocation).mkdir();
+ txName.setText(editedDroolsRuntimeName);
+ txPath.setText(editedDroolsRuntimeLocation);
+ bot.button(IDELabel.Button.OK).click();
+ bot.shell(IDELabel.Shell.PREFERENCES).activate();
+ boolean droolsRuntimeEdited =
+
SWTEclipseExt.isItemInTableColumn(table,editedDroolsRuntimeName,IDELabel.DroolsRuntimeDialog.COLUMN_NAME_INDEX)
+ &&
SWTEclipseExt.isItemInTableColumn(table,editedDroolsRuntimeLocation,IDELabel.DroolsRuntimeDialog.COLUMN_LOCATION_INDEX);
+ bot.button(IDELabel.Button.OK).click();
+ assertTrue("Drools Runtime with name [" + runtimeName +
+ "] and location [" + runtimeLocation +
+ "] was not renamed properly.",droolsRuntimeEdited);
+ testDroolsRuntimeName = editedDroolsRuntimeName;
+ testDroolsRuntimeLocation = editedDroolsRuntimeLocation;
+ }
+
+ /**
+ * Removes Drools Runtime
+ * @param runtimeName
+ * @param runtimeLocation
+ */
+ private void removeDroolsRuntime(String runtimeName){
+ selectDroolsPreferences();
+ SWTBotTable table = bot.table();
+ table.getTableItem(runtimeName).select();
+ bot.button(IDELabel.Button.REMOVE).click();
+ boolean droolsRuntimeRemoved =
!SWTEclipseExt.isItemInTableColumn(table,runtimeName,
+ IDELabel.DroolsRuntimeDialog.COLUMN_NAME_INDEX);
+ bot.button(IDELabel.Button.OK).click();
+ assertTrue("Drools Runtime with name [" + runtimeName +
+ "] was not removed properly.",droolsRuntimeRemoved);
+ // Remove temporary directory created within editDroolsRuntime() method
+ if (!testDroolsRuntimeLocation.equals(DroolsAllBotTests.DROOLS_RUNTIME_NAME)){
+ File tempDir = new File (testDroolsRuntimeLocation);
+ if (tempDir.isDirectory()){
+ tempDir.delete();
+ }
+ }
+ testDroolsRuntimeName = null;
+ testDroolsRuntimeLocation = null;
+ }
+ /**
+ * Creates Drools Runtime
+ * @param runtimeName
+ * @param runtimeLocation
+ */
+ private void createDroolsRuntime(String runtimeName, String runtimeLocation){
+ String newDroolsRuntimeLocation = runtimeLocation + File.separator +
"drools";
+ new File(newDroolsRuntimeLocation).mkdir();
+ DroolsRuntimeManager.createDefaultRuntime(newDroolsRuntimeLocation);
+ DroolsRuntime droolsRuntime = new DroolsRuntime();
+ droolsRuntime.setName(runtimeName);
+ droolsRuntime.setPath(newDroolsRuntimeLocation);
+ droolsRuntime.setDefault(true);
+ DroolsRuntimeManager.setDroolsRuntimes(new DroolsRuntime[]{droolsRuntime});
+ // Test if Drools runtime is defined
+ assertTrue("Drools Runtime was not properly created on location: " +
newDroolsRuntimeLocation,
+ new File (newDroolsRuntimeLocation + File.separator +
"drools-api.jar").exists());
+ selectDroolsPreferences();
+ SWTBotTable table = bot.table();
+ boolean droolsRuntimeCreated =
+
SWTEclipseExt.isItemInTableColumn(table,runtimeName,IDELabel.DroolsRuntimeDialog.COLUMN_NAME_INDEX)
+ &&
SWTEclipseExt.isItemInTableColumn(table,newDroolsRuntimeLocation,IDELabel.DroolsRuntimeDialog.COLUMN_LOCATION_INDEX);
+ bot.button(IDELabel.Button.OK).click();
+ SWTEclipseExt.hideWarningIfDisplayed(bot);
+ assertTrue("Drools Runtime with name [" + runtimeName +
+ "] and location [" + newDroolsRuntimeLocation +
+ "] was not created properly.",droolsRuntimeCreated);
+ testDroolsRuntimeName = runtimeName;
+ testDroolsRuntimeLocation = newDroolsRuntimeLocation;
+
+ }
+
+}
+
Property changes on:
trunk/drools/tests/src/org/jboss/tools/drools/ui/bot/test/smoke/ManageDroolsRuntime.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain