Author: nickboldt
Date: 2011-08-03 03:48:31 -0400 (Wed, 03 Aug 2011)
New Revision: 33537
Removed:
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/.classpath
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/.gitignore
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/.project
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/.settings/org.eclipse.jdt.core.prefs
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/META-INF/MANIFEST.MF
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/build.properties
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/pom.xml
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/resources/project.properties
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/Activator.java
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/DroolsAllBotTests.java
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/DecisionTableTest.java
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/DomainSpecificLanguageEditorTest.java
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/DroolsRulesEditorTest.java
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/GuidedDroolsRulesEditorTest.java
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/GuvnorRepositoriesTest.java
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/ManageDroolsProject.java
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/ManageDroolsRules.java
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/ManageDroolsRuntime.java
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/OpenDroolsPerspective.java
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/RuleFlowTest.java
trunk/drools/tests/pom.xml
Log:
move org.jboss.tools.drools.ui.bot.test from
~/trunk/drools/tests/org.jboss.tools.drools.ui.bot.test into
~/trunk/build/aggregate/bottests-site/tests/org.jboss.tools.drools.ui.bot.test
(JBIDE-8734)
Deleted: trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/.classpath
===================================================================
--- trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/.classpath 2011-08-03 07:47:59
UTC (rev 33536)
+++ trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/.classpath 2011-08-03 07:48:31
UTC (rev 33537)
@@ -1,8 +0,0 @@
-<?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>
Deleted: trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/.gitignore
===================================================================
--- trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/.gitignore 2011-08-03 07:47:59
UTC (rev 33536)
+++ trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/.gitignore 2011-08-03 07:48:31
UTC (rev 33537)
@@ -1 +0,0 @@
-target
Deleted: trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/.project
===================================================================
--- trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/.project 2011-08-03 07:47:59 UTC
(rev 33536)
+++ trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/.project 2011-08-03 07:48:31 UTC
(rev 33537)
@@ -1,34 +0,0 @@
-<?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>
- <buildCommand>
- <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
- </natures>
-</projectDescription>
Deleted:
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/.settings/org.eclipse.jdt.core.prefs
===================================================================
---
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/.settings/org.eclipse.jdt.core.prefs 2011-08-03
07:47:59 UTC (rev 33536)
+++
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/.settings/org.eclipse.jdt.core.prefs 2011-08-03
07:48:31 UTC (rev 33537)
@@ -1,8 +0,0 @@
-#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
Deleted: trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/META-INF/MANIFEST.MF 2011-08-03
07:47:59 UTC (rev 33536)
+++ trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/META-INF/MANIFEST.MF 2011-08-03
07:48:31 UTC (rev 33537)
@@ -1,21 +0,0 @@
-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,
- org.eclipse.swtbot.eclipse.core;bundle-version="2.0.0",
- org.eclipse.swtbot.eclipse.finder;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,
- org.drools.eclipse;bundle-version="5.1.0",
- org.eclipse.swtbot.eclipse.gef.finder,
- org.apache.log4j;bundle-version="1.2.13"
-Bundle-ActivationPolicy: lazy
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Bundle-Vendor: JBoss by Red Hat
-Import-Package: org.eclipse.ui.forms.widgets
Deleted: trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/build.properties
===================================================================
--- trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/build.properties 2011-08-03
07:47:59 UTC (rev 33536)
+++ trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/build.properties 2011-08-03
07:48:31 UTC (rev 33537)
@@ -1,5 +0,0 @@
-source.. = src/,\
- resources/
-output.. = bin/
-bin.includes = META-INF/,\
- .
Deleted: trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/pom.xml
===================================================================
--- trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/pom.xml 2011-08-03 07:47:59 UTC
(rev 33536)
+++ trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/pom.xml 2011-08-03 07:48:31 UTC
(rev 33537)
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
-
- <groupId>org.jboss.tools</groupId>
- <artifactId>org.jboss.tools.parent.pom</artifactId>
- <version>0.0.2-SNAPSHOT</version>
- </parent>
- <groupId>org.jboss.tools.drools</groupId>
- <artifactId>org.jboss.tools.drools.ui.bot.test</artifactId>
- <version>1.0.0-SNAPSHOT</version>
- <packaging>eclipse-plugin</packaging>
- <build>
- <plugins>
- <plugin>
- <groupId>org.sonatype.tycho</groupId>
- <artifactId>maven-osgi-test-plugin</artifactId>
- <version>${tychoVersion}</version>
- <configuration>
- <useUIThread>false</useUIThread>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
\ No newline at end of file
Deleted:
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/resources/project.properties
===================================================================
---
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/resources/project.properties 2011-08-03
07:47:59 UTC (rev 33536)
+++
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/resources/project.properties 2011-08-03
07:48:31 UTC (rev 33537)
@@ -1,3 +0,0 @@
-use-external-drools-runtime=true
-guvnor-repository-url=/jboss-brms/org.drools.guvnor.Guvnor/webdav
-external-drools-runtime-home=/home/vpakan/tmp/drools
Deleted:
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/Activator.java
===================================================================
---
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/Activator.java 2011-08-03
07:47:59 UTC (rev 33536)
+++
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/Activator.java 2011-08-03
07:48:31 UTC (rev 33537)
@@ -1,50 +0,0 @@
-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;
- }
-
-}
Deleted:
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/DroolsAllBotTests.java
===================================================================
---
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/DroolsAllBotTests.java 2011-08-03
07:47:59 UTC (rev 33536)
+++
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/DroolsAllBotTests.java 2011-08-03
07:48:31 UTC (rev 33537)
@@ -1,155 +0,0 @@
-/*******************************************************************************
- * 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 java.io.File;
-
-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.DecisionTableTest;
-import org.jboss.tools.drools.ui.bot.test.smoke.DomainSpecificLanguageEditorTest;
-//import org.jboss.tools.drools.ui.bot.test.smoke.GuidedDroolsRulesEditorTest;
-import org.jboss.tools.drools.ui.bot.test.smoke.GuvnorRepositoriesTest;
-import org.jboss.tools.drools.ui.bot.test.smoke.ManageDroolsRuntime;
-import org.jboss.tools.drools.ui.bot.test.smoke.ManageDroolsProject;
-import org.jboss.tools.drools.ui.bot.test.smoke.ManageDroolsRules;
-import org.jboss.tools.drools.ui.bot.test.smoke.DroolsRulesEditorTest;
-import org.jboss.tools.drools.ui.bot.test.smoke.OpenDroolsPerspective;
-import org.jboss.tools.drools.ui.bot.test.smoke.RuleFlowTest;
-import org.jboss.tools.ui.bot.ext.SWTTestExt;
-import org.jboss.tools.ui.bot.ext.SWTUtilExt;
-import org.jboss.tools.ui.bot.ext.types.IDELabel;
-import org.jboss.tools.ui.bot.ext.types.PerspectiveType;
-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 Drools swtbot test case for JBoss Tools.
- *
- * @author Vladimir Pakan
- *
- */
-(a)RunWith(Suite.class)
-(a)SuiteClasses({OpenDroolsPerspective.class,
- ManageDroolsRuntime.class,
- ManageDroolsProject.class,
- ManageDroolsRules.class,
- DroolsRulesEditorTest.class,
- //GuidedDroolsRulesEditorTest.class,
- DomainSpecificLanguageEditorTest.class,
- RuleFlowTest.class,
- DecisionTableTest.class,
- GuvnorRepositoriesTest.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;
- public static String CREATE_DROOLS_RUNTIME_LOCATION = null;
- public static String SRC_MAIN_JAVA_TREE_NODE = "src/main/java";
- public static String SRC_MAIN_RULES_TREE_NODE = "src/main/rules";
- public static String COM_SAMPLE_TREE_NODE = "com.sample";
- public static String DROOLS_TEST_JAVA_TREE_NODE = "DroolsTest.java";
- public static final String TEST_DROOLS_RULE_NAME = "TestRule.drl";
- public static final String SAMPLE_DROOLS_RULE_NAME = "Sample.drl";
- public static final String GUIDED_DROOLS_RULE_NAME = "GuidedRule.brl";
- public static final String DOMAIN_SPECIFIC_LANGUAGE_FILE_NAME =
"DslTest.dsl";
- public static final String RULE_FLOW_JAVA_TEST_FILE_NAME =
"ProcessTest.java";
- public static final String RULE_FLOW_RF_FILE_NAME = "ruleflow.rf";
- public static final String DECISION_TABLE_JAVA_TEST_FILE_NAME =
"DecisionTableTest.java";
- public static final String USE_EXTERNAL_DROOLS_RUNTIME_PROPERTY_NAME =
"use-external-drools-runtime";
- public static final String EXTERNAL_DROOLS_RUTIME_HOME_PROPERTY_NAME =
"external-drools-runtime-home";
- public static final String GUVNOR_REPOSITORY_URL_PROPERTY_NAME =
"guvnor-repository-url";
- private static boolean USE_EXTERNAL_DROOLS_RUNTIME;
-
- private static String testDroolsRuntimeName = null;
- private static String testDroolsRuntimeLocation = null;
- private static String guvnorRepositoryUrl = null;
- private static String guvnorRepositoryRootTreeItem =
"http://localhost:8080/jboss-brms/org.drools.guvnor.Guvnor/webdav/";
-
- public static String getTestDroolsRuntimeName() {
- return testDroolsRuntimeName;
- }
-
- public static void setTestDroolsRuntimeName(String testDroolsRuntimeName) {
- DroolsAllBotTests.testDroolsRuntimeName = testDroolsRuntimeName;
- }
-
- public static String getTestDroolsRuntimeLocation() {
- return testDroolsRuntimeLocation;
- }
-
- public static void setTestDroolsRuntimeLocation(String testDroolsRuntimeLocation) {
- DroolsAllBotTests.testDroolsRuntimeLocation = testDroolsRuntimeLocation;
- }
-
- public static String getGuvnorRepositoryUrl() {
- return guvnorRepositoryUrl;
- }
-
- private static void setGuvnorRepositoryUrl(String guvnorRepositoryUrl) {
- DroolsAllBotTests.guvnorRepositoryUrl = guvnorRepositoryUrl;
- }
-
- public static String getGuvnorRepositoryRootTreeItem() {
- return guvnorRepositoryRootTreeItem;
- }
-
- private static void setGuvnorRepositoryRootTreeItem(
- String guvnorRepositoryRootTreeItem) {
- DroolsAllBotTests.guvnorRepositoryRootTreeItem = guvnorRepositoryRootTreeItem;
- }
-
- @BeforeClass
- public static void setUpTest() {
- jbt.closeReportUsageWindowIfOpened(false);
- props = util.loadProperties(Activator.PLUGIN_ID);
- String guvnorRepositoryUrl =
props.getProperty(DroolsAllBotTests.GUVNOR_REPOSITORY_URL_PROPERTY_NAME);
- if (guvnorRepositoryUrl != null){
- DroolsAllBotTests.setGuvnorRepositoryUrl(guvnorRepositoryUrl);
- DroolsAllBotTests.setGuvnorRepositoryRootTreeItem("http://localhost:8080"
+ guvnorRepositoryUrl);
- }
- String useExternalDroolRuntime =
props.getProperty(DroolsAllBotTests.USE_EXTERNAL_DROOLS_RUNTIME_PROPERTY_NAME);
- DroolsAllBotTests.USE_EXTERNAL_DROOLS_RUNTIME = useExternalDroolRuntime != null
&& useExternalDroolRuntime.equalsIgnoreCase("true");
- String droolsRuntimeLocation =
props.getProperty(DroolsAllBotTests.EXTERNAL_DROOLS_RUTIME_HOME_PROPERTY_NAME);
- String tmpDir = System.getProperty("java.io.tmpdir");
- if (droolsRuntimeLocation == null || droolsRuntimeLocation.length() ==0){
- DroolsAllBotTests.DROOLS_RUNTIME_LOCATION = tmpDir;
- }
- else{
- DroolsAllBotTests.DROOLS_RUNTIME_LOCATION = droolsRuntimeLocation;
- }
- DroolsAllBotTests.CREATE_DROOLS_RUNTIME_LOCATION = tmpDir + File.separator +
"drools";
- // Create directory for Drools Runtime which will be created as a part of test
- new File(DroolsAllBotTests.CREATE_DROOLS_RUNTIME_LOCATION).mkdir();
- try{
- SWTBotView welcomeView = eclipse.getBot().viewByTitle(IDELabel.View.WELCOME);
- welcomeView.close();
- } catch (WidgetNotFoundException wnfe){
- // Do nothing ignore this error
- }
- eclipse.openPerspective(PerspectiveType.JAVA);
- eclipse.maximizeActiveShell();
- }
-
- public static boolean useExternalDroolsRuntime() {
- return USE_EXTERNAL_DROOLS_RUNTIME;
- }
-
- @AfterClass
- public static void tearDownTest() {
- // delete created drools runtime
- SWTUtilExt.deleteDirectory(DroolsAllBotTests.CREATE_DROOLS_RUNTIME_LOCATION);
- }
-}
\ No newline at end of file
Deleted:
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/DecisionTableTest.java
===================================================================
---
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/DecisionTableTest.java 2011-08-03
07:47:59 UTC (rev 33536)
+++
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/DecisionTableTest.java 2011-08-03
07:48:31 UTC (rev 33537)
@@ -1,53 +0,0 @@
- /*******************************************************************************
- * 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.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
-import org.jboss.tools.drools.ui.bot.test.DroolsAllBotTests;
-import org.jboss.tools.ui.bot.ext.SWTTestExt;
-import org.junit.Test;
-/**
- * Tests Decision Table
- * @author Vladimir Pakan
- *
- */
-public class DecisionTableTest extends SWTTestExt{
- /**
- * Tests Decision Table
- */
- @Test
- public void testDecisionTable() {
- runDecisionTable(DroolsAllBotTests.DECISION_TABLE_JAVA_TEST_FILE_NAME);
- }
- /**
- * Runs newly created Drools project and check result
- * @param decisionTableFileName
- */
- private void runDecisionTable(String decisionTableFileName){
- console.clearConsole();
- bot.sleep(5000L);
-
- SWTBotTreeItem tiTestFile = packageExplorer.selectTreeItem(decisionTableFileName,
- new String[] {DroolsAllBotTests.DROOLS_PROJECT_NAME,
- DroolsAllBotTests.SRC_MAIN_JAVA_TREE_NODE,
- DroolsAllBotTests.COM_SAMPLE_TREE_NODE});
-
- eclipse.runTreeItemAsJavaApplication(tiTestFile);
-
- String consoleText = console.getConsoleText(3*1000L,60*1000L,true);
-
- assertTrue(decisionTableFileName + " didn't run properly.\n" +
- "Console Text was: " + consoleText + "\n" +
- "Expected console text is: Hello World\nGoodbye cruel world\n",
- consoleText.endsWith("Hello World\nGoodbye cruel world\n"));
- }
-}
\ No newline at end of file
Deleted:
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/DomainSpecificLanguageEditorTest.java
===================================================================
---
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/DomainSpecificLanguageEditorTest.java 2011-08-03
07:47:59 UTC (rev 33536)
+++
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/DomainSpecificLanguageEditorTest.java 2011-08-03
07:48:31 UTC (rev 33537)
@@ -1,229 +0,0 @@
- /*******************************************************************************
- * 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.eclipse.swt.SWT;
-import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor;
-import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
-import org.eclipse.swtbot.swt.finder.SWTBot;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
-import org.jboss.tools.ui.bot.ext.SWTEclipseExt;
-import org.jboss.tools.ui.bot.ext.SWTTestExt;
-import org.jboss.tools.ui.bot.ext.Timing;
-import org.jboss.tools.ui.bot.ext.helper.KeyboardHelper;
-import org.jboss.tools.ui.bot.ext.parts.SWTBotEditorExt;
-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.view.ProblemsView;
-import org.jboss.tools.drools.ui.bot.test.DroolsAllBotTests;
-import org.junit.Test;
-/**
- * Tests Domain Specific Language Editor
- * @author Vladimir Pakan
- *
- */
-public class DomainSpecificLanguageEditorTest extends SWTTestExt{
- /**
- * Tests Domain Specific Language Editor
- */
- private static final String LANGUAGE_EXRESSION = "Message {msg} of type {t}
contains {what}";
- @Test
- public void testDomainSpecificLanguageEditor() {
- createDslFile(DroolsAllBotTests.DOMAIN_SPECIFIC_LANGUAGE_FILE_NAME);
- addDslExpression(DroolsAllBotTests.DOMAIN_SPECIFIC_LANGUAGE_FILE_NAME);
- useDslExpression(DroolsAllBotTests.DOMAIN_SPECIFIC_LANGUAGE_FILE_NAME,
- DroolsAllBotTests.SAMPLE_DROOLS_RULE_NAME);
- runDslExpressionCheck(DroolsAllBotTests.DROOLS_TEST_JAVA_TREE_NODE,
- DroolsAllBotTests.DOMAIN_SPECIFIC_LANGUAGE_FILE_NAME);
- }
- /**
- * Creates DSL File
- * @param dslFileName
- */
- private void createDslFile(String dslFileName){
- packageExplorer.show();
- SWTBotTreeItem tiRules =
packageExplorer.selectTreeItem(DroolsAllBotTests.SRC_MAIN_RULES_TREE_NODE,
- new String[] {DroolsAllBotTests.DROOLS_PROJECT_NAME});
-
- tiRules.select();
- eclipse.createNew(EntityType.DSL_DROOLS_FILE);
- bot.textWithLabel(IDELabel.NewDslDroolsFileDialog.FILE_NAME).setText(dslFileName);
- eclipse.selectTreeLocation(DroolsAllBotTests.DROOLS_PROJECT_NAME,
- "src",
- "main",
- "rules");
- bot.button(IDELabel.Button.FINISH).click();
- bot.sleep(Timing.time1S());
- tiRules.expand();
- // Test if new DSL File is within package tree view
- assertTrue("New DSL File was not created properly. It's not present within
Package Explorer",
- SWTEclipseExt.containsTreeItemWithLabel(tiRules, dslFileName));
- // Test if new DSL File is opened in editor
- assertTrue("New DSL File was not created properly. File " + dslFileName +
" is not opened in editor",
- SWTEclipseExt.existEditorWithLabel(bot,dslFileName));
-
- }
- /**
- * Adds DSL Expression to DSL File
- * @param dslFileName
- */
- private void addDslExpression(String dslFileName){
- SWTBotEditor dslRuleEditor = bot.editorByTitle(dslFileName);
- SWTBot dslRuleEditorBot = dslRuleEditor.bot();
- dslRuleEditorBot
- .button(IDELabel.Button.ADD_WITHOUT_DOTS).click();
- SWTBot dialogBot = dslRuleEditorBot
- .shell(IDELabel.DslDroolsFileEditor.ADD_LANGUAGE_MAPPING_DIALOG_TITLE)
- .activate()
- .bot();
-
- dialogBot.textWithLabel(IDELabel.DslDroolsFileEditor.LANGUAGE_EXPRESSION_TEXT_LABEL)
- .setText(DomainSpecificLanguageEditorTest.LANGUAGE_EXRESSION);
- dialogBot.textWithLabel(IDELabel.DslDroolsFileEditor.RULE_MAPPING_TEXT_LABEL)
- .setText("{msg} : Message(status == {t}, {what} : message)");
- dialogBot.comboBoxWithLabel(IDELabel.DslDroolsFileEditor.SCOPE_COMBO_LABEL)
- .setSelection(IDELabel.DslDroolsFileEditor.SCOPE_COMBO_VALUE);
- dialogBot.button(IDELabel.Button.OK).click();
- dslRuleEditor.save();
-
- assertTrue("DSL table has to containt this Language Expression:\n" +
- DomainSpecificLanguageEditorTest.LANGUAGE_EXRESSION,
- SWTEclipseExt.isItemInTableColumn(dslRuleEditorBot.table(),
- DomainSpecificLanguageEditorTest.LANGUAGE_EXRESSION,
- 0));
-
- }
- /**
- * Use defined language expression in dslFileName file within sampleDrlFileName file
- * @param dslFileName
- * @param sampleDrlFileName
- */
- private void useDslExpression (String dslFileName,String sampleDrlFileName){
- packageExplorer.show();
- SWTBotEclipseEditor drlDroolsEditor =
packageExplorer.openFile(DroolsAllBotTests.DROOLS_PROJECT_NAME ,
- DroolsAllBotTests.SRC_MAIN_RULES_TREE_NODE,
- DroolsAllBotTests.SAMPLE_DROOLS_RULE_NAME).toTextEditor();
- SWTBotEditorExt ruleEditor =
bot.swtBotEditorExtByTitle(DroolsAllBotTests.SAMPLE_DROOLS_RULE_NAME);
- ruleEditor.selectPage(IDELabel.DroolsEditor.TEXT_EDITOR_TAB);
- // update drl file
- drlDroolsEditor.insertText(3,0,"\nexpander " +
- dslFileName +
- ";\n");
- int[] linesToIgnoreExpander = new int[]{8,10,11,12,13,20};
- for (int lineNumber : linesToIgnoreExpander){
- drlDroolsEditor.insertText(lineNumber,0,">");
- }
- drlDroolsEditor.selectLine(18);
- bot.sleep(Timing.time1S());
- KeyboardHelper.pressKeyCode(bot.getDisplay(),(int)SWT.DEL);
- bot.sleep(Timing.time1S());
- drlDroolsEditor.insertText(18, 0, " Message m of type Message.GOODBYE
contains myMessage");
- drlDroolsEditor.save();
- util.waitForJobs(Timing.time10S(), JobName.BUILDING_WS);
- SWTBotTreeItem[] errors = ProblemsView
- .getFilteredErrorsTreeItems(bot,
- null,
- null,
- sampleDrlFileName,
- null);
- assertTrue("File "
- + sampleDrlFileName
- + " was not udpated properly. There are these errors: "
- + SWTEclipseExt.getFormattedTreeNodesText(bot.tree(), errors),
- errors == null || errors.length == 0);
-
- SWTBotTreeItem[] warnings = ProblemsView
- .getFilteredWarningsTreeItems(bot,
- null,
- null,
- sampleDrlFileName,
- null);
- assertTrue("File "
- + sampleDrlFileName
- + " was not udpated properly. There are these warnings: "
- + SWTEclipseExt.getFormattedTreeNodesText(bot.tree(), warnings),
- warnings == null || warnings.length == 0);
- }
- /**
- * Runs javaFileName testing defined DSL
- * @param javaFileName
- * @param dslFileName
- */
- private void runDslExpressionCheck(String javaFileName,
- String dslFileName){
-
- packageExplorer.show();
- SWTBotEclipseEditor drlDroolsEditor =
packageExplorer.openFile(DroolsAllBotTests.DROOLS_PROJECT_NAME ,
- DroolsAllBotTests.SRC_MAIN_JAVA_TREE_NODE,
- DroolsAllBotTests.COM_SAMPLE_TREE_NODE,
- javaFileName).toTextEditor();
- // Change java file content to support new DSL
- updateJavaTestFile(drlDroolsEditor,dslFileName);
-
- console.clearConsole();
- bot.sleep(Timing.time5S());
-
- SWTBotTreeItem tiTestFile = packageExplorer.selectTreeItem(javaFileName,
- new String[] {DroolsAllBotTests.DROOLS_PROJECT_NAME,
- DroolsAllBotTests.SRC_MAIN_JAVA_TREE_NODE,
- DroolsAllBotTests.COM_SAMPLE_TREE_NODE});
-
- eclipse.runTreeItemAsJavaApplication(tiTestFile);
-
- String consoleText = console.getConsoleText(3*1000L,60*1000L,true);
-
- assertTrue(javaFileName + " didn't run properly.\n" +
- "Console Text was: " + consoleText + "\n" +
- "Expected console text is: " + "Hello World\nGoodbye cruel
world\n",
- "Hello World\nGoodbye cruel world\n".equals(consoleText));
- }
- /**
- * Update properly Java Test file in drlDroolsEditor to be able to run
- * with new DSL definition
- * @param drlDroolsEditor
- * @param dslFileName
- */
- private void updateJavaTestFile(SWTBotEclipseEditor drlDroolsEditor,
- String dslFileName){
- int lineIndex = 0;
- String foundLineText = null;
- while (lineIndex < drlDroolsEditor.getLineCount() && foundLineText ==
null){
- String lineText = drlDroolsEditor.getTextOnLine(lineIndex);
- if(lineText.trim().startsWith("kbuilder.add")){
- foundLineText = lineText;
- }
- else{
- lineIndex++;
- }
- }
- if (foundLineText != null){
- drlDroolsEditor.insertText(lineIndex,0,
- "kbuilder.add(ResourceFactory.newClassPathResource(\"" +
- dslFileName +
- "\"), ResourceType.DSL);\n");
- lineIndex++;
- drlDroolsEditor.selectLine(lineIndex);
- KeyboardHelper.pressKeyCode(bot.getDisplay(),(int)SWT.DEL);
- drlDroolsEditor.insertText(foundLineText
- .replace("ResourceType.DRL","ResourceType.DSLR") +
"\n");
- drlDroolsEditor.save();
- util.waitForJobs(Timing.time10S(), JobName.BUILDING_WS);
- }
- else{
- throw new RuntimeException("File " +
- drlDroolsEditor.getTitle() +
- " has wrong content. It doesn't contain 'kbuilder.add'
string.");
- }
- }
-
-}
\ No newline at end of file
Deleted:
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/DroolsRulesEditorTest.java
===================================================================
---
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/DroolsRulesEditorTest.java 2011-08-03
07:47:59 UTC (rev 33536)
+++
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/DroolsRulesEditorTest.java 2011-08-03
07:48:31 UTC (rev 33537)
@@ -1,95 +0,0 @@
- /*******************************************************************************
- * 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.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor;
-import org.eclipse.swtbot.swt.finder.utils.Position;
-import org.jboss.tools.ui.bot.ext.SWTTestExt;
-import org.jboss.tools.ui.bot.ext.parts.ContentAssistBot;
-import org.jboss.tools.ui.bot.ext.parts.SWTBotEditorExt;
-import org.jboss.tools.ui.bot.ext.types.IDELabel;
-import org.jboss.tools.drools.ui.bot.test.DroolsAllBotTests;
-import org.junit.Test;
-/**
- * Tests Drools Rule Editor
- * @author Vladimir Pakan
- *
- */
-public class DroolsRulesEditorTest extends SWTTestExt{
- /**
- * Tests Drools Rule Editor
- */
- private static final String CONTENT_ASSIST_IMPORT = "import";
- private static final String CONTENT_ASSIST_MESSAGE = "Message";
- @Test
- public void testDroolsRulesEditor() {
- codeCompletionCheck(DroolsAllBotTests.SAMPLE_DROOLS_RULE_NAME);
- reteViewCheck(DroolsAllBotTests.SAMPLE_DROOLS_RULE_NAME);
- }
- /**
- * Check code completion for Drools Rule
- * @param droolsRuleName
- */
- private void codeCompletionCheck(String droolsRuleName){
-
- packageExplorer.show();
- packageExplorer.openFile(DroolsAllBotTests.DROOLS_PROJECT_NAME ,
- DroolsAllBotTests.SRC_MAIN_RULES_TREE_NODE,droolsRuleName);
- SWTBotEditorExt ruleEditor = bot.swtBotEditorExtByTitle(droolsRuleName);
- ruleEditor.selectPage(IDELabel.DroolsEditor.TEXT_EDITOR_TAB);
- ruleEditor.typeText(3, 0, "i");
- ContentAssistBot contentAssist = ruleEditor.contentAssist();
- contentAssist.checkContentAssist(DroolsRulesEditorTest.CONTENT_ASSIST_IMPORT, true);
- ruleEditor.typeText(6, 0, "m");
- contentAssist.checkContentAssist(DroolsRulesEditorTest.CONTENT_ASSIST_MESSAGE,
true);
-
- SWTBotEclipseEditor ruleTextEditor = ruleEditor.toTextEditor();
- String lineText = ruleTextEditor.getTextOnLine(3).trim();
- assertTrue("Content Assist for " +
DroolsRulesEditorTest.CONTENT_ASSIST_IMPORT +
- " was not inserted properly.\n" +
- "Inserted text is: " + lineText + "\n" +
- "Expected text is: " + DroolsRulesEditorTest.CONTENT_ASSIST_IMPORT,
- lineText.equals(DroolsRulesEditorTest.CONTENT_ASSIST_IMPORT));
-
- lineText = ruleTextEditor.getTextOnLine(6).trim();
- String messageContentAssistText = DroolsRulesEditorTest.CONTENT_ASSIST_MESSAGE +
"( )";
- assertTrue("Content Assist for " +
DroolsRulesEditorTest.CONTENT_ASSIST_MESSAGE +
- " was not inserted properly.\n" +
- "Inserted text is: " + lineText + "\n" +
- "Expected text has to stard with: " + messageContentAssistText,
- lineText.startsWith(messageContentAssistText));
-
- Position cursorPosition = ruleTextEditor.cursorPosition();
- assertTrue("Content Assist for " +
DroolsRulesEditorTest.CONTENT_ASSIST_MESSAGE +
- " was not inserted properly.\n" +
- "Position of cursor is wrong: " + cursorPosition + "\n" +
- "Expected X cursor position is: " + 9,
- cursorPosition.column == 9);
-
- ruleEditor.close();
-
- }
- /**
- * Check Rete View of Drools Rule
- * @param droolsRuleName
- */
- private void reteViewCheck(String droolsRuleName){
-
- packageExplorer.show();
- packageExplorer.openFile(DroolsAllBotTests.DROOLS_PROJECT_NAME ,
- DroolsAllBotTests.SRC_MAIN_RULES_TREE_NODE,droolsRuleName);
- SWTBotEditorExt ruleEditor = bot.swtBotEditorExtByTitle(droolsRuleName);
- ruleEditor.selectPage(IDELabel.DroolsEditor.RETE_TREE_TAB);
-
- }
-}
-
Deleted:
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/GuidedDroolsRulesEditorTest.java
===================================================================
---
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/GuidedDroolsRulesEditorTest.java 2011-08-03
07:47:59 UTC (rev 33536)
+++
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/GuidedDroolsRulesEditorTest.java 2011-08-03
07:48:31 UTC (rev 33537)
@@ -1,175 +0,0 @@
- /*******************************************************************************
- * 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.awt.event.KeyEvent;
-
-import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor;
-import org.eclipse.swtbot.swt.finder.SWTBot;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
-import org.jboss.tools.ui.bot.ext.SWTEclipseExt;
-import org.jboss.tools.ui.bot.ext.SWTTestExt;
-import org.jboss.tools.ui.bot.ext.Timing;
-import org.jboss.tools.ui.bot.ext.helper.ImageHyperlinkHelper;
-import org.jboss.tools.ui.bot.ext.helper.KeyboardHelper;
-import org.jboss.tools.ui.bot.ext.parts.SWTBotEditorExt;
-import org.jboss.tools.ui.bot.ext.types.EntityType;
-import org.jboss.tools.ui.bot.ext.types.IDELabel;
-import org.jboss.tools.drools.ui.bot.test.DroolsAllBotTests;
-import org.junit.Test;
-/**
- * Tests Guided Drools Rule Editor
- * @author Vladimir Pakan
- *
- */
-public class GuidedDroolsRulesEditorTest extends SWTTestExt{
- private static final String DROOLS_PACKAGE_FILE = "drools.package";
- /**
- * Tests Guided Drools Rule Editor
- */
- @Test
- public void testGuidedDroolsRulesEditorTest() {
- createGuidedDroolsRule(DroolsAllBotTests.GUIDED_DROOLS_RULE_NAME);
- editDroolsPackageFile();
- addGuidedDroolsRuleCondition(DroolsAllBotTests.GUIDED_DROOLS_RULE_NAME);
- removeGuidedDroolsRuleCondition(DroolsAllBotTests.GUIDED_DROOLS_RULE_NAME);
- }
- /**
- * Creates Guided Drools Rule
- * @param guidedDroolsRuleName
- */
- private void createGuidedDroolsRule(String guidedDroolsRuleName){
- packageExplorer.show();
- SWTBotTreeItem tiRules =
packageExplorer.selectTreeItem(DroolsAllBotTests.SRC_MAIN_RULES_TREE_NODE,
- new String[] {DroolsAllBotTests.DROOLS_PROJECT_NAME});
-
- tiRules.select();
- eclipse.createNew(EntityType.GUIDED_DROOLS_RULE);
-
bot.textWithLabel(IDELabel.NewGuidedDroolsRuleDialog.FILE_NAME).setText(guidedDroolsRuleName);
- eclipse.selectTreeLocation(DroolsAllBotTests.DROOLS_PROJECT_NAME,
- "src",
- "main",
- "rules");
- bot.button(IDELabel.Button.FINISH).click();
- bot.sleep(Timing.time1S());
- tiRules.expand();
- // Test if new Drools Rule is within package tree view
- assertTrue("New Guided Drools Rule was not created properly. It's not
present within Package Explorer",
- SWTEclipseExt.containsTreeItemWithLabel(tiRules, guidedDroolsRuleName));
- // Test if new Drools Rule is opened in editor
- assertTrue("New Guided Drools Rule was not created properly. File " +
guidedDroolsRuleName + " is not opened in editor",
- SWTEclipseExt.existEditorWithLabel(bot,guidedDroolsRuleName));
- // Test if drools.package file is within package tree view
- assertTrue("New Guided Drools Rule was not created properly. It's not
present within Package Explorer",
- SWTEclipseExt.containsTreeItemWithLabel(tiRules,
- GuidedDroolsRulesEditorTest.DROOLS_PACKAGE_FILE));
- }
- /**
- * Edits drools.package file.
- * Actually only adds import java.util.List to file
- */
- private void editDroolsPackageFile(){
- packageExplorer.show();
- SWTBotEclipseEditor droolsPackageEditor =
packageExplorer.openFile(DroolsAllBotTests.DROOLS_PROJECT_NAME ,
- DroolsAllBotTests.SRC_MAIN_RULES_TREE_NODE,
- GuidedDroolsRulesEditorTest.DROOLS_PACKAGE_FILE).toTextEditor();
- droolsPackageEditor.setText(droolsPackageEditor.getText() +
- "\nimport java.util.List;");
- droolsPackageEditor.save();
- droolsPackageEditor.close();
- }
-
- private void addGuidedDroolsRuleCondition(String guidedDroolsRuleName){
- packageExplorer.show();
- SWTBotEclipseEditor droolsEditor =
packageExplorer.openFile(DroolsAllBotTests.DROOLS_PROJECT_NAME ,
- DroolsAllBotTests.SRC_MAIN_RULES_TREE_NODE,
- DroolsAllBotTests.GUIDED_DROOLS_RULE_NAME).toTextEditor();
- SWTBot droolsEditorBot = droolsEditor.bot();
- droolsEditorBot.toolbarButton().click();
- SWTBotShell dialogShell =
droolsEditorBot.shell(IDELabel.GuidedDroolsRuleEditor.WHEN_ADD_DIALOG_TITLE);
- dialogShell.activate();
-
dialogShell.bot().comboBoxWithLabel(IDELabel.GuidedDroolsRuleEditor.WHEN_ADD_FACT_COMBO)
- .setSelection("List");
- ImageHyperlinkHelper
- .imageHyperlinkWithTooltip(droolsEditorBot,
- IDELabel.GuidedDroolsRuleEditor.ADD_FIELD_TO_THIS_CONDITION_TOOLTIP)
- .click();
- dialogShell =
droolsEditorBot.shell(IDELabel.GuidedDroolsRuleEditor.UPDATE_CONSTRAINTS_DIALOG_TITLE);
- dialogShell.activate();
- dialogShell.bot().comboBox()
-
.setSelection(IDELabel.GuidedDroolsRuleEditor.ADD_RESTRICTION_ON_A_FIELD_COMBO_VALUE);
- droolsEditorBot.comboBox()
- .setSelection(IDELabel.GuidedDroolsRuleEditor.WHEN_COMBO_CONSTRAINTS_VALUE);
- ImageHyperlinkHelper
- .imageHyperlinkWithTooltip(droolsEditorBot,
- IDELabel.GuidedDroolsRuleEditor.CHOOSE_VALUE_EDITOR_TYPE_TOOLTIP)
- .click();
- dialogShell =
droolsEditorBot.shell(IDELabel.GuidedDroolsRuleEditor.SELECT_VALUE_EDITOR_TYPE_DIALOG_TITLE);
- dialogShell.activate();
-
dialogShell.bot().comboBoxWithLabel(IDELabel.GuidedDroolsRuleEditor.SELECT_VALUE_EDITOR_TYPE_COMBO_LABEL)
-
.setSelection(IDELabel.GuidedDroolsRuleEditor.SELECT_VALUE_EDITOR_TYPE_COMBO_VALUE);
-
droolsEditorBot.comboBox(1).setSelection(IDELabel.GuidedDroolsRuleEditor.FIELD_VALUE_COMBO_VALUE);
- droolsEditor.save();
- droolsEditor.close();
- droolsEditor = packageExplorer.openFile(DroolsAllBotTests.DROOLS_PROJECT_NAME ,
- DroolsAllBotTests.SRC_MAIN_RULES_TREE_NODE,
- DroolsAllBotTests.GUIDED_DROOLS_RULE_NAME).toTextEditor();
- SWTBotEditorExt ruleEditor =
bot.swtBotEditorExtByTitle(DroolsAllBotTests.GUIDED_DROOLS_RULE_NAME);
- ruleEditor.selectPage(2);
- String editorContent = droolsEditor.getText();
- assertTrue(DroolsAllBotTests.GUIDED_DROOLS_RULE_NAME +
- " has to contain text: List( empty == true )\n" +
- "but it doesn't.\n" +
- "It contains this text: " + editorContent,
- editorContent.replaceAll("
","").indexOf("List(empty==true)") > 0);
- }
- /**
- * Removes Drools Rule Condition from Guided Drools Rule
- * @param guidedDroolsRuleName
- */
- private void removeGuidedDroolsRuleCondition(String guidedDroolsRuleName){
- packageExplorer.show();
- SWTBotEclipseEditor droolsEditor =
packageExplorer.openFile(DroolsAllBotTests.DROOLS_PROJECT_NAME ,
- DroolsAllBotTests.SRC_MAIN_RULES_TREE_NODE,
- DroolsAllBotTests.GUIDED_DROOLS_RULE_NAME).toTextEditor();
- SWTBot droolsEditorBot = droolsEditor.bot();
- SWTBotEditorExt ruleEditor =
bot.swtBotEditorExtByTitle(DroolsAllBotTests.GUIDED_DROOLS_RULE_NAME);
- ruleEditor.selectPage(0);
- ImageHyperlinkHelper
- .imageHyperlinkWithTooltip(droolsEditorBot,
- IDELabel.GuidedDroolsRuleEditor.REMOVE_THIS_CONDITION_TOOLTIP)
- .click();
- bot.sleep(Timing.time1S());
- KeyboardHelper.pressKeyCodeUsingAWT(KeyEvent.VK_RIGHT);
- KeyboardHelper.releaseKeyCodeUsingAWT(KeyEvent.VK_RIGHT);
- bot.sleep(Timing.time1S());
- KeyboardHelper.pressKeyCodeUsingAWT(KeyEvent.VK_ENTER);
- KeyboardHelper.releaseKeyCodeUsingAWT(KeyEvent.VK_ENTER);
- bot.sleep(Timing.time1S());
- droolsEditor.save();
- droolsEditor.close();
- droolsEditor = packageExplorer.openFile(DroolsAllBotTests.DROOLS_PROJECT_NAME ,
- DroolsAllBotTests.SRC_MAIN_RULES_TREE_NODE,
- DroolsAllBotTests.GUIDED_DROOLS_RULE_NAME).toTextEditor();
- ruleEditor = bot.swtBotEditorExtByTitle(DroolsAllBotTests.GUIDED_DROOLS_RULE_NAME);
- ruleEditor.selectPage(2);
- String editorContent = droolsEditor.getText();
- assertTrue(DroolsAllBotTests.GUIDED_DROOLS_RULE_NAME +
- " has to contain textjak e:\nwhen\nthen\n" +
- "but it doesn't.\n" +
- "It contains this text: " + editorContent,
- ruleEditor.getTextOnLine(2).trim().equals("when") &&
- ruleEditor.getTextOnLine(3).trim().equals("then"));
- }
-
-}
\ No newline at end of file
Deleted:
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/GuvnorRepositoriesTest.java
===================================================================
---
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/GuvnorRepositoriesTest.java 2011-08-03
07:47:59 UTC (rev 33536)
+++
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/GuvnorRepositoriesTest.java 2011-08-03
07:48:31 UTC (rev 33537)
@@ -1,542 +0,0 @@
- /*******************************************************************************
- * 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 static org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable.syncExec;
-
-import java.awt.event.KeyEvent;
-import java.util.List;
-
-import org.apache.log4j.Logger;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
-import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
-import org.eclipse.swtbot.swt.finder.SWTBot;
-import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
-import org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory;
-import org.eclipse.swtbot.swt.finder.results.StringResult;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu;
-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.drools.ui.bot.test.DroolsAllBotTests;
-import org.jboss.tools.ui.bot.ext.config.requirement.PrepareViews;
-import org.jboss.tools.ui.bot.ext.config.requirement.RequirementNotFulfilledException;
-import org.jboss.tools.ui.bot.ext.config.requirement.StartServer;
-import org.jboss.tools.ui.bot.ext.config.requirement.StopServer;
-import org.jboss.tools.ui.bot.ext.gen.ActionItem.View.GuvnorGuvnorResourceHistory;
-import org.jboss.tools.ui.bot.ext.helper.ContextMenuHelper;
-import org.jboss.tools.ui.bot.ext.helper.DragAndDropHelper;
-import org.jboss.tools.ui.bot.ext.helper.KeyboardHelper;
-import org.jboss.tools.ui.bot.ext.parts.SWTBotBrowserExt;
-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.PerspectiveType;
-import org.jboss.tools.ui.bot.ext.view.GuvnorRepositories;
-import org.jboss.tools.ui.bot.ext.SWTEclipseExt;
-import org.jboss.tools.ui.bot.ext.SWTTestExt;
-import org.jboss.tools.ui.bot.ext.SWTUtilExt;
-import org.jboss.tools.ui.bot.ext.Timing;
-import org.junit.Test;
-/**
- * Tests Guvnor Repositories
- * @author Vladimir Pakan
- *
- */
-public class GuvnorRepositoriesTest extends SWTTestExt{
- @SuppressWarnings("unused")
- private static final Logger log = Logger.getLogger(GuvnorRepositoriesTest.class);
- private static final String GUVNOR_TEST_FILE = "Dummy rule.drl";
- private static final String GUVNOR_REPOSITORY_IMPORT_TEST_FILE =
"Underage.brl";
- private static final String GUVNOR_REPOSITORY_HISTORY_TEST_FILE =
"MortgageModel.model.drl";
- private static final String GUVNOR_USER_NAME = "admin";
- private static final String GUVNOR_PASSWORD = "admin";
- private GuvnorRepositories guvnorRepositories = new GuvnorRepositories();
-
- /**
- * Tests Guvnor Repositories
- */
- @Test
- public void testGuvnorRepositories() {
- startGuvnor();
- addGuvnorRepository();
- deleteGuvnorRepository();
- addGuvnorRepository();
- openGuvnorConsole();
- drillIntoFunctionalityCheck();
- browseGuvnorRepository(GuvnorRepositoriesTest.GUVNOR_TEST_FILE);
- guvnorFunctionalityCheck(GuvnorRepositoriesTest.GUVNOR_TEST_FILE,
- DroolsAllBotTests.SAMPLE_DROOLS_RULE_NAME,
- GuvnorRepositoriesTest.GUVNOR_REPOSITORY_IMPORT_TEST_FILE);
- repositoryHistoryCheck(GuvnorRepositoriesTest.GUVNOR_REPOSITORY_HISTORY_TEST_FILE);
- stopGuvnor();
- }
-
- /**
- * Adds Guvnor Repository
- */
- private void addGuvnorRepository(){
- eclipse.openPerspective(PerspectiveType.GUVNOR_REPOSITORY_EXPLORING);
- SWTBot guvnorRepositoriesBot = guvnorRepositories.show().bot();
- SWTUtilExt.getViewToolbarButtonWithTooltip(
- guvnorRepositories.show(),
- IDELabel.GuvnorRepositories.ADD_GUVNOR_REPOSITORY_TOOLTIP)
- .click();
- eclipse.waitForShell("");
- SWTBot addGuvnorRepositoryDialog = guvnorRepositoriesBot.activeShell().bot();
- String guvnorRepositoryUrl = DroolsAllBotTests.getGuvnorRepositoryUrl();
- if (guvnorRepositoryUrl != null && guvnorRepositoryUrl.length() > 0){
-
addGuvnorRepositoryDialog.textWithLabel(IDELabel.GuvnorAddRepositoryDialog.REPOSITORY)
- .setText(guvnorRepositoryUrl);
- }
- addGuvnorRepositoryDialog.button(IDELabel.Button.FINISH).click();
- assertTrue("Guvnor repository was not created properly",
- guvnorRepositoriesBot.tree().rowCount() == 1);
- }
- /**
- * Deletes Guvnor Repostiry
- */
- private void deleteGuvnorRepository(){
- SWTBot guvnorRepositoriesBot = guvnorRepositories.show().bot();;
- SWTBotTree guvnorRepositoryTree = guvnorRepositoriesBot.tree();
- guvnorRepositoryTree.select(0);
- SWTUtilExt.getViewToolbarButtonWithTooltip(
- guvnorRepositories.show(),
- IDELabel.GuvnorRepositories.REMOVE_GUVNOR_REPOSITORY_TOOLTIP)
- .click();
-
guvnorRepositoriesBot.shell(IDELabel.GuvnorRepositories.REMOVE_GUVNOR_REPOSITORY_DIALOG_TITLE)
- .activate();
- bot.button(IDELabel.Button.OK).click();
- assertTrue("Guvnor repository was not deleted properly",
- guvnorRepositoriesBot.tree().rowCount() == 0);
- }
- /**
- * Opens Guvnor Console
- */
- private void openGuvnorConsole(){
- SWTBot guvnorRepositoriesBot = guvnorRepositories.show().bot();
- SWTBotTree guvnorRepositoryTree = guvnorRepositoriesBot.tree();
- SWTBotTreeItem tiGuvnorRepository = guvnorRepositoryTree.getAllItems()[0];
- ContextMenuHelper.prepareTreeItemForContextMenu(guvnorRepositoryTree,
tiGuvnorRepository);
- new SWTBotMenu(ContextMenuHelper.getContextMenu(guvnorRepositoryTree,
- IDELabel.Menu.OPEN_GUVNOR_CONSOLE, false)).click();
- bot.sleep(Timing.time5S());
- SWTBotBrowserExt browser =
bot.browserByTitle(IDELabel.GuvnorConsole.GUVNOR_CONSOLE_TITLE);
- browser.setInputTextViaJavaScript(GuvnorRepositoriesTest.GUVNOR_USER_NAME, 0, bot);
- browser.setInputTextViaJavaScript(GuvnorRepositoriesTest.GUVNOR_PASSWORD, 1, bot);
- browser.clickOnButtonViaJavaScript(0, bot);
- browser.clickOnButtonViaJavaScript(IDELabel.GuvnorConsole.BUTTON_YES_INSTALL_SAMPLES,
bot);
- bot.sleep(Timing.time1S());
- KeyboardHelper.pressKeyCodeUsingAWT(KeyEvent.VK_RIGHT);
- KeyboardHelper.releaseKeyCodeUsingAWT(KeyEvent.VK_RIGHT);
- bot.sleep(Timing.time1S());
- KeyboardHelper.pressKeyCodeUsingAWT(KeyEvent.VK_ENTER);
- KeyboardHelper.releaseKeyCodeUsingAWT(KeyEvent.VK_ENTER);
- bot.sleep(Timing.time10S());
- KeyboardHelper.pressKeyCodeUsingAWT(KeyEvent.VK_ENTER);
- KeyboardHelper.releaseKeyCodeUsingAWT(KeyEvent.VK_ENTER);
- }
- /**
- * Browse Guvnor Repository and open fileToOpenFile
- * @param fileToOpen
- */
- private void browseGuvnorRepository(String fileToOpen){
-
- guvnorRepositories.show();
-
-
guvnorRepositories.openFile(Timing.time3S(),DroolsAllBotTests.getGuvnorRepositoryRootTreeItem(),
- IDELabel.GuvnorRepositories.PACKAGES_TREE_ITEM,
- IDELabel.GuvnorRepositories.MORTGAGE_TREE_ITEM,
- fileToOpen);
-
- assertTrue("File from Guvnor Repository was not opened properly. File " +
fileToOpen + " is not opened in editor",
- SWTEclipseExt.existEditorWithLabel(bot,fileToOpen + " (Read only)"));
-
- }
- /**
- * Starts Guvnor AS
- */
- private void startGuvnor(){
- try {
- new StartServer().fulfill();
- new PrepareViews().fulfill();
- } catch (RequirementNotFulfilledException e) {
- throw new RuntimeException(e);
- }
- }
- /**
- * Stops Guvnor AS
- */
- private void stopGuvnor(){
- try {
- new StopServer().fulfill();
- } catch (RequirementNotFulfilledException e) {
- throw new RuntimeException(e);
- }
- }
- /**
- * Imports file with fileName to Drools project and check update and commit Guvnor
functionality
- * @param fileName
- * @param sampleFileName
- * @param importFileName
- */
- private void guvnorFunctionalityCheck(String fileName, String sampleFileName, String
importFileName){
- eclipse.openPerspective(PerspectiveType.JAVA);
- guvnorRepositories.show().bot();
- SWTBotTreeItem tiGuvnorFile =
guvnorRepositories.selectTreeItem(Timing.time3S(),fileName,
- new String[]{DroolsAllBotTests.getGuvnorRepositoryRootTreeItem(),
- IDELabel.GuvnorRepositories.PACKAGES_TREE_ITEM,
- IDELabel.GuvnorRepositories.MORTGAGE_TREE_ITEM});
- tiGuvnorFile.select();
- SWTBot packageExplorerBot = packageExplorer.show().bot();
- SWTBotTreeItem tiDroolRuleDir =
packageExplorer.selectTreeItem(DroolsAllBotTests.SRC_MAIN_RULES_TREE_NODE,
- new String[] {DroolsAllBotTests.DROOLS_PROJECT_NAME});
- DragAndDropHelper.dragAndDropOnTo(tiGuvnorFile.widget,tiDroolRuleDir.widget);
- bot.sleep(Timing.time5S());
- bot.shell(IDELabel.Shell.COPY_FILE_FROM_GUVNOR_TO_PACKAGE_EXPLORER).activate();
- bot.button(IDELabel.Button.OK).click();
- SWTBotTree packageExplorerTree = packageExplorerBot.tree();
- // File is renamed because there is appended Guvnor info to Tree Item Label
- // So we need to get real label of Tree Item and use it later
- SWTBotTreeItem tiDroolRuleFile =
SWTEclipseExt.getTreeItemOnPathStartsWith(packageExplorerBot,
- packageExplorerTree,
- Timing.time1S(),
- fileName,
- new String[]{DroolsAllBotTests.DROOLS_PROJECT_NAME,
- DroolsAllBotTests.SRC_MAIN_RULES_TREE_NODE});
- SWTBotEditor editor = packageExplorer.openFile(DroolsAllBotTests.DROOLS_PROJECT_NAME,
- DroolsAllBotTests.SRC_MAIN_RULES_TREE_NODE,
- tiDroolRuleFile.getText());
-
- assertTrue("File moved from Guvnor Repository to Drools project was not opened
properly. File " + fileName + " is not opened in editor",
- SWTEclipseExt.existEditorWithLabel(bot,fileName));
- // Test Update from Guvnor Repository
- final String changeText = "#$%SWTBot Change#$%";
- final String originalEditorText = editor.toTextEditor().getText();
- editor.toTextEditor().insertText(0, 0, changeText);
- editor.save();
- bot.sleep(Timing.time1S());
- ContextMenuHelper.prepareTreeItemForContextMenu(packageExplorerTree,
tiDroolRuleFile);
- ContextMenuHelper.clickContextMenu(packageExplorerTree,
- IDELabel.Menu.GUVNOR,IDELabel.Menu.GUVNOR_UPDATE);
- bot.sleep(Timing.time5S());
- assertTrue("Update from Guvnor Repository was not successful. File " +
fileName + " has not updated content.",
- editor.toTextEditor().getText().equals(originalEditorText));
- // Test commit to Guvnor Repository
- editor.toTextEditor().insertText(0, 0, changeText);
- editor.save();
- bot.sleep(Timing.time1S());
- ContextMenuHelper.prepareTreeItemForContextMenu(packageExplorerTree,
tiDroolRuleFile);
- ContextMenuHelper.clickContextMenu(packageExplorerTree,
- IDELabel.Menu.GUVNOR,IDELabel.Menu.GUVNOR_COMMIT);
- bot.sleep(Timing.time5S());
- editor.close();
- editor =
guvnorRepositories.openFile(Timing.time2S(),DroolsAllBotTests.getGuvnorRepositoryRootTreeItem(),
- IDELabel.GuvnorRepositories.PACKAGES_TREE_ITEM,
- IDELabel.GuvnorRepositories.MORTGAGE_TREE_ITEM,
- fileName);
- assertTrue("Commit to Guvnor Repository was not successful. File " +
fileName + " was not commited properly." +
- "\nIt has content: " + editor.toTextEditor().getText() +
- "\nExpected content: " + changeText + originalEditorText,
- editor.toTextEditor().getText().equals(changeText + originalEditorText));
- // Test Add To Repository
- SWTBotTreeItem tiSampleFile = packageExplorer.selectTreeItem(sampleFileName,
- new String[] {DroolsAllBotTests.DROOLS_PROJECT_NAME,
- DroolsAllBotTests.SRC_MAIN_RULES_TREE_NODE});
- ContextMenuHelper.prepareTreeItemForContextMenu(packageExplorerTree, tiSampleFile);
- ContextMenuHelper.clickContextMenu(packageExplorerTree,
- IDELabel.Menu.GUVNOR,IDELabel.Menu.GUVNOR_ADD);
- eclipse.waitForShell("");
- SWTBotShell addToGuvnorShell = packageExplorerBot.activeShell();
- SWTBot addToGuvnorDialogBot = addToGuvnorShell.bot();
- addToGuvnorDialogBot.button(IDELabel.Button.NEXT).click();
- SWTEclipseExt.getTreeItemOnPath(addToGuvnorDialogBot,
- addToGuvnorDialogBot.tree(),
- Timing.time3S(),
- IDELabel.GuvnorRepositories.MORTGAGE_TREE_ITEM,
- new String[]{DroolsAllBotTests.getGuvnorRepositoryRootTreeItem(),
- IDELabel.GuvnorRepositories.PACKAGES_TREE_ITEM})
- .select();
- bot.sleep(Timing.time5S());
- addToGuvnorDialogBot.button(IDELabel.Button.FINISH).click();
- eclipse.waitForClosedShell(addToGuvnorShell);
- boolean isAddedToGuvnorRepository = false;
- try{
- guvnorRepositories.selectTreeItem(Timing.time2S(),sampleFileName,
- new String[]{DroolsAllBotTests.getGuvnorRepositoryRootTreeItem(),
- IDELabel.GuvnorRepositories.PACKAGES_TREE_ITEM,
- IDELabel.GuvnorRepositories.MORTGAGE_TREE_ITEM});
- isAddedToGuvnorRepository = true;
- } catch (WidgetNotFoundException wnfe){
- isAddedToGuvnorRepository = false;
- }
-
- assertTrue("File " + sampleFileName + " was not added to Guvnor
Repository.",
- isAddedToGuvnorRepository);
- // Test Deleting from Guvnor Repository file is already selected in Guvnor Repository
Tree
- packageExplorerBot = packageExplorer.show().bot();
- packageExplorerTree = packageExplorerBot.tree();
- packageExplorerBot.sleep(Timing.time2S());
- ContextMenuHelper.prepareTreeItemForContextMenu(packageExplorerTree, tiSampleFile);
- ContextMenuHelper.clickContextMenu(packageExplorerTree,
- IDELabel.Menu.GUVNOR,IDELabel.Menu.GUVNOR_DELETE);
- SWTBot dialogBot =
packageExplorerBot.shell(IDELabel.Shell.CONFIRM_DELETE).activate().bot();
- dialogBot.button(IDELabel.Button.OK).click();
- packageExplorerBot.sleep(Timing.time2S());
- boolean isRemovedFromGuvnorRepository = false;
- try{
- guvnorRepositories.selectTreeItem(Timing.time2S(),sampleFileName,
- new String[]{DroolsAllBotTests.getGuvnorRepositoryRootTreeItem(),
- IDELabel.GuvnorRepositories.PACKAGES_TREE_ITEM,
- IDELabel.GuvnorRepositories.MORTGAGE_TREE_ITEM});
- isRemovedFromGuvnorRepository = false;
- } catch (WidgetNotFoundException wnfe){
- isRemovedFromGuvnorRepository = true;
- }
- assertTrue("File " + sampleFileName + " was not removed from Guvnor
Repository.",
- isRemovedFromGuvnorRepository);
- // Import File From Repository
- eclipse.createNew(EntityType.RESOURCES_FROM_GUVNOR);
- bot.button(IDELabel.Button.NEXT).click();
- bot.sleep(Timing.time2S());
- SWTEclipseExt.getTreeItemOnPath(
- bot,
- bot.tree(),
- Timing.time5S(),
- importFileName,
- new String[] {
- DroolsAllBotTests.getGuvnorRepositoryRootTreeItem(),
- IDELabel.GuvnorRepositories.PACKAGES_TREE_ITEM,
- IDELabel.GuvnorRepositories.MORTGAGE_TREE_ITEM }).select();
- bot.button(IDELabel.Button.NEXT).click();
- SWTEclipseExt.getTreeItemOnPath(bot,
- bot.tree(),
- Timing.time1S(),
- "rules",
- new String[]
{DroolsAllBotTests.DROOLS_PROJECT_NAME,"src","main"}).select();
- bot.button(IDELabel.Button.FINISH).click();
- util.waitForJobs(Timing.time5S(),JobName.BUILDING_WS);
- bot.sleep(Timing.time1S());
- packageExplorerBot = packageExplorer.show().bot();
- packageExplorerTree = packageExplorerBot.tree();
- boolean isAddedFromGuvnorRepository = false;
- SWTBotTreeItem tiImportRuleFile = null;
- try{
- tiImportRuleFile = SWTEclipseExt.getTreeItemOnPathStartsWith(packageExplorerBot,
- packageExplorerTree,
- Timing.time1S(),
- importFileName,
- new String[]{DroolsAllBotTests.DROOLS_PROJECT_NAME,
- DroolsAllBotTests.SRC_MAIN_RULES_TREE_NODE});
- isAddedFromGuvnorRepository = true;
- } catch (WidgetNotFoundException wnfe){
- isAddedFromGuvnorRepository = false;
- }
- assertTrue("File " + importFileName + " was not added from Guvnor
Repository.",
- isAddedFromGuvnorRepository);
-
- ContextMenuHelper.prepareTreeItemForContextMenu(packageExplorerTree,
tiImportRuleFile);
- ContextMenuHelper.clickContextMenu(packageExplorerTree,
- IDELabel.Menu.GUVNOR,IDELabel.Menu.GUVNOR_DISCONNECT);
- bot.sleep(Timing.time1S());
- // name of the file has to be without Guvnor information appended to end of file
name
- // when imported from Guvnor repository
- assertTrue("File " + importFileName + " was not disconnected from
Guvnor Repository.",
- tiImportRuleFile.getText().trim().equals(importFileName));
- }
- private void drillIntoFunctionalityCheck(){
- SWTBotView guvnorReposioryView = guvnorRepositories.show();
- SWTBotTreeItem tiRoot =
guvnorRepositories.selectTreeItem(DroolsAllBotTests.getGuvnorRepositoryRootTreeItem(),null)
- .doubleClick();
- bot.sleep(Timing.time5S());
- SWTBotShell activeShell = bot.activeShell();
- SWTBot dialogBot = null;
- if (activeShell.getText().length() != 0){
- dialogBot = bot.shell("").activate().bot();
- }
- else{
- dialogBot = activeShell.bot();
- }
-
- dialogBot.textWithLabel(IDELabel.GuvnorConsoleLoginDialog.USER_NAME).setText(
- GuvnorRepositoriesTest.GUVNOR_USER_NAME);
- dialogBot.textWithLabel(IDELabel.GuvnorConsoleLoginDialog.PASSWORD).setText(
- GuvnorRepositoriesTest.GUVNOR_PASSWORD);
- dialogBot.button(IDELabel.Button.OK).click();
- tiRoot.expand();
- bot.sleep(Timing.time2S());
- tiRoot.select(IDELabel.GuvnorRepositories.PACKAGES_TREE_ITEM);
- SWTUtilExt.getViewToolbarButtonWithTooltip(guvnorReposioryView,
- IDELabel.GuvnorRepositories.GO_INTO_GUVNOR_REPOSITORY_TOOLTIP)
- .click();
- SWTBot guvnorRepositoryBot = guvnorReposioryView.bot();
- SWTBotTree guvnorRepositoryTree = guvnorRepositoryBot.tree();
- guvnorRepositoryBot.sleep(Timing.time3S());
- assertTrue("Guvnor repository Go Into functionality doesn't work
properly.\n" +
- "Expected First Tree Item in Guvnor Repository is " +
IDELabel.GuvnorRepositories.DEFAULT_PACKAGE_TREE_ITEM +
- "\nBut it was " + guvnorRepositoryTree.getAllItems()[0].getText(),
-
IDELabel.GuvnorRepositories.DEFAULT_PACKAGE_TREE_ITEM.equals(guvnorRepositoryTree.getAllItems()[0].getText()));
-
- guvnorRepositories.selectTreeItem(Timing.time2S(),
IDELabel.GuvnorRepositories.MORTGAGE_TREE_ITEM,
- null);
- SWTUtilExt.getViewToolbarButtonWithTooltip(guvnorReposioryView,
- IDELabel.GuvnorRepositories.GO_INTO_GUVNOR_REPOSITORY_TOOLTIP)
- .click();
- guvnorRepositoryBot.sleep(Timing.time3S());
- assertTrue("Guvnor repository Go Into functionality doesn't work
properly.\n" +
- "Expected First Tree Item in Guvnor Repository is " +
IDELabel.GuvnorRepositories.APPLICANTDSL_DSL_TREE_ITEM +
- "\nBut it was " + guvnorRepositoryTree.getAllItems()[0].getText(),
-
IDELabel.GuvnorRepositories.APPLICANTDSL_DSL_TREE_ITEM.equals(guvnorRepositoryTree.getAllItems()[0].getText()));
-
- SWTUtilExt.getViewToolbarButtonWithTooltip(guvnorReposioryView,
- IDELabel.GuvnorRepositories.BACK_GUVNOR_REPOSITORY_TOOLTIP)
- .click();
- guvnorRepositoryBot.sleep(Timing.time3S());
- assertTrue("Guvnor repository Back functionality doesn't work
properly.\n" +
- "Expected First Tree Item in Guvnor Repository is " +
IDELabel.GuvnorRepositories.DEFAULT_PACKAGE_TREE_ITEM +
- "\nBut it was " + guvnorRepositoryTree.getAllItems()[0].getText(),
-
IDELabel.GuvnorRepositories.DEFAULT_PACKAGE_TREE_ITEM.equals(guvnorRepositoryTree.getAllItems()[0].getText()));
-
- SWTUtilExt.getViewToolbarButtonWithTooltip(guvnorReposioryView,
- IDELabel.GuvnorRepositories.HOME_GUVNOR_REPOSITORY_TOOLTIP)
- .click();
- guvnorRepositoryBot.sleep(Timing.time3S());
- assertTrue("Guvnor repository Home functionality doesn't work
properly.\n" +
- "Expected First Tree Item in Guvnor Repository is " +
DroolsAllBotTests.getGuvnorRepositoryRootTreeItem() +
- "\nBut it was " + guvnorRepositoryTree.getAllItems()[0].getText(),
-
DroolsAllBotTests.getGuvnorRepositoryRootTreeItem().equals(guvnorRepositoryTree.getAllItems()[0].getText()));
- }
- /**
- * Check Repository History Functionality
- * @param testFileName
- */
- private void repositoryHistoryCheck (String testFileName){
- // Import File From Repository
- eclipse.createNew(EntityType.RESOURCES_FROM_GUVNOR);
- bot.button(IDELabel.Button.NEXT).click();
- SWTEclipseExt.getTreeItemOnPath(
- bot,
- bot.tree(),
- Timing.time5S(),
- testFileName,
- new String[] {
- DroolsAllBotTests.getGuvnorRepositoryRootTreeItem(),
- IDELabel.GuvnorRepositories.PACKAGES_TREE_ITEM,
- IDELabel.GuvnorRepositories.MORTGAGE_TREE_ITEM }).select();
- bot.button(IDELabel.Button.NEXT).click();
- SWTEclipseExt.getTreeItemOnPath(bot,
- bot.tree(),
- Timing.time1S(),
- "rules",
- new String[]
{DroolsAllBotTests.DROOLS_PROJECT_NAME,"src","main"}).select();
- bot.button(IDELabel.Button.FINISH).click();
- util.waitForJobs(Timing.time5S(),JobName.BUILDING_WS);
- bot.sleep(Timing.time1S());
- SWTBot packageExplorerBot = packageExplorer.show().bot();
- SWTBotTree packageExplorerTree = packageExplorerBot.tree();
- // File is renamed because there is appended Guvnor info to Tree Item Label
- // So we need to get real label of Tree Item and use it later
- SWTBotTreeItem tiTestRuleFile =
SWTEclipseExt.getTreeItemOnPathStartsWith(packageExplorerBot,
- packageExplorerTree,
- Timing.time1S(),
- testFileName,
- new String[]{DroolsAllBotTests.DROOLS_PROJECT_NAME,
- DroolsAllBotTests.SRC_MAIN_RULES_TREE_NODE});
- SWTBotEditor editor = packageExplorer.openFile(DroolsAllBotTests.DROOLS_PROJECT_NAME,
- DroolsAllBotTests.SRC_MAIN_RULES_TREE_NODE,
- tiTestRuleFile.getText());
- // change test file
- String addedChange = "SWTBOT Change!@#$asdfghjkl)(*&^";
- editor.toTextEditor().insertText(0,0,addedChange);
- editor.save();
- bot.sleep(Timing.time1S());
- // commit changes
- ContextMenuHelper.prepareTreeItemForContextMenu(packageExplorerTree,
tiTestRuleFile);
- ContextMenuHelper.clickContextMenu(packageExplorerTree,
- IDELabel.Menu.GUVNOR,IDELabel.Menu.GUVNOR_COMMIT);
- bot.sleep(Timing.time5S());
- // check history
- ContextMenuHelper.prepareTreeItemForContextMenu(packageExplorerTree,
tiTestRuleFile);
- ContextMenuHelper.clickContextMenu(packageExplorerTree,
- IDELabel.Menu.GUVNOR,IDELabel.Menu.GUVNOR_SHOW_HISTORY);
- bot.sleep(Timing.time5S());
- SWTBotView guvnorResourceHistoryView =
open.viewOpen(GuvnorGuvnorResourceHistory.LABEL);
- SWTBot guvnorResourceHistoryBot = guvnorResourceHistoryView.bot();
- SWTBotTable guvnorResourceHistoryTable = guvnorResourceHistoryView.bot().table();
- assertTrue("Guvnor Resource History table for file " + testFileName +
- " has to contain at least one record but is empty.",
- guvnorResourceHistoryTable.rowCount() > 0);
- // Compare Revisions
- String secondAddedChange = "222222" + addedChange;
- editor.toTextEditor().insertText(0,0,secondAddedChange);
- editor.saveAndClose();
- bot.sleep(Timing.time1S());
- ContextMenuHelper.prepareTreeItemForContextMenu(packageExplorerTree,
tiTestRuleFile);
- ContextMenuHelper.clickContextMenu(packageExplorerTree,
- IDELabel.Menu.GUVNOR,IDELabel.Menu.GUVNOR_COMPARE_WITH_VERSION);
- eclipse.waitForShell("");
- guvnorResourceHistoryBot.activeShell().bot().button(IDELabel.Button.OK).click();
- SWTBotEditor compareEditor = bot.editorByTitle("Compare");
- Matcher<StyledText> widgetOfTypeMatcher =
WidgetMatcherFactory.widgetOfType(StyledText.class);
- final List<?> styledTexts =
compareEditor.bot().widgets(widgetOfTypeMatcher,compareEditor.getWidget());
- String newVersionEditorText = syncExec(new StringResult() {
- public String run() {
- return ((StyledText)styledTexts.get(0)).getText();
- }
- });
- String revisionEditorText = syncExec(new StringResult() {
- public String run() {
- return ((StyledText)styledTexts.get(1)).getText();
- }
- });
- compareEditor.close();
- assertTrue("Actual version of file opened within compare editor has wrong
content.\n" +
- "Content should start with " + secondAddedChange +
- "\n but is " +
newVersionEditorText,newVersionEditorText.startsWith(secondAddedChange));
- assertTrue("File stored in Guvnor Repository opened within compare editor has
wrong content.\n" +
- "Content should start with " + addedChange +
- "\n but is " +
revisionEditorText,revisionEditorText.startsWith(addedChange));
- // Open Revision
- guvnorResourceHistoryView.show();
- guvnorResourceHistoryTable.setFocus();
- bot.sleep(Timing.time1S());
- guvnorResourceHistoryTable.select(0);
- bot.sleep(Timing.time1S());
- KeyboardHelper.pressKeyCodeUsingAWT(KeyEvent.VK_ENTER);
- KeyboardHelper.releaseKeyCodeUsingAWT(KeyEvent.VK_ENTER);
- bot.sleep(Timing.time1S());
- SWTBotEditor revisonFileEditor = eclipse.editorStartsWith(testFileName);
- String revisionFileText = revisonFileEditor.toTextEditor().getText();
- revisonFileEditor.close();
- assertTrue("File stored in Guvnor Repository has wrong content.\n" +
- "Content should start with " + addedChange +
- "\n but is " +
revisionFileText,revisionFileText.startsWith(addedChange));
- // Switch to version
- editor = packageExplorer.openFile(DroolsAllBotTests.DROOLS_PROJECT_NAME,
- DroolsAllBotTests.SRC_MAIN_RULES_TREE_NODE,
- tiTestRuleFile.getText());
- ContextMenuHelper.prepareTreeItemForContextMenu(packageExplorerTree,
tiTestRuleFile);
- ContextMenuHelper.clickContextMenu(packageExplorerTree,
- IDELabel.Menu.GUVNOR,IDELabel.Menu.GUVNOR_SWITCH_TO_VERSION);
- eclipse.waitForShell("");
- guvnorResourceHistoryBot.activeShell().bot().button(IDELabel.Button.OK).click();
- bot.sleep(Timing.time3S());
- String editorText = editor.toTextEditor().getText();
- assertTrue("Switched version of file has wrong content.\n" +
- "Content should start with " + addedChange +
- "\n but is " + editorText,editorText.startsWith(addedChange));
- }
-
-}
\ No newline at end of file
Deleted:
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/ManageDroolsProject.java
===================================================================
---
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/ManageDroolsProject.java 2011-08-03
07:47:59 UTC (rev 33536)
+++
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/ManageDroolsProject.java 2011-08-03
07:48:31 UTC (rev 33537)
@@ -1,156 +0,0 @@
- /*******************************************************************************
- * 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.SWTTestExt;
-import org.jboss.tools.ui.bot.ext.SWTEclipseExt;
-import org.jboss.tools.ui.bot.ext.Timing;
-import org.jboss.tools.ui.bot.ext.helper.FileRenameHelper;
-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.jboss.tools.ui.bot.ext.view.ProblemsView;
-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;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
-/**
- * Test managing of Drools Project
- * @author Vladimir Pakan
- *
- */
-public class ManageDroolsProject extends SWTTestExt{
- /**
- * Test manage Drools project
- */
- private static final String RENAMED_DROOLS_PROJECT =
DroolsAllBotTests.DROOLS_PROJECT_NAME + "-renamed";
- @Test
- public void testManageDroolsProject() {
- createDroolsProject (DroolsAllBotTests.DROOLS_PROJECT_NAME);
- runNewDroolsProject (DroolsAllBotTests.DROOLS_PROJECT_NAME);
- renameDroolsProject (DroolsAllBotTests.DROOLS_PROJECT_NAME,
ManageDroolsProject.RENAMED_DROOLS_PROJECT);
- deleteDroolsProject (ManageDroolsProject.RENAMED_DROOLS_PROJECT);
- createDroolsProject (DroolsAllBotTests.DROOLS_PROJECT_NAME);
- }
- /**
- * Creates new Drools project
- * @param droolsProjectName
- */
- 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.waitForAll(30*1000L);
- bot.sleep(Timing.time10S());
- assertTrue("Project "
- + droolsProjectName
- + " was not created
properly.",SWTEclipseExt.isProjectInPackageExplorer(bot,droolsProjectName));
- String projectPath = File.separator + droolsProjectName;
- SWTBotTreeItem[] errors = ProblemsView.getFilteredErrorsTreeItems(bot,null
,projectPath, null,null);
- assertTrue("Project "
- + droolsProjectName
- + " was not created properly. There are these errors: "
- + SWTEclipseExt.getFormattedTreeNodesText(bot.tree(), errors),
- errors == null || errors.length == 0);
- SWTBotTreeItem[] warnings = ProblemsView.getFilteredWarningsTreeItems(bot,null
,projectPath, null,null);
- assertTrue("Project "
- + droolsProjectName
- + " was not created properly. There are these warnings: "
- + SWTEclipseExt.getFormattedTreeNodesText(bot.tree(), warnings),
- warnings == null || warnings.length == 0);
-
- }
- /**
- * Runs newly created Drools project and check result
- * @param droolsProjectName
- */
- private void runNewDroolsProject(String droolsProjectName){
- console.clearConsole();
- bot.sleep(5000L);
-
- SWTBotTreeItem tiTestFile =
packageExplorer.selectTreeItem(DroolsAllBotTests.DROOLS_TEST_JAVA_TREE_NODE,
- new String[] {DroolsAllBotTests.DROOLS_PROJECT_NAME,
- DroolsAllBotTests.SRC_MAIN_JAVA_TREE_NODE,
- DroolsAllBotTests.COM_SAMPLE_TREE_NODE});
-
- eclipse.runTreeItemAsJavaApplication(tiTestFile);
-
- String consoleText = console.getConsoleText(3*1000L,60*1000L,true);
-
- assertTrue("DroolsTest.java class didn't run properly.\n" +
- "Console Text was: " + consoleText + "\n" +
- "Expected console text is: " + "Hello World\nGoodbye cruel
world\n",
- "Hello World\nGoodbye cruel world\n".equals(consoleText));
- }
- /**
- * Renames Drools project and check result
- * @param droolsProjectName
- * @param renamedProjectName
- */
- private void renameDroolsProject(String droolsProjectName, String renamedProjectName){
- packageExplorer.show();
-
- bot.sleep(TIME_1S);
-
- SWTBot webProjects = bot.viewByTitle(WidgetVariables.PACKAGE_EXPLORER).bot();
- SWTBotTree tree = webProjects.tree();
-
- tree.setFocus();
- String checkResult = FileRenameHelper.checkProjectRenamingWithinPackageExplorer(bot,
- DroolsAllBotTests.DROOLS_PROJECT_NAME,
- ManageDroolsProject.RENAMED_DROOLS_PROJECT,
- IDELabel.Shell.RENAME_JAVA_PROJECT);
- assertNull(checkResult,checkResult);
- }
- /**
- * Deletes Drools project and check result
- * @param droolsProjectName
- */
- private void deleteDroolsProject(String droolsProjectName){
-
- packageExplorer.deleteProject(droolsProjectName, true);
- boolean notFound = false;
- try{
- packageExplorer.selectProject(droolsProjectName);
- }catch (WidgetNotFoundException wnf){
- notFound = true;
- }
- assertTrue("Drools project: " + droolsProjectName +
- " was not deleted properly",notFound);
- }
-}
-
Deleted:
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/ManageDroolsRules.java
===================================================================
---
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/ManageDroolsRules.java 2011-08-03
07:47:59 UTC (rev 33536)
+++
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/ManageDroolsRules.java 2011-08-03
07:48:31 UTC (rev 33537)
@@ -1,119 +0,0 @@
- /*******************************************************************************
- * 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.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
-import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor;
-import org.eclipse.swtbot.swt.finder.SWTBot;
-import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
-import org.jboss.tools.ui.bot.ext.SWTTestExt;
-import org.jboss.tools.ui.bot.ext.Timing;
-import org.jboss.tools.ui.bot.ext.helper.ContextMenuHelper;
-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.jboss.tools.drools.ui.bot.test.DroolsAllBotTests;
-import org.junit.Test;
-/**
- * Test managing of Drools Rules
- * @author Vladimir Pakan
- *
- */
-public class ManageDroolsRules extends SWTTestExt{
- /**
- * Test manage Drools Rules
- */
- @Test
- public void testManageDroolsRules() {
- createDroolsRule (DroolsAllBotTests.TEST_DROOLS_RULE_NAME);
- bot.sleep(Timing.time3S());
- debugDroolsRule (DroolsAllBotTests.SAMPLE_DROOLS_RULE_NAME);
- }
- /**
- * Creates Drools Rule and checks result
- * @param droolsRuletName
- */
- private void createDroolsRule(String droolsRuleName){
-
- packageExplorer.show();
- SWTBotTreeItem tiDroolsRules =
packageExplorer.selectTreeItem(DroolsAllBotTests.SRC_MAIN_RULES_TREE_NODE,
- new String[] {DroolsAllBotTests.DROOLS_PROJECT_NAME});
-
- tiDroolsRules.select();
- eclipse.createNew(EntityType.DROOLS_RULE);
-
- bot.textWithLabel(IDELabel.NewDroolsRuleDialog.FILE_NAME).setText(droolsRuleName);
-
bot.textWithLabel(IDELabel.NewDroolsRuleDialog.RULE_PACKAGE_NAME).setText(DroolsAllBotTests.COM_SAMPLE_TREE_NODE);
- bot.button(IDELabel.Button.FINISH).click();
- bot.sleep(Timing.time1S());
- tiDroolsRules.expand();
- // Test if new Drools Rule is within package tree view
- boolean isRuleCreated = true;
- try{
- tiDroolsRules.getNode(droolsRuleName);
- } catch (WidgetNotFoundException wnfe){
- isRuleCreated = false;
- }
- assertTrue("New Drools Rule was not created properly. It's not present
within Package Explorer",isRuleCreated);
- // Test if new Drools Rule is opened in editor
- isRuleCreated = true;
- try{
- bot.editorByTitle(droolsRuleName);
- } catch (WidgetNotFoundException wnfe){
- isRuleCreated = false;
- }
- assertTrue("New Drools Rule was not created properly. File " +
droolsRuleName + " is not opened in editor",isRuleCreated);
- }
- /**
- * Debug Drools Rule and checks result
- * @param droolsRuletName
- */
- private void debugDroolsRule(String droolsRuleName){
- packageExplorer.show();
- SWTBotTreeItem tiDroolsRule =
packageExplorer.selectTreeItem(DroolsAllBotTests.SAMPLE_DROOLS_RULE_NAME,
- new String[] {DroolsAllBotTests.DROOLS_PROJECT_NAME,
- DroolsAllBotTests.SRC_MAIN_RULES_TREE_NODE});
- SWTBot packageExplorerBot =
bot.viewByTitle(ViewType.PACKAGE_EXPLORER.getViewLabel()).bot();
- SWTBotTree tree = packageExplorerBot.tree();
- // Select and Open Rule File
- ContextMenuHelper.prepareTreeItemForContextMenu(tree , tiDroolsRule);
- new SWTBotMenu(ContextMenuHelper.getContextMenu(tree, IDELabel.Menu.OPEN,
true)).click();
- SWTBotEclipseEditor ruleEditor = bot.editorByTitle(droolsRuleName).toTextEditor();
- ruleEditor.selectRange(8, 0, 0);
- bot.menu(IDELabel.Menu.RUN).menu(IDELabel.Menu.TOGGLE_BREAKPOINT).click();
- SWTBotTreeItem tiDroolsTest =
packageExplorer.selectTreeItem(DroolsAllBotTests.DROOLS_TEST_JAVA_TREE_NODE,
- new String[] {DroolsAllBotTests.DROOLS_PROJECT_NAME,
- DroolsAllBotTests.SRC_MAIN_JAVA_TREE_NODE,
- DroolsAllBotTests.COM_SAMPLE_TREE_NODE});
- console.clearConsole();
- eclipse.debugTreeItemAsDroolsApplication(tiDroolsTest);
- bot.sleep(Timing.time10S());
- eclipse.closeConfirmPerspectiveSwitchShellIfOpened(false);
- String consoleText = console.getConsoleText(3*1000L,3*1000L,true);
- assertTrue("Drools Rule was not debuged properly.\nConsole content should have
been empty but is:\n" + consoleText,
- consoleText.length() == 0);
- SWTBotView debugView = bot.viewByTitle(ViewType.DEBUG.getViewLabel());
- debugView.toolbarButton(IDELabel.DebugView.BUTTON_STEP_OVER_TOOLTIP).click();
- consoleText = console.getConsoleText(3*1000L,60*1000L,true);
- assertTrue("Drools Rule was not debuged properly.\nConsole content should
be:\n'Hello World\n' but is:\n" + consoleText,
- consoleText.equals("Hello World\n"));
- debugView.toolbarButton(IDELabel.DebugView.BUTTON_RESUME_TOOLTIP).click();
- consoleText = console.getConsoleText(3*1000L,60*1000L,true);
- assertTrue("Drools Rule was not debuged properly.\nConsole content should
be:Hello World\nGoodbye cruel world\n" + consoleText,
- consoleText.equals("Hello World\nGoodbye cruel world\n"));
- }
-
-}
-
Deleted:
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/ManageDroolsRuntime.java
===================================================================
---
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/ManageDroolsRuntime.java 2011-08-03
07:47:59 UTC (rev 33536)
+++
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/ManageDroolsRuntime.java 2011-08-03
07:48:31 UTC (rev 33537)
@@ -1,180 +0,0 @@
- /*******************************************************************************
- * 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{
- /**
- * Test manage Drools Runtime
- */
- @Test
- public void testManageDroolsRuntime() {
-
addDroolsRuntime(DroolsAllBotTests.DROOLS_RUNTIME_NAME,DroolsAllBotTests.DROOLS_RUNTIME_LOCATION,true);
- editDroolsRuntime(DroolsAllBotTests.getTestDroolsRuntimeName(),
- DroolsAllBotTests.getTestDroolsRuntimeLocation(),
- "edited" , "testedit");
- removeDroolsRuntime(DroolsAllBotTests.getTestDroolsRuntimeName());
-
createDroolsRuntime(DroolsAllBotTests.DROOLS_RUNTIME_NAME,DroolsAllBotTests.CREATE_DROOLS_RUNTIME_LOCATION);
- if (DroolsAllBotTests.useExternalDroolsRuntime()){
- removeDroolsRuntime(DroolsAllBotTests.DROOLS_RUNTIME_NAME);
-
addDroolsRuntime(DroolsAllBotTests.DROOLS_RUNTIME_NAME,DroolsAllBotTests.DROOLS_RUNTIME_LOCATION,true);
- }
- }
- /**
- * Adds Drools Runtime
- * @param runtimeName
- * @param runtimeLocation
- * @param setAsDefault
- */
- private void addDroolsRuntime(String runtimeName, String runtimeLocation, boolean
setAsDefault){
- 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);
- // Set new runtime as default
- if (setAsDefault){
- table.getTableItem(0).check();
- }
- bot.button(IDELabel.Button.OK).click();
- assertTrue("Drools Runtime with name [" + runtimeName +
- "] and location [" + runtimeLocation +
- "] was not added properly.",droolsRuntimeAdded);
- DroolsAllBotTests.setTestDroolsRuntimeName(runtimeName);
- DroolsAllBotTests.setTestDroolsRuntimeLocation(runtimeLocation);
- SWTEclipseExt.hideWarningIfDisplayed(bot);
- }
- /**
- * Selects Drools Preferences within Preferences Dialog
- */
- private void selectDroolsPreferences(){
- jbt.delay();
- 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);
- DroolsAllBotTests.setTestDroolsRuntimeName(editedDroolsRuntimeName);
- DroolsAllBotTests.setTestDroolsRuntimeLocation(editedDroolsRuntimeLocation);
- SWTEclipseExt.hideWarningIfDisplayed(bot);
- }
-
- /**
- * 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
(!DroolsAllBotTests.getTestDroolsRuntimeName().equals(DroolsAllBotTests.DROOLS_RUNTIME_NAME)){
- File tempDir = new File (DroolsAllBotTests.getTestDroolsRuntimeLocation());
- if (tempDir.isDirectory()){
- tempDir.delete();
- }
- }
- DroolsAllBotTests.setTestDroolsRuntimeName(null);
- DroolsAllBotTests.setTestDroolsRuntimeLocation(null);
- SWTEclipseExt.hideWarningIfDisplayed(bot);
- }
- /**
- * Creates Drools Runtime
- * @param runtimeName
- * @param runtimeLocation
- */
- private void createDroolsRuntime(String runtimeName, String runtimeLocation){
- DroolsRuntimeManager.createDefaultRuntime(runtimeLocation);
- DroolsRuntime droolsRuntime = new DroolsRuntime();
- droolsRuntime.setName(runtimeName);
- droolsRuntime.setPath(runtimeLocation);
- droolsRuntime.setDefault(true);
- DroolsRuntimeManager.setDroolsRuntimes(new DroolsRuntime[]{droolsRuntime});
- // Test if Drools runtime is defined
- assertTrue("Drools Runtime was not properly created on location: " +
runtimeLocation,
- new File (runtimeLocation + File.separator +
"drools-core.jar").exists());
- selectDroolsPreferences();
- SWTBotTable table = bot.table();
- boolean droolsRuntimeCreated =
-
SWTEclipseExt.isItemInTableColumn(table,runtimeName,IDELabel.DroolsRuntimeDialog.COLUMN_NAME_INDEX)
- &&
SWTEclipseExt.isItemInTableColumn(table,runtimeLocation,IDELabel.DroolsRuntimeDialog.COLUMN_LOCATION_INDEX);
- bot.button(IDELabel.Button.OK).click();
- SWTEclipseExt.hideWarningIfDisplayed(bot);
- assertTrue("Drools Runtime with name [" + runtimeName +
- "] and location [" + runtimeLocation +
- "] was not created properly.",droolsRuntimeCreated);
- DroolsAllBotTests.setTestDroolsRuntimeName(runtimeName);
- DroolsAllBotTests.setTestDroolsRuntimeLocation(runtimeLocation);
-
- }
-
-}
-
Deleted:
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/OpenDroolsPerspective.java
===================================================================
---
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/OpenDroolsPerspective.java 2011-08-03
07:47:59 UTC (rev 33536)
+++
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/OpenDroolsPerspective.java 2011-08-03
07:48:31 UTC (rev 33537)
@@ -1,50 +0,0 @@
- /*******************************************************************************
- * 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.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
-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.PerspectiveType;
-import org.junit.Test;
-/**
- * Test opening perspective
- * @author Vladimir Pakan
- *
- */
-public class OpenDroolsPerspective extends SWTTestExt{
- /**
- * Test Opening Drools Rules
- */
- @Test
- public void testOpenDroolsPerspective() {
- openDroolsPerspective();
- }
- /**
- * Open Drools Perspective
- */
- private void openDroolsPerspective(){
- eclipse.openPerspective(PerspectiveType.DROOLS);
- boolean wasFound = false;
- try{
- bot.toolbarDropDownButtonWithTooltip(IDELabel.Button.DROOLS_WORKBENCH);
- wasFound = true;
- } catch (WidgetNotFoundException wnfe){
- wasFound = false;
- }
- eclipse.openPerspective(PerspectiveType.JAVA);
- assertTrue("Drools Perspective was not opened properly. Button " +
- IDELabel.Button.DROOLS_WORKBENCH + " is not present in Workbench",
- wasFound);
- }
-}
-
Deleted:
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/RuleFlowTest.java
===================================================================
---
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/RuleFlowTest.java 2011-08-03
07:47:59 UTC (rev 33536)
+++
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/RuleFlowTest.java 2011-08-03
07:48:31 UTC (rev 33537)
@@ -1,491 +0,0 @@
- /*******************************************************************************
- * 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.awt.event.KeyEvent;
-import java.io.File;
-import java.io.IOException;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-
-import org.eclipse.swtbot.eclipse.gef.finder.SWTGefBot;
-import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefEditor;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
-import org.jboss.tools.drools.ui.bot.test.DroolsAllBotTests;
-import org.jboss.tools.ui.bot.ext.SWTEclipseExt;
-import org.jboss.tools.ui.bot.ext.SWTTestExt;
-import org.jboss.tools.ui.bot.ext.SWTUtilExt;
-import org.jboss.tools.ui.bot.ext.Timing;
-import org.jboss.tools.ui.bot.ext.helper.KeyboardHelper;
-import org.jboss.tools.ui.bot.ext.types.IDELabel;
-import org.jboss.tools.ui.bot.ext.types.ViewType;
-import org.junit.Test;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.xml.sax.SAXException;
-/**
- * Tests Rule Flow
- * @author Vladimir Pakan
- *
- */
-public class RuleFlowTest extends SWTTestExt{
- private static final String RULE_FLOW_FILE_DIRECTORY = "src" + File.separator
+
- "main" + File.separator +
- "rules";
- private static final String ROOT_NODE_NAME = "process";
- private static final String HEADER_NODE_NAME = "header";
- private static final String NODES_NODE_NAME = "nodes";
- private static final String CONNECTIONS_NODE_NAME = "connections";
- private static final String CONNECTION_NODE_NAME = "connection";
- private static final int NODES_NODE_CHILDREN_COUNT = 7;
- private static final int CONNECTIONS_NODE_CHILDREN_COUNT = 1;
- private static final int ROOT_NODE_CHILDREN_COUNT = 3;
-
- private boolean isEditorMaximized = false;
- /**
- * Tests Rule Flow
- */
- @Test
- public void testRuleFlow() {
- runRuleFlowCheck(DroolsAllBotTests.RULE_FLOW_JAVA_TEST_FILE_NAME);
- ruleFlowEditorCheck(DroolsAllBotTests.RULE_FLOW_RF_FILE_NAME);
- }
- /**
- * Runs newly created Drools project and check result
- * @param droolsProjectName
- */
- private void runRuleFlowCheck(String droolsRuleTestFileName){
- console.clearConsole();
- bot.sleep(5000L);
-
- SWTBotTreeItem tiTestFile = packageExplorer.selectTreeItem(droolsRuleTestFileName,
- new String[] {DroolsAllBotTests.DROOLS_PROJECT_NAME,
- DroolsAllBotTests.SRC_MAIN_JAVA_TREE_NODE,
- DroolsAllBotTests.COM_SAMPLE_TREE_NODE});
-
- eclipse.runTreeItemAsJavaApplication(tiTestFile);
-
- String consoleText = console.getConsoleText(3*1000L,60*1000L,true);
-
- assertTrue(droolsRuleTestFileName + " didn't run properly.\n" +
- "Console Text was: " + consoleText + "\n" +
- "Expected console text is: " + "Hello World\n",
- "Hello World\n".equals(consoleText));
- }
- /**
- * Add all possible object to RF diagram and then remove them
- * @param ruleFlowRfFileName
- */
- private void ruleFlowEditorCheck (String ruleFlowFileName){
- packageExplorer.show();
- packageExplorer.openFile(DroolsAllBotTests.DROOLS_PROJECT_NAME ,
- DroolsAllBotTests.SRC_MAIN_RULES_TREE_NODE,
- DroolsAllBotTests.RULE_FLOW_RF_FILE_NAME);
- // Test if Rule Flow RF File is opened in editor
- assertTrue("Rule Flow RF File is not opened properly. File " +
ruleFlowFileName + " is not opened in editor",
- SWTEclipseExt.existEditorWithLabel(bot,ruleFlowFileName));
- // Maximize editor
- bot.menu(IDELabel.Menu.WINDOW)
- .menu(IDELabel.Menu.NAVIGATION)
- .menu(IDELabel.Menu.MAXIMIZE_ACTIVE_VIEW_OR_EDITOR)
- .click();
- isEditorMaximized = true;
- SWTGefBot gefBot = new SWTGefBot();
- SWTBotGefEditor gefEditor = gefBot.gefEditor(ruleFlowFileName);
- // Clear Editor
- gefEditor.setFocus();
- deleteAllObjectsFromRFFile(gefEditor,
- DroolsAllBotTests.DROOLS_PROJECT_NAME,
- DroolsAllBotTests.RULE_FLOW_RF_FILE_NAME);
- // Draw each component
- String[] tools = new String[]{"Start Event","End
Event","Rule Task",
- "Gateway [diverge]","Gateway [converge]","Reusable
Sub-Process",
- "Script Task"
- };
- int xspacing = 100;
- int xoffset = 10;
- int yspacing = 100;
- int yoffset = 10;
- for (int toolIndex = 0;toolIndex < tools.length;toolIndex++){
- gefEditor.activateTool(tools[toolIndex]);
- gefEditor.click(xspacing * (toolIndex % 3) + xoffset,
- yspacing * (toolIndex / 3) + yoffset);
- }
- // Add Sequence Flow between Start and End Node
- gefEditor.activateTool("Sequence Flow");
- // Click on Start Node
- gefEditor.click(xoffset + 5, yoffset + 5);
- // Click on End Node
- gefEditor.click(xspacing + xoffset + 5, yoffset + 5);
- gefEditor.save();
- checkFullRFFile(DroolsAllBotTests.DROOLS_PROJECT_NAME , ruleFlowFileName);
- // check synchronization with Properties View
- gefEditor.activateTool("Select");
- gefEditor.click(xoffset + 5, yoffset + 5);
- SWTBotTree tree = eclipse.showView(ViewType.PROPERTIES).tree();
- String id = tree.getTreeItem("Id").cell(1);
- String name = tree.getTreeItem("Name").cell(1);
- assertTrue("First editor element has to have Id=1 and Name=Start." +
- "\nBut it has Id=" + id +
- " Name=" + name, id.equals("1") &&
name.equals("Start"));
- // Delete each component
- gefEditor.activateTool("Select");
- for (int toolIndex = 0;toolIndex < tools.length;toolIndex++){
- gefEditor.click(xspacing * (toolIndex % 3) + xoffset + 10,
- yspacing * (toolIndex / 3) + yoffset + 10);
- gefEditor.setFocus();
- bot.sleep(Timing.time1S());
- KeyboardHelper.typeKeyCodeUsingAWT(KeyEvent.VK_DELETE);
- }
- // Restore maximized editor
- bot.menu(IDELabel.Menu.WINDOW)
- .menu(IDELabel.Menu.NAVIGATION)
- .menu(IDELabel.Menu.MAXIMIZE_ACTIVE_VIEW_OR_EDITOR)
- .click();
- isEditorMaximized = false;
- gefEditor.save();
- gefEditor.close();
- checkEmptyRFFile(DroolsAllBotTests.DROOLS_PROJECT_NAME , ruleFlowFileName);
- }
- /**
- * Check content of Rule Flow file containing all possible objects
- *
- * @param projectName
- * @param ruleFlowFileName
- */
- private void checkFullRFFile(String projectName, String ruleFlowFileName) {
-
- Document doc = loadXmlFile(SWTUtilExt.getPathToProject(projectName)
- + File.separator + RuleFlowTest.RULE_FLOW_FILE_DIRECTORY
- + File.separator + ruleFlowFileName);
-
- String errorDescription = null;
- Element rootNode = doc.getDocumentElement();
- doc.normalizeDocument();
- if (rootNode.getNodeName().equals(ROOT_NODE_NAME)) {
- NodeList rootNodeList = rootNode.getChildNodes();
- List<Node> rootNodes = removeTextNodes(rootNodeList);
- if (rootNodes.size() == ROOT_NODE_CHILDREN_COUNT) {
- Node header = rootNodes.get(0);
- errorDescription = checkEmptyFileNode(header, HEADER_NODE_NAME);
- if (errorDescription == null) {
- Node nodesNode = rootNodes.get(1);
- errorDescription = checkNodeName(nodesNode, NODES_NODE_NAME);
- if (errorDescription == null) {
- errorDescription = checkNodesFileNodes(removeTextNodes(nodesNode
- .getChildNodes()));
- if (errorDescription == null) {
- Node connectionsNode = rootNodes.get(2);
- errorDescription = checkNodeName(connectionsNode,
- CONNECTIONS_NODE_NAME);
- if (errorDescription == null) {
- errorDescription =
checkConnectionsFileNodes(removeTextNodes(connectionsNode
- .getChildNodes()));
- }
- }
- }
- }
- } else {
- errorDescription = "Root node has to have " + ROOT_NODE_CHILDREN_COUNT
- + " child nodes but it has " + rootNodeList.getLength();
- }
- } else {
- errorDescription = "Root node has to have name '" + ROOT_NODE_NAME
- + "' but it has name '" + rootNode.getNodeName() +
"'";
- }
- assertNull(errorDescription,errorDescription);
- }
- /**
- * Check content of empty Rule Flow file
- * @param projectName
- * @param ruleFlowRfFileName
- */
- private void checkEmptyRFFile(String projectName, String ruleFlowFileName){
-
- Document doc = loadXmlFile(SWTUtilExt.getPathToProject(projectName) +
- File.separator + RuleFlowTest.RULE_FLOW_FILE_DIRECTORY + File.separator +
- ruleFlowFileName);
-
- String errorDescription = null;
-
- Element rootNode = doc.getDocumentElement();
- doc.normalizeDocument();
- if (rootNode.getNodeName().equals(ROOT_NODE_NAME)) {
- NodeList rootNodeList = rootNode.getChildNodes();
- List<Node> nodes = removeTextNodes(rootNodeList);
- if (nodes.size() == ROOT_NODE_CHILDREN_COUNT) {
- Node header = nodes.get(0);
- errorDescription = checkEmptyFileNode(header, HEADER_NODE_NAME);
- if (errorDescription == null) {
- Node nodesNode = nodes.get(1);
- errorDescription = checkEmptyFileNode(nodesNode, NODES_NODE_NAME);
- if (errorDescription == null) {
- Node connnections = nodes.get(2);
- errorDescription = checkEmptyFileNode(connnections, CONNECTIONS_NODE_NAME);
- }
- }
- } else {
- errorDescription = "Root node has to have " +
- ROOT_NODE_CHILDREN_COUNT +
- " child nodes but it has " +
- rootNodeList.getLength();
- }
- } else {
- errorDescription = "Root node has to have name '" + ROOT_NODE_NAME
- + "' but it has name '" + rootNode.getNodeName() +
"'";
- }
- assertNull(errorDescription,errorDescription);
-
- }
- /**
- * Loads and parse XML file with fileName from file system
- * @param fileName - full path to XML file
- * @return
- */
- private Document loadXmlFile (String fileName){
- File file = new File(fileName);
- DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
- DocumentBuilder db;
- Document doc = null;
- try {
- db = dbf.newDocumentBuilder();
- doc = db.parse(file);
- } catch (ParserConfigurationException pce) {
- throw new RuntimeException(pce);
- } catch (SAXException saxe) {
- throw new RuntimeException(saxe);
- } catch (IOException ioe) {
- throw new RuntimeException(ioe);
- }
- return doc;
- }
- private static List<Node> removeTextNodes(NodeList rootNodeList){
- LinkedList<Node> nodes = new LinkedList<Node>();
- for (int index = 0 ; index < rootNodeList.getLength(); index++){
- Node node = rootNodeList.item(index);
- if (!node.getNodeName().equals("#text")){
- nodes.add(node);
- }
- }
- return nodes;
- }
- /**
- * Check if node is correct for empty file
- * @param node
- * @param expectedNodeName
- * @return
- */
- private static String checkEmptyFileNode (Node node,String expectedNodeName){
- String errorDescription = null;
- if (node.getNodeName().equals(expectedNodeName)){
- if (removeTextNodes(node.getChildNodes()).size() == 0){
- if(node.getTextContent().trim().length() != 0){
- errorDescription = expectedNodeName + " node has to have no text value but
it has " +
- node.getTextContent();
- }
- }
- else{
- errorDescription = expectedNodeName + " node has to have no children but is
has " +
- removeTextNodes(node.getChildNodes()).size();
-
- }
- }
- else{
- errorDescription = checkNodeName(node, expectedNodeName);
- }
-
- return errorDescription;
-
- }
- /**
- * Check nodes of Nodes children.
- * @param nodes - list of nodes of nodes node stripped from text nodes
- * @return
- */
- private static String checkNodesFileNodes(List<Node> nodes){
- String errorDescription = null;
-
- if (nodes.size() == NODES_NODE_CHILDREN_COUNT){
- List<String> mandatoryNodes = getMandatoryNodesOfNodesNode();
- int index = 0;
- Iterator<Node> iterator = nodes.iterator();
- while (index < nodes.size() && errorDescription == null){
- String nodeName = iterator.next().getNodeName();
- if (mandatoryNodes.contains(nodeName)){
- mandatoryNodes.remove(nodeName);
- }
- else{
- errorDescription = "Nodes node cannot contain node " + nodeName;
- }
- index++;
- }
- if (errorDescription == null && mandatoryNodes.size() > 0) {
- StringBuilder sb = new StringBuilder("");
- for (String nodeName : mandatoryNodes){
- if (sb.length() != 0){
- sb.append(", ");
- }
- sb.append(nodeName);
- }
- errorDescription = "Nodes node doesn't contain all necesarry
nodes.\n" +
- "These node(s) are missing within nodes node: " +
- sb.toString();
- }
- }
- else{
- errorDescription = "Nodes node has to have " +
- NODES_NODE_CHILDREN_COUNT +
- " child nodes but it has " +
- nodes.size();
- }
-
- return errorDescription;
- }
- /**
- * Returns list of mandatory nodes of nodes node
- * @return
- */
- private static List<String> getMandatoryNodesOfNodesNode(){
- LinkedList<String> allowedNodes = new LinkedList<String>();
- allowedNodes.add("split");
- /*
- allowedNodes.add("timerNode");
- allowedNodes.add("humanTask");
- */
- allowedNodes.add("ruleSet");
- allowedNodes.add("actionNode");
- /*
- allowedNodes.add("composite");
- */
- allowedNodes.add("end");
- /*
- allowedNodes.add("workItem");
- allowedNodes.add("fault");
- */
- allowedNodes.add("subProcess");
- allowedNodes.add("start");
- /*
- allowedNodes.add("workItem");
- allowedNodes.add("eventNode");
- */
- allowedNodes.add("join");
-
- return allowedNodes;
- }
-
- /**
- * Check nodes of connections children.
- * @param nodes - list of nodes of connections node stripped from text nodes
- * @return
- */
- private static String checkConnectionsFileNodes(List<Node> nodes){
- String errorDescription = null;
-
- if (nodes.size() == CONNECTIONS_NODE_CHILDREN_COUNT){
- Node connectioNode = nodes.get(0);
- errorDescription = checkEmptyFileNode(connectioNode, CONNECTION_NODE_NAME);
- }
- else{
- errorDescription = "Conections node has to have " +
- CONNECTIONS_NODE_CHILDREN_COUNT +
- " child nodes but it has " +
- nodes.size();
- }
-
- return errorDescription;
- }
- /**
- * Check if node has expected name
- * @param node
- * @param expectedNodeName
- * @return
- */
- private static String checkNodeName (Node node, String expectedNodeName){
- String errorDescription = null;
-
- if (!node.getNodeName().equals(expectedNodeName)){
- errorDescription = "Node has to have name '" +
- expectedNodeName + "' but it has name '" +
- node.getNodeName() + "'";
- }
-
- return errorDescription;
- }
-
- protected void tearDown(){
- if (isEditorMaximized){
- // Restore maximized editor
- bot.menu(IDELabel.Menu.WINDOW)
- .menu(IDELabel.Menu.NAVIGATION)
- .menu(IDELabel.Menu.MAXIMIZE_ACTIVE_VIEW_OR_EDITOR)
- .click();
- isEditorMaximized = false;
- }
- try {
- super.tearDown();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- /**
- * Delete all objects from RF File
- * @param gefEditor
- * @param projectName
- * @param ruleFlowFileName
- */
- private void deleteAllObjectsFromRFFile(SWTBotGefEditor gefEditor, String projectName,
String ruleFlowFileName) {
-
- Document doc = loadXmlFile(SWTUtilExt.getPathToProject(projectName)
- + File.separator + RuleFlowTest.RULE_FLOW_FILE_DIRECTORY
- + File.separator + ruleFlowFileName);
-
- String errorDescription = null;
- Element rootNode = doc.getDocumentElement();
- doc.normalizeDocument();
- if (rootNode.getNodeName().equals(ROOT_NODE_NAME)) {
- NodeList rootNodeList = rootNode.getChildNodes();
- List<Node> rootNodes = removeTextNodes(rootNodeList);
- if (rootNodes.size() == ROOT_NODE_CHILDREN_COUNT) {
- Node nodesNode = rootNodes.get(1);
- errorDescription = checkNodeName(nodesNode, NODES_NODE_NAME);
- if (errorDescription == null) {
- List<Node> nodes = removeTextNodes(nodesNode.getChildNodes());
- for (Node node : nodes){
- NamedNodeMap attributes = node.getAttributes();
- int xPos =
Integer.parseInt(attributes.getNamedItem("x").getNodeValue());
- int yPos =
Integer.parseInt(attributes.getNamedItem("y").getNodeValue());
- gefEditor.click(xPos + 3, yPos + 3);
- bot.sleep(Timing.time1S());
- KeyboardHelper.typeKeyCodeUsingAWT(KeyEvent.VK_DELETE);
- bot.sleep(Timing.time1S());
- }
- }
- } else {
- errorDescription = "'" + NODES_NODE_NAME + "'"
+" was not found on expected location within RF file." +
- " RF file structure has been changed";
- }
- } else {
- errorDescription = "Root Node has to have name '" + ROOT_NODE_NAME +
"'. RF file structure has been changed.";
- }
- assertNull(errorDescription,errorDescription);
- }
-
-}
\ No newline at end of file
Deleted: trunk/drools/tests/pom.xml
===================================================================
--- trunk/drools/tests/pom.xml 2011-08-03 07:47:59 UTC (rev 33536)
+++ trunk/drools/tests/pom.xml 2011-08-03 07:48:31 UTC (rev 33537)
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
-
- <groupId>org.jboss.tools</groupId>
- <artifactId>org.jboss.tools.parent.pom</artifactId>
- <version>0.0.2-SNAPSHOT</version>
- </parent>
- <groupId>org.jboss.tools.drools</groupId>
- <artifactId>org.jboss.tools.drools.tests</artifactId>
- <name>org.jboss.tools.drools.tests</name>
- <version>0.0.1-SNAPSHOT</version>
- <packaging>pom</packaging>
- <modules>
- <module>org.jboss.tools.drools.ui.bot.test</module>
- </modules>
-</project>
\ No newline at end of file