Author: jpeterka
Date: 2012-03-21 03:03:42 -0400 (Wed, 21 Mar 2012)
New Revision: 39680
Added:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/launcher/Validation.launch
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/resources/prj/jpatest40/
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/resources/prj/jpatest40/src/
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/resources/prj/jpatest40/src/org/
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/resources/prj/jpatest40/src/org/validation/
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/resources/prj/jpatest40/src/org/validation/Dog.java
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/resources/prj/jpatest40/src/org/validation/GeneratorValidationEntity.java
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/resources/prj/jpatest40/src/org/validation/MyNamingStrategy.java
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/resources/prj/jpatest40/src/org/validation/MySequenceGenerator.java
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/resources/prj/jpatest40/src/org/validation/Owner.java
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/common/ProjectExplorer.java
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/suite/ValidationSuite.java
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/validation/
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/validation/AnnotationValidationTest.java
Log:
HB ui bot test initial generator annotation validation test added
Added:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/launcher/Validation.launch
===================================================================
---
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/launcher/Validation.launch
(rev 0)
+++
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/launcher/Validation.launch 2012-03-21
07:03:42 UTC (rev 39680)
@@ -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/ValidationSuite.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.ValidationSuite"/>
+<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/Validation.launch
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/resources/prj/jpatest40/src/org/validation/Dog.java
===================================================================
---
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/resources/prj/jpatest40/src/org/validation/Dog.java
(rev 0)
+++
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/resources/prj/jpatest40/src/org/validation/Dog.java 2012-03-21
07:03:42 UTC (rev 39680)
@@ -0,0 +1,27 @@
+package org.validation;
+
+import java.io.Serializable;
+import javax.persistence.*;
+
+/**
+ * Entity implementation class for Entity: Dog
+ *
+ */
+@Entity
+public class Dog implements Serializable {
+
+ @Id
+ long id;
+
+ private Owner owner;
+
+ private static final long serialVersionUID = 1L;
+
+ @ManyToOne()
+ public Owner getCustomer() { return owner; }
+
+ public Dog() {
+ super();
+ }
+
+}
Property changes on:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/resources/prj/jpatest40/src/org/validation/Dog.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/resources/prj/jpatest40/src/org/validation/GeneratorValidationEntity.java
===================================================================
---
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/resources/prj/jpatest40/src/org/validation/GeneratorValidationEntity.java
(rev 0)
+++
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/resources/prj/jpatest40/src/org/validation/GeneratorValidationEntity.java 2012-03-21
07:03:42 UTC (rev 39680)
@@ -0,0 +1,31 @@
+package org.validation;
+
+import java.io.Serializable;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+
+import org.hibernate.annotations.GenericGenerator;
+
+/**
+ * Entity implementation class for Entity: GeneratorValidationEntity
+ *
+ */
+@GenericGenerator(name="mygenerator", strategy = "uuid")
+
+@Entity
+public class GeneratorValidationEntity implements Serializable {
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.TABLE, generator = "mygen")
+ long id;
+
+ private static final long serialVersionUID = 1L;
+
+ public GeneratorValidationEntity() {
+ super();
+ }
+
+}
Property changes on:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/resources/prj/jpatest40/src/org/validation/GeneratorValidationEntity.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/resources/prj/jpatest40/src/org/validation/MyNamingStrategy.java
===================================================================
---
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/resources/prj/jpatest40/src/org/validation/MyNamingStrategy.java
(rev 0)
+++
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/resources/prj/jpatest40/src/org/validation/MyNamingStrategy.java 2012-03-21
07:03:42 UTC (rev 39680)
@@ -0,0 +1,16 @@
+package org.validation;
+
+import org.hibernate.cfg.DefaultNamingStrategy;
+
+public class MyNamingStrategy extends DefaultNamingStrategy {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public String columnName(String columnName) {
+ return super.columnName(columnName);
+ }
+}
\ No newline at end of file
Property changes on:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/resources/prj/jpatest40/src/org/validation/MyNamingStrategy.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/resources/prj/jpatest40/src/org/validation/MySequenceGenerator.java
===================================================================
---
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/resources/prj/jpatest40/src/org/validation/MySequenceGenerator.java
(rev 0)
+++
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/resources/prj/jpatest40/src/org/validation/MySequenceGenerator.java 2012-03-21
07:03:42 UTC (rev 39680)
@@ -0,0 +1,13 @@
+package org.validation;
+
+import java.io.Serializable;
+
+import org.hibernate.engine.spi.SessionImplementor;
+import org.hibernate.id.IdentifierGenerator;
+
+public class MySequenceGenerator implements IdentifierGenerator {
+ public static int unique;
+ public Serializable generate(SessionImplementor session, Object object) {
+ return unique++;
+ }
+}
\ No newline at end of file
Property changes on:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/resources/prj/jpatest40/src/org/validation/MySequenceGenerator.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/resources/prj/jpatest40/src/org/validation/Owner.java
===================================================================
---
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/resources/prj/jpatest40/src/org/validation/Owner.java
(rev 0)
+++
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/resources/prj/jpatest40/src/org/validation/Owner.java 2012-03-21
07:03:42 UTC (rev 39680)
@@ -0,0 +1,39 @@
+package org.validation;
+
+import java.io.Serializable;
+import java.util.List;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.OneToMany;
+import javax.persistence.OrderBy;
+import javax.persistence.Table;
+
+import org.hibernate.annotations.Generated;
+import org.hibernate.annotations.GenerationTime;
+
+/**
+ * Entity implementation class for Entity: Owner
+ *
+ */
+@Entity
+@Table(name = "OWNER")
+public class Owner implements Serializable {
+
+ @Id
+ @Generated(GenerationTime.ALWAYS)
+ long id;
+
+ private static final long serialVersionUID = 1L;
+
+ private List<Dog> dogs;
+
+ @OneToMany(mappedBy="Owner")
+ @OrderBy("number")
+ public List<Dog> getDogs() { return dogs; }
+
+ public Owner() {
+ super();
+ }
+
+}
Property changes on:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/resources/prj/jpatest40/src/org/validation/Owner.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/common/ProjectExplorer.java
===================================================================
---
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/common/ProjectExplorer.java
(rev 0)
+++
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/common/ProjectExplorer.java 2012-03-21
07:03:42 UTC (rev 39680)
@@ -0,0 +1,18 @@
+package org.jboss.tools.hb.ui.bot.common;
+
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+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;
+
+public class ProjectExplorer {
+
+ public static SWTBotTreeItem open(String... items) {
+ SWTBotExt bot = new SWTBotExt();
+ SWTOpenExt open = new SWTOpenExt(bot);
+ SWTBotView view = open.viewOpen(ActionItem.View.GeneralProjectExplorer.LABEL);
+ SWTBotTreeItem item = Tree.open(view.bot(), items);
+ return item;
+ }
+}
Property changes on:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/common/ProjectExplorer.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/suite/ValidationSuite.java
===================================================================
---
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/suite/ValidationSuite.java
(rev 0)
+++
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/suite/ValidationSuite.java 2012-03-21
07:03:42 UTC (rev 39680)
@@ -0,0 +1,12 @@
+package org.jboss.tools.hb.ui.bot.suite;
+
+import org.jboss.tools.hb.ui.bot.test.validation.AnnotationValidationTest;
+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({AnnotationValidationTest.class})
+public class ValidationSuite {
+
+}
Property changes on:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/suite/ValidationSuite.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/validation/AnnotationValidationTest.java
===================================================================
---
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/validation/AnnotationValidationTest.java
(rev 0)
+++
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/validation/AnnotationValidationTest.java 2012-03-21
07:03:42 UTC (rev 39680)
@@ -0,0 +1,42 @@
+package org.jboss.tools.hb.ui.bot.test.validation;
+
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.jboss.tools.hb.ui.bot.common.ProjectExplorer;
+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.view.ProblemsView;
+import org.junit.Test;
+
+/**
+ * Hibernate annotation validation test
+ *
+ * @author jpeterka
+ *
+ */
+@Require(clearProjects = false, perspective = "JPA")
+public class AnnotationValidationTest extends HibernateBaseTest {
+
+ final String prj = "jpatest40";
+ final String pkg = "org.validation";
+
+ @Test
+ public void annotationValidationTest() {
+ importTestProject("/resources/prj/hibernatelib");
+ importTestProject("/resources/prj/jpatest40");
+
+ checkGenericGeneratorValidation();
+ }
+
+ private void checkGenericGeneratorValidation() {
+ ProjectExplorer.open(prj, "src",pkg);
+
+ String desc = "No generator named \"mygen\" is defined in the
persistence unit";
+ String path = "/" + prj + "/src/org/validation";
+ String resource = "GeneratorValidationEntity.java";
+ String type = "JPA Problem";
+
+ SWTBotTreeItem[] items = null;
+ items = ProblemsView.getFilteredErrorsTreeItems(bot, desc, path, resource, type);
+ assertTrue(items.length == 1);
+ }
+}
\ No newline at end of file
Property changes on:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/validation/AnnotationValidationTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Show replies by date