-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from emmanuelbernard/JPABoot
Integrate JPA into Shamrock
- Loading branch information
Showing
29 changed files
with
1,355 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,173 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<artifactId>shamrock-examples-parent</artifactId> | ||
<groupId>org.jboss.shamrock</groupId> | ||
<version>1.0.0.Alpha1-SNAPSHOT</version> | ||
<relativePath>../</relativePath> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>shamrock-strict-jpa-example</artifactId> | ||
<description>An example that only contains JPA related tests running in strict mode</description> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.jboss.shamrock</groupId> | ||
<artifactId>shamrock-jaxrs-deployment</artifactId> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.jboss.shamrock</groupId> | ||
<artifactId>shamrock-jpa-deployment</artifactId> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.postgresql</groupId> | ||
<artifactId>postgresql-protean</artifactId> | ||
<version>42.2.5-SNAPSHOT</version> | ||
</dependency> | ||
|
||
<!-- test dependencies --> | ||
<dependency> | ||
<groupId>org.jboss.shamrock</groupId> | ||
<artifactId>shamrock-junit</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.jboss.shamrock</groupId> | ||
<artifactId>shamrock-graal</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.glassfish</groupId> | ||
<artifactId>javax.json</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>${project.groupId}</groupId> | ||
<artifactId>shamrock-maven-plugin</artifactId> | ||
<version>${project.version}</version> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>build</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>io.fabric8</groupId> | ||
<artifactId>docker-maven-plugin</artifactId> | ||
<version>0.26.1</version> | ||
<configuration> | ||
<images> | ||
<image> | ||
<name>postgres:10.5</name> | ||
<alias>postgresql</alias> | ||
<run> | ||
<env> | ||
<POSTGRES_USER>hibernate_orm_test</POSTGRES_USER> | ||
<POSTGRES_PASSWORD>hibernate_orm_test</POSTGRES_PASSWORD> | ||
<POSTGRES_DB>hibernate_orm_test</POSTGRES_DB> | ||
</env> | ||
<ports> | ||
<port>5432:5432</port> | ||
</ports> | ||
<wait> | ||
<tcp> | ||
<mode>mapped</mode> | ||
<ports> | ||
<port>5432</port> | ||
</ports> | ||
</tcp> | ||
<time>10000</time> | ||
</wait> | ||
</run> | ||
</image> | ||
</images> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<id>docker-start</id> | ||
<phase>compile</phase> | ||
<goals> | ||
<goal>stop</goal> | ||
<goal>start</goal> | ||
</goals> | ||
</execution> | ||
<execution> | ||
<id>docker-stop</id> | ||
<phase>post-integration-test</phase> | ||
<goals> | ||
<goal>stop</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
<profiles> | ||
<profile> | ||
<id>native-image</id> | ||
<activation> | ||
<property> | ||
<name>!no-native</name> | ||
</property> | ||
</activation> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-failsafe-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>integration-test</goal> | ||
<goal>verify</goal> | ||
</goals> | ||
<configuration> | ||
<systemProperties> | ||
<native.image.path>${project.build.directory}/${project.build.finalName}-runner</native.image.path> | ||
</systemProperties> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>${project.groupId}</groupId> | ||
<artifactId>shamrock-maven-plugin</artifactId> | ||
<version>${project.version}</version> | ||
<executions> | ||
<execution> | ||
<id>native-image</id> | ||
<goals> | ||
<goal>native-image</goal> | ||
</goals> | ||
<configuration> | ||
<reportErrorsAtRuntime>false</reportErrorsAtRuntime> | ||
<cleanupServer>true</cleanupServer> | ||
<enableHttpUrlHandler>true</enableHttpUrlHandler> | ||
<!-- Requires Protean Graal fork to work, will fail otherwise | ||
<enableRetainedHeapReporting>true</enableRetainedHeapReporting> | ||
<enableCodeSizeReporting>true</enableCodeSizeReporting> | ||
--> | ||
<graalvmHome>${graalvmHome}</graalvmHome> | ||
<enableJni>false</enableJni> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</profile> | ||
</profiles> | ||
|
||
|
||
</project> |
9 changes: 9 additions & 0 deletions
9
examples/jpa-strict/src/main/java/org/jboss/shamrock/example/MainMethod.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package org.jboss.shamrock.example; | ||
|
||
public class MainMethod { | ||
|
||
public static void main(String... args) throws Exception { | ||
Class.forName("org.jboss.shamrock.runtime.RuntimeRunner"); | ||
} | ||
|
||
} |
42 changes: 42 additions & 0 deletions
42
examples/jpa-strict/src/main/java/org/jboss/shamrock/example/jpa/Address.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package org.jboss.shamrock.example.jpa; | ||
|
||
import javax.persistence.Embeddable; | ||
|
||
/** | ||
* This is an enmarked @Embeddable class. | ||
* Let's see if just being referenced by the main entity is enough to be detected. | ||
* | ||
* @author Emmanuel Bernard [email protected] | ||
*/ | ||
//FIXME : this used to be non-annotated explicitly for testing purposes | ||
// added the annotation as it's illegal according to the ORM metadata validation | ||
@Embeddable | ||
public class Address { | ||
private String street1; | ||
private String street2; | ||
private String zipCode; | ||
|
||
public String getStreet1() { | ||
return street1; | ||
} | ||
|
||
public void setStreet1(String street1) { | ||
this.street1 = street1; | ||
} | ||
|
||
public String getStreet2() { | ||
return street2; | ||
} | ||
|
||
public void setStreet2(String street2) { | ||
this.street2 = street2; | ||
} | ||
|
||
public String getZipCode() { | ||
return zipCode; | ||
} | ||
|
||
public void setZipCode(String zipCode) { | ||
this.zipCode = zipCode; | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
examples/jpa-strict/src/main/java/org/jboss/shamrock/example/jpa/Animal.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package org.jboss.shamrock.example.jpa; | ||
|
||
/** | ||
* @author Emmanuel Bernard [email protected] | ||
*/ | ||
public class Animal { | ||
private double weight; | ||
|
||
public double getWeight() { | ||
return weight; | ||
} | ||
|
||
public void setWeight(double weight) { | ||
this.weight = weight; | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
examples/jpa-strict/src/main/java/org/jboss/shamrock/example/jpa/Customer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package org.jboss.shamrock.example.jpa; | ||
|
||
import javax.persistence.Embedded; | ||
import javax.persistence.Entity; | ||
import javax.persistence.Id; | ||
|
||
/** | ||
* Used to test reflection references for JPA | ||
* | ||
* @author Emmanuel Bernard [email protected] | ||
*/ | ||
@Entity | ||
public class Customer extends Human { | ||
@Id | ||
// no getter explicitly to test field only reflective access | ||
private Long id; | ||
|
||
private Address address; | ||
private WorkAddress workAddress; | ||
|
||
private String name; | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
|
||
// Address is referenced but not marked as @Embeddable | ||
@Embedded | ||
public Address getAddress() { | ||
return address; | ||
} | ||
|
||
public WorkAddress getWorkAddress() { | ||
return workAddress; | ||
} | ||
|
||
public void setWorkAddress(WorkAddress workAddress) { | ||
this.workAddress = workAddress; | ||
} | ||
|
||
public void setAddress(Address address) { | ||
this.address = address; | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
examples/jpa-strict/src/main/java/org/jboss/shamrock/example/jpa/Human.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package org.jboss.shamrock.example.jpa; | ||
|
||
import javax.persistence.MappedSuperclass; | ||
|
||
/** | ||
* Mapped superclass test | ||
* | ||
* @author Emmanuel Bernard [email protected] | ||
*/ | ||
@MappedSuperclass | ||
public class Human extends Animal { | ||
private String name; | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
} |
Oops, something went wrong.