Skip to content

Commit 7d41888

Browse files
committed
test: ajustes para testes com H2 #64
1 parent a5beda7 commit 7d41888

File tree

5 files changed

+59
-11
lines changed

5 files changed

+59
-11
lines changed

src/test/java/br/ufrn/dct/apf/APFApplicationTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import org.testng.annotations.Test;
66

77
@SpringBootTest
8-
public class APFApplicationTests extends AbstractTestNGSpringContextTests{
8+
public class APFApplicationTests extends AbstractTestNGSpringContextTests {
99

1010
@Test
1111
public void contextLoads() {

src/test/java/br/ufrn/dct/apf/controller/UserStoryControllerTest.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package br.ufrn.dct.apf.controller;
22

3-
import static org.assertj.core.api.Assertions.assertThat;
4-
import static org.hamcrest.Matchers.containsString;
53
import static org.mockito.Mockito.when;
64
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
75
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
@@ -11,11 +9,8 @@
119
import java.util.List;
1210

1311
import org.springframework.beans.factory.annotation.Autowired;
14-
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
1512
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
16-
import org.springframework.boot.test.context.SpringBootTest;
1713
import org.springframework.boot.test.mock.mockito.MockBean;
18-
import org.springframework.test.context.ContextConfiguration;
1914
import org.springframework.test.web.servlet.MockMvc;
2015
import org.testng.annotations.Test;
2116

src/test/java/br/ufrn/dct/apf/repository/RoleRepositoryTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import java.util.List;
44

55
import org.springframework.beans.factory.annotation.Autowired;
6+
import org.springframework.boot.jdbc.EmbeddedDatabaseConnection;
7+
import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase;
68
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
79
import org.springframework.test.context.ContextConfiguration;
810
import org.springframework.test.context.testng.AbstractTestNGSpringContextTests;
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# ===============================
2+
# = DATA SOURCE
3+
# ===============================
4+
#spring.datasource.url=jdbc:h2:mem:apf_db;DB_CLOSE_DELAY=-1;INIT=CREATE SCHEMA IF NOT EXISTS apf
5+
spring.datasource.url=jdbc:h2:mem:apf_db;DB_CLOSE_DELAY=-1;MODE=Postgres;
6+
spring.datasource.username=sa
7+
spring.datasource.password=
8+
spring.datasource.driver-class-name=org.h2.Driver
9+
spring.data.jpa.repositories.bootstrap-mode=default
10+
11+
# ===============================
12+
# = JPA / HIBERNATE
13+
# ===============================
14+
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
15+
spring.jpa.hibernate.ddl-auto=update
16+
spring.jpa.defer-datasource-initialization=true
17+
# spring.jpa.properties.hibernate.default_schema=apf
18+
spring.jpa.show-sql=true
19+
spring.jpa.properties.hibernate.format_sql=true
20+
21+
# Enabling H2 Console
22+
spring.h2.console.enabled=true
23+
24+
# By default enabled for Embedded Databases
25+
spring.sql.init.mode=always
26+
spring.sql.init.continue-on-error=true
27+
28+
logging.level.br.ufrn.dct.apf=DEBUG
29+
30+
# ===============================
31+
# = Thymeleaf configurations
32+
# ===============================
33+
spring.thymeleaf.mode=HTML
34+
spring.thymeleaf.cache=false
35+
36+
# ----------------------------------------
37+
# WEB PROPERTIES
38+
# ----------------------------------------
39+
40+
# Context path of the application.
41+
server.servlet.context-path=/apf
42+
# Display name of the application.
43+
server.servlet.application-display-name=Analisador de Pontos de Função
44+
# Define server port.
45+
server.port=8080
46+
47+
# ==============================================================
48+
# = Spring Security / Queries for AuthenticationManagerBuilder
49+
# ==============================================================
50+
spring.queries.users-query=select email, password, active from apf.user where email=?
51+
spring.queries.roles-query=select u.email, r.role_name from apf.user u inner join apf.user_role ur on(u.user_id=ur.user_id) inner join apf.role r on(ur.role_id=r.role_id) where u.email=?
52+
53+
# =============================================================
54+
# = Spring General
55+
# =============================================================
56+
spring.main.allow-bean-definition-overriding=true

src/test/resources/data.sql

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)