示例#1
0
 @Before
 public void setUp() throws Exception {
   DbSetup dbSetup =
       new DbSetup(
           new DataSourceDestination(dataSource),
           sequenceOf(
               DataTest.DELETE_ALL,
               DataTest.INSERT_MEMBER,
               insertInto("ARTICLE")
                   .withGeneratedValue("id", ValueGenerators.sequence())
                   .columns(
                       "AUTHOR_ID",
                       "CONTENT",
                       "POSTEDAT",
                       "TITLE",
                       "HEADLINE",
                       "VALID",
                       "NBCONSULTS")
                   .values(1, "Content *markdown*", new Date(), "title", "intro", true, 1)
                   .build(),
               insertInto("ARTICLECOMMENT")
                   .withGeneratedValue("id", ValueGenerators.sequence())
                   .columns("MEMBER_ID", "CONTENT", "POSTEDAT", "ARTICLE_ID")
                   .values(1, "Comment *markdown*", new Date(), 1)
                   .build()));
   dbSetup.launch();
 }
  @BeforeClass
  public void initData() {
    Operation operations =
        sequenceOf(
            insertInto("item")
                .columns("id", "name", "status", "date")
                .values(1, "test", true, new Date())
                .values(2, "test", true, new Date())
                .values(3, "test", true, new Date())
                .values(4, "test1", false, new Date())
                .build());

    DbSetup dbSetup = new DbSetup(new DataSourceDestination(dataSource), operations);
    dbSetup.launch();
  }