Author: jpeterka
Date: 2012-03-19 11:56:13 -0400 (Mon, 19 Mar 2012)
New Revision: 39623
Added:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/launcher/MappingFile.launch
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/suite/MappingFileSuite.java
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/mappingfile/
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/mappingfile/CreateMappingFileTest.java
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/mappingfile/EditMappingFileTest.java
Log:
Mapping file ui bot tests added into hibernate tests
Added:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/launcher/MappingFile.launch
===================================================================
---
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/launcher/MappingFile.launch
(rev 0)
+++
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/launcher/MappingFile.launch 2012-03-19
15:56:13 UTC (rev 39623)
@@ -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/MappingFileSuite.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.MappingFileSuite"/>
+<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/MappingFile.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/MappingFileSuite.java
===================================================================
---
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/suite/MappingFileSuite.java
(rev 0)
+++
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/suite/MappingFileSuite.java 2012-03-19
15:56:13 UTC (rev 39623)
@@ -0,0 +1,13 @@
+package org.jboss.tools.hb.ui.bot.suite;
+
+import org.jboss.tools.hb.ui.bot.test.mappingfile.EditMappingFileTest;
+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({CreateMappingFileTest.class})
+(a)SuiteClasses({EditMappingFileTest.class})
+public class MappingFileSuite {
+
+}
Property changes on:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/suite/MappingFileSuite.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/mappingfile/CreateMappingFileTest.java
===================================================================
---
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/mappingfile/CreateMappingFileTest.java
(rev 0)
+++
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/mappingfile/CreateMappingFileTest.java 2012-03-19
15:56:13 UTC (rev 39623)
@@ -0,0 +1,51 @@
+package org.jboss.tools.hb.ui.bot.test.mappingfile;
+
+import static org.eclipse.swtbot.swt.finder.waits.Conditions.shellIsActive;
+import static org.eclipse.swtbot.swt.finder.waits.Conditions.widgetIsEnabled;
+
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
+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.gen.ActionItem;
+import org.jboss.tools.ui.bot.ext.types.EntityType;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
+import org.junit.Test;
+
+/**
+ * Hibernate create mapping files ui bot test
+ *
+ * @author jpeterka
+ *
+ */
+@Require(clearProjects = false)
+public class CreateMappingFileTest extends HibernateBaseTest {
+
+ final String prj = "hibernate35";
+ final String pkg = "org.mapping";
+
+ @Test
+ public void createMappingFileTest() {
+ importTestProject("/resources/prj/hibernate35");
+ createMappingFilesFromPackage();
+ }
+
+ private void createMappingFilesFromPackage() {
+ // Select Both classes
+ SWTBotView pe = open.viewOpen(ActionItem.View.GeneralProjectExplorer.LABEL);
+ Tree.select(pe.bot(), prj,"src",pkg);
+
+ // Create mapping files
+ eclipse.createNew(EntityType.HIBERNATE_MAPPING_FILE);
+
+ bot.waitUntil(shellIsActive("New Hibernate XML Mapping files (hbm.xml)"));
+ SWTBotShell shell = bot.shell("New Hibernate XML Mapping files (hbm.xml)");
+ shell.setFocus();
+
+ bot.waitUntil(widgetIsEnabled(bot.button("Next >")));
+ bot.button(IDELabel.Button.NEXT).click();
+ bot.waitUntil(widgetIsEnabled(bot.button("Finish")));
+ bot.button(IDELabel.Button.FINISH).click();
+ }
+}
Property changes on:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/mappingfile/CreateMappingFileTest.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/mappingfile/EditMappingFileTest.java
===================================================================
---
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/mappingfile/EditMappingFileTest.java
(rev 0)
+++
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/mappingfile/EditMappingFileTest.java 2012-03-19
15:56:13 UTC (rev 39623)
@@ -0,0 +1,62 @@
+package org.jboss.tools.hb.ui.bot.test.mappingfile;
+
+import java.util.List;
+
+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.gen.ActionItem;
+import org.jboss.tools.ui.bot.ext.parts.ObjectMultiPageEditorBot;
+import org.jboss.tools.ui.bot.ext.parts.SWTBotEditorExt;
+import org.junit.Test;
+
+/**
+ * Hibernate perspective ui bot test
+ *
+ * @author jpeterka
+ *
+ */
+@Require(clearProjects = false)
+public class EditMappingFileTest extends HibernateBaseTest {
+
+ final String prj = "hibernate35";
+ final String pkg = "org.mapping.edit";
+ final String file1 = "Customer.hbm.xml";
+
+ @Test
+ public void editMappingFile() {
+ importTestProject("/resources/prj/hibernate35");
+ editFile();
+ }
+
+ private void editFile() {
+ SWTBotView view = open.viewOpen(ActionItem.View.GeneralProjectExplorer.LABEL);
+ Tree.open(view.bot(), prj, "src", pkg, file1 );
+
+ ObjectMultiPageEditorBot pageBot = new ObjectMultiPageEditorBot(file1);
+ pageBot.selectPage("Source");
+ SWTBotEditorExt editor = bot.swtBotEditorExtByTitle(file1);
+
+ String search = "</id>";
+ List<String> lines = editor.getLines();
+
+ int index = 0;
+ for (String line : lines ) {
+ index++;
+ if (line.trim().equals(search)) break;
+ }
+
+ log.info("Line index: " + index);
+
+ // Insert tag for cc check
+ String newLine = "<property name=\"\"> ";
+ int col = newLine.indexOf("\"\"");
+ editor.selectRange(index, 0, 0);
+ editor.insertText("\n");
+ editor.insertText(newLine);
+ editor.selectRange(index, col + 1, 0);
+
+ editor.save();
+ }
+}
Property changes on:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/mappingfile/EditMappingFileTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Show replies by date