Author: vyemialyanchyk
Date: 2011-01-17 08:15:06 -0500 (Mon, 17 Jan 2011)
New Revision: 28295
Added:
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/annotations.hibernate.cfg.xml
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/annotations/
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/annotations/database/
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/annotations/database/schema/
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/annotations/database/schema/CVgeneric.java
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/annotations/database/schema/GeneNames.java
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/annotations/database/schema/GeneNamesId.java
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/annotations/database/schema/OrganismRoleId.java
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/annotations/database/schema/OrganismRoleInReferenceSystemProcess.java
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/annotations/database/schema/PhysicalGeneGenericIdType.java
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/annotations/database/schema/ReferenceGeneProduct.java
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/annotations/database/schema/ReferenceOrganism.java
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/annotations/database/schema/ReferencePhysicalGene.java
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/annotations/database/schema/ReferenceSystemProcess.java
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/annotations/database/schema/ReferenceSystemProcessType.java
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/MappingTestsAnnotations.java
Modified:
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/ConsolePluginAllTests.java
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/MappingTestsJpa.java
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/project/ConfigurableTestProject.java
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/project/TestProject.java
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/utils/ConsoleConfigUtils.java
Log:
https://issues.jboss.org/browse/JBIDE-8112 - fixed
Added:
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/annotations/database/schema/CVgeneric.java
===================================================================
---
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/annotations/database/schema/CVgeneric.java
(rev 0)
+++
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/annotations/database/schema/CVgeneric.java 2011-01-17
13:15:06 UTC (rev 28295)
@@ -0,0 +1,147 @@
+package annotations.database.schema;
+
+import java.io.Serializable;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import org.hibernate.annotations.Type;
+
+@Entity
+@Table(name="CVgeneric")
+public class CVgeneric implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ private Long id;
+ private CV_TYPE type;
+ private String category;
+ private CV_STATUS status;
+ private String term;
+ private String description;
+ private Long oboId;
+ private String oboNs;
+ private String oboPrefix;
+
+ public enum CV_TYPE {
+ processPhenotype,
+ pathogenPhenotype,
+ chemicalPhenotype,
+ dnastructurePhenotype,
+ genePhenotype,
+ geneproductPhenotype,
+ cmode,
+ processCharacterization,
+ organismCharacterization,
+ chemicalCharacterization,
+ dnastructureCharacterization,
+ geneCharacterization,
+ geneproductCharacterization,
+ modeOfAction,
+ experimentalConditions,
+ biologicalProcess,
+ comparativeValue,
+ disease,
+ hostPhenotype
+ }
+
+ public enum CV_STATUS {
+ accepted,proposed,toRefine
+ }
+
+ public CVgeneric() { }
+
+ @Id
+ @GeneratedValue
+ @Column(name="ID", nullable=false, unique=true, precision=11)
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ @Column(name="type", nullable=false)
+ @Enumerated(EnumType.STRING)
+ public CV_TYPE getType() {
+ return type;
+ }
+
+ public void setType(CV_TYPE type) {
+ this.type = type;
+ }
+
+ @Column(name="Category", length=45)
+ public String getCategory() {
+ return category;
+ }
+
+ public void setCategory(String category) {
+ this.category = category;
+ }
+
+ @Column(name="status", nullable=false)
+ @Enumerated(EnumType.STRING)
+ public CV_STATUS getStatus() {
+ return status;
+ }
+
+ public void setStatus(CV_STATUS status) {
+ this.status = status;
+ }
+
+ @Column(name="term", length=255, nullable=false)
+ public String getTerm() {
+ return term;
+ }
+
+ public void setTerm(String term) {
+ this.term = term;
+ }
+
+ @Column(name="Description")
+ @Type(type="text")
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ @Column(name="oboID", precision=11)
+ public Long getOboId() {
+ return oboId;
+ }
+
+ public void setOboId(Long oboId) {
+ this.oboId = oboId;
+ }
+
+ @Column(name="oboNS", length=255)
+ public String getOboNs() {
+ return oboNs;
+ }
+
+ public void setOboNs(String oboNs) {
+ this.oboNs = oboNs;
+ }
+
+ @Column(name="oboPrefix", length=10)
+ public String getOboPrefix() {
+ return oboPrefix;
+ }
+
+ public void setOboPrefix(String oboPrefix) {
+ this.oboPrefix = oboPrefix;
+ }
+}
Added:
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/annotations/database/schema/GeneNames.java
===================================================================
---
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/annotations/database/schema/GeneNames.java
(rev 0)
+++
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/annotations/database/schema/GeneNames.java 2011-01-17
13:15:06 UTC (rev 28295)
@@ -0,0 +1,65 @@
+package annotations.database.schema;
+
+import java.io.Serializable;
+
+import javax.persistence.AttributeOverride;
+import javax.persistence.AttributeOverrides;
+import javax.persistence.Column;
+import javax.persistence.EmbeddedId;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+
+
+@Entity
+@Table(name="GeneNames")
+public class GeneNames implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ private GeneNamesId id;
+ private ReferencePhysicalGene referenceGene;
+ private boolean pragmaDisplay;
+
+ public GeneNames() { }
+
+ @EmbeddedId
+ @AttributeOverrides({
+ @AttributeOverride(name="referenceGeneId", column =
@Column(name="referenceGeneID", nullable=false)),
+ @AttributeOverride(name="name", column= @Column(name="name",
nullable=false, length=255))
+ })
+ public GeneNamesId getId() {
+ return id;
+ }
+
+ public void setId(GeneNamesId id) {
+ this.id = id;
+ }
+
+ @ManyToOne(fetch=FetchType.LAZY)
+ @JoinColumn(name="referenceGeneID", nullable=false, updatable=false,
insertable=false)
+ public ReferencePhysicalGene getReferenceGene() {
+ return referenceGene;
+ }
+
+ public void setReferenceGene(ReferencePhysicalGene referenceGene) {
+ this.referenceGene = referenceGene;
+ }
+
+ @Column(name="pragmaDisplay", nullable=false)
+ public boolean isPragmaDisplay() {
+ return pragmaDisplay;
+ }
+
+
+ public void setPragmaDisplay(boolean pragmaDisplay) {
+ this.pragmaDisplay = pragmaDisplay;
+ }
+
+
+}
Added:
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/annotations/database/schema/GeneNamesId.java
===================================================================
---
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/annotations/database/schema/GeneNamesId.java
(rev 0)
+++
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/annotations/database/schema/GeneNamesId.java 2011-01-17
13:15:06 UTC (rev 28295)
@@ -0,0 +1,68 @@
+package annotations.database.schema;
+
+import java.io.Serializable;
+
+import javax.persistence.Embeddable;
+
+@Embeddable
+public class GeneNamesId implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+ private String name;
+ private Long referenceGeneId;
+
+ public GeneNamesId() { }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Long getReferenceGeneId() {
+ return referenceGeneId;
+ }
+
+ public void setReferenceGeneId(Long referenceGeneId) {
+ this.referenceGeneId = referenceGeneId;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ GeneNamesId other = (GeneNamesId) obj;
+
+ if (obj == null)
+ return false;
+ // check if tested object is the same class as the original one
+ if (obj.getClass() != GeneNamesId.class)
+ return false;
+
+ // check nulls
+ if (this.getName() == null | this.getReferenceGeneId() == null)
+ return false;
+ if (other.getName() == null | other.getReferenceGeneId() == null)
+ return false;
+
+ // compare values
+ if (this.getName().equals(other.getName()) &
other.getName().equals(this.getName()))
+ return true;
+ if (this.getReferenceGeneId().equals(other.getReferenceGeneId()) &
other.getReferenceGeneId().equals(this.getReferenceGeneId()))
+ return true;
+
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+
+ int hash = this.name.hashCode();
+ hash ^= 41*hash+this.referenceGeneId.hashCode();
+
+ return hash;
+ }
+}
Added:
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/annotations/database/schema/OrganismRoleId.java
===================================================================
---
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/annotations/database/schema/OrganismRoleId.java
(rev 0)
+++
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/annotations/database/schema/OrganismRoleId.java 2011-01-17
13:15:06 UTC (rev 28295)
@@ -0,0 +1,91 @@
+package annotations.database.schema;
+
+import java.io.Serializable;
+
+import javax.persistence.Embeddable;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+
+import annotations.database.schema.OrganismRoleInReferenceSystemProcess.ROLE_TYPE;
+
+@Embeddable
+public class OrganismRoleId implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+ private Long referenceOrganismId;
+ private Long referenceSystemProcessId;
+ private ROLE_TYPE roleType;
+
+ public OrganismRoleId() { }
+
+ public Long getReferenceOrganismId() {
+ return referenceOrganismId;
+ }
+
+ public void setReferenceOrganismId(Long referenceOrganismId) {
+ this.referenceOrganismId = referenceOrganismId;
+ }
+
+ public Long getReferenceSystemProcessId() {
+ return referenceSystemProcessId;
+ }
+
+ public void setReferenceSystemProcessId(Long referenceSystemProcessId) {
+ this.referenceSystemProcessId = referenceSystemProcessId;
+ }
+
+ @Enumerated(EnumType.STRING)
+ public ROLE_TYPE getRoleType() {
+ return roleType;
+ }
+
+ public void setRoleType(ROLE_TYPE roleType) {
+ this.roleType = roleType;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+
+ if (obj==null)
+ return false;
+
+ // check if tested object is the same class as the original one
+ if (obj.getClass() != OrganismRoleId.class)
+ return false;
+
+ OrganismRoleId tested = (OrganismRoleId) obj;
+ // check nulls
+ if (this.referenceOrganismId == null | this.referenceSystemProcessId == null |
this.roleType == null)
+ return false;
+ if (tested.getReferenceOrganismId() == null |
+ tested.getReferenceSystemProcessId() == null |
+ tested.getRoleType() == null)
+ return false;
+
+ // check values
+ if (this.referenceOrganismId.equals(tested.getReferenceOrganismId()) &
+ tested.getReferenceOrganismId().equals(this.referenceOrganismId))
+ return true;
+ if (this.referenceSystemProcessId.equals(tested.getReferenceSystemProcessId()) &
+ tested.getReferenceSystemProcessId().equals(this.referenceSystemProcessId))
+ return true;
+ if (this.roleType.equals(tested.getRoleType()) &
tested.getRoleType().equals(this.roleType))
+ return true;
+
+
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+
+ int hash = referenceOrganismId.hashCode();
+ hash ^= 41*hash+referenceSystemProcessId.hashCode();
+ hash ^= 41*hash+roleType.hashCode();
+
+ return hash;
+ }
+}
Added:
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/annotations/database/schema/OrganismRoleInReferenceSystemProcess.java
===================================================================
---
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/annotations/database/schema/OrganismRoleInReferenceSystemProcess.java
(rev 0)
+++
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/annotations/database/schema/OrganismRoleInReferenceSystemProcess.java 2011-01-17
13:15:06 UTC (rev 28295)
@@ -0,0 +1,97 @@
+package annotations.database.schema;
+
+import java.io.Serializable;
+
+import javax.persistence.AttributeOverride;
+import javax.persistence.AttributeOverrides;
+import javax.persistence.Column;
+import javax.persistence.EmbeddedId;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.FetchType;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+
+import org.hibernate.annotations.Type;
+
+@Entity
+@Table(name="OrganismRoleInReferenceSystemProcess")
+public class OrganismRoleInReferenceSystemProcess implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ private OrganismRoleId id;
+ private ROLE_TYPE roleType;
+ private String description;
+ private ReferenceOrganism referenceOrganism;
+ private ReferenceSystemProcess referenecSystemProcess;
+
+ public enum ROLE_TYPE {
+ host,
+ pathogen,
+ participant
+ }
+
+ public OrganismRoleInReferenceSystemProcess() { }
+
+ @EmbeddedId
+ @AttributeOverrides({
+ @AttributeOverride(name="referenceOrganism",
column=@Column(name="referenceOrganism", nullable=false)),
+ @AttributeOverride(name="referenceSystemProcess",
column=@Column(name="referenceSystemProcess", nullable=false)),
+ @AttributeOverride(name="roleType", column=@Column(name="roleType",
nullable=false))
+ })
+ public OrganismRoleId getId() {
+ return id;
+ }
+
+
+ public void setId(OrganismRoleId id) {
+ this.id = id;
+ }
+
+ @Column(name="roleType", nullable=false, updatable=false, insertable=false)
+ @Enumerated(EnumType.STRING)
+ public ROLE_TYPE getRoleType() {
+ return roleType;
+ }
+
+ public void setRoleType(ROLE_TYPE roleType) {
+ this.roleType = roleType;
+ }
+
+ @Column(name="description")
+ @Type(type="text")
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ @ManyToOne(fetch=FetchType.LAZY)
+ @JoinColumn(name="referenceOrganism", nullable=false, updatable=false,
insertable=false)
+ public ReferenceOrganism getReferenceOrganism() {
+ return referenceOrganism;
+ }
+
+ public void setReferenceOrganism(ReferenceOrganism referenceOrganism) {
+ this.referenceOrganism = referenceOrganism;
+ }
+
+ @ManyToOne(fetch=FetchType.LAZY)
+ @JoinColumn(name="referenceSystemProcess", nullable=false, updatable=false,
insertable=false)
+ public ReferenceSystemProcess getReferenecSystemProcess() {
+ return referenecSystemProcess;
+ }
+
+ public void setReferenecSystemProcess(
+ ReferenceSystemProcess referenecSystemProcess) {
+ this.referenecSystemProcess = referenecSystemProcess;
+ }
+}
Added:
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/annotations/database/schema/PhysicalGeneGenericIdType.java
===================================================================
---
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/annotations/database/schema/PhysicalGeneGenericIdType.java
(rev 0)
+++
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/annotations/database/schema/PhysicalGeneGenericIdType.java 2011-01-17
13:15:06 UTC (rev 28295)
@@ -0,0 +1,57 @@
+package annotations.database.schema;
+
+import java.io.Serializable;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name="PhysicalGeneGenericIDType")
+public class PhysicalGeneGenericIdType implements Serializable {
+
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ private long id;
+ private String name;
+ private String description;
+
+ public PhysicalGeneGenericIdType() { }
+
+
+ @Id
+ @GeneratedValue
+ @Column(name="ID", nullable=false, unique=true, precision=11)
+ public long getId() {
+ return id;
+ }
+
+ public void setId(long id) {
+ this.id = id;
+ }
+
+
+ @Column(name="name", nullable=false, length=45)
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ @Column(name="description", length=45)
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+}
Added:
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/annotations/database/schema/ReferenceGeneProduct.java
===================================================================
---
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/annotations/database/schema/ReferenceGeneProduct.java
(rev 0)
+++
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/annotations/database/schema/ReferenceGeneProduct.java 2011-01-17
13:15:06 UTC (rev 28295)
@@ -0,0 +1,85 @@
+package annotations.database.schema;
+
+import java.io.Serializable;
+import java.util.Set;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.FetchType;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.ManyToMany;
+import javax.persistence.Table;
+
+import org.hibernate.annotations.Type;
+
+@Entity
+@Table(name="ReferenceGeneProduct")
+public class ReferenceGeneProduct implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+ private Long id;
+ private String UniprotId;
+ private String AASequence;
+ private PRODUCT_TYPE type;
+ private Set<ReferencePhysicalGene> referenceGene;
+
+ public enum PRODUCT_TYPE {
+ protein
+ };
+
+ public ReferenceGeneProduct() { }
+
+ @Id @GeneratedValue
+ @Column(name="ID", nullable=false, unique=true, precision=11)
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ @Column(name="UniprotID", nullable=true, unique=true, length=20)
+ public String getUniprotId() {
+ return UniprotId;
+ }
+
+ public void setUniprotId(String uniprotId) {
+ UniprotId = uniprotId;
+ }
+
+ @Column(name="amminoacidSequence")
+ @Type(type="text")
+ public String getAASequence() {
+ return AASequence;
+ }
+
+ public void setAASequence(String aASequence) {
+ AASequence = aASequence;
+ }
+
+ @Enumerated(EnumType.STRING)
+ @Column(name="type")
+ public PRODUCT_TYPE getType() {
+ return type;
+ }
+
+ public void setType(PRODUCT_TYPE type) {
+ this.type = type;
+ }
+
+ @ManyToMany(fetch=FetchType.LAZY, mappedBy="geneProducts")
+ public Set<ReferencePhysicalGene> getReferenceGene() {
+ return referenceGene;
+ }
+
+ public void setReferenceGene(Set<ReferencePhysicalGene> referenceGene) {
+ this.referenceGene = referenceGene;
+ }
+}
Added:
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/annotations/database/schema/ReferenceOrganism.java
===================================================================
---
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/annotations/database/schema/ReferenceOrganism.java
(rev 0)
+++
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/annotations/database/schema/ReferenceOrganism.java 2011-01-17
13:15:06 UTC (rev 28295)
@@ -0,0 +1,118 @@
+package annotations.database.schema;
+
+import java.io.Serializable;
+import java.util.Set;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.FetchType;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+
+import org.hibernate.annotations.Index;
+
+@Entity
+@Table(name="ReferenceOrganism")
+public class ReferenceOrganism implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ private Long id;
+ private Long ncbiId;
+ private COTILEDON_TYPE cotiledonType;
+ private String systematicName;
+ private String commonName;
+ private String tempName;
+ private String strain;
+ private Set<ReferencePhysicalGene> referenceGenes;
+
+ public enum COTILEDON_TYPE {
+ monocotiledon,
+ dicotiledon
+ }
+
+ public ReferenceOrganism() { }
+
+ @Id
+ @GeneratedValue
+ @Column(name="ID", nullable=false, unique=true, precision=11)
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ @Column(name="NCBI_Taxonomy_ID", nullable=false, unique=true, precision=11)
+ @Index(name = "nvbiTax")
+ public Long getNcbiId() {
+ return ncbiId;
+ }
+
+ public void setNcbiId(Long ncbiId) {
+ this.ncbiId = ncbiId;
+ }
+
+ @Column(name="cotiledonType")
+ @Enumerated(EnumType.STRING)
+ public COTILEDON_TYPE getCotiledonType() {
+ return cotiledonType;
+ }
+
+ public void setCotiledonType(COTILEDON_TYPE cotiledonType) {
+ this.cotiledonType = cotiledonType;
+ }
+
+ @Column(name="systematicName", length=255)
+ public String getSystematicName() {
+ return systematicName;
+ }
+
+ public void setSystematicName(String systematicName) {
+ this.systematicName = systematicName;
+ }
+
+ @Column(name="commonName", length=255)
+ public String getCommonName() {
+ return commonName;
+ }
+
+ public void setCommonName(String commonName) {
+ this.commonName = commonName;
+ }
+
+ @Column(name="tempName", nullable=false, length=255)
+ public String getTempName() {
+ return tempName;
+ }
+
+ public void setTempName(String tempName) {
+ this.tempName = tempName;
+ }
+
+ @Column(name="strain", length=255)
+ public String getStrain() {
+ return strain;
+ }
+
+ public void setStrain(String strain) {
+ this.strain = strain;
+ }
+
+ @OneToMany(mappedBy="referenceOrganism", fetch=FetchType.LAZY)
+ public Set<ReferencePhysicalGene> getReferenceGenes() {
+ return referenceGenes;
+ }
+
+ public void setReferenceGenes(Set<ReferencePhysicalGene> refGenes) {
+ this.referenceGenes = refGenes;
+ }
+}
Added:
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/annotations/database/schema/ReferencePhysicalGene.java
===================================================================
---
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/annotations/database/schema/ReferencePhysicalGene.java
(rev 0)
+++
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/annotations/database/schema/ReferencePhysicalGene.java 2011-01-17
13:15:06 UTC (rev 28295)
@@ -0,0 +1,122 @@
+package annotations.database.schema;
+
+import java.io.Serializable;
+import java.util.Set;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.JoinTable;
+import javax.persistence.ManyToMany;
+import javax.persistence.ManyToOne;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+
+import org.hibernate.annotations.Type;
+
+
+
+
+@Entity
+@Table(name="ReferencePhysicalGene")
+public class ReferencePhysicalGene implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ private Long id;
+ private String genericId;
+ private PhysicalGeneGenericIdType idType;
+ private String nucleotideSequence;
+ private ReferenceOrganism referenceOrganism;
+ private String tempGeneName;
+ private Set<GeneNames> geneNames;
+ private Set<ReferenceGeneProduct> geneProducts;
+
+ public ReferencePhysicalGene() { }
+
+ @Id @GeneratedValue
+ @Column(name="ID", nullable=false, unique=true, precision=11)
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ @Column(name="GenericID", length=255)
+ public String getGenericId() {
+ return genericId;
+ }
+
+ public void setGenericId(String genericId) {
+ this.genericId = genericId;
+ }
+
+ @ManyToOne(fetch=FetchType.LAZY)
+ @JoinColumn(name="IDType", nullable=false, updatable=false, insertable=false)
+ public PhysicalGeneGenericIdType getIdType() {
+ return idType;
+ }
+
+ public void setIdType(PhysicalGeneGenericIdType idType) {
+ this.idType = idType;
+ }
+
+ @Type(type="text")
+ @Column(name="nucleotideSequence")
+ public String getNucleotideSequence() {
+ return nucleotideSequence;
+ }
+
+ public void setNucleotideSequence(String nucleotideSequence) {
+ this.nucleotideSequence = nucleotideSequence;
+ }
+
+ @ManyToOne(fetch=FetchType.LAZY, cascade=CascadeType.ALL)
+ @JoinColumn(name="referenceOrganismID", nullable=false)
+ public ReferenceOrganism getReferenceOrganism() {
+ return referenceOrganism;
+ }
+
+ public void setReferenceOrganism(ReferenceOrganism referenceOrganism) {
+ this.referenceOrganism = referenceOrganism;
+ }
+
+ @Column(name="tempGeneName", nullable=false, length=50)
+ public String getTempGeneName() {
+ return tempGeneName;
+ }
+ public void setTempGeneName(String tempGeneName) {
+ this.tempGeneName = tempGeneName;
+ }
+
+ @OneToMany(fetch=FetchType.LAZY, mappedBy="referenceGene")
+ public Set<GeneNames> getGeneNames() {
+ return geneNames;
+ }
+
+ public void setGeneNames(Set<GeneNames> geneNames) {
+ this.geneNames = geneNames;
+ }
+
+ @ManyToMany(fetch=FetchType.LAZY, cascade=CascadeType.ALL)
+ @JoinTable(name="ReferencePhysicalGeneEncodesReferenceGeneProduct",
+ joinColumns= @JoinColumn(name="referenceGeneID",
referencedColumnName="ID"),
+ inverseJoinColumns= @JoinColumn(name="referenceGeneProductID",
referencedColumnName="ID")
+ )
+ public Set<ReferenceGeneProduct> getGeneProducts() {
+ return geneProducts;
+ }
+
+ public void setGeneProducts(Set<ReferenceGeneProduct> geneProducts) {
+ this.geneProducts = geneProducts;
+ }
+}
Added:
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/annotations/database/schema/ReferenceSystemProcess.java
===================================================================
---
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/annotations/database/schema/ReferenceSystemProcess.java
(rev 0)
+++
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/annotations/database/schema/ReferenceSystemProcess.java 2011-01-17
13:15:06 UTC (rev 28295)
@@ -0,0 +1,78 @@
+package annotations.database.schema;
+
+import java.io.Serializable;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import org.hibernate.annotations.Type;
+
+@Entity
+@Table(name="ReferenceSystemProcess")
+public class ReferenceSystemProcess implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+ private Long id;
+ private String name;
+ private ReferenceSystemProcessType type;
+ private String description;
+ private Long tempToVerify;
+
+ public ReferenceSystemProcess() { }
+
+ @Id @GeneratedValue
+ @Column(name="ID", nullable=false, unique=true, precision=11)
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ @Column(name="name", length=255)
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ @Column(name="type")
+ @Enumerated(EnumType.STRING)
+ public ReferenceSystemProcessType getType() {
+ return type;
+ }
+
+ public void setType(ReferenceSystemProcessType type) {
+ this.type = type;
+ }
+
+ @Type(type="text")
+ @Column(name="description")
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ @Column(name="tempToVerify", precision=11)
+ public Long getTempToVerify() {
+ return tempToVerify;
+ }
+
+ public void setTempToVerify(Long tempToVerify) {
+ this.tempToVerify = tempToVerify;
+ }
+}
Added:
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/annotations/database/schema/ReferenceSystemProcessType.java
===================================================================
---
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/annotations/database/schema/ReferenceSystemProcessType.java
(rev 0)
+++
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/annotations/database/schema/ReferenceSystemProcessType.java 2011-01-17
13:15:06 UTC (rev 28295)
@@ -0,0 +1,42 @@
+package annotations.database.schema;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
+@SuppressWarnings("unused")
+public class ReferenceSystemProcessType implements Serializable {
+
+ /**
+ *
host-pathogen,host-pathogen-disease,host-pathogen-disease-chemical,host-pathogen-chemical,pathogen-disease
+ */
+ private static final long serialVersionUID = 1L;
+
+ private static final Map<String, ReferenceSystemProcessType> types =
+ new HashMap<String, ReferenceSystemProcessType>(0);
+
+ /**
+ * Create list of all cases according the column type:
+ *
enum('host-pathogen','host-pathogen-disease','host-pathogen-disease-chemical','host-pathogen-chemical','pathogen-disease')
+ */
+ private static final ReferenceSystemProcessType host_pathogen = new
ReferenceSystemProcessType("host-pathogen");
+ private static final ReferenceSystemProcessType host_pathogen_disease = new
ReferenceSystemProcessType("host-pathogen-disease");
+ private static final ReferenceSystemProcessType host_pathogen_disease_chemical = new
ReferenceSystemProcessType("host-pathogen-disease-chemical");
+ private static final ReferenceSystemProcessType host_pathogen_chemical = new
ReferenceSystemProcessType("host-pathogen-chemical");
+ private static final ReferenceSystemProcessType pathogen_disease = new
ReferenceSystemProcessType("pathogen-disease");
+
+ private String name;
+
+ public ReferenceSystemProcessType(String name) {
+ this.name = name;
+ ReferenceSystemProcessType.types.put(name, this);
+ }
+
+ public static ReferenceSystemProcessType valueOf(String name) {
+ return types.get(name);
+ }
+
+ public String toString() {
+ return name;
+ }
+}
Added:
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/annotations.hibernate.cfg.xml
===================================================================
---
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/annotations.hibernate.cfg.xml
(rev 0)
+++
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/annotations.hibernate.cfg.xml 2011-01-17
13:15:06 UTC (rev 28295)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration
DTD 3.0//EN"
+
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
+<hibernate-configuration>
+ <session-factory>
+ <mapping class="annotations.database.schema.GeneNames"/>
+ <mapping class="annotations.database.schema.GeneNamesId"/>
+ <mapping
class="annotations.database.schema.PhysicalGeneGenericIdType"/>
+ <mapping class="annotations.database.schema.ReferenceOrganism"/>
+ <mapping class="annotations.database.schema.ReferencePhysicalGene"/>
+ <mapping class="annotations.database.schema.ReferenceSystemProcess"/>
+ <mapping class="annotations.database.schema.ReferenceGeneProduct"/>
+ <mapping class="annotations.database.schema.CVgeneric"/>
+ <mapping class="annotations.database.schema.OrganismRoleId"/>
+ <mapping
class="annotations.database.schema.OrganismRoleInReferenceSystemProcess"/>
+ <mapping
class="annotations.database.schema.OrganismRoleInReferenceSystemProcess$ROLE_TYPE"/>
+ </session-factory>
+</hibernate-configuration>
Modified:
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/ConsolePluginAllTests.java
===================================================================
---
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/ConsolePluginAllTests.java 2011-01-17
13:14:51 UTC (rev 28294)
+++
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/ConsolePluginAllTests.java 2011-01-17
13:15:06 UTC (rev 28295)
@@ -5,6 +5,7 @@
import junit.framework.Test;
import junit.framework.TestSuite;
+import org.hibernate.eclipse.console.test.mappingproject.MappingTestsAnnotations;
import org.hibernate.eclipse.console.test.mappingproject.MappingTestsCore;
import org.hibernate.eclipse.console.test.mappingproject.MappingTestsJpa;
import org.hibernate.eclipse.console.views.test.QueryPageViewerTest;
@@ -30,6 +31,7 @@
suite.addTestSuite(MappingTestsCore.class);
suite.addTestSuite(MappingTestsJpa.class);
+ suite.addTestSuite(MappingTestsAnnotations.class);
suite.addTestSuite(HQLEditorPreferencePageTest.class);
suite.addTestSuite(QueryPageViewerTest.class);
Added:
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/MappingTestsAnnotations.java
===================================================================
---
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/MappingTestsAnnotations.java
(rev 0)
+++
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/MappingTestsAnnotations.java 2011-01-17
13:15:06 UTC (rev 28295)
@@ -0,0 +1,131 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.BufferedInputStream;
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+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.ConfigurableTestProject;
+import org.hibernate.eclipse.console.test.project.TestProject;
+import org.hibernate.eclipse.console.test.utils.ConsoleConfigUtils;
+
+/**
+ *
+ * @author vitali
+ */
+public class MappingTestsAnnotations extends MappingTestsBase {
+
+ public MappingTestsAnnotations(String name) {
+ super(name);
+ }
+
+ protected void setUpConsoleConfig() throws Exception {
+ createCfgXml();
+ final String projName = testProject.getIProject().getName();
+ ConsoleConfigUtils.createAnnotationsConsoleConfig(consoleConfigName,
+ projName, File.separator + projName + File.separator + annotationsMarkerCfgXml);
+ }
+
+ static final String annotationsMarkerStr = TestProject.SRC_FOLDER + File.separator +
"annotations"; //$NON-NLS-1$
+
+ public static final FileFilter filterFoldersAnnotations = new FileFilter() {
+ public boolean accept(File f) {
+ return f.exists() && f.isDirectory() && !f.isHidden() &&
+ (f.getAbsolutePath().toLowerCase().contains(annotationsMarkerStr));
+ }
+ };
+
+ static final String annotationsMarkerCfgXml = TestProject.SRC_FOLDER + File.separator +
ConsoleConfigUtils.CFG_FILE_NAME;
+ static final String annotationsMarkerAnnotationsCfgXml = TestProject.SRC_FOLDER +
File.separator + "annotations.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(annotationsMarkerCfgXml)) &&
+ !(f.getAbsolutePath().toLowerCase().contains(annotationsMarkerAnnotationsCfgXml)));
+ }
+ };
+
+ public void testEachPackWithTestSet() throws CoreException, IOException {
+ long start_time = System.currentTimeMillis();
+ boolean createListRes = testProject.createTestFoldersList(
+ filterFilesJavaXmlPlus, filterFoldersAnnotations);
+ 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
+ createCfgXml();
+ }
+
+ protected void createCfgXml() {
+ File fileHibernateCfgXml = null;
+ try {
+ fileHibernateCfgXml = TestProject.getFolder(ConfigurableTestProject.RESOURCE_SRC_PATH
+
+ File.separator + "annotations.hibernate.cfg.xml"); //$NON-NLS-1$
+ } catch (IOException e) {
+ // ignore
+ }
+ if (fileHibernateCfgXml == null) {
+ return;
+ }
+ FileInputStream fis = null;
+ BufferedInputStream bis = null;
+ try {
+ fis = new FileInputStream(fileHibernateCfgXml);
+ bis = new BufferedInputStream(fis);
+ //
+ IFolder srcFolder = (IFolder) testProject.createSourceFolder().getResource();
+ IFile iFile = srcFolder.getFile(ConsoleConfigUtils.CFG_FILE_NAME);
+ if (iFile.exists()) {
+ iFile.delete(true, null);
+ }
+ iFile.create(bis, true, null);
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ } catch (CoreException e) {
+ e.printStackTrace();
+ } finally {
+ if (bis != null) {
+ try {
+ bis.close();
+ } catch (IOException e) {}
+ }
+ if (fis != null) {
+ try {
+ fis.close();
+ } catch (IOException e) {}
+ }
+ }
+ }
+}
Modified:
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/MappingTestsJpa.java
===================================================================
---
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/MappingTestsJpa.java 2011-01-17
13:14:51 UTC (rev 28294)
+++
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/MappingTestsJpa.java 2011-01-17
13:15:06 UTC (rev 28295)
@@ -46,13 +46,15 @@
}
};
- static final String jpaMarkerCfgXml = TestProject.SRC_FOLDER + File.separator +
"hibernate.cfg.xml"; //$NON-NLS-1$
+ static final String jpaMarkerCfgXml = TestProject.SRC_FOLDER + File.separator +
ConsoleConfigUtils.CFG_FILE_NAME;
+ static final String jpaMarkerAnnotationsCfgXml = TestProject.SRC_FOLDER + File.separator
+ "annotations.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)));
+ !(f.getAbsolutePath().toLowerCase().contains(jpaMarkerCfgXml)) &&
+ !(f.getAbsolutePath().toLowerCase().contains(jpaMarkerAnnotationsCfgXml)));
}
};
Modified:
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/project/ConfigurableTestProject.java
===================================================================
---
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/project/ConfigurableTestProject.java 2011-01-17
13:14:51 UTC (rev 28294)
+++
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/project/ConfigurableTestProject.java 2011-01-17
13:15:06 UTC (rev 28295)
@@ -84,7 +84,7 @@
public IPackageFragment getCurrentPackage() throws JavaModelException{
if (activePackage < foldersList.size()) {
- final String pack = foldersList.get(activePackage).replaceAll("\\\\",
".");
+ final String pack = foldersList.get(activePackage).replaceAll("\\\\",
"."); //$NON-NLS-1$ //$NON-NLS-2$
IPackageFragment[] packageFragments = javaProject.getPackageFragments();
for (IPackageFragment iPackageFragment : packageFragments) {
if (iPackageFragment.getKind() == IPackageFragmentRoot.K_SOURCE
Modified:
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/project/TestProject.java
===================================================================
---
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/project/TestProject.java 2011-01-17
13:14:51 UTC (rev 28294)
+++
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/project/TestProject.java 2011-01-17
13:15:06 UTC (rev 28295)
@@ -210,7 +210,7 @@
javaProject.setRawClasspath(entries.toArray(new IClasspathEntry[0]), null);
}
- protected File getFolder(String path) throws IOException {
+ static public File getFolder(String path) throws IOException {
URL entry = HibernateConsoleTestPlugin.getDefault().getBundle().getEntry(path);
URL resProject = FileLocator.resolve(entry);
String resolvePath = FileLocator.resolve(resProject).getFile();
Modified:
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/utils/ConsoleConfigUtils.java
===================================================================
---
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/utils/ConsoleConfigUtils.java 2011-01-17
13:14:51 UTC (rev 28294)
+++
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/utils/ConsoleConfigUtils.java 2011-01-17
13:15:06 UTC (rev 28295)
@@ -180,6 +180,49 @@
}
/**
+ * "Launch" the wizard and create hibernate annotations 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 createAnnotationsConsoleConfig(String name, String project, String
cfgFilePath) 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 configurationFile = clazz.getDeclaredField("configurationFileText");
//$NON-NLS-1$
+ configurationFile.setAccessible(true);
+ text = (Text)configurationFile.get(main);
+ text.setText(cfgFilePath);
+ //
+ Field annotationsMode = clazz.getDeclaredField("annotationsMode");
//$NON-NLS-1$
+ Field coreMode = clazz.getDeclaredField("coreMode"); //$NON-NLS-1$
+ annotationsMode.setAccessible(true);
+ coreMode.setAccessible(true);
+ Button button = (Button)coreMode.get(main);
+ button.setSelection(false);
+ button = (Button)annotationsMode.get(main);
+ button.setSelection(true);
+ //
+ page.setName(name);
+ page.performFinish();
+ wdialog.close();
+ }
+
+ /**
* Delete console configuration with given name.
* @param name
*/