1
package test.chinantn.ldapuser;
2
3
import org.springframework.test.AbstractTransactionalSpringContextTests;
4
5
import com.chinantn.ldapuser.core.Ldap2Database;
6
7
8
public class TestLdap2Database extends
9
//建議使用的有事務處理的
10
AbstractTransactionalSpringContextTests{
11
// AbstractDependencyInjectionSpringContextTests {
12
13
14
protected String[] getConfigLocations() {
15
return new String[] { "classpath:applicationContext.xml" };
16
}
17
public Ldap2Database l2d=null;
18
19
20
@Override
21
protected void onSetUpInTransaction() throws Exception {
22
l2d=(Ldap2Database)applicationContext.getBean("ldap2Database");
23
}
24
25
26
/**
27
* 測試處理數據
28
* @throws Exception
29
*/
30
public void testProcessData()throws Exception{
31
l2d.dataBatchMoveProcess("dataimp.xml");
32
//assertTrue(arg0);
33
}
34
35
}
36

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

進行完測試以后數據庫里面不會留下任何的垃圾數據的!如果用下面的就不行了!??!