peter_backlund 17 年前
父节点
当前提交
bc021c7486
共有 1 个文件被更改,包括 0 次插入42 次删除
  1. 0
    42
      dddsample/external/reporting/src/test/java/com/reporting/Fixture.java

+ 0
- 42
dddsample/external/reporting/src/test/java/com/reporting/Fixture.java 查看文件

@@ -1,42 +0,0 @@
1
-/**
2
- * Purpose
3
- * @author peter
4
- * @created 2009-okt-03
5
- * $Id$
6
- */
7
-package com.reporting;
8
-
9
-import org.apache.commons.io.IOUtils;
10
-import org.springframework.context.ApplicationEvent;
11
-import org.springframework.context.ApplicationListener;
12
-import org.springframework.context.event.ContextRefreshedEvent;
13
-import org.springframework.core.io.Resource;
14
-import org.springframework.jdbc.core.simple.SimpleJdbcTemplate;
15
-
16
-import javax.sql.DataSource;
17
-import java.io.IOException;
18
-
19
-public class Fixture implements ApplicationListener {
20
-
21
-  private SimpleJdbcTemplate jdbc;
22
-  private Resource schema;
23
-  private Resource testdata;
24
-
25
-  public Fixture(DataSource dataSource, Resource schema, Resource testdata) {
26
-    this.jdbc = new SimpleJdbcTemplate(dataSource);
27
-    this.testdata = testdata;
28
-    this.schema = schema;
29
-  }
30
-
31
-  @Override
32
-  public void onApplicationEvent(ApplicationEvent event) {
33
-    if (event instanceof ContextRefreshedEvent) {
34
-      try {
35
-        jdbc.update(IOUtils.toString(schema.getInputStream()));
36
-        jdbc.update(IOUtils.toString(testdata.getInputStream()));
37
-      } catch (IOException e) {
38
-        throw new RuntimeException(e);
39
-      }
40
-    }
41
-  }
42
-}