[jbosstools-commits] JBoss Tools SVN: r39621 - in trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test: src/org/jboss/tools/hb/ui/bot/suite and 2 other directories.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Mon Mar 19 11:54:14 EDT 2012


Author: jpeterka
Date: 2012-03-19 11:54:13 -0400 (Mon, 19 Mar 2012)
New Revision: 39621

Added:
   trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/launcher/ConsoleConfiguration.launch
   trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/suite/ConsoleConfigurationSuite.java
   trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/console/
   trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/console/CreateConsoleConfigurationTest.java
   trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/console/EditConsoleConfigurationTest.java
Log:
Console configuration ui bot tests added

Added: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/launcher/ConsoleConfiguration.launch
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/launcher/ConsoleConfiguration.launch	                        (rev 0)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/launcher/ConsoleConfiguration.launch	2012-03-19 15:54:13 UTC (rev 39621)
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.swtbot.eclipse.ui.launcher.JunitLaunchConfig">
+<booleanAttribute key="append.args" value="true"/>
+<booleanAttribute key="askclear" value="false"/>
+<booleanAttribute key="automaticAdd" value="true"/>
+<booleanAttribute key="automaticValidate" value="false"/>
+<stringAttribute key="bootstrap" value=""/>
+<stringAttribute key="checked" value="[NONE]"/>
+<booleanAttribute key="clearConfig" value="true"/>
+<booleanAttribute key="clearws" value="true"/>
+<booleanAttribute key="clearwslog" value="false"/>
+<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/>
+<booleanAttribute key="default" value="true"/>
+<booleanAttribute key="includeOptional" value="true"/>
+<stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/suite/ConsoleConfigurationSuite.java"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="1"/>
+</listAttribute>
+<mapAttribute key="org.eclipse.debug.core.environmentVariables">
+<mapEntry key="DISPLAY" value=":1"/>
+</mapAttribute>
+<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
+<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
+<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
+<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.jboss.tools.hb.ui.bot.suite.ConsoleConfigurationSuite"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.jboss.tools.hibernate.ui.bot.test"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dosgi.requiredJavaVersion=1.5 -XX:MaxPermSize=256m -Xms40m -Xmx512m -Xmx1024M -XX:PermSize=128M -XX:MaxPermSize=256M -Dusage_reporting_enabled=false -Dtest.configurations.dir=/home/jpeterka/etc/hb"/>
+<stringAttribute key="pde.version" value="3.3"/>
+<stringAttribute key="product" value="com.jboss.jbds.product.product"/>
+<booleanAttribute key="show_selected_only" value="false"/>
+<stringAttribute key="templateConfig" value="${target_home}/configuration/config.ini"/>
+<booleanAttribute key="tracing" value="false"/>
+<booleanAttribute key="useCustomFeatures" value="false"/>
+<booleanAttribute key="useDefaultConfig" value="true"/>
+<booleanAttribute key="useDefaultConfigArea" value="false"/>
+<booleanAttribute key="useProduct" value="true"/>
+</launchConfiguration>


Property changes on: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/launcher/ConsoleConfiguration.launch
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/suite/ConsoleConfigurationSuite.java
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/suite/ConsoleConfigurationSuite.java	                        (rev 0)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/suite/ConsoleConfigurationSuite.java	2012-03-19 15:54:13 UTC (rev 39621)
@@ -0,0 +1,12 @@
+package org.jboss.tools.hb.ui.bot.suite;
+
+import org.jboss.tools.hb.ui.bot.test.console.CreateConsoleConfigurationTest;
+import org.jboss.tools.ui.bot.ext.RequirementAwareSuite;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite.SuiteClasses;
+
+ at RunWith(RequirementAwareSuite.class)
+ at SuiteClasses({CreateConsoleConfigurationTest.class})
+public class ConsoleConfigurationSuite {
+
+}


