Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapt to hibernate #102

Draft
wants to merge 2 commits into
base: sb-2.5.x
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,16 @@ oc create -f .openshiftio/database.yaml

Once the database is up and running, we can deploy the application using Dekorate:

```
```bash
mvn clean verify -Popenshift -Ddekorate.deploy=true
```

To deploy the application using a specific Spring Boot version use the `-Dspring-boot.version` switch.

```bash
mvn clean verify -Popenshift -Ddekorate.deploy=true -Dspring-boot.version=2.6.7
```

## Deploying application on OpenShift using Helm

First, make sure you have installed [the Helm command line](https://helm.sh/docs/intro/install/) and connected/logged to a kubernetes cluster.
Expand Down Expand Up @@ -66,10 +72,18 @@ helm uninstall crud

## Running Tests on OpenShift using Dekorate

```
```bash
./run_tests_with_dekorate.sh
```

Alternativelly, tests can be executed against a specific Spring Boot version by passing the
version as a `-v` parameter.

```bash
./run_tests_with_dekorate.sh -v "2.6.7"
```


## Running Tests on OpenShift using S2i from Source

```
Expand Down
76 changes: 64 additions & 12 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,19 @@
-->
<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">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>dev.snowdrop</groupId>
<artifactId>snowdrop-dependencies</artifactId>
<version>2.5.12.Final</version>
</parent>
<groupId>dev.snowdrop.example</groupId>
<artifactId>crud</artifactId>
<version>2.5.12-3-SNAPSHOT</version>
<name>Spring Boot - CRUD Example</name>
<description>Spring Boot - CRUD Example</description>
<version>2.9.3</version>
<name>Dekorate - Spring Boot - CRUD Example</name>
<description>Dekorate - Spring Boot - CRUD Example</description>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven-surefire-plugin.version>2.22.2</maven-surefire-plugin.version>
<maven-failsafe-plugin.version>2.22.2</maven-failsafe-plugin.version>
<postgresql.version>42.3.3</postgresql.version>
<spring-boot.version>2.5.12</spring-boot.version>
<dekorate.version>2.9.3</dekorate.version>
</properties>
<licenses>
<license>
Expand Down Expand Up @@ -76,6 +72,26 @@
<url>https://maven.repository.redhat.com/earlyaccess/all/</url>
</pluginRepository>
</pluginRepositories>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.dekorate</groupId>
<artifactId>dekorate-spring-bom</artifactId>
<version>${dekorate.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring-boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
Expand All @@ -84,7 +100,44 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<exclusions>
<exclusion>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- Hibernate Validator-->
<dependency>
<groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator</artifactId>
<version>6.0.22.Final-redhat-00002</version>
</dependency>

<!-- Hibernate -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.3.24.Final-redhat-00001</version>
<exclusions>
<exclusion>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jta_1.1_spec</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>5.3.24.Final-redhat-00001</version>
<exclusions>
<exclusion>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jta_1.1_spec</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
Expand Down Expand Up @@ -131,6 +184,7 @@
<scope>test</scope>
</dependency>
</dependencies>

<build>
<!-- Used only to replace ${db.name} in index.html with the corresponding Database name -->
<resources>
Expand All @@ -151,13 +205,10 @@
</testResource>
</testResources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot.version}</version>
<configuration/>
<executions>
<execution>
Expand All @@ -174,6 +225,7 @@
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>local</id>
Expand Down
14 changes: 13 additions & 1 deletion run_tests_with_dekorate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,17 @@ if [[ $(waitFor "my-database" "app") -eq 1 ]] ; then
exit 1
fi

SB_VERSION_SWITCH=""

while getopts v: option
do
case "${option}"
in
v)SB_VERSION_SWITCH="-Dspring-boot.version=${OPTARG}";;
esac
done

echo "SB_VERSION_SWITCH: ${SB_VERSION_SWITCH}"

# Run OpenShift Tests
./mvnw -s .github/mvn-settings.xml clean verify -Popenshift,openshift-it
eval "./mvnw -s .github/mvn-settings.xml clean verify -Popenshift,openshift-it ${SB_VERSION_SWITCH}"