コード例 #1
0
  @Test
  public void createTableOnStartupCreatesCorrectTable() {
    template.execute("drop table persistent_logins");
    repo = new JdbcTokenRepositoryImpl();
    repo.setDataSource(dataSource);
    repo.setCreateTableOnStartup(true);
    repo.initDao();

    template.queryForList("select username,series,token,last_used from persistent_logins");
  }
コード例 #2
0
 @Before
 public void populateDatabase() {
   repo = new JdbcTokenRepositoryImpl();
   ReflectionTestUtils.setField(repo, "logger", logger);
   repo.setDataSource(dataSource);
   repo.initDao();
   template = repo.getJdbcTemplate();
   template.execute(
       "create table persistent_logins (username varchar(100) not null, "
           + "series varchar(100) not null, token varchar(500) not null, last_used timestamp not null)");
 }