Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- jdbc.driverClassName=com.mysql.cj.jdbc.Driver
- jdbc.url=jdbc:mysql://localhost:6161/myTestDb?allowPublicKeyRetrieval=true&useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Europe/Moscow&&useSSL=false
- jdbc.username=root
- jdbc.cred=admin
- hibernate.dialect=org.hibernate.dialect.MySQLDialect
- hibernate.show_sql=true
- hibernate.format_sql=true
- <dependency>
- <groupId>org.testcontainers</groupId>
- <artifactId>testcontainers</artifactId>
- <version>1.9.1</version>
- </dependency>
- <dependency>
- <groupId>org.testcontainers</groupId>
- <artifactId>mysql</artifactId>
- <version>1.9.1</version>
- <scope>test</scope>
- </dependency>
- public class TestMySQL extends MySQLContainer {
- public TestMySQL() {
- super();
- }
- public TestMySQL(String dockerImageName) {
- super(dockerImageName);
- }
- @Override
- public String getDriverClassName() {
- return "com.mysql.cj.jdbc.Driver";
- }
- }
- @RunWith(SpringJUnit4ClassRunner.class)
- @ContextConfiguration(classes = {
- HibernateConfiguration.class,
- SecurityConfiguration.class,
- SecurityInitializer.class,
- ViewConfiguration.class,
- ViewInitializer.class})
- @WebAppConfiguration
- public class ControllerServiceJTest {
- @ClassRule
- public static TestMySQL container
- = new TestMySQL("h2testbase");
- @Autowired
- ControllerService controllerService;
- @Test
- public void stationPagination() {
- Map<String, Object> pag = controllerService.stationPagination(4);
- Assert.assertTrue(((List<Station>)pag.get("stations")).size() == 8);
- }
- @Test
- public void trainPagination() {
- Map<String, Object> pag = controllerService.trainPagination(1);
- Assert.assertTrue(((List<Train>)pag.get("trains")).size() == 20);
- }
- @Test
- public void switchHelper() {
- Assert.assertTrue(controllerService.stationSwitchHelper("BLUE").equals(URLs.REDIRECT_DASHSTATION + "/2"));
- }
- }
- org.testcontainers.containers.ContainerLaunchException: Container startup failed
- Caused by: org.rnorth.ducttape.RetryCountExceededException: Retry limit hit with exception
- Caused by: org.testcontainers.containers.ContainerLaunchException: Could not create/start container
- Caused by: org.rnorth.ducttape.TimeoutException: org.rnorth.ducttape.TimeoutException: java.util.concurrent.TimeoutException
- Caused by: org.rnorth.ducttape.TimeoutException: java.util.concurrent.TimeoutException
- Caused by: java.util.concurrent.TimeoutException
Add Comment
Please, Sign In to add comment