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

feat(shop-server) Add first integration test #6

Merged
merged 1 commit into from
Jan 19, 2024
Merged
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
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() {

}
}
Loading