Skip to content

Commit

Permalink
feat(shop-server) Add first integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
Y-Henry authored and z3ddycus committed Jan 19, 2024
1 parent 75c5d66 commit 6121e42
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 6 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,13 @@ jobs:
uses: actions/checkout@v2

- name: Build
run: ./mvnw compile package
run: ./mvnw compile

- name: Test
run: ./mvnw test

- name: Package
run: ./mvnw package

- name: Docker build
run: docker build .
2 changes: 1 addition & 1 deletion shop-server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ RUN ./mvnw package

FROM eclipse-temurin:17-jre-jammy
COPY --from=build /app/target/shop-app-0.0.1-SNAPSHOT.jar /shop-app.jar
ENTRYPOINT ["java","-jar","shop-app.jar"]
ENTRYPOINT ["java","-Dspring.profiles.active=prod", "-jar","shop-app.jar"]
EXPOSE 8080
5 changes: 5 additions & 0 deletions shop-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@
<version>3.0.0</version>
</dependency>

<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<!-- Can be usefull for avoid manual migration on database -->
<!-- <dependency>-->
<!-- <groupId>org.liquibase</groupId>-->
Expand Down
20 changes: 20 additions & 0 deletions shop-server/src/main/resources/application-prod.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# port
server.port=8080
# database
spring.datasource.url=jdbc:postgresql://localhost:5432/postgres
spring.datasource.username=postgres
spring.datasource.password=1234
# jpa
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
spring.jpa.properties.hibernate.search.backend.protocol=http
spring.jpa.properties.hibernate.search.backend.hosts=localhost:9200
# Fix Postgres JPA Error:
# Method org.postgresql.jdbc.PgConnection.createClob() is not yet implemented.
spring.jpa.properties.hibernate.temp.use_jdbc_metadata_defaults=false
spring.mvc.pathmatch.matching-strategy=ant_path_matcher
# error message
server.error.include-message=always
logging.level.org.hibernate.search.query=DEBUG
logging.level.org.apache.http=DEBUG
4 changes: 0 additions & 4 deletions shop-server/src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
# port
server.port=8080
# database
spring.datasource.driver-class-name=org.postgresql.Driver
spring.datasource.url=jdbc:postgresql://localhost:5432/postgres
spring.datasource.username=postgres
spring.datasource.password=1234
# jpa
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package fr.fullstack.shopapp.model;

import fr.fullstack.shopapp.ShopAppApplication;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.test.context.web.WebAppConfiguration;

@ExtendWith(SpringExtension.class)
@ContextConfiguration(classes = { ShopAppApplication.class })
@WebAppConfiguration
public class ShopAppIntegrationTest {

@Test
public void shouldStartContext() {

}
}

0 comments on commit 6121e42

Please sign in to comment.