Property changes on: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/suite/ConsoleConfigurationSuite.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/console/CreateConsoleConfigurationTest.java
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/console/CreateConsoleConfigurationTest.java	                        (rev 0)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/console/CreateConsoleConfigurationTest.java	2012-03-19 15:54:13 UTC (rev 39621)
@@ -0,0 +1,130 @@
+package org.jboss.tools.hb.ui.bot.test.console;
+
+import static org.eclipse.swtbot.swt.finder.waits.Conditions.shellCloses;
+
+import java.util.List;
+
+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.hb.ui.bot.common.ConfigurationFile;
+import org.jboss.tools.hb.ui.bot.common.Tree;
+import org.jboss.tools.hb.ui.bot.test.HibernateBaseTest;
+import org.jboss.tools.ui.bot.ext.config.Annotations.Require;
+import org.jboss.tools.ui.bot.ext.config.TestConfigurator;
+import org.jboss.tools.ui.bot.ext.gen.ActionItem;
+import org.jboss.tools.ui.bot.ext.helper.DatabaseHelper;
+import org.jboss.tools.ui.bot.ext.types.EntityType;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
+import org.junit.Test;
+
+/**
+ * Create Hibernate Console UI Bot Test
+ * @author jpeterka
+ *
+ */
+ at Require(clearProjects = true)
+public class CreateConsoleConfigurationTest extends HibernateBaseTest {
+
+	final String prjName = "configurationtest";
+	
+	@Test
+	public void createConsoleConfigurationTest() {
+		emptyErrorLog();
+		importTestProject("/resources/prj/" + prjName);
+		createConfigurationFile();
+		createHibernateConsole();
+		checkErrorLog();
+	}
+	
+	private void createConfigurationFile() {
+		ConfigurationFile.create(new String[]{prjName,"src"},"hibernate.cfg.xml",false);		
+	}
+
+	private void createHibernateConsole() {
+		open.viewOpen(ActionItem.View.GeneralProjectExplorer.LABEL);
+		eclipse.createNew(EntityType.HIBERNATE_CONSOLE);		
+
+		// Hibernate Console Dialog has no title
+		SWTBotShell shell = bot.waitForShell("");
+				
+		createMainTab(shell);
+		createOptionTab(shell);
+		createClasspathTab(shell);
+		createMappingsTab(shell);
+		createCommonTab(shell);
+		
+		bot.button(IDELabel.Button.FINISH).click();
+		bot.waitUntil(shellCloses(shell));
+		util.waitForNonIgnoredJobs();
+		
+		expandDatabaseInConsole();		
+	}
+	
+	private void createMainTab(SWTBotShell shell) {
+		bot.cTabItem(IDELabel.HBConsoleWizard.MAIN_TAB).activate();
+		bot.textWithLabel("Name:").setText(prjName + "-w");
+		bot.textWithLabelInGroup("","Configuration file:").setText(prjName + "/src/hibernate.cfg.xml");						
+	}
+
+	private void createOptionTab(SWTBotShell shell) {
+		shell.setFocus();
+		bot.cTabItem(IDELabel.HBConsoleWizard.OPTIONS_TAB).activate();
+				
+		String dialect = DatabaseHelper.getDialect(TestConfigurator.currentConfig.getDB().dbType);
+		bot.comboBoxWithLabelInGroup("", IDELabel.HBConsoleWizard.DATABASE_DIALECT).setSelection(dialect);
+	}
+
+	private void createClasspathTab(SWTBotShell shell) {
+		shell.activate();
+		bot.cTabItem(IDELabel.HBConsoleWizard.CLASSPATH_TAB).activate();
+	}
+
+	private void createMappingsTab(SWTBotShell shell) {
+		shell.activate();
+		bot.cTabItem(IDELabel.HBConsoleWizard.MAPPINGS_TAB).activate();
+	}
+
+	private void createCommonTab(SWTBotShell shell) {
+		shell.activate();
+		bot.cTabItem(IDELabel.HBConsoleWizard.COMMON_TAB).activate();
+	}
+
+	private void expandDatabaseInConsole() {
+		SWTBot viewBot = open.viewOpen(ActionItem.View.HibernateHibernateConfigurations.LABEL).bot();
+		SWTBotTreeItem db = Tree.select(viewBot, prjName,"Database");
+		db.expand();
+
+		// expand PUBLIC node or whatever
+		SWTBotTreeItem pub = db.getItems()[0];
+		final int limit = 10; // 10s
+		final int sleep = 1000;
+		int counter = 0;
+				
+		while(counter < limit) {
+			if (pub.widget.isDisposed()) {
+				pub = db.getItems()[0];
+				bot.sleep(sleep);
+			}
+			if (pub.getText().equals("<Reading schema error: Getting database metadata >")) {
+				fail("Can't load data, DB not accessible");
+			}		
+			if (pub.getText().equals("Pending...") &&  counter < limit) {
+				bot.sleep(sleep);
+				counter++;
+				log.info("Waiting for database loading...");
+			}
+			else
+			{
+				log.info("DB loaded");
+				break;
+			}
+		}
+		
+		List<String> tables = Tree.getSubNodes(viewBot, pub);
+		assertTrue("Table must contain tables", tables.size()> 0);
+		for (String s : tables) {
+			log.info("Table:" + s);
+		}
+	}
+}


Property changes on: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/console/CreateConsoleConfigurationTest.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/console/EditConsoleConfigurationTest.java
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/console/EditConsoleConfigurationTest.java	                        (rev 0)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/console/EditConsoleConfigurationTest.java	2012-03-19 15:54:13 UTC (rev 39621)
@@ -0,0 +1,5 @@
+package org.jboss.tools.hb.ui.bot.test.console;
+
+public class EditConsoleConfigurationTest {
+
+}


Property changes on: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/console/EditConsoleConfigurationTest.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain



More information about the jbosstools-commits mailing list