Skip to content

Commit 57d52db

Browse files
authored
Merge pull request #1 from luismoro/master
Commit Inicial
2 parents e3a1e96 + 01a9acc commit 57d52db

137 files changed

Lines changed: 5726 additions & 17 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

100644100755
Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,34 @@
1-
# Compiled class file
2-
*.class
1+
target/
2+
.mvn/
33

4-
# Log file
5-
*.log
4+
application-*.yml
65

7-
# BlueJ files
8-
*.ctxt
6+
### STS ###
7+
.classpath
8+
.factorypath
9+
.project
10+
.settings
11+
.springBeans
912

10-
# Mobile Tools for Java (J2ME)
11-
.mtj.tmp/
13+
### IntelliJ IDEA ###
14+
.idea
15+
*.iws
16+
*.iml
17+
*.ipr
1218

13-
# Package Files #
14-
*.jar
15-
*.war
16-
*.ear
17-
*.zip
18-
*.tar.gz
19-
*.rar
19+
### NetBeans ###
20+
nbproject/private/
21+
build/
22+
nbbuild/
23+
dist/
24+
nbdist/
25+
.nb-gradle/
2026

21-
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
22-
hs_err_pid*
27+
gradle
28+
.gradle/
29+
gradlew
30+
31+
### Application ###
32+
backup-temp/
33+
mocks-prod
34+
fake-api-data

README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Mock API
2+
3+
App criado para fazer mock com REST utilizando JSON
4+
5+
## Regras
6+
7+
Quando uma request é feita é seguido o seguinte fluxo:
8+
9+
* Existe na pasta do mock (conforme a propriedade `api.fileBase`)? Caso sim, retorna o mock
10+
* A uri se encaixa em algum pattern da lista de `api.uriConfigurations[].pattern`? Caso sim, vai redirecionar conforme a configuração e fazer fazer cache conforme o field `backup`
11+
* Se não entrar nos fluxos anteriores, vai redirecionar para o host padrão `api.host`
12+
13+
## Requisitos
14+
* Java JDK 8
15+
* Maven 3
16+
17+
## Run
18+
19+
## Usando seu arquivo de propriedades
20+
Crie seu arquivo de propriedade `src/main/resources/application-custom.yml` e rode com o argumento `-Dspring.profiles.active=custom`. Exemplo:
21+
```
22+
mvn spring-boot:run -Dspring.profiles.active=custom
23+
```
24+
25+
## TODO
26+
* Mudar para Gradle
27+
* Adicionar a opção de fazer build com Docker
28+
* Quando não existir `api.acceptedHeaders` não precisa validar
29+
* Separar testes unitários dos testes integrados
30+
* Corrigir os testes ignorados
31+
* Corrigir Code Style
32+
* Adcionar plugin do FindBugs

mocks-test/get/guests/132/1.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"response": {
3+
"body": [
4+
{
5+
"cc": "11",
6+
"ca": "12"
7+
},
8+
{
9+
"cc": "21",
10+
"ca": "22"
11+
},
12+
{
13+
"cc": "31",
14+
"ca": "32"
15+
}
16+
]
17+
}
18+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"response": {
3+
"body": [
4+
{
5+
"move": "3"
6+
}
7+
]
8+
}
9+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"response": {
3+
"body": {
4+
"tt": "789"
5+
}
6+
}
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"response": {
3+
"body": {
4+
"tt": "456"
5+
}
6+
}
7+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"request": {
3+
"query": {
4+
"payment": "1",
5+
"value": "10"
6+
}
7+
},
8+
"response": {
9+
"body": [
10+
{
11+
"total": "1700"
12+
},
13+
{
14+
"total": "1800"
15+
}
16+
]
17+
}
18+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"request": {
3+
"query": {
4+
"payment": "2",
5+
"value": "20"
6+
}
7+
},
8+
"response": {
9+
"body": [
10+
{
11+
"total": "1702"
12+
},
13+
{
14+
"total": "1802"
15+
}
16+
]
17+
}
18+
}

mocks-test/get/person/11/1.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"response": {
3+
"body": {
4+
"name": "Paul"
5+
}
6+
}
7+
}

mocks-test/get/users/123/1.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"response": {
3+
"body": {
4+
"name": "Paul"
5+
}
6+
}
7+
}

0 commit comments

Comments
 (0)