Skip to content

Commit ac95de3

Browse files
committed
fix1
1 parent f2b74a4 commit ac95de3

3 files changed

Lines changed: 18 additions & 18 deletions

File tree

pom.xml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@
3333
<artifactId>spring-boot-configuration-processor</artifactId>
3434
<optional>true</optional>
3535
</dependency>
36-
36+
<dependency>
37+
<groupId>com.h2database</groupId>
38+
<artifactId>h2</artifactId>
39+
<scope>runtime</scope>
40+
</dependency>
3741
<dependency>
3842
<groupId>org.postgresql</groupId>
3943
<artifactId>postgresql</artifactId>
@@ -45,12 +49,6 @@
4549
<artifactId>lombok</artifactId>
4650
<optional>true</optional>
4751
</dependency>
48-
49-
<dependency>
50-
<groupId>com.h2database</groupId>
51-
<artifactId>h2</artifactId>
52-
<scope>test</scope>
53-
</dependency>
5452
<dependency>
5553
<groupId>org.springframework.boot</groupId>
5654
<artifactId>spring-boot-starter-test</artifactId>
Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1-
spring.jpa.hibernate.ddl-auto=none
1+
spring.sql.init.mode=never
2+
3+
spring.datasource.driver-class-name=org.h2.Driver
4+
spring.datasource.url=jdbc:h2:mem:shareit;DB_CLOSE_DELAY=-1;MODE=PostgreSQL
5+
spring.datasource.username=sa
6+
spring.datasource.password=
7+
8+
spring.jpa.hibernate.ddl-auto=create-drop
29
spring.jpa.properties.hibernate.format_sql=true
3-
spring.sql.init.mode=always
10+
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.H2Dialect
11+
412
logging.level.org.springframework.orm.jpa=INFO
513
logging.level.org.springframework.transaction=INFO
614
logging.level.org.springframework.transaction.interceptor=TRACE
7-
logging.level.org.springframework.orm.jpa.JpaTransactionManager=DEBUG
8-
9-
# TODO Append connection to H2 DB
10-
#spring.datasource.driverClassName
11-
#spring.datasource.url
12-
#spring.datasource.username
13-
#spring.datasource.password
15+
logging.level.org.springframework.orm.jpa.JpaTransactionManager=DEBUG

src/test/java/ru/practicum/shareit/ShareItTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
import org.junit.jupiter.api.Test;
44
import org.springframework.boot.test.context.SpringBootTest;
5+
import org.springframework.test.context.ActiveProfiles;
56

67
@SpringBootTest
8+
@ActiveProfiles("test")
79
class ShareItTests {
8-
910
@Test
1011
void contextLoads() {
1112
}
12-
1313
}

0 commit comments

Comments
 (0)