-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
58 additions
and
45 deletions.
There are no files selected for viewing
9 changes: 0 additions & 9 deletions
9
...ng-cloud-room-service/src/main/java/ca/zhoozhoo/springcloud/rooms/config/R2dbcConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,9 @@ | ||
package ca.zhoozhoo.springcloud.rooms.config; | ||
|
||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.data.r2dbc.core.R2dbcEntityTemplate; | ||
import org.springframework.data.r2dbc.repository.config.EnableR2dbcRepositories; | ||
|
||
import io.r2dbc.spi.ConnectionFactory; | ||
|
||
@Configuration | ||
@EnableR2dbcRepositories(basePackages = "ca.zhoozhoo.springcloud.rooms") | ||
public class R2dbcConfig { | ||
|
||
// @Bean(value = "r2dbcEntityTemplate") | ||
// public R2dbcEntityTemplate getR2dbcEntityTemplate(ConnectionFactory connectionFactory) { | ||
// return new R2dbcEntityTemplate(connectionFactory); | ||
// } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
47 changes: 47 additions & 0 deletions
47
...om-service/src/test/java/ca/zhoozhoo/springcloud/rooms/repository/RoomRepositoryTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package ca.zhoozhoo.springcloud.rooms.repository; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
|
||
import ca.zhoozhoo.springcloud.rooms.model.Room; | ||
import reactor.test.StepVerifier; | ||
|
||
@SpringBootTest | ||
public class RoomRepositoryTest { | ||
|
||
@Autowired | ||
private RoomRepository roomRepository; | ||
|
||
@Test | ||
public void testFindAll() { | ||
insertRooms(); | ||
|
||
roomRepository.findAll() | ||
.as(StepVerifier::create) | ||
.expectNextCount(4) | ||
.verifyComplete(); | ||
} | ||
|
||
@Test | ||
public void testDeleteAll() { | ||
insertRooms(); | ||
|
||
roomRepository.deleteAll() | ||
.as(StepVerifier::create) | ||
.expectNextCount(0) | ||
.verifyComplete(); | ||
} | ||
|
||
public void insertRooms() { | ||
List<Room> rooms = Arrays.asList(new Room(null, "Room 1", "101", "King Bed"), | ||
new Room(null, "Room 2", "102", "Queen Bed"), | ||
new Room(null, "Room 3", "103", "Single Bed"), | ||
new Room(null, "Room 4", "104", "Single Bed")); | ||
|
||
roomRepository.saveAll(rooms).subscribe(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters