Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
Laboratorio 1
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Packages
Packages
Container Registry
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Daiana Nahuelpan Penchulef
Laboratorio 1
Commits
ce43bda0
Commit
ce43bda0
authored
Sep 27, 2022
by
Daiana Nahuelpan Penchulef
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
entrega segundo laboratorio
parent
7fa2d29e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
176 additions
and
9 deletions
+176
-9
pom.xml
pom.xml
+78
-1
src/test/java/com/trabajopractico/demo/LaboratorioApplicationTestSecond.java
...rabajopractico/demo/LaboratorioApplicationTestSecond.java
+2
-4
src/test/java/com/trabajopractico/demo/LaboratorioApplicationTests.java
...com/trabajopractico/demo/LaboratorioApplicationTests.java
+2
-4
src/test/java/com/trabajopractico/demo/TestPuertos.java
src/test/java/com/trabajopractico/demo/TestPuertos.java
+94
-0
No files found.
pom.xml
View file @
ce43bda0
...
...
@@ -11,7 +11,7 @@
<groupId>
com.trabajopractico
</groupId>
<artifactId>
demo
</artifactId>
<version>
0.0.1-SNAPSHOT
</version>
<name>
Laboratori
o
</name>
<name>
dem
o
</name>
<description>
Demo project for Spring Boot
</description>
<properties>
<java.version>
18
</java.version>
...
...
@@ -59,6 +59,83 @@
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
</plugin>
<!-- inicio plugin docker -->
<plugin>
<groupId>
io.fabric8
</groupId>
<artifactId>
docker-maven-plugin
</artifactId>
<version>
0.40.2
</version>
<configuration>
<logDate>
default
</logDate>
<autoPull>
true
</autoPull>
<verbose>
true
</verbose>
<!-- <dockerHost>unix:///var/run/docker.sock</dockerHost> -->
<dockerHost>
npipe:////./pipe/docker_engine
</dockerHost>
<images>
<image>
<alias>
${db}
</alias>
<name>
postgres:13.8-alpine
</name>
<run>
<env>
<POSTGRES_USER>
laboratorioadm
</POSTGRES_USER>
<POSTGRES_PASSWORD>
laboratorioadm
</POSTGRES_PASSWORD>
<POSTGRES_DB>
laboratorio
</POSTGRES_DB>
</env>
<wait>
<log>
database system is ready to accept connections
</log>
<time>
20000
</time>
</wait>
<log>
<prefix>
DB:
</prefix>
<color>
yellow
</color>
</log>
</run>
</image>
<image>
<name>
${project.name}:${project.version}
</name>
<build>
<from>
openjdk:18
</from>
<assembly>
<name>
build
</name>
<descriptorRef>
artifact
</descriptorRef>
</assembly>
<ports>
<port>
8080
</port>
</ports>
<cmd>
java -jar build/${project.name}-${project.version}.jar
</cmd>
</build>
<run>
<ports>
<port>
${spring.port}:8080
</port>
</ports>
<env>
<SPRING_DATASOURCE_URL>
jdbc:postgresql://${db}:5432/laboratorio
</SPRING_DATASOURCE_URL>
<SPRING_DATASOURCE_USER>
laboratorioadm
</SPRING_DATASOURCE_USER>
<SPRING_DATASOURCE_PASSWORD>
laboratorioadm
</SPRING_DATASOURCE_PASSWORD>
</env>
<log>
<prefix>
spring:
</prefix>
<color>
blue
</color>
</log>
<dependsOn>
<container>
${db}
</container>
</dependsOn>
<links>
<link>
${db}
</link>
</links>
<wait>
<time>
10000
</time>
</wait>
</run>
</image>
</images>
</configuration>
</plugin>
<!-- FIN DEL PLUGIN DOCKER -->
</plugins>
</build>
...
...
src/test/java/com/trabajopractico/demo/LaboratorioApplicationTestSecond.java
View file @
ce43bda0
...
...
@@ -3,10 +3,7 @@ package com.trabajopractico.demo;
import
com.trabajopractico.demo.backend.model.Operacion
;
import
com.trabajopractico.demo.backend.model.OperacionType
;
import
org.junit.jupiter.api.MethodOrderer
;
import
org.junit.jupiter.api.Order
;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.TestMethodOrder
;
import
org.junit.jupiter.api.*
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebTestClient
;
import
org.springframework.boot.test.context.SpringBootTest
;
...
...
@@ -16,6 +13,7 @@ import org.springframework.test.web.reactive.server.WebTestClient;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertEquals
;
@Disabled
@SpringBootTest
(
webEnvironment
=
SpringBootTest
.
WebEnvironment
.
RANDOM_PORT
)
@TestMethodOrder
(
MethodOrderer
.
OrderAnnotation
.
class
)
@AutoConfigureWebTestClient
...
...
src/test/java/com/trabajopractico/demo/LaboratorioApplicationTests.java
View file @
ce43bda0
...
...
@@ -2,10 +2,7 @@ package com.trabajopractico.demo;
import
com.trabajopractico.demo.backend.model.Operacion
;
import
com.trabajopractico.demo.backend.model.OperacionType
;
import
org.junit.jupiter.api.MethodOrderer
;
import
org.junit.jupiter.api.Order
;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.TestMethodOrder
;
import
org.junit.jupiter.api.*
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebTestClient
;
import
org.springframework.boot.test.context.SpringBootTest
;
...
...
@@ -15,6 +12,7 @@ import org.springframework.test.web.reactive.server.WebTestClient;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertEquals
;
@SpringBootTest
(
webEnvironment
=
SpringBootTest
.
WebEnvironment
.
RANDOM_PORT
)
@TestMethodOrder
(
MethodOrderer
.
OrderAnnotation
.
class
)
@AutoConfigureWebTestClient
...
...
src/test/java/com/trabajopractico/demo/TestPuertos.java
0 → 100644
View file @
ce43bda0
package
com
.
trabajopractico
.
demo
;
import
com.trabajopractico.demo.backend.model.Operacion
;
import
org.junit.jupiter.api.*
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.boot.test.web.client.TestRestTemplate
;
import
org.springframework.http.*
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertEquals
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertTrue
;
@SpringBootTest
@TestMethodOrder
(
MethodOrderer
.
OrderAnnotation
.
class
)
class
TestPuertos
{
TestRestTemplate
restTemplate
=
new
TestRestTemplate
();
HttpHeaders
headers
=
new
HttpHeaders
();
@Test
@Order
(
1
)
public
void
depositoFirst
()
{
HttpEntity
<
String
>
entity
=
new
HttpEntity
<
String
>(
null
,
headers
);
restTemplate
.
exchange
(
"http://localhost:8082/api"
+
"/operaciones/deleteall"
,
HttpMethod
.
GET
,
entity
,
Operacion
.
class
);
ResponseEntity
<
Operacion
>
response
=
restTemplate
.
exchange
(
"http://localhost:8082/api"
+
"/operaciones/deposito?tipo=DEPOSITO&monto=1000"
,
HttpMethod
.
POST
,
entity
,
Operacion
.
class
);
assertEquals
(
1000.0
,
response
.
getBody
().
getMonto
());
// assertTrue(true);
}
@Test
@Order
(
2
)
public
void
depositoSecond
()
{
HttpEntity
<
String
>
entity
=
new
HttpEntity
<
String
>(
null
,
headers
);
restTemplate
.
exchange
(
"http://localhost:8085/api"
+
"/operaciones/deleteall"
,
HttpMethod
.
GET
,
entity
,
Operacion
.
class
);
ResponseEntity
<
Operacion
>
response
=
restTemplate
.
exchange
(
"http://localhost:8085/api"
+
"/operaciones/deposito?tipo=DEPOSITO&monto=5000"
,
HttpMethod
.
POST
,
entity
,
Operacion
.
class
);
assertEquals
(
5000.0
,
response
.
getBody
().
getMonto
());
//assertTrue(true);
}
@Test
@Order
(
3
)
public
void
depositoTercero
()
{
HttpEntity
<
String
>
entity
=
new
HttpEntity
<
String
>(
null
,
headers
);
restTemplate
.
exchange
(
"http://localhost:8083/api"
+
"/operaciones/deleteall"
,
HttpMethod
.
GET
,
entity
,
Operacion
.
class
);
ResponseEntity
<
Operacion
>
response
=
restTemplate
.
exchange
(
"http://localhost:8083/api"
+
"/operaciones/deposito?tipo=DEPOSITO&monto=200"
,
HttpMethod
.
POST
,
entity
,
Operacion
.
class
);
assertEquals
(
200.0
,
response
.
getBody
().
getMonto
());
}
@Test
@Order
(
4
)
public
void
saldosPuertos
()
{
HttpEntity
<
String
>
entity
=
new
HttpEntity
<
String
>(
null
,
headers
);
ResponseEntity
<
Operacion
>
response
=
restTemplate
.
exchange
(
"http://localhost:8082/api/operaciones/consulta"
,
HttpMethod
.
GET
,
entity
,
Operacion
.
class
);
assertEquals
(
1000.0
,
response
.
getBody
().
getMonto
());
response
=
restTemplate
.
exchange
(
"http://localhost:8085/api/operaciones/consulta"
,
HttpMethod
.
GET
,
entity
,
Operacion
.
class
);
assertEquals
(
5000.0
,
response
.
getBody
().
getMonto
());
response
=
restTemplate
.
exchange
(
"http://localhost:8083/api/operaciones/consulta"
,
HttpMethod
.
GET
,
entity
,
Operacion
.
class
);
assertEquals
(
200.0
,
response
.
getBody
().
getMonto
());
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment