Author: jpeterka
Date: 2012-03-19 11:55:11 -0400 (Mon, 19 Mar 2012)
New Revision: 39622
Added:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/launcher/JPA.launch
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/suite/JPASuite.java
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/jpa/
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/jpa/CreateJPAProjectTest.java
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/jpa/EditPersistenceXMLTest.java
Log:
JPA create/edit ui bot tests added into hibernate ui.bot tests
Added:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/launcher/JPA.launch
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/launcher/JPA.launch
(rev 0)
+++
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/launcher/JPA.launch 2012-03-19
15:55:11 UTC (rev 39622)
@@ -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/JPASuite.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.JPASuite"/>
+<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/JPA.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/JPASuite.java
===================================================================
---
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/suite/JPASuite.java
(rev 0)
+++
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/suite/JPASuite.java 2012-03-19
15:55:11 UTC (rev 39622)
@@ -0,0 +1,13 @@
+package org.jboss.tools.hb.ui.bot.suite;
+
+import org.jboss.tools.hb.ui.bot.test.jpa.EditPersistenceXMLTest;
+import org.jboss.tools.ui.bot.ext.RequirementAwareSuite;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite.SuiteClasses;
+
+(a)RunWith(RequirementAwareSuite.class)
+//(a)SuiteClasses({CreateJPAProjectTest.class})
+(a)SuiteClasses({EditPersistenceXMLTest.class})
+public class JPASuite {
+
+}
Property changes on:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/suite/JPASuite.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/jpa/CreateJPAProjectTest.java
===================================================================
---
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/jpa/CreateJPAProjectTest.java
(rev 0)
+++
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/jpa/CreateJPAProjectTest.java 2012-03-19
15:55:11 UTC (rev 39622)
@@ -0,0 +1,49 @@
+package org.jboss.tools.hb.ui.bot.test.jpa;
+
+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.types.EntityType;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
+import org.junit.Test;
+import org.osgi.framework.Version;
+
+/**
+ * Create JPA Project ui bot test
+ *
+ * @author jpeterka
+ *
+ */
+@Require(clearProjects = false, perspective="JPA")
+public class CreateJPAProjectTest extends HibernateBaseTest {
+
+ final String prj = "jpa35test";
+
+ @Test
+ public void createJPAProject() {
+ createProject();
+ }
+
+ private void createProject() {
+ EntityType type = EntityType.JPA_PROJECT;
+ eclipse.createNew(type);
+
+ // JPA Project Page
+ eclipse.waitForShell("New JPA Project");
+ bot.textWithLabel("Project name:").setText(prj);
+ bot.button(IDELabel.Button.NEXT).click();
+ // Java Page
+ bot.button(IDELabel.Button.NEXT).click();
+ // JPA Facet Page
+ Version version = jbt.getJBTVersion();
+ if ((version.getMajor() == 3) && (version.getMinor() == 1))
+ bot.comboBoxInGroup("Platform").setSelection("Hibernate");
+ else
+ bot.comboBoxInGroup("Platform").setSelection("Hibernate (JPA
2.x)");
+ bot.comboBoxInGroup("JPA implementation").setSelection("Disable Library
Configuration");
+
+ // Finish
+ bot.button(IDELabel.Button.FINISH).click();
+ eclipse.waitForClosedShell(bot.shell("New JPA Project"));
+ util.waitForNonIgnoredJobs();
+ }
+}
Property changes on:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/jpa/CreateJPAProjectTest.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/jpa/EditPersistenceXMLTest.java
===================================================================
---
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/jpa/EditPersistenceXMLTest.java
(rev 0)
+++
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/jpa/EditPersistenceXMLTest.java 2012-03-19
15:55:11 UTC (rev 39622)
@@ -0,0 +1,88 @@
+package org.jboss.tools.hb.ui.bot.test.jpa;
+
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotMultiPageEditor;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
+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.helper.StringHelper;
+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.junit.Test;
+
+/**
+ * Create JPA Project ui bot test
+ *
+ * @author jpeterka
+ *
+ */
+@Require(clearProjects = false, perspective="JPA")
+public class EditPersistenceXMLTest extends HibernateBaseTest {
+
+ final String prj = "jpatest35";
+
+ @Test
+ public void createJPAProject() {
+ importTestProject("/resources/prj/" + prj);
+ openPersistenceXML();
+ editPersistenceHibernatePageXML();
+ checkCAInConfigurationEditorXML();
+ }
+
+ private void openPersistenceXML() {
+ SWTBotView pe = open.viewOpen(ActionItem.View.GeneralProjectExplorer.LABEL);
+ Tree.open(pe.bot(), prj,"JPA Content","persistence.xml");
+ }
+
+ private void editPersistenceHibernatePageXML() {
+ SWTBotEditor editor = bot.editorByTitle("persistence.xml");
+ editor.show();
+ SWTBotMultiPageEditor mpe = new SWTBotMultiPageEditor(editor.getReference(), bot);
+ mpe.activatePage("Hibernate");
+
+ // Fill in
+ String dialect =
DatabaseHelper.getDialect(TestConfigurator.currentConfig.getDB().dbType);
+ bot.comboBoxWithLabel(IDELabel.HBConsoleWizard.DATABASE_DIALECT).setSelection(dialect);
+ String drvClass =
DatabaseHelper.getDriverClass(TestConfigurator.currentConfig.getDB().dbType);
+ bot.comboBoxWithLabel(IDELabel.HBConsoleWizard.DRIVER_CLASS).setSelection(drvClass);
+ String jdbc = TestConfigurator.currentConfig.getDB().jdbcString;
+ bot.comboBoxWithLabel(IDELabel.HBConsoleWizard.CONNECTION_URL).setText(jdbc);
+ bot.textWithLabel("Username:").setText("sa");
+
+ editor.save();
+ mpe.activatePage("Source");
+
+ // Check xml content
+ String text = mpe.toTextEditor().getText();
+ StringHelper helper = new StringHelper(text);
+ String str = "<property name=\"hibernate.dialect\"
value=\"org.hibernate.dialect.HSQLDialect\"/>";
+ helper.getPositionBefore(str);
+ str = "<property name=\"hibernate.connection.driver_class\"
value=\"org.hsqldb.jdbcDriver\"/>";
+ helper.getPositionBefore(str);
+ }
+
+ private void checkCAInConfigurationEditorXML() {
+ SWTBotEditor editor = bot.editorByTitle("persistence.xml");
+ editor.show();
+ SWTBotMultiPageEditor mpe = new SWTBotMultiPageEditor(editor.getReference(), bot);
+ mpe.activatePage("Source");
+
+ // Code completion
+ String text = mpe.toTextEditor().getText();
+ StringHelper helper = new StringHelper(text);
+ Point p = helper.getPositionBefore("</persistence-unit>");
+ editor.toTextEditor().selectRange(p.y, p.x, 0);
+ editor.save();
+ SWTBotEditorExt editorExt = new SWTBotEditorExt(editor.getReference(), bot);
+ ContentAssistBot ca = new ContentAssistBot(editorExt);
+ ca.useProposal("class");
+
+ editor.save();
+ }
+}
Property changes on:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/jpa/EditPersistenceXMLTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Show replies by date