JBoss Tools SVN: r15961 - trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/META-INF.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2009-06-15 18:37:57 -0400 (Mon, 15 Jun 2009)
New Revision: 15961
Modified:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/META-INF/MANIFEST.MF
Log:
Modified: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/META-INF/MANIFEST.MF
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/META-INF/MANIFEST.MF 2009-06-15 19:02:01 UTC (rev 15960)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/META-INF/MANIFEST.MF 2009-06-15 22:37:57 UTC (rev 15961)
@@ -15,6 +15,7 @@
org.jboss.tools.jbpm.common;bundle-version="1.0.0"
Bundle-ActivationPolicy: lazy
Bundle-Activator: org.jboss.tools.flow.jpdl4.Activator
-Export-Package: org.jboss.tools.flow.jpdl4.editor,
+Export-Package: org.jboss.tools.flow.jpdl4,
+ org.jboss.tools.flow.jpdl4.editor,
org.jboss.tools.flow.jpdl4.model
Bundle-Localization: plugin
15 years, 6 months
JBoss Tools SVN: r15960 - trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2009-06-15 15:02:01 -0400 (Mon, 15 Jun 2009)
New Revision: 15960
Modified:
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamValidatorsTest.java
Log:
Fixed JUnit test failures.
Modified: trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamValidatorsTest.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamValidatorsTest.java 2009-06-15 18:59:03 UTC (rev 15959)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamValidatorsTest.java 2009-06-15 19:02:01 UTC (rev 15960)
@@ -698,7 +698,7 @@
IFile abcComponentFile = project.getFile("src/action/org/domain/SeamWebWarTestProject/session/AbcComponent.java");
refreshProject(project);
-
+
int number = getMarkersNumber(abcComponentXHTMLFile);
assertEquals("Problem marker was found in abcComponent.xhtml", 0, number);
@@ -843,15 +843,24 @@
}
JobUtils.waitForIdle();
int[] lineNumbers = getMarkersNumbersOfLine(duplicateJavaComponentFile);
- assertEquals("There shuold be the only one error marker in DuplicateComponent.java.", 1, lineNumbers.length);
+ assertEquals("There should be the only one error marker in DuplicateComponent.java.", 1, lineNumbers.length);
assertEquals("Problem marker has wrong line number", 5, lineNumbers[0]);
lineNumbers = getMarkersNumbersOfLine(componentsXmlFile);
- assertEquals("There shuold be two error marker in components.xml.", 2, lineNumbers.length);
- assertEquals("Problem marker has wrong line number", 8, lineNumbers[0]);
- assertEquals("Problem marker has wrong line number", 9, lineNumbers[1]);
+ assertEquals("There should be two error marker in components.xml.", 2, lineNumbers.length);
+ assertTrue("Problem marker was not found on 8 line", findLine(lineNumbers, 8));
+ assertTrue("Problem marker was not found on 9 line", findLine(lineNumbers, 9));
}
+ private static boolean findLine(int[] lines, int number) {
+ for (int i = 0; i < lines.length; i++) {
+ if(lines[i]==number) {
+ return true;
+ }
+ }
+ return false;
+ }
+
private void modifyPreferences(){
IPreferenceStore store = SeamCorePlugin.getDefault().getPreferenceStore();
store.putValue(SeamPreferences.UNKNOWN_EL_VARIABLE_NAME, SeamPreferences.ERROR);
15 years, 6 months
JBoss Tools SVN: r15959 - in trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4: src/org/jboss/tools/flow/jpdl4/properties and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2009-06-15 14:59:03 -0400 (Mon, 15 Jun 2009)
New Revision: 15959
Added:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/SequenceFlowOutcomeValueFilter.java
Removed:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/jpdl4/properties/
Modified:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/plugin.xml
Log:
move the filter to the right package
Modified: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/plugin.xml
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/plugin.xml 2009-06-15 17:03:46 UTC (rev 15958)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/plugin.xml 2009-06-15 18:59:03 UTC (rev 15959)
@@ -301,14 +301,15 @@
point="org.eclipse.ui.newWizards">
<category
id="org.jboss.tools.flow.jpdl4"
- name="JBoss jBPM">
+ name="jBPM 4"
+ parentCategory="org.jboss.tools.jbpm">
</category>
<wizard
category="org.jboss.tools.flow.jpdl4"
class="org.jboss.tools.flow.jpdl4.wizard.NewJpdl4FileWizard"
icon="icons/process.gif"
id="org.jboss.tools.flow.jpdl4.file"
- name="jPDL4 File">
+ name="Process Definition">
</wizard>
</extension>
@@ -488,7 +489,7 @@
<propertySection
afterSection="org.jboss.tools.jpdl4.sequenceFlow.timer"
class="org.jboss.tools.flow.jpdl4.properties.SequenceFlowOutcomeValueSection"
- filter="org.jboss.tools.jpdl4.properties.SequenceFlowOutcomeValueFilter"
+ filter="org.jboss.tools.flow.jpdl4.properties.SequenceFlowOutcomeValueFilter"
id="org.jboss.tools.jpdl4.sequenceFlow.outcome"
tab="org.jboss.tools.jpdl4.general">
</propertySection>
Copied: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/SequenceFlowOutcomeValueFilter.java (from rev 15783, trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/jpdl4/properties/SequenceFlowOutcomeValueFilter.java)
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/SequenceFlowOutcomeValueFilter.java (rev 0)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/SequenceFlowOutcomeValueFilter.java 2009-06-15 18:59:03 UTC (rev 15959)
@@ -0,0 +1,19 @@
+package org.jboss.tools.flow.jpdl4.properties;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.jface.viewers.IFilter;
+import org.jboss.tools.flow.common.wrapper.Wrapper;
+import org.jboss.tools.flow.jpdl4.editpart.SequenceFlowGraphicalEditPart;
+import org.jboss.tools.flow.jpdl4.model.SubprocessTask;
+
+public class SequenceFlowOutcomeValueFilter implements IFilter {
+
+ public boolean select(Object toTest) {
+ if (!(toTest instanceof SequenceFlowGraphicalEditPart)) return false;
+ SequenceFlowGraphicalEditPart editPart = (SequenceFlowGraphicalEditPart)toTest;
+ EditPart source = editPart.getSource();
+ Wrapper wrapper = (Wrapper)source.getModel();
+ return wrapper.getElement() instanceof SubprocessTask;
+ }
+
+}
Property changes on: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/SequenceFlowOutcomeValueFilter.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
15 years, 6 months
JBoss Tools SVN: r15957 - in trunk/seam: tests/org.jboss.tools.seam.core.test/projects/SeamWebWarTestProject/WebContent/WEB-INF and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2009-06-15 12:08:21 -0400 (Mon, 15 Jun 2009)
New Revision: 15957
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/SeamWebWarTestProject/WebContent/WEB-INF/duplicateComponents.test
Log:
https://jira.jboss.org/jira/browse/JBIDE-4393
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java 2009-06-15 16:02:13 UTC (rev 15956)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java 2009-06-15 16:08:21 UTC (rev 15957)
@@ -558,7 +558,7 @@
}
}
- String className = component.getClassName();
+ String className = declaration.getClassName();
if(className!=null) {
IType type = null;
// validate class name
Modified: trunk/seam/tests/org.jboss.tools.seam.core.test/projects/SeamWebWarTestProject/WebContent/WEB-INF/duplicateComponents.test
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/projects/SeamWebWarTestProject/WebContent/WEB-INF/duplicateComponents.test 2009-06-15 16:02:13 UTC (rev 15956)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/projects/SeamWebWarTestProject/WebContent/WEB-INF/duplicateComponents.test 2009-06-15 16:08:21 UTC (rev 15957)
@@ -5,7 +5,7 @@
"http://jboss.com/products/seam/core http://jboss.com/products/seam/core-1.2.xsd
http://jboss.com/products/seam/components http://jboss.com/products/seam/components-1.2.xsd">
- <component class="org.domain.SeamWebWarTestProject.session.DuplicateComponent" name="duplicateJavaAndXmlComponentName" precedence="20" />
- <component class="org.domain.SeamWebWarTestProject.session.DuplicateComponent" name="duplicateJavaAndXmlComponentName" precedence="20" />
+ <component class="org.domain.SeamWebWarTestProject.session.DuplicateComponent" name="duplicateJavaAndXmlComponentName" />
+ <component class="java.lang.String" name="duplicateJavaAndXmlComponentName" />
</components>
\ No newline at end of file
15 years, 6 months
JBoss Tools SVN: r15956 - in trunk/hibernatetools/tests/org.hibernate.eclipse.console.test: res/project/src and 9 other directories.
by jbosstools-commits@lists.jboss.org
Author: vyemialyanchyk
Date: 2009-06-15 12:02:13 -0400 (Mon, 15 Jun 2009)
New Revision: 15956
Added:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/lib/ejb3-persistence.jar
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/META-INF/
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/META-INF/orm.xml
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/META-INF/persistence.xml
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/jpa/
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/jpa/springframework/
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/jpa/springframework/samples/
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/jpa/springframework/samples/petclinic/
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/jpa/springframework/samples/petclinic/BaseEntity.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/jpa/springframework/samples/petclinic/BaseSuperclass.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/jpa/springframework/samples/petclinic/Clinic.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/jpa/springframework/samples/petclinic/NamedEntity.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/jpa/springframework/samples/petclinic/Owner.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/jpa/springframework/samples/petclinic/Person.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/jpa/springframework/samples/petclinic/Pet.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/jpa/springframework/samples/petclinic/PetType.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/jpa/springframework/samples/petclinic/Specialty.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/jpa/springframework/samples/petclinic/SuperOffspring.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/jpa/springframework/samples/petclinic/TestIdClass.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/jpa/springframework/samples/petclinic/Vet.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/jpa/springframework/samples/petclinic/Vets.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/jpa/springframework/samples/petclinic/Visit.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/MappingTestsBase.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/MappingTestsCore.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/MappingTestsJpa.java
Removed:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/HibernateAllMappingTests.java
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/ConsolePluginAllTests.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenMappingFileTest.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/project/ConfigurableTestProject.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/utils/ConsoleConfigUtils.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/utils/FilesTransfer.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4366 - junits for "Open Mapping File" for orm.xml
Added: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/lib/ejb3-persistence.jar
===================================================================
(Binary files differ)
Property changes on: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/lib/ejb3-persistence.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/META-INF/orm.xml
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/META-INF/orm.xml (rev 0)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/META-INF/orm.xml 2009-06-15 16:02:13 UTC (rev 15956)
@@ -0,0 +1,151 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_1_0.xsd"
+ version="1.0">
+
+ <persistence-unit-metadata>
+ <xml-mapping-metadata-complete/>
+ <persistence-unit-defaults>
+ <access>PROPERTY</access>
+ </persistence-unit-defaults>
+ </persistence-unit-metadata>
+
+ <package>jpa.springframework.samples.petclinic</package>
+
+ <mapped-superclass class="BaseSuperclass" access="FIELD">
+ <attributes>
+ <embedded-id name="embeddedId">
+ </embedded-id>
+ <!-- id name="simpleId">
+ <generated-value strategy="IDENTITY"/>
+ </id-->
+ </attributes>
+ </mapped-superclass>
+
+ <mapped-superclass class="BaseEntity">
+ <attributes>
+ <id name="id">
+ <generated-value strategy="IDENTITY"/>
+ </id>
+ <transient name="new"/>
+ </attributes>
+ </mapped-superclass>
+
+ <mapped-superclass class="NamedEntity">
+ <attributes>
+ <basic name="name">
+ <column name="NAME"/>
+ </basic>
+ </attributes>
+ </mapped-superclass>
+
+ <mapped-superclass class="Person">
+ <attributes>
+ <basic name="firstName">
+ <column name="FIRST_NAME"/>
+ </basic>
+ <basic name="lastName">
+ <column name="LAST_NAME"/>
+ </basic>
+ </attributes>
+ </mapped-superclass>
+
+ <entity class="TestIdClass" access="FIELD">
+ <attributes>
+ <!-- id name="id">
+ <generated-value strategy="IDENTITY"/>
+ </id-->
+ <embedded-id name="id">
+ </embedded-id>
+ </attributes>
+ </entity>
+
+ <entity class="SuperOffspring" access="FIELD">
+ <table name="SUPEROFFSPRING"/>
+ <attributes>
+ <basic name="justProperty">
+ <column name="JUSTPROPERTY"/>
+ </basic>
+ </attributes>
+ </entity>
+
+ <entity class="Vet">
+ <table name="VETS"/>
+ <attributes>
+ <many-to-many name="specialtiesInternal" target-entity="Specialty" fetch="EAGER">
+ <join-table name="VET_SPECIALTIES">
+ <join-column name="VET_ID"/>
+ <inverse-join-column name="SPECIALTY_ID"/>
+ </join-table>
+ </many-to-many>
+ <transient name="specialties"/>
+ <transient name="nrOfSpecialties"/>
+ </attributes>
+ </entity>
+
+ <entity class="Specialty">
+ <table name="SPECIALTIES"/>
+ </entity>
+
+ <entity class="Owner">
+ <table name="OWNERS"/>
+ <attributes>
+ <basic name="address"/>
+ <basic name="city"/>
+ <basic name="telephone"/>
+ <one-to-many name="petsInternal" target-entity="Pet" mapped-by="owner" fetch="EAGER">
+ <cascade>
+ <cascade-all/>
+ </cascade>
+ </one-to-many>
+ <transient name="pets"/>
+ </attributes>
+ </entity>
+
+ <entity class="Pet">
+ <table name="PETS"/>
+ <attributes>
+ <basic name="birthDate">
+ <column name="BIRTH_DATE"/>
+ <temporal>DATE</temporal>
+ </basic>
+ <many-to-one name="owner" fetch="EAGER">
+ <cascade>
+ <cascade-all/>
+ </cascade>
+ </many-to-one>
+ <many-to-one name="type" fetch="EAGER">
+ <cascade>
+ <cascade-all/>
+ </cascade>
+ </many-to-one>
+ <one-to-many name="visitsInternal" target-entity="Visit" mapped-by="pet" fetch="EAGER">
+ <cascade>
+ <cascade-all/>
+ </cascade>
+ </one-to-many>
+ <transient name="visits"/>
+ </attributes>
+ </entity>
+
+ <entity class="PetType">
+ <table name="TYPES"/>
+ </entity>
+
+ <entity class="Visit">
+ <table name="VISITS"/>
+ <attributes>
+ <basic name="date">
+ <column name="VISIT_DATE"/>
+ <temporal>DATE</temporal>
+ </basic>
+ <many-to-one name="pet" fetch="EAGER">
+ <cascade>
+ <cascade-all/>
+ </cascade>
+ </many-to-one>
+ </attributes>
+ </entity>
+
+</entity-mappings>
Added: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/META-INF/persistence.xml
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/META-INF/persistence.xml (rev 0)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/META-INF/persistence.xml 2009-06-15 16:02:13 UTC (rev 15956)
@@ -0,0 +1,16 @@
+<persistence xmlns="http://java.sun.com/xml/ns/persistence"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
+ version="1.0">
+
+ <persistence-unit name="PetClinic" transaction-type="RESOURCE_LOCAL">
+
+ <!-- Explicitly define mapping file path, else Hibernate won't find the default -->
+ <mapping-file>META-INF/orm.xml</mapping-file>
+
+ <!-- Prevent annotation scanning. In this app we are purely driven by orm.xml -->
+ <exclude-unlisted-classes>true</exclude-unlisted-classes>
+
+ </persistence-unit>
+
+</persistence>
Added: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/jpa/springframework/samples/petclinic/BaseEntity.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/jpa/springframework/samples/petclinic/BaseEntity.java (rev 0)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/jpa/springframework/samples/petclinic/BaseEntity.java 2009-06-15 16:02:13 UTC (rev 15956)
@@ -0,0 +1,27 @@
+package jpa.springframework.samples.petclinic;
+
+/**
+ * Simple JavaBean domain object with an id property.
+ * Used as a base class for objects needing this property.
+ *
+ * @author Ken Krebs
+ * @author Juergen Hoeller
+ */
+public class BaseEntity {
+
+ private Integer id;
+
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public Integer getId() {
+ return id;
+ }
+
+ public boolean isNew() {
+ return (this.id == null);
+ }
+
+}
Added: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/jpa/springframework/samples/petclinic/BaseSuperclass.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/jpa/springframework/samples/petclinic/BaseSuperclass.java (rev 0)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/jpa/springframework/samples/petclinic/BaseSuperclass.java 2009-06-15 16:02:13 UTC (rev 15956)
@@ -0,0 +1,30 @@
+package jpa.springframework.samples.petclinic;
+
+import javax.persistence.EmbeddedId;
+import javax.persistence.Id;
+import javax.persistence.MappedSuperclass;
+
+@MappedSuperclass
+public class BaseSuperclass {
+
+ @EmbeddedId
+ protected Object embeddedId;
+ //@Id
+ //protected Integer simpleId;
+
+ public Object getTestId() {
+ return embeddedId;
+ }
+
+ public void setTestId(Object embeddedId) {
+ this.embeddedId = embeddedId;
+ }
+
+ //public Integer getSimpleId() {
+ // return simpleId;
+ //}
+
+ //public void setSimpleId(Integer simpleId) {
+ // this.simpleId = simpleId;
+ //}
+}
Added: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/jpa/springframework/samples/petclinic/Clinic.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/jpa/springframework/samples/petclinic/Clinic.java (rev 0)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/jpa/springframework/samples/petclinic/Clinic.java 2009-06-15 16:02:13 UTC (rev 15956)
@@ -0,0 +1,82 @@
+package jpa.springframework.samples.petclinic;
+
+import java.util.Collection;
+
+import org.springframework.dao.DataAccessException;
+
+/**
+ * The high-level PetClinic business interface.
+ *
+ * <p>This is basically a data access object.
+ * PetClinic doesn't have a dedicated business facade.
+ *
+ * @author Ken Krebs
+ * @author Juergen Hoeller
+ * @author Sam Brannen
+ */
+public interface Clinic {
+
+ /**
+ * Retrieve all <code>Vet</code>s from the data store.
+ * @return a <code>Collection</code> of <code>Vet</code>s
+ */
+ Collection<Vet> getVets() throws DataAccessException;
+
+ /**
+ * Retrieve all <code>PetType</code>s from the data store.
+ * @return a <code>Collection</code> of <code>PetType</code>s
+ */
+ Collection<PetType> getPetTypes() throws DataAccessException;
+
+ /**
+ * Retrieve <code>Owner</code>s from the data store by last name,
+ * returning all owners whose last name <i>starts</i> with the given name.
+ * @param lastName Value to search for
+ * @return a <code>Collection</code> of matching <code>Owner</code>s
+ * (or an empty <code>Collection</code> if none found)
+ */
+ Collection<Owner> findOwners(String lastName) throws DataAccessException;
+
+ /**
+ * Retrieve an <code>Owner</code> from the data store by id.
+ * @param id the id to search for
+ * @return the <code>Owner</code> if found
+ * @throws org.springframework.dao.DataRetrievalFailureException if not found
+ */
+ Owner loadOwner(int id) throws DataAccessException;
+
+ /**
+ * Retrieve a <code>Pet</code> from the data store by id.
+ * @param id the id to search for
+ * @return the <code>Pet</code> if found
+ * @throws org.springframework.dao.DataRetrievalFailureException if not found
+ */
+ Pet loadPet(int id) throws DataAccessException;
+
+ /**
+ * Save an <code>Owner</code> to the data store, either inserting or updating it.
+ * @param owner the <code>Owner</code> to save
+ * @see BaseEntity#isNew
+ */
+ void storeOwner(Owner owner) throws DataAccessException;
+
+ /**
+ * Save a <code>Pet</code> to the data store, either inserting or updating it.
+ * @param pet the <code>Pet</code> to save
+ * @see BaseEntity#isNew
+ */
+ void storePet(Pet pet) throws DataAccessException;
+
+ /**
+ * Save a <code>Visit</code> to the data store, either inserting or updating it.
+ * @param visit the <code>Visit</code> to save
+ * @see BaseEntity#isNew
+ */
+ void storeVisit(Visit visit) throws DataAccessException;
+
+ /**
+ * Deletes a <code>Pet</code> from the data store.
+ */
+ void deletePet(int id) throws DataAccessException;
+
+}
Added: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/jpa/springframework/samples/petclinic/NamedEntity.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/jpa/springframework/samples/petclinic/NamedEntity.java (rev 0)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/jpa/springframework/samples/petclinic/NamedEntity.java 2009-06-15 16:02:13 UTC (rev 15956)
@@ -0,0 +1,28 @@
+package jpa.springframework.samples.petclinic;
+
+/**
+ * Simple JavaBean domain object adds a name property to <code>BaseEntity</code>.
+ * Used as a base class for objects needing these properties.
+ *
+ * @author Ken Krebs
+ * @author Juergen Hoeller
+ */
+public class NamedEntity extends BaseEntity {
+
+ private String name;
+
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ @Override
+ public String toString() {
+ return this.getName();
+ }
+
+}
Added: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/jpa/springframework/samples/petclinic/Owner.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/jpa/springframework/samples/petclinic/Owner.java (rev 0)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/jpa/springframework/samples/petclinic/Owner.java 2009-06-15 16:02:13 UTC (rev 15956)
@@ -0,0 +1,127 @@
+package jpa.springframework.samples.petclinic;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.springframework.beans.support.MutableSortDefinition;
+import org.springframework.beans.support.PropertyComparator;
+import org.springframework.core.style.ToStringCreator;
+
+/**
+ * Simple JavaBean domain object representing an owner.
+ *
+ * @author Ken Krebs
+ * @author Juergen Hoeller
+ * @author Sam Brannen
+ */
+public class Owner extends Person {
+
+ private String address;
+
+ private String city;
+
+ private String telephone;
+
+ private Set<Pet> pets;
+
+
+ public String getAddress() {
+ return this.address;
+ }
+
+ public void setAddress(String address) {
+ this.address = address;
+ }
+
+ public String getCity() {
+ return this.city;
+ }
+
+ public void setCity(String city) {
+ this.city = city;
+ }
+
+ public String getTelephone() {
+ return this.telephone;
+ }
+
+ public void setTelephone(String telephone) {
+ this.telephone = telephone;
+ }
+
+ protected void setPetsInternal(Set<Pet> pets) {
+ this.pets = pets;
+ }
+
+ protected Set<Pet> getPetsInternal() {
+ if (this.pets == null) {
+ this.pets = new HashSet<Pet>();
+ }
+ return this.pets;
+ }
+
+ public List<Pet> getPets() {
+ List<Pet> sortedPets = new ArrayList<Pet>(getPetsInternal());
+ PropertyComparator.sort(sortedPets, new MutableSortDefinition("name", true, true));
+ return Collections.unmodifiableList(sortedPets);
+ }
+
+ public void addPet(Pet pet) {
+ getPetsInternal().add(pet);
+ pet.setOwner(this);
+ }
+
+ /**
+ * Return the Pet with the given name, or null if none found for this Owner.
+ *
+ * @param name to test
+ * @return true if pet name is already in use
+ */
+ public Pet getPet(String name) {
+ return getPet(name, false);
+ }
+
+ /**
+ * Return the Pet with the given name, or null if none found for this Owner.
+ *
+ * @param name to test
+ * @return true if pet name is already in use
+ */
+ public Pet getPet(String name, boolean ignoreNew) {
+ name = name.toLowerCase();
+ for (Pet pet : getPetsInternal()) {
+ if (!ignoreNew || !pet.isNew()) {
+ String compName = pet.getName();
+ compName = compName.toLowerCase();
+ if (compName.equals(name)) {
+ return pet;
+ }
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringCreator(this)
+
+ .append("id", this.getId())
+
+ .append("new", this.isNew())
+
+ .append("lastName", this.getLastName())
+
+ .append("firstName", this.getFirstName())
+
+ .append("address", this.address)
+
+ .append("city", this.city)
+
+ .append("telephone", this.telephone)
+
+ .toString();
+ }
+}
Added: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/jpa/springframework/samples/petclinic/Person.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/jpa/springframework/samples/petclinic/Person.java (rev 0)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/jpa/springframework/samples/petclinic/Person.java 2009-06-15 16:02:13 UTC (rev 15956)
@@ -0,0 +1,32 @@
+package jpa.springframework.samples.petclinic;
+
+/**
+ * Simple JavaBean domain object representing an person.
+ *
+ * @author Ken Krebs
+ */
+public class Person extends BaseEntity {
+
+ private String firstName;
+
+ private String lastName;
+
+ public String getFirstName() {
+ return this.firstName;
+ }
+
+ public void setFirstName(String firstName) {
+ this.firstName = firstName;
+ }
+
+ public String getLastName() {
+ return this.lastName;
+ }
+
+ public void setLastName(String lastName) {
+ this.lastName = lastName;
+ }
+
+
+
+}
Added: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/jpa/springframework/samples/petclinic/Pet.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/jpa/springframework/samples/petclinic/Pet.java (rev 0)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/jpa/springframework/samples/petclinic/Pet.java 2009-06-15 16:02:13 UTC (rev 15956)
@@ -0,0 +1,87 @@
+package jpa.springframework.samples.petclinic;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.springframework.beans.support.MutableSortDefinition;
+import org.springframework.beans.support.PropertyComparator;
+
+/**
+ * Simple JavaBean business object representing a pet.
+ *
+ * @author Ken Krebs
+ * @author Juergen Hoeller
+ * @author Sam Brannen
+ */
+public class Pet extends NamedEntity {
+
+ private Date birthDate;
+
+ private PetType type;
+
+ private Owner owner;
+
+ private Set<Visit> visits;
+
+ private Date testSuperDate;
+
+
+ public Date getTestSuperDate22222() {
+ return testSuperDate;
+ }
+
+ public void setTestSuperDate11111(Date testSuperDate) {
+ this.testSuperDate = testSuperDate;
+ }
+
+ public void setBirthDate(Date birthDate) {
+ this.birthDate = birthDate;
+ }
+
+ public Date getBirthDate() {
+ return this.birthDate;
+ }
+
+ public void setType(PetType type) {
+ this.type = type;
+ }
+
+ public PetType getType() {
+ return this.type;
+ }
+
+ protected void setOwner(Owner owner) {
+ this.owner = owner;
+ }
+
+ public Owner getOwner() {
+ return this.owner;
+ }
+
+ protected void setVisitsInternal(Set<Visit> visits) {
+ this.visits = visits;
+ }
+
+ protected Set<Visit> getVisitsInternal() {
+ if (this.visits == null) {
+ this.visits = new HashSet<Visit>();
+ }
+ return this.visits;
+ }
+
+ public List<Visit> getVisits() {
+ List<Visit> sortedVisits = new ArrayList<Visit>(getVisitsInternal());
+ PropertyComparator.sort(sortedVisits, new MutableSortDefinition("date", false, false));
+ return Collections.unmodifiableList(sortedVisits);
+ }
+
+ public void addVisit(Visit visit) {
+ getVisitsInternal().add(visit);
+ visit.setPet(this);
+ }
+
+}
Added: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/jpa/springframework/samples/petclinic/PetType.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/jpa/springframework/samples/petclinic/PetType.java (rev 0)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/jpa/springframework/samples/petclinic/PetType.java 2009-06-15 16:02:13 UTC (rev 15956)
@@ -0,0 +1,8 @@
+package jpa.springframework.samples.petclinic;
+
+/**
+ * @author Juergen Hoeller
+ */
+public class PetType extends NamedEntity {
+
+}
Added: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/jpa/springframework/samples/petclinic/Specialty.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/jpa/springframework/samples/petclinic/Specialty.java (rev 0)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/jpa/springframework/samples/petclinic/Specialty.java 2009-06-15 16:02:13 UTC (rev 15956)
@@ -0,0 +1,10 @@
+package jpa.springframework.samples.petclinic;
+
+/**
+ * Models a {@link Vet Vet's} specialty (for example, dentistry).
+ *
+ * @author Juergen Hoeller
+ */
+public class Specialty extends NamedEntity {
+
+}
Added: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/jpa/springframework/samples/petclinic/SuperOffspring.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/jpa/springframework/samples/petclinic/SuperOffspring.java (rev 0)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/jpa/springframework/samples/petclinic/SuperOffspring.java 2009-06-15 16:02:13 UTC (rev 15956)
@@ -0,0 +1,16 @@
+package jpa.springframework.samples.petclinic;
+
+import javax.persistence.Id;
+
+public class SuperOffspring extends BaseSuperclass {
+
+ private Integer justProperty;
+
+ public void setJustProperty(Integer justProperty) {
+ this.justProperty = justProperty;
+ }
+
+ public Integer getJustProperty() {
+ return justProperty;
+ }
+}
Added: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/jpa/springframework/samples/petclinic/TestIdClass.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/jpa/springframework/samples/petclinic/TestIdClass.java (rev 0)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/jpa/springframework/samples/petclinic/TestIdClass.java 2009-06-15 16:02:13 UTC (rev 15956)
@@ -0,0 +1,24 @@
+package jpa.springframework.samples.petclinic;
+
+import javax.persistence.EmbeddedId;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+
+@Entity
+public class TestIdClass {
+
+ //@Id
+ //protected Integer id;
+ @EmbeddedId
+ protected Object id;
+
+ //public Integer getId() {
+ public Object getId() {
+ return id;
+ }
+
+ //public void setId(Integer id) {
+ public void setId(Object id) {
+ this.id = id;
+ }
+}
Added: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/jpa/springframework/samples/petclinic/Vet.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/jpa/springframework/samples/petclinic/Vet.java (rev 0)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/jpa/springframework/samples/petclinic/Vet.java 2009-06-15 16:02:13 UTC (rev 15956)
@@ -0,0 +1,52 @@
+package jpa.springframework.samples.petclinic;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import javax.xml.bind.annotation.XmlElement;
+
+import org.springframework.beans.support.MutableSortDefinition;
+import org.springframework.beans.support.PropertyComparator;
+
+/**
+ * Simple JavaBean domain object representing a veterinarian.
+ *
+ * @author Ken Krebs
+ * @author Juergen Hoeller
+ * @author Sam Brannen
+ * @author Arjen Poutsma
+ */
+public class Vet extends Person {
+
+ private Set<Specialty> specialties;
+
+
+ protected void setSpecialtiesInternal(Set<Specialty> specialties) {
+ this.specialties = specialties;
+ }
+
+ protected Set<Specialty> getSpecialtiesInternal() {
+ if (this.specialties == null) {
+ this.specialties = new HashSet<Specialty>();
+ }
+ return this.specialties;
+ }
+
+ @XmlElement
+ public List<Specialty> getSpecialties() {
+ List<Specialty> sortedSpecs = new ArrayList<Specialty>(getSpecialtiesInternal());
+ PropertyComparator.sort(sortedSpecs, new MutableSortDefinition("name", true, true));
+ return Collections.unmodifiableList(sortedSpecs);
+ }
+
+ public int getNrOfSpecialties() {
+ return getSpecialtiesInternal().size();
+ }
+
+ public void addSpecialty(Specialty specialty) {
+ getSpecialtiesInternal().add(specialty);
+ }
+
+}
Added: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/jpa/springframework/samples/petclinic/Vets.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/jpa/springframework/samples/petclinic/Vets.java (rev 0)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/jpa/springframework/samples/petclinic/Vets.java 2009-06-15 16:02:13 UTC (rev 15956)
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2002-2009 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package jpa.springframework.samples.petclinic;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * Simple JavaBean domain object representing a list of veterinarians. Mostly here to be used for the 'vets'
+ * {@link org.springframework.web.servlet.view.xml.MarshallingView}.
+ *
+ * @author Arjen Poutsma
+ */
+@XmlRootElement
+public class Vets {
+
+ private List<Vet> vets;
+
+ @XmlElement
+ public List<Vet> getVetList() {
+ if (vets == null) {
+ vets = new ArrayList<Vet>();
+ }
+ return vets;
+ }
+
+}
Added: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/jpa/springframework/samples/petclinic/Visit.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/jpa/springframework/samples/petclinic/Visit.java (rev 0)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/jpa/springframework/samples/petclinic/Visit.java 2009-06-15 16:02:13 UTC (rev 15956)
@@ -0,0 +1,70 @@
+package jpa.springframework.samples.petclinic;
+
+import java.util.Date;
+
+/**
+ * Simple JavaBean domain object representing a visit.
+ *
+ * @author Ken Krebs
+ */
+public class Visit extends BaseEntity {
+
+ /** Holds value of property date. */
+ private Date date;
+
+ /** Holds value of property description. */
+ private String description;
+
+ /** Holds value of property pet. */
+ private Pet pet;
+
+
+ /** Creates a new instance of Visit for the current date */
+ public Visit() {
+ this.date = new Date();
+ }
+
+
+ /** Getter for property date.
+ * @return Value of property date.
+ */
+ public Date getDate() {
+ return this.date;
+ }
+
+ /** Setter for property date.
+ * @param date New value of property date.
+ */
+ public void setDate(Date date) {
+ this.date = date;
+ }
+
+ /** Getter for property description.
+ * @return Value of property description.
+ */
+ public String getDescription() {
+ return this.description;
+ }
+
+ /** Setter for property description.
+ * @param description New value of property description.
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ /** Getter for property pet.
+ * @return Value of property pet.
+ */
+ public Pet getPet() {
+ return this.pet;
+ }
+
+ /** Setter for property pet.
+ * @param pet New value of property pet.
+ */
+ public void setPet(Pet pet) {
+ this.pet = pet;
+ }
+
+}
Modified: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/ConsolePluginAllTests.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/ConsolePluginAllTests.java 2009-06-15 15:57:28 UTC (rev 15955)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/ConsolePluginAllTests.java 2009-06-15 16:02:13 UTC (rev 15956)
@@ -2,7 +2,8 @@
import java.io.IOException;
-import org.hibernate.eclipse.console.test.mappingproject.HibernateAllMappingTests;
+import org.hibernate.eclipse.console.test.mappingproject.MappingTestsCore;
+import org.hibernate.eclipse.console.test.mappingproject.MappingTestsJpa;
import org.hibernate.eclipse.console.views.test.QueryPageViewerTest;
import org.hibernate.eclipse.hqleditor.preferences.HQLEditorPreferencePageTest;
import org.hibernate.eclipse.mapper.HBMInfoExtractorTest;
@@ -16,14 +17,15 @@
TestSuite suite = new TestSuite(
ConsoleTestMessages.ConsolePluginAllTests_test_for );
- suite.addTestSuite( KnownConfigurationsTest.class );
- suite.addTestSuite( QueryParametersTest.class );
- suite.addTestSuite( PerspectiveTest.class );
- suite.addTestSuite( ConsoleConfigurationTest.class );
- suite.addTestSuite( JavaFormattingTest.class );
- suite.addTestSuite( RefactoringTest.class );
+ suite.addTestSuite(KnownConfigurationsTest.class);
+ suite.addTestSuite(QueryParametersTest.class);
+ suite.addTestSuite(PerspectiveTest.class);
+ suite.addTestSuite(ConsoleConfigurationTest.class);
+ suite.addTestSuite(JavaFormattingTest.class);
+ suite.addTestSuite(RefactoringTest.class);
- suite.addTestSuite( HibernateAllMappingTests.class );
+ suite.addTestSuite(MappingTestsCore.class);
+ suite.addTestSuite(MappingTestsJpa.class);
suite.addTestSuite(HQLEditorPreferencePageTest.class);
suite.addTestSuite(QueryPageViewerTest.class);
Deleted: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/HibernateAllMappingTests.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/HibernateAllMappingTests.java 2009-06-15 15:57:28 UTC (rev 15955)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/HibernateAllMappingTests.java 2009-06-15 16:02:13 UTC (rev 15956)
@@ -1,243 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.hibernate.eclipse.console.test.mappingproject;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.regex.Pattern;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestResult;
-import junit.framework.TestSuite;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jdt.internal.core.PackageFragmentRoot;
-import org.eclipse.jdt.ui.IPackagesViewPart;
-import org.eclipse.jdt.ui.JavaUI;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.hibernate.eclipse.console.HibernateConsolePerspectiveFactory;
-import org.hibernate.eclipse.console.test.ConsoleTestMessages;
-import org.hibernate.eclipse.console.test.project.ConfigurableTestProject;
-import org.hibernate.eclipse.console.test.project.TestProject;
-import org.hibernate.eclipse.console.test.utils.ConsoleConfigUtils;
-import org.hibernate.eclipse.console.utils.ProjectUtils;
-
-/**
- *
- */
-@SuppressWarnings("restriction")
-public class HibernateAllMappingTests extends TestCase {
-
- protected String consoleConfigName = null;
-
- protected IPackageFragment testPackage = null;
-
- protected ConfigurableTestProject testProject = null;
-
- protected TestResult result = null;
-
- protected int executions = 0;
-
- public HibernateAllMappingTests(String name) {
- super(name);
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- testProject = new ConfigurableTestProject("JUnitTestProj"); //$NON-NLS-1$
- consoleConfigName = testProject.getIProject().getName();
- testPackage = null;
-
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().setPerspective(
- PlatformUI.getWorkbench().getPerspectiveRegistry().findPerspectiveWithId("org.eclipse.ui.resourcePerspective")); //$NON-NLS-1$
-
- IPackagesViewPart packageExplorer = null;
- try {
- packageExplorer = (IPackagesViewPart) PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow().getActivePage().showView(JavaUI.ID_PACKAGES);
- } catch (PartInitException e) {
- throw new RuntimeException(e);
- }
-
- packageExplorer.selectAndReveal(testProject.getIJavaProject());
-
- PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow().getActivePage().setPerspective(
- PlatformUI.getWorkbench().getPerspectiveRegistry().findPerspectiveWithId(HibernateConsolePerspectiveFactory.ID_CONSOLE_PERSPECTIVE));
-
- IPath cfgFilePath = new Path(testProject.getIProject().getName() + File.separator +
- TestProject.SRC_FOLDER + File.separator + ConsoleConfigUtils.CFG_FILE_NAME);
- ConsoleConfigUtils.createConsoleConfig(consoleConfigName,
- cfgFilePath, testProject.getIProject().getName());
- ProjectUtils.toggleHibernateOnProject(testProject.getIProject(), true, consoleConfigName);
- testProject.fullBuild();
- }
-
- /* (non-Javadoc)
- * @see junit.framework.TestCase#run(junit.framework.TestResult)
- */
- @Override
- public void run(TestResult result) {
- this.result = result;
- super.run(result);
- }
-
- public void tearDown() throws Exception {
- ProjectUtils.toggleHibernateOnProject(testProject.getIProject(), false, consoleConfigName);
- ConsoleConfigUtils.deleteConsoleConfig(consoleConfigName);
- testProject.deleteIProject(false);
- testProject = null;
- consoleConfigName = null;
- testPackage = null;
- super.tearDown();
- }
-
- /**
- * Inspect all it's packages of the current testProject and
- * execute all tests from TestSet, considering one test package as active.
- * @throws CoreException
- */
- public void allTestsRunForProject() throws CoreException {
- testProject.fullBuild();
- IPackageFragmentRoot[] roots = testProject.getIJavaProject().getAllPackageFragmentRoots();
- for (int i = 0; i < roots.length; i++) {
- if (roots[i].getClass() != PackageFragmentRoot.class) {
- continue;
- }
- PackageFragmentRoot packageFragmentRoot = (PackageFragmentRoot) roots[i];
- IJavaElement[] els = packageFragmentRoot.getChildren();
- for (int j = 0; j < els.length; j++) {
- IJavaElement javaElement = els[j];
- if (!(javaElement instanceof IPackageFragment)) {
- continue;
- }
- testPackage = (IPackageFragment)javaElement;
- // use packages only with compilation units
- if (testPackage.getCompilationUnits().length == 0) {
- continue;
- }
- if (Customization.U_TEST_PACKS_PATTERN) {
- if (!Pattern.matches(Customization.TEST_PACKS_PATTERN, javaElement.getElementName())) {
- continue;
- }
- }
-
- long st_pack_time = System.currentTimeMillis();
- int prev_failCount = result.failureCount();
- int prev_errCount = result.errorCount();
-
- TestSuite suite = TestSet.createTestSuite(consoleConfigName, testPackage, testProject);
-
- customizeCfgXml(testPackage);
- //==============================
- //run all tests for package
- //suite.run(result);
- for (int k = 0; k < suite.testCount(); k++) {
- Test test = suite.testAt(k);
- test.run(result);
- }
- closeAllEditors();
- //==============================
- executions++;
- if (Customization.USE_CONSOLE_OUTPUT) {
- System.out.print(result.errorCount() - prev_errCount + ConsoleTestMessages.HibernateAllMappingTests_errors + " \t"); //$NON-NLS-1$
- System.out.print(result.failureCount() - prev_failCount + ConsoleTestMessages.HibernateAllMappingTests_fails + "\t"); //$NON-NLS-1$
- long period = System.currentTimeMillis() - st_pack_time;
- String time = period / 1000 + "." + (period % 1000) / 100; //$NON-NLS-1$
- System.out.println( time +ConsoleTestMessages.HibernateAllMappingTests_seconds +
- " {" + javaElement.getElementName() + "}"); //$NON-NLS-1$//$NON-NLS-2$
- }
-
- if (Customization.STOP_AFTER_MISSING_PACK) {
- if (result.failureCount() > prev_failCount) {
- break;
- }
- }
- prev_failCount = result.failureCount();
- prev_errCount = result.errorCount();
- }
- }
- }
-
- public void testEachPackWithTestSet() throws CoreException, IOException {
- long start_time = System.currentTimeMillis();
- // 1) ---
- // here we use one BIG project configuration for testing - time consuming thing
- //boolean useAllRes = testProject.useAllSources();
- //assertTrue(useAllRes);
- // 1) ---
- // 2) +++
- // here we use many SMALL projects configurations for testing.
- // this case is essential better for run time.
- boolean createListRes = testProject.createTestFoldersList();
- assertTrue(createListRes);
- // 2) +++
- testProject.restartTestFolders();
- executions = 0;
- while (testProject.setupNextTestFolder()) {
- allTestsRunForProject();
- }
- if (Customization.USE_CONSOLE_OUTPUT) {
- System.out.println("====================================================="); //$NON-NLS-1$
- System.out.print(result.errorCount() + ConsoleTestMessages.HibernateAllMappingTests_errors + " \t"); //$NON-NLS-1$
- System.out.print(result.failureCount() + ConsoleTestMessages.HibernateAllMappingTests_fails + "\t"); //$NON-NLS-1$
- System.out.print((System.currentTimeMillis() - start_time) / 1000 + ConsoleTestMessages.HibernateAllMappingTests_seconds + "\t" ); //$NON-NLS-1$
- System.out.println(executions + ConsoleTestMessages.HibernateAllMappingTests_packages_tested );
- }
- }
-
- protected void customizeCfgXml(IPackageFragment pack) {
- assertNotNull(pack);
- try {
- ConsoleConfigUtils.customizeCfgXmlForPack(pack);
- } catch (CoreException e) {
- String out = NLS.bind(ConsoleTestMessages.UpdateConfigurationTest_error_customising_file_for_package,
- new Object[] { ConsoleConfigUtils.CFG_FILE_NAME, pack.getPath(), e.getMessage() } );
- fail(out);
- }
- }
-
- protected void closeAllEditors() {
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().closeAllEditors(false);
- }
-
- public String getConsoleConfigName() {
- return consoleConfigName;
- }
-
- public void setConsoleConfigName(String consoleConfigName) {
- this.consoleConfigName = consoleConfigName;
- }
-
- public IPackageFragment getTestPackage() {
- return testPackage;
- }
-
- public void setTestPackage(IPackageFragment testPackage) {
- this.testPackage = testPackage;
- }
-
- public ConfigurableTestProject getTestProject() {
- return testProject;
- }
-
- public void setTestProject(ConfigurableTestProject testProject) {
- this.testProject = testProject;
- }
-}
Added: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/MappingTestsBase.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/MappingTestsBase.java (rev 0)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/MappingTestsBase.java 2009-06-15 16:02:13 UTC (rev 15956)
@@ -0,0 +1,201 @@
+package org.hibernate.eclipse.console.test.mappingproject;
+
+import java.io.IOException;
+import java.util.regex.Pattern;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.internal.core.PackageFragmentRoot;
+import org.eclipse.jdt.ui.IPackagesViewPart;
+import org.eclipse.jdt.ui.JavaUI;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.hibernate.eclipse.console.HibernateConsolePerspectiveFactory;
+import org.hibernate.eclipse.console.test.ConsoleTestMessages;
+import org.hibernate.eclipse.console.test.project.ConfigurableTestProject;
+import org.hibernate.eclipse.console.test.utils.ConsoleConfigUtils;
+import org.hibernate.eclipse.console.utils.ProjectUtils;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestResult;
+import junit.framework.TestSuite;
+
+@SuppressWarnings("restriction")
+public abstract class MappingTestsBase extends TestCase {
+
+ protected String consoleConfigName = null;
+
+ protected IPackageFragment testPackage = null;
+
+ protected ConfigurableTestProject testProject = null;
+
+ protected TestResult result = null;
+
+ protected int executions = 0;
+
+ public MappingTestsBase(String name) {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ testProject = new ConfigurableTestProject("JUnitTestProj"); //$NON-NLS-1$
+ consoleConfigName = testProject.getIProject().getName();
+ testPackage = null;
+
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().setPerspective(
+ PlatformUI.getWorkbench().getPerspectiveRegistry().findPerspectiveWithId("org.eclipse.ui.resourcePerspective")); //$NON-NLS-1$
+
+ IPackagesViewPart packageExplorer = null;
+ try {
+ packageExplorer = (IPackagesViewPart) PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getActivePage().showView(JavaUI.ID_PACKAGES);
+ } catch (PartInitException e) {
+ throw new RuntimeException(e);
+ }
+
+ packageExplorer.selectAndReveal(testProject.getIJavaProject());
+
+ PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getActivePage().setPerspective(
+ PlatformUI.getWorkbench().getPerspectiveRegistry().findPerspectiveWithId(HibernateConsolePerspectiveFactory.ID_CONSOLE_PERSPECTIVE));
+
+ setUpConsoleConfig();
+
+ ProjectUtils.toggleHibernateOnProject(testProject.getIProject(), true, consoleConfigName);
+ testProject.fullBuild();
+ }
+
+ abstract protected void setUpConsoleConfig() throws Exception;
+
+ /* (non-Javadoc)
+ * @see junit.framework.TestCase#run(junit.framework.TestResult)
+ */
+ @Override
+ public void run(TestResult result) {
+ this.result = result;
+ super.run(result);
+ }
+
+ public void tearDown() throws Exception {
+ ProjectUtils.toggleHibernateOnProject(testProject.getIProject(), false, consoleConfigName);
+ ConsoleConfigUtils.deleteConsoleConfig(consoleConfigName);
+ testProject.deleteIProject(false);
+ testProject = null;
+ consoleConfigName = null;
+ testPackage = null;
+ super.tearDown();
+ }
+
+ /**
+ * Inspect all it's packages of the current testProject and
+ * execute all tests from TestSet, considering one test package as active.
+ * @throws CoreException
+ */
+ public void allTestsRunForProject() throws CoreException {
+ testProject.fullBuild();
+ IPackageFragmentRoot[] roots = testProject.getIJavaProject().getAllPackageFragmentRoots();
+ for (int i = 0; i < roots.length; i++) {
+ if (roots[i].getClass() != PackageFragmentRoot.class) {
+ continue;
+ }
+ PackageFragmentRoot packageFragmentRoot = (PackageFragmentRoot) roots[i];
+ IJavaElement[] els = packageFragmentRoot.getChildren();
+ for (int j = 0; j < els.length; j++) {
+ IJavaElement javaElement = els[j];
+ if (!(javaElement instanceof IPackageFragment)) {
+ continue;
+ }
+ testPackage = (IPackageFragment)javaElement;
+ // use packages only with compilation units
+ if (testPackage.getCompilationUnits().length == 0) {
+ continue;
+ }
+ if (Customization.U_TEST_PACKS_PATTERN) {
+ if (!Pattern.matches(Customization.TEST_PACKS_PATTERN, javaElement.getElementName())) {
+ continue;
+ }
+ }
+
+ long st_pack_time = System.currentTimeMillis();
+ int prev_failCount = result.failureCount();
+ int prev_errCount = result.errorCount();
+
+ TestSuite suite = TestSet.createTestSuite(consoleConfigName, testPackage, testProject);
+
+ customizeCfgXml(testPackage);
+ //==============================
+ //run all tests for package
+ //suite.run(result);
+ for (int k = 0; k < suite.testCount(); k++) {
+ Test test = suite.testAt(k);
+ test.run(result);
+ }
+ closeAllEditors();
+ //==============================
+ executions++;
+ if (Customization.USE_CONSOLE_OUTPUT) {
+ System.out.print(result.errorCount() - prev_errCount + ConsoleTestMessages.HibernateAllMappingTests_errors + " \t"); //$NON-NLS-1$
+ System.out.print(result.failureCount() - prev_failCount + ConsoleTestMessages.HibernateAllMappingTests_fails + "\t"); //$NON-NLS-1$
+ long period = System.currentTimeMillis() - st_pack_time;
+ String time = period / 1000 + "." + (period % 1000) / 100; //$NON-NLS-1$
+ System.out.println(time + ConsoleTestMessages.HibernateAllMappingTests_seconds +
+ " {" + javaElement.getElementName() + "}"); //$NON-NLS-1$//$NON-NLS-2$
+ }
+
+ if (Customization.STOP_AFTER_MISSING_PACK) {
+ if (result.failureCount() > prev_failCount) {
+ break;
+ }
+ }
+ prev_failCount = result.failureCount();
+ prev_errCount = result.errorCount();
+ }
+ }
+ }
+
+ abstract public void testEachPackWithTestSet() throws CoreException, IOException;
+
+ protected void customizeCfgXml(IPackageFragment pack) {
+ assertNotNull(pack);
+ try {
+ ConsoleConfigUtils.customizeCfgXmlForPack(pack);
+ } catch (CoreException e) {
+ String out = NLS.bind(ConsoleTestMessages.UpdateConfigurationTest_error_customising_file_for_package,
+ new Object[] { ConsoleConfigUtils.CFG_FILE_NAME, pack.getPath(), e.getMessage() } );
+ fail(out);
+ }
+ }
+
+ protected void closeAllEditors() {
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().closeAllEditors(false);
+ }
+
+ public String getConsoleConfigName() {
+ return consoleConfigName;
+ }
+
+ public void setConsoleConfigName(String consoleConfigName) {
+ this.consoleConfigName = consoleConfigName;
+ }
+
+ public IPackageFragment getTestPackage() {
+ return testPackage;
+ }
+
+ public void setTestPackage(IPackageFragment testPackage) {
+ this.testPackage = testPackage;
+ }
+
+ public ConfigurableTestProject getTestProject() {
+ return testProject;
+ }
+
+ public void setTestProject(ConfigurableTestProject testProject) {
+ this.testProject = testProject;
+ }
+}
Copied: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/MappingTestsCore.java (from rev 15729, trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/HibernateAllMappingTests.java)
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/MappingTestsCore.java (rev 0)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/MappingTestsCore.java 2009-06-15 16:02:13 UTC (rev 15956)
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.hibernate.eclipse.console.test.mappingproject;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.hibernate.eclipse.console.test.ConsoleTestMessages;
+import org.hibernate.eclipse.console.test.project.TestProject;
+import org.hibernate.eclipse.console.test.utils.ConsoleConfigUtils;
+
+/**
+ *
+ */
+public class MappingTestsCore extends MappingTestsBase {
+
+ public MappingTestsCore(String name) {
+ super(name);
+ }
+
+ protected void setUpConsoleConfig() throws Exception {
+ IPath cfgFilePath = new Path(testProject.getIProject().getName() + File.separator +
+ TestProject.SRC_FOLDER + File.separator + ConsoleConfigUtils.CFG_FILE_NAME);
+ ConsoleConfigUtils.createConsoleConfig(consoleConfigName,
+ cfgFilePath, testProject.getIProject().getName());
+ }
+
+ public void testEachPackWithTestSet() throws CoreException, IOException {
+ long start_time = System.currentTimeMillis();
+ // 1) ---
+ // here we use one BIG project configuration for testing - time consuming thing
+ //boolean useAllRes = testProject.useAllSources();
+ //assertTrue(useAllRes);
+ // 1) ---
+ // 2) +++
+ // here we use many SMALL projects configurations for testing.
+ // this case is essential better for run time.
+ boolean createListRes = testProject.createTestFoldersList();
+ assertTrue(createListRes);
+ // 2) +++
+ testProject.restartTestFolders();
+ executions = 0;
+ while (testProject.setupNextTestFolder()) {
+ allTestsRunForProject();
+ }
+ if (Customization.USE_CONSOLE_OUTPUT) {
+ System.out.println("====================================================="); //$NON-NLS-1$
+ System.out.print(result.errorCount() + ConsoleTestMessages.HibernateAllMappingTests_errors + " \t"); //$NON-NLS-1$
+ System.out.print(result.failureCount() + ConsoleTestMessages.HibernateAllMappingTests_fails + "\t"); //$NON-NLS-1$
+ System.out.print((System.currentTimeMillis() - start_time) / 1000 + ConsoleTestMessages.HibernateAllMappingTests_seconds + "\t" ); //$NON-NLS-1$
+ System.out.println(executions + ConsoleTestMessages.HibernateAllMappingTests_packages_tested );
+ }
+ }
+}
Added: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/MappingTestsJpa.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/MappingTestsJpa.java (rev 0)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/MappingTestsJpa.java 2009-06-15 16:02:13 UTC (rev 15956)
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.hibernate.eclipse.console.test.mappingproject;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.io.IOException;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.hibernate.eclipse.console.test.ConsoleTestMessages;
+import org.hibernate.eclipse.console.test.project.TestProject;
+import org.hibernate.eclipse.console.test.utils.ConsoleConfigUtils;
+
+/**
+ *
+ * @author vitali
+ */
+public class MappingTestsJpa extends MappingTestsBase {
+
+ public MappingTestsJpa(String name) {
+ super(name);
+ }
+
+ protected void setUpConsoleConfig() throws Exception {
+ ConsoleConfigUtils.createJpaConsoleConfig(consoleConfigName,
+ testProject.getIProject().getName(), "PetClinic"); //$NON-NLS-1$
+ }
+
+ static final String jpaMarkerStr = TestProject.SRC_FOLDER + File.separator + "jpa"; //$NON-NLS-1$
+ static final String jpaMarkerMetaInf = TestProject.SRC_FOLDER + File.separator + "meta-inf"; //$NON-NLS-1$
+
+ public static final FileFilter filterFoldersJpa = new FileFilter() {
+ public boolean accept(File f) {
+ return f.exists() && f.isDirectory() && !f.isHidden() &&
+ (f.getAbsolutePath().toLowerCase().contains(jpaMarkerStr) ||
+ f.getAbsolutePath().toLowerCase().contains(jpaMarkerMetaInf));
+ }
+ };
+
+ static final String jpaMarkerCfgXml = TestProject.SRC_FOLDER + File.separator + "hibernate.cfg.xml"; //$NON-NLS-1$
+
+ public static final FileFilter filterFilesJavaXmlPlus = new FileFilter() {
+ public boolean accept(File f) {
+ return f.exists() && f.isFile() && !f.isHidden() &&
+ ((f.getName().toLowerCase().endsWith(".java") || f.getName().toLowerCase().endsWith(".xml")) && //$NON-NLS-1$ //$NON-NLS-2$
+ !(f.getAbsolutePath().toLowerCase().contains(jpaMarkerCfgXml)));
+ }
+ };
+
+ public void testEachPackWithTestSet() throws CoreException, IOException {
+ long start_time = System.currentTimeMillis();
+ boolean createListRes = testProject.createTestFoldersList(
+ filterFilesJavaXmlPlus, filterFoldersJpa);
+ assertTrue(createListRes);
+ boolean useSelRes = testProject.useSelectedFolders();
+ assertTrue(useSelRes);
+ testProject.restartTestFolders();
+ executions = 0;
+ allTestsRunForProject();
+ if (Customization.USE_CONSOLE_OUTPUT) {
+ System.out.println("====================================================="); //$NON-NLS-1$
+ System.out.print(result.errorCount() + ConsoleTestMessages.HibernateAllMappingTests_errors + " \t"); //$NON-NLS-1$
+ System.out.print(result.failureCount() + ConsoleTestMessages.HibernateAllMappingTests_fails + "\t"); //$NON-NLS-1$
+ System.out.print((System.currentTimeMillis() - start_time) / 1000 + ConsoleTestMessages.HibernateAllMappingTests_seconds + "\t" ); //$NON-NLS-1$
+ System.out.println(executions + ConsoleTestMessages.HibernateAllMappingTests_packages_tested );
+ }
+ }
+
+ protected void customizeCfgXml(IPackageFragment pack) {
+ // do not customize cfg hml
+ }
+}
Modified: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenMappingFileTest.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenMappingFileTest.java 2009-06-15 15:57:28 UTC (rev 15955)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenMappingFileTest.java 2009-06-15 16:02:13 UTC (rev 15956)
@@ -75,19 +75,28 @@
new Object[]{testPackage.getElementName(), ex.getMessage()});
fail(out);
}
- if (persClasses.length > 0){
+ if (persClasses.length > 0) {
+ final String testClass = "class"; //$NON-NLS-1$
for (int i = 0; i < persClasses.length; i++) {
- assertTrue(persClasses[0] instanceof PersistentClass);
+ assertTrue(persClasses[i] instanceof PersistentClass);
PersistentClass persClass = (PersistentClass) persClasses[i];
openTest(persClass, consCFG);
props = new PersistentClassWorkbenchAdapter().getChildren(persClass);
for (int j = 0; j < props.length; j++) {
- if (props[j].getClass() != Property.class) continue;
+ if (props[j].getClass() != Property.class) {
+ continue;
+ }
openTest(props[j], consCFG);
Object[] compProperties = new PropertyWorkbenchAdapter().getChildren(props[j]);
for (int k = 0; k < compProperties.length; k++) {
//test Composite properties
- if (compProperties[k].getClass() != Property.class) continue;
+ if (compProperties[k].getClass() != Property.class) {
+ continue;
+ }
+ final Property prop = (Property)compProperties[k];
+ if (testClass.equals(prop.getNodeName()) || testClass.equals(prop.getName())) {
+ continue;
+ }
openPropertyTest((Property)compProperties[k], (Property) props[j], consCFG);
}
}
@@ -121,7 +130,9 @@
} catch (FileNotFoundException e) {
ex = e;
}
- if (ex == null ) ex = Utils.getExceptionIfItOccured(editor);
+ if (ex == null ) {
+ ex = Utils.getExceptionIfItOccured(editor);
+ }
if (ex != null) {
String out = NLS.bind(ConsoleTestMessages.OpenMappingFileTest_mapping_file_for_property_not_opened_package,
new Object[]{compositeProperty.getNodeName(), testPackage.getElementName(), ex.getMessage()});
@@ -147,7 +158,9 @@
} catch (FileNotFoundException e) {
ex = e;
}
- if (ex == null ) ex = Utils.getExceptionIfItOccured(editor);
+ if (ex == null ) {
+ ex = Utils.getExceptionIfItOccured(editor);
+ }
if (ex != null) {
String out = NLS.bind(ConsoleTestMessages.OpenMappingFileTest_mapping_file_for_not_opened_package,
new Object[]{selection, testPackage.getElementName(), ex.getMessage()});
Modified: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/project/ConfigurableTestProject.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/project/ConfigurableTestProject.java 2009-06-15 15:57:28 UTC (rev 15955)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/project/ConfigurableTestProject.java 2009-06-15 16:02:13 UTC (rev 15956)
@@ -11,6 +11,7 @@
package org.hibernate.eclipse.console.test.project;
import java.io.File;
+import java.io.FileFilter;
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
@@ -80,9 +81,9 @@
if (activePackage >= foldersList.size()) {
return false;
}
+ FilesTransfer.delete(new File(project.getLocation().append(SRC_FOLDER).toOSString()));
final String pack = foldersList.get(activePackage);
final File srcFolder = getFolder(RESOURCE_SRC_PATH + pack);
- FilesTransfer.delete(new File(project.getLocation().append(SRC_FOLDER).toOSString()));
IPackageFragmentRoot sourcePackageFragment = createFolder(SRC_FOLDER + File.separator + pack);
FilesTransfer.copyFolder(srcFolder, (IFolder)sourcePackageFragment.getResource());
return true;
@@ -100,7 +101,7 @@
return folder;
}
- public boolean createTestFoldersList() {
+ public boolean createTestFoldersList(FileFilter filterFiles, FileFilter filterFolders) {
activePackage = -1;
foldersList = new ArrayList<String>();
File srcFolder = null;
@@ -112,8 +113,7 @@
if (srcFolder == null) {
return false;
}
- FilesTransfer.collectFoldersWithFiles(srcFolder, FilesTransfer.filterFilesJava,
- FilesTransfer.filterFolders, foldersList);
+ FilesTransfer.collectFoldersWithFiles(srcFolder, filterFiles, filterFolders, foldersList);
IPath base = Path.fromOSString(srcFolder.getPath());
for (int i = 0; i < foldersList.size(); i++) {
String str = foldersList.get(i);
@@ -124,6 +124,10 @@
return true;
}
+ public boolean createTestFoldersList() {
+ return createTestFoldersList(FilesTransfer.filterFilesJava, FilesTransfer.filterFolders);
+ }
+
public boolean useAllSources() {
activePackage = -1;
foldersList = new ArrayList<String>();
@@ -147,6 +151,23 @@
return false;
}
+ public boolean useSelectedFolders() throws IOException, CoreException {
+ activePackage = -1;
+ if (foldersList == null) {
+ return false;
+ }
+ FilesTransfer.delete(new File(project.getLocation().append(SRC_FOLDER).toOSString()));
+ for (int i = 0; i < foldersList.size(); i++) {
+ final String pack = foldersList.get(i);
+ final File srcFolder = getFolder(RESOURCE_SRC_PATH + pack);
+ IPackageFragmentRoot sourcePackageFragment = createFolder(SRC_FOLDER + File.separator + pack);
+ FilesTransfer.copyFolder(srcFolder, (IFolder)sourcePackageFragment.getResource());
+ }
+ foldersList = new ArrayList<String>();
+ foldersList.add(""); //$NON-NLS-1$
+ return true;
+ }
+
public void fullBuild() throws CoreException {
IPackageFragmentRoot sourcePackageFragment = createSourceFolder();
sourcePackageFragment.getResource().refreshLocal(IResource.DEPTH_INFINITE, null);
Modified: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/utils/ConsoleConfigUtils.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/utils/ConsoleConfigUtils.java 2009-06-15 15:57:28 UTC (rev 15955)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/utils/ConsoleConfigUtils.java 2009-06-15 16:02:13 UTC (rev 15956)
@@ -11,6 +11,7 @@
import org.eclipse.debug.ui.ILaunchConfigurationTab;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
@@ -125,6 +126,49 @@
}
/**
+ * "Launch" the wizard and create hibernate jpa console configuration in the current workspace.
+ * @param name - console configuration name
+ * @param cfgFilePath - path to hibernate.cfg.xml
+ * @param project - name of java project selected for console configuration
+ * @throws CoreException
+ * @throws NoSuchFieldException
+ * @throws IllegalAccessException
+ */
+ public static void createJpaConsoleConfig(String name, String project, String persistenceUnitName) throws CoreException, NoSuchFieldException, IllegalAccessException {
+ final IWorkbenchWindow win = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ final ConsoleConfigurationCreationWizard wiz = new ConsoleConfigurationCreationWizard();
+ final WizardDialog wdialog = new WizardDialog(win.getShell(), wiz);
+ wdialog.create();
+ ConsoleConfigurationWizardPage page = ((ConsoleConfigurationWizardPage)wiz.getPages()[0]);
+ ILaunchConfigurationTab[] tabs = page.getTabs();
+ ConsoleConfigurationMainTab main = (ConsoleConfigurationMainTab) tabs[0];
+ Class<? extends ConsoleConfigurationMainTab> clazz = main.getClass();
+ //
+ Field projectName = clazz.getDeclaredField("projectNameText"); //$NON-NLS-1$
+ projectName.setAccessible(true);
+ Text text = (Text)projectName.get(main);
+ text.setText(project);
+ //
+ Field persistenceUnitNameText = clazz.getDeclaredField("persistenceUnitNameText"); //$NON-NLS-1$
+ persistenceUnitNameText.setAccessible(true);
+ text = (Text)persistenceUnitNameText.get(main);
+ text.setText(persistenceUnitName);
+ //
+ Field jpaMode = clazz.getDeclaredField("jpaMode"); //$NON-NLS-1$
+ Field coreMode = clazz.getDeclaredField("coreMode"); //$NON-NLS-1$
+ jpaMode.setAccessible(true);
+ coreMode.setAccessible(true);
+ Button button = (Button)coreMode.get(main);
+ button.setSelection(false);
+ button = (Button)jpaMode.get(main);
+ button.setSelection(true);
+ //
+ page.setName(name);
+ page.performFinish();
+ wdialog.close();
+ }
+
+ /**
* Delete console configuration with given name.
* @param name
*/
Modified: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/utils/FilesTransfer.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/utils/FilesTransfer.java 2009-06-15 15:57:28 UTC (rev 15955)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/utils/FilesTransfer.java 2009-06-15 16:02:13 UTC (rev 15956)
@@ -53,6 +53,13 @@
}
};
+ public static final FileFilter filterFilesJavaXml = new FileFilter() {
+ public boolean accept(File f) {
+ return f.exists() && f.isFile() && !f.isHidden() &&
+ (f.getName().toLowerCase().endsWith(".java") || f.getName().toLowerCase().endsWith(".xml")); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ };
+
/**
* Copy whole folder content from source folder to destination folder.
* @param src - source folder
@@ -144,48 +151,35 @@
* Delete the whole directory
* @param path
*/
- public static void delete(File path) {
+ public static boolean delete(File path) {
+ boolean res = true, tmp = true;
if (path.exists()) {
File[] files = path.listFiles();
for (int i = 0; i < files.length; i++) {
if (files[i].isDirectory()) {
- delete(files[i]);
+ tmp = delete(files[i]);;
} else {
- deleteFile(files[i]);
+ tmp = deleteFile(files[i]);
}
+ res = res && tmp;
}
}
- deleteFile(path);
-
+ tmp = deleteFile(path);
+ res = res && tmp;
+ return res;
}
/**
* Delete single file
* @param file
*/
- public static void deleteFile(File file) {
- try {
- if (file.exists()) {
- if (!file.delete()) {
- throw new RuntimeException(getMessage(file));
- }
+ public static boolean deleteFile(File file) {
+ boolean res = false;
+ if (file.exists()) {
+ if (file.delete()) {
+ res = true;
}
- } catch (Throwable e) {
- throw new RuntimeException(getMessage(file) ,e);
}
+ return res;
}
-
-
- private static String getMessage(File file) {
- StringBuffer buffer = new StringBuffer();
- buffer.append("Cannot remove the "); //$NON-NLS-1$
- buffer.append(file.getAbsolutePath());
- buffer.append(" file. "); //$NON-NLS-1$
- if (file.exists() && file.isDirectory()) {
- String[] files = file.list();
- buffer.append("List="); //$NON-NLS-1$
- buffer.append(files.toString());
- }
- return buffer.toString();
- }
}
15 years, 6 months
JBoss Tools SVN: r15955 - trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/preferences.
by jbosstools-commits@lists.jboss.org
Author: vyemialyanchyk
Date: 2009-06-15 11:57:28 -0400 (Mon, 15 Jun 2009)
New Revision: 15955
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/preferences/ConsoleConfigurationPreferences.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-3785 - temporary solution just to fix compilation problems
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/preferences/ConsoleConfigurationPreferences.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/preferences/ConsoleConfigurationPreferences.java 2009-06-15 15:36:09 UTC (rev 15954)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/preferences/ConsoleConfigurationPreferences.java 2009-06-15 15:57:28 UTC (rev 15955)
@@ -86,6 +86,10 @@
}
return rtn;
}
+
+ public static String[] values() {
+ return null;
+ }
}
15 years, 6 months
JBoss Tools SVN: r15954 - trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2009-06-15 11:36:09 -0400 (Mon, 15 Jun 2009)
New Revision: 15954
Modified:
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamValidatorsTest.java
Log:
Fixed JUnit test failures.
Modified: trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamValidatorsTest.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamValidatorsTest.java 2009-06-15 14:58:05 UTC (rev 15953)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamValidatorsTest.java 2009-06-15 15:36:09 UTC (rev 15954)
@@ -28,6 +28,7 @@
import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.core.SeamPreferences;
import org.jboss.tools.seam.internal.core.SeamProject;
+import org.jboss.tools.seam.internal.core.validation.ISeamValidator;
import org.jboss.tools.test.util.JUnitUtils;
import org.jboss.tools.test.util.JobUtils;
import org.jboss.tools.test.util.ProjectImportTestSetup;
@@ -883,7 +884,14 @@
// for(int i=0;i<markers.length;i++){
// System.out.println("Marker - "+markers[i].getAttribute(IMarker.MESSAGE, ""));
// }
- return markers.length;
+ int length = markers.length;
+ for (int i = 0; i < markers.length; i++) {
+ String groupName = markers[i].getAttribute("groupName", null);
+ if(groupName==null || (!groupName.equals(ISeamValidator.MARKED_SEAM_PROJECT_MESSAGE_GROUP) && !groupName.equals(ISeamValidator.MARKED_SEAM_RESOURCE_MESSAGE_GROUP))) {
+ length--;
+ }
+ }
+ return length;
}catch(CoreException ex){
JUnitUtils.fail("Can'r get problem markers", ex);
}
15 years, 6 months
JBoss Tools SVN: r15953 - trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2009-06-15 10:58:05 -0400 (Mon, 15 Jun 2009)
New Revision: 15953
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4393
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java 2009-06-15 13:44:49 UTC (rev 15952)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java 2009-06-15 14:58:05 UTC (rev 15953)
@@ -1005,6 +1005,9 @@
if(!(ds1[i1] instanceof ISeamJavaComponentDeclaration)) continue;
ISeamJavaComponentDeclaration jcd = (ISeamJavaComponentDeclaration)ds1[i1];
if(jcd.getClassName().equals(className)) continue;
+ // We cannot remove declaration if it declares the same component.
+ // This is an error to be reported by Seam Validator.
+ if(c.getName().equals(jcd.getName())) continue;
c.removeDeclaration(jcd);
changes = Change.addChange(changes, new Change(c, null, jcd, null));
}
15 years, 6 months
JBoss Tools SVN: r15952 - trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2009-06-15 09:44:49 -0400 (Mon, 15 Jun 2009)
New Revision: 15952
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsoleMessages.properties
Log:
https://jira.jboss.org/jira/browse/JBIDE-3785
*Mode* label changed to *Type* as *type* used in the wizard.
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsoleMessages.properties
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsoleMessages.properties 2009-06-15 13:31:55 UTC (rev 15951)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsoleMessages.properties 2009-06-15 13:44:49 UTC (rev 15952)
@@ -111,7 +111,7 @@
ConsoleConfigurationPropertySource_name=Name
ConsoleConfigurationPropertySource_project=Project
ConsoleConfigurationPropertySource_connection=Connection
-ConsoleConfigurationPropertySource_mode=Mode
+ConsoleConfigurationPropertySource_mode=Type
ConsoleConfigurationPropertySource_properties_file=Properties file
DynamicSQLPreviewView_caused_by=\nCaused by:\n
DynamicSQLPreviewView_empty_hql_query=Empty HQL query.
15 years, 6 months