Guest User

Untitled

a guest
Oct 24th, 2018
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.50 KB | None | 0 0
  1. jdbc.driverClassName=com.mysql.cj.jdbc.Driver
  2. jdbc.url=jdbc:mysql://localhost:6161/myTestDb?allowPublicKeyRetrieval=true&useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Europe/Moscow&&useSSL=false
  3. jdbc.username=root
  4. jdbc.cred=admin
  5. hibernate.dialect=org.hibernate.dialect.MySQLDialect
  6. hibernate.show_sql=true
  7. hibernate.format_sql=true
  8.  
  9. <dependency>
  10. <groupId>org.testcontainers</groupId>
  11. <artifactId>testcontainers</artifactId>
  12. <version>1.9.1</version>
  13. </dependency>
  14.  
  15. <dependency>
  16. <groupId>org.testcontainers</groupId>
  17. <artifactId>mysql</artifactId>
  18. <version>1.9.1</version>
  19. <scope>test</scope>
  20. </dependency>
  21.  
  22. public class TestMySQL extends MySQLContainer {
  23.  
  24. public TestMySQL() {
  25. super();
  26. }
  27.  
  28. public TestMySQL(String dockerImageName) {
  29. super(dockerImageName);
  30. }
  31.  
  32. @Override
  33. public String getDriverClassName() {
  34. return "com.mysql.cj.jdbc.Driver";
  35. }
  36. }
  37.  
  38. @RunWith(SpringJUnit4ClassRunner.class)
  39. @ContextConfiguration(classes = {
  40. HibernateConfiguration.class,
  41. SecurityConfiguration.class,
  42. SecurityInitializer.class,
  43. ViewConfiguration.class,
  44. ViewInitializer.class})
  45. @WebAppConfiguration
  46. public class ControllerServiceJTest {
  47.  
  48. @ClassRule
  49. public static TestMySQL container
  50. = new TestMySQL("h2testbase");
  51.  
  52. @Autowired
  53. ControllerService controllerService;
  54.  
  55. @Test
  56. public void stationPagination() {
  57. Map<String, Object> pag = controllerService.stationPagination(4);
  58. Assert.assertTrue(((List<Station>)pag.get("stations")).size() == 8);
  59. }
  60.  
  61. @Test
  62. public void trainPagination() {
  63. Map<String, Object> pag = controllerService.trainPagination(1);
  64. Assert.assertTrue(((List<Train>)pag.get("trains")).size() == 20);
  65. }
  66.  
  67. @Test
  68. public void switchHelper() {
  69. Assert.assertTrue(controllerService.stationSwitchHelper("BLUE").equals(URLs.REDIRECT_DASHSTATION + "/2"));
  70. }
  71. }
  72.  
  73. org.testcontainers.containers.ContainerLaunchException: Container startup failed
  74. Caused by: org.rnorth.ducttape.RetryCountExceededException: Retry limit hit with exception
  75. Caused by: org.testcontainers.containers.ContainerLaunchException: Could not create/start container
  76. Caused by: org.rnorth.ducttape.TimeoutException: org.rnorth.ducttape.TimeoutException: java.util.concurrent.TimeoutException
  77. Caused by: org.rnorth.ducttape.TimeoutException: java.util.concurrent.TimeoutException
  78. Caused by: java.util.concurrent.TimeoutException
Add Comment
Please, Sign In to add comment