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

Post integration test pedro #26

Open
wants to merge 99 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
80a86af
Adpatación a Postgresql
lmlopezmagana Jan 25, 2024
36e707b
added the dependencies
Javi-Prieto Jan 29, 2024
1f7dac6
initial commit for my branch
Javi-Prieto Jan 29, 2024
53bf745
initial commit for my branch
Javi-Prieto Jan 29, 2024
54e510a
resolve error entityManagerFactory
alvaropol Jan 29, 2024
aeb9ec9
role repository tested
alvaropol Jan 29, 2024
f139651
tryout for fix test error
Javi-Prieto Jan 29, 2024
d8e1ac9
fixed
Javi-Prieto Jan 29, 2024
b23dc48
Repository test
PedroFranchEchaniz Jan 29, 2024
c60ede1
test
PedroFranchEchaniz Jan 29, 2024
2ef50a1
test repositorio usuario
PedroFranchEchaniz Jan 29, 2024
c8bd4da
finished the test
Javi-Prieto Jan 30, 2024
66aa8bb
Merge pull request #1 from Javi-Prieto/post-repository-test
Javi-Prieto Jan 30, 2024
3fd783c
merge
PedroFranchEchaniz Jan 30, 2024
2b13181
test repostiorio usuario
PedroFranchEchaniz Jan 30, 2024
3280bb6
branch test merged
alvaropol Jan 30, 2024
9820884
Merge pull request #2 from Javi-Prieto/role-repository-test
alvaropol Jan 30, 2024
baa4f2b
register test
PedroFranchEchaniz Jan 30, 2024
98bd893
actualizacion de la rama
PedroFranchEchaniz Jan 30, 2024
6465c47
actualización de la rama
PedroFranchEchaniz Jan 30, 2024
5f1c150
all category service methods tested
alvaropol Jan 30, 2024
038e114
Merge pull request #3 from Javi-Prieto/category-service-test
alvaropol Jan 30, 2024
d30b588
actualizacion de rama
PedroFranchEchaniz Jan 30, 2024
f2157c8
actualizacion rama
PedroFranchEchaniz Jan 30, 2024
4852849
Merge pull request #4 from Javi-Prieto/auth-service-test
PedroFranchEchaniz Jan 30, 2024
f5e4341
actualizacion rama
PedroFranchEchaniz Jan 30, 2024
adb5be9
Merge pull request #5 from Javi-Prieto/user-repository-test
PedroFranchEchaniz Jan 30, 2024
4192b41
Comentado controlador auth registro
PedroFranchEchaniz Jan 30, 2024
61d908d
ordanado test
PedroFranchEchaniz Jan 30, 2024
d7ba118
finished all the service test
Javi-Prieto Jan 31, 2024
e8be68d
Merge branch 'test' into post-service-test
Javi-Prieto Jan 31, 2024
e6795c4
Merge pull request #6 from Javi-Prieto/post-service-test
Javi-Prieto Jan 31, 2024
ebc6bd3
test de controlador
PedroFranchEchaniz Jan 31, 2024
599747d
actualizacion de rama
PedroFranchEchaniz Jan 31, 2024
e506780
all category controller methods tested
alvaropol Jan 31, 2024
a7b8958
test controlador
PedroFranchEchaniz Jan 31, 2024
c865756
first test
Javi-Prieto Jan 31, 2024
0f25c42
actualizacion rama
PedroFranchEchaniz Feb 1, 2024
5ad610c
resolve dto null
alvaropol Feb 1, 2024
1010c04
test
PedroFranchEchaniz Feb 2, 2024
b304d08
close to finish the full controller
Javi-Prieto Feb 2, 2024
6999215
Repository test
PedroFranchEchaniz Feb 2, 2024
bc9c0c5
Repository test
PedroFranchEchaniz Feb 2, 2024
4c7a910
controller category tested and dto null fixed
alvaropol Feb 5, 2024
6d8b236
Merge branch 'test' into category-controller-test
alvaropol Feb 5, 2024
ba629f8
Merge pull request #7 from Javi-Prieto/category-controller-test
alvaropol Feb 5, 2024
4015dce
finished the test for the controller of post
Javi-Prieto Feb 5, 2024
8e64a24
updating security test dependency version
Javi-Prieto Feb 5, 2024
16fdf66
Merge pull request #8 from Javi-Prieto/post-controller-test
Javi-Prieto Feb 5, 2024
2d0f294
test put Post
PedroFranchEchaniz Feb 5, 2024
a29d01e
role repository not equal name tested
alvaropol Feb 5, 2024
b029bba
actualizacio de rama
PedroFranchEchaniz Feb 5, 2024
32ffe02
controller test different cases added
alvaropol Feb 5, 2024
eaecd83
Merge pull request #9 from Javi-Prieto/category-controller-test
alvaropol Feb 5, 2024
83bc4a4
Test updatePost controller
PedroFranchEchaniz Feb 5, 2024
5d40ead
Merge pull request #10 from Javi-Prieto/post-controller-test-pedro
PedroFranchEchaniz Feb 5, 2024
79ce994
test controller pedro
PedroFranchEchaniz Feb 5, 2024
5bfcaa6
Merge pull request #11 from Javi-Prieto/post-controller-test-pedro
PedroFranchEchaniz Feb 5, 2024
a00fb33
actualizar rama
PedroFranchEchaniz Feb 5, 2024
2b45ca6
actualizar rama
PedroFranchEchaniz Feb 5, 2024
be3eedb
authcontrollertest
PedroFranchEchaniz Feb 5, 2024
8c43970
Merge pull request #12 from Javi-Prieto/user-controller-test
PedroFranchEchaniz Feb 5, 2024
940f106
first two integration methods done
Javi-Prieto Feb 5, 2024
c2e2289
Merge branch 'test' into post-integration-test
Javi-Prieto Feb 6, 2024
e9b84c7
created the test for create post
Javi-Prieto Feb 6, 2024
d832479
resolve import-integration-category.sql error
alvaropol Feb 6, 2024
74b5f40
Repository test
PedroFranchEchaniz Feb 6, 2024
21b50fd
finished the integration test for the post entity
Javi-Prieto Feb 6, 2024
019bfd8
category integration tested
alvaropol Feb 6, 2024
f4eccf3
Merge pull request #13 from Javi-Prieto/category-integration-test
alvaropol Feb 6, 2024
33b62c2
category controller update category (404 status) added
alvaropol Feb 6, 2024
5c318b4
Merge pull request #14 from Javi-Prieto/category-controller-test-fix
alvaropol Feb 6, 2024
600d365
integration test auth controller
PedroFranchEchaniz Feb 6, 2024
141ab53
test integracion
PedroFranchEchaniz Feb 6, 2024
53f83e2
actaulizacion rama
PedroFranchEchaniz Feb 6, 2024
8697482
actualizacion
PedroFranchEchaniz Feb 6, 2024
3683f78
not found cases added (get, update and delete) and tested
alvaropol Feb 7, 2024
616692a
Merge pull request #15 from Javi-Prieto/category-service-test-fix
alvaropol Feb 7, 2024
aa1e1c7
actualizando
PedroFranchEchaniz Feb 7, 2024
1a30da3
actualizacion
PedroFranchEchaniz Feb 7, 2024
a157bac
no entiedo que pasa
PedroFranchEchaniz Feb 7, 2024
53d7f58
actualizando rama
PedroFranchEchaniz Feb 7, 2024
55fc224
test branch merged
PedroFranchEchaniz Feb 7, 2024
3b3beb4
Merge pull request #16 from Javi-Prieto/user-integration-test-pedro
PedroFranchEchaniz Feb 7, 2024
1e0f3c3
finished and fixed all the test in the api
Javi-Prieto Feb 7, 2024
7131801
addapted to quit test containers
Javi-Prieto Feb 7, 2024
51d23a8
solving merge conflicts
Javi-Prieto Feb 7, 2024
98a589b
update post
PedroFranchEchaniz Feb 7, 2024
d51d269
Merge pull request #17 from Javi-Prieto/post-integration-test
Javi-Prieto Feb 7, 2024
de2df07
integration profile modified in test integration category
alvaropol Feb 7, 2024
2c79227
Merge pull request #18 from Javi-Prieto/integration-fix-test-alvaro
alvaropol Feb 7, 2024
e6ff4a8
test containers anotation removed
alvaropol Feb 7, 2024
9b9c04a
actualizacion rama
PedroFranchEchaniz Feb 7, 2024
5008076
Merge pull request #19 from Javi-Prieto/integration-fix-test-alvaro
alvaropol Feb 7, 2024
45d5ad5
container and imports not necesary
alvaropol Feb 7, 2024
6edc572
Merge pull request #20 from Javi-Prieto/integration-fix-test-alvaro
alvaropol Feb 7, 2024
d604387
actualizacion de la rama
PedroFranchEchaniz Feb 7, 2024
002dde7
Merge branch 'test' into post-integration-test-pedro
PedroFranchEchaniz Feb 7, 2024
c706cb6
no entiedo
PedroFranchEchaniz Feb 7, 2024
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
1 change: 1 addition & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/jpa-buddy.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/springboot-blog-rest-api-test.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

