Author: jpeterka
Date: 2012-04-03 10:26:17 -0400 (Tue, 03 Apr 2012)
New Revision: 40011
Added:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/common/JPAEntity.java
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/jpa/CreateJPAEntityTest.java
Modified:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/resources/prj/jpatest35/.classpath
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/suite/JPASuite.java
Log:
Initial version of JPA Create Entity Test added into hb ui bot tests
Modified:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/resources/prj/jpatest35/.classpath
===================================================================
---
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/resources/prj/jpatest35/.classpath 2012-04-03
14:24:19 UTC (rev 40010)
+++
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/resources/prj/jpatest35/.classpath 2012-04-03
14:26:17 UTC (rev 40011)
@@ -6,5 +6,13 @@
<attribute name="owner.project.facets" value="java"/>
</attributes>
</classpathentry>
+ <classpathentry kind="lib"
path="/hibernatelib/hibernate35/antlr-2.7.6.jar"/>
+ <classpathentry kind="lib"
path="/hibernatelib/hibernate35/commons-collections-3.1.jar"/>
+ <classpathentry kind="lib"
path="/hibernatelib/hibernate35/dom4j-1.6.1.jar"/>
+ <classpathentry kind="lib"
path="/hibernatelib/hibernate35/hibernate3.jar"/>
+ <classpathentry kind="lib"
path="/hibernatelib/hibernate35/javassist-3.9.0.GA.jar"/>
+ <classpathentry kind="lib"
path="/hibernatelib/hibernate35/jta-1.1.jar"/>
+ <classpathentry kind="lib"
path="/hibernatelib/hibernate35/slf4j-api-1.5.8.jar"/>
+ <classpathentry kind="lib"
path="/hibernatelib/jpa2/javax.persistence_2.0.0.jar"/>
<classpathentry kind="output" path="build/classes"/>
</classpath>
Added:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/common/JPAEntity.java
===================================================================
---
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/common/JPAEntity.java
(rev 0)
+++
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/common/JPAEntity.java 2012-04-03
14:26:17 UTC (rev 40011)
@@ -0,0 +1,30 @@
+package org.jboss.tools.hb.ui.bot.common;
+
+import static org.eclipse.swtbot.swt.finder.waits.Conditions.shellCloses;
+import static org.eclipse.swtbot.swt.finder.waits.Conditions.shellIsActive;
+
+import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
+import org.jboss.tools.ui.bot.ext.SWTBotExt;
+import org.jboss.tools.ui.bot.ext.SWTOpenExt;
+import org.jboss.tools.ui.bot.ext.gen.ActionItem;
+
+/*
+ * JPA entity bot common class
+ */
+public class JPAEntity {
+
+ static SWTBotExt bot = new SWTBotExt();
+ static SWTOpenExt open = new SWTOpenExt(bot);
+
+ public static void create(String packageName, String entityName) {
+ SWTBot bot = open.newObject(ActionItem.NewObject.JPAEntity.LABEL);
+ String title = "New JPA Entity";
+ bot.waitUntil(shellIsActive(title));
+ SWTBotShell shell = bot.shell(title);
+ bot.textWithLabel("Java package:").setText(packageName);
+ bot.textWithLabel("Class name:").setText(entityName);
+ bot.button("Finish").click();
+ bot.waitUntil(shellCloses(shell));
+ }
+}
Property changes on:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/common/JPAEntity.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified:
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 2012-04-03
14:24:19 UTC (rev 40010)
+++
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/suite/JPASuite.java 2012-04-03
14:26:17 UTC (rev 40011)
@@ -1,13 +1,14 @@
package org.jboss.tools.hb.ui.bot.suite;
-import org.jboss.tools.hb.ui.bot.test.jpa.EditPersistenceXMLTest;
+import org.jboss.tools.hb.ui.bot.test.jpa.CreateJPAEntityTest;
import org.jboss.tools.ui.bot.ext.RequirementAwareSuite;
import org.junit.runner.RunWith;
import org.junit.runners.Suite.SuiteClasses;
@RunWith(RequirementAwareSuite.class)
//(a)SuiteClasses({CreateJPAProjectTest.class})
-(a)SuiteClasses({EditPersistenceXMLTest.class})
+//(a)SuiteClasses({EditPersistenceXMLTest.class})
+(a)SuiteClasses({CreateJPAEntityTest.class})
public class JPASuite {
}
Added:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/jpa/CreateJPAEntityTest.java
===================================================================
---
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/jpa/CreateJPAEntityTest.java
(rev 0)
+++
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/jpa/CreateJPAEntityTest.java 2012-04-03
14:26:17 UTC (rev 40011)
@@ -0,0 +1,52 @@
+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.SWTBotView;
+import org.jboss.tools.hb.ui.bot.common.JPAEntity;
+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.gen.ActionItem;
+import org.jboss.tools.ui.bot.ext.helper.StringHelper;
+import org.junit.Test;
+
+/**
+ * Create JPA Entity ui bot test
+ */
+public class CreateJPAEntityTest extends HibernateBaseTest {
+
+ final String prj = "jpatest35";
+ final String pkg = "org.newentity";
+ final String ent = "NewEntity";
+ final String ext = ".java";
+
+ @Test
+ public void createJPAProject() {
+ emptyErrorLog();
+ importTestProject("/resources/prj/" + prj);
+ importTestProject("/resources/prj/" + "hibernatelib");
+ createJPAEntity();
+ addIdIntoEntity();
+ checkErrorLog();
+ }
+
+ private void addIdIntoEntity() {
+ SWTBotEditor editor = bot.editorByTitle(ent + ext);
+ StringHelper sh = new StringHelper(editor.toTextEditor().getText());
+ Point p = sh.getPositionBefore("private static final long
serialVersionUID");
+ editor.toTextEditor().selectRange(p.y, p.x, 0);
+ editor.toTextEditor().insertText("@Id\nprivate long id;\n");
+ editor.save();
+ editor.toTextEditor().selectRange(0, 0, editor.toTextEditor().getText().length());
+ bot.menu("Source").menu("Format").click();
+ editor.toTextEditor().selectRange(0, 0, 0);
+ editor.save();
+ }
+
+ private void createJPAEntity() {
+ SWTBotView view = open.viewOpen(ActionItem.View.GeneralProjectExplorer.LABEL);
+ Tree.select(view.bot(), prj);
+ JPAEntity.create(pkg,ent);
+ Tree.open(view.bot(),prj,"src", pkg,ent + ext);
+ }
+}
Property changes on:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/jpa/CreateJPAEntityTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Show replies by date