124 changes: 124 additions & 0 deletions .idea/uiDesigner.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,10 @@ Udemy Course Link - [Building Real-Time REST APIs with Spring Boot - Blog App](h
- Learn Docker
- Learn Spring and Spring Boot Annotations
- Interview QA

# Cambios introducidos por Luismi

- Se ha portado el script de sql de Mysql a Postgresql
- Se han adaptado las entidades para que estén en consonancia con el DDL anterior.
- Se ha creado un nuevo perfil para Postgresql.
- Se ha cambiado el valor de `ddl-auto=validate` para que Hibernate no genere el modelo, sino que lo valide con lo que encuentre en la base de datos.
50 changes: 26 additions & 24 deletions Run.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,35 @@
# Steps to Run Spring Boot Blog App
## 1. Maven Build the Project
If you have installed Maven on your machine then use the below command:
# Pasos para ejecutar Spring Boot Blog App

## 1. Construir el proyecton con Maven
Si tienes instalado maven puedes ejecutar el siguiente comando
```
mvn clean package
```
If you haven't insatlled Maven on your machine then use below command:
Si no tienes instalado maven puedes ejecutar el siguiente comando
```
./mvnw clean package
```
Note: Go to root directory of the project and execute above command.
## 2. Create a Database
Before running Spring boot blog application, you need to create the MySQL database.

Use the below SQL database to create the MySQL database:
```sql
create database myblog
```
Database name - myblog
## 3. Run Spring Boot Project
Use below command to run Spring boot application:
> Nota: Debes estar en el directorio raíz del proyecto para ejecutar los comandos anteriores

## 2. Creación de la base de datos
Antes de ejecutar la aplicación, necesitas tener un servidor de Postgresql creado y ejecutar el script `sql/myblog-ddl-script.sql`.
Si usas Docker, puedes usar el siguiente comando:

```
docker-compose up -d
```

Generará dos contenedores:
- Uno con Postgresql, que ejecutará el script mencionado al inicializar.
- Otro con pgAdmin

> Nota: Debes estar en el directorio raíz del proyecto para ejecutar los comandos anteriores

## 3. Ejecutar el proyecto de Spring Boot
Utiliza el comando siguiente para ejecutar la aplicación:
```
mvn spring-boot:run
```
Once you run Spring boot application, Hibernate will create the database tables autimatically.
However, you can refer to DDL scritp for all tables here:
https://github.com/RameshMF/springboot-blog-rest-api/blob/main/myblog-ddl-script.sql
## 4. Insert Data
User below Insert SQL statements to insert records into roles table:
```sql
INSERT INTO `myblog.roles` VALUES (1,'ROLE_ADMIN'),(2,'ROLE_USER');
```
Now, Spring boot blog application is ready to use.
Una vez ejecuta la aplicación, Hibernate **validará** el esquema de la base de datos con las entidades definidas, para garantizar que no hay ningún error en la base de datos.

Entonces, la aplicación de Spring Boot estará lista para utilizarse.
51 changes: 51 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
services:

pg:
image: postgres:16-alpine
environment:
- POSTGRES_DB=test
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=12345678
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 30s
timeout: 30s
retries: 3
restart: on-failure
ports:
- "5433:5432"
volumes:
- pgdata:/var/lib/postgresql/data
profiles: ['dev']


pg-integration-test:
image: postgres:16-alpine
environment:
- POSTGRES_DB=test
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=12345678
ports:
- "55432:5432"
profiles: ['integration']
tmpfs:
- /var/lib/postgresql/data



pgadmin:
image: dpage/pgadmin4
container_name: test-pgadmin
restart: always
ports:
- "5050:80"
environment:
PGADMIN_DEFAULT_EMAIL: [email protected]
PGADMIN_DEFAULT_PASSWORD: admin
volumes:
- pgadmin-data:/var/lib/pgadmin
profiles: ['dev']

volumes:
pgdata:
pgadmin-data:
60 changes: 0 additions & 60 deletions myblog-ddl-script.sql

This file was deleted.

Loading