1
2
3
4
5
6
7
8
9
10
11
12
13 package org.kuali.rice.test.lifecycles;
14
15 import org.kuali.rice.core.api.lifecycle.Lifecycle;
16 import org.kuali.rice.core.api.lifecycle.Lifecycle;
17 import org.kuali.rice.test.RiceTestCase;
18 import org.kuali.rice.test.data.PerSuiteUnitTestData;
19 import org.kuali.rice.test.data.UnitTestData;
20 import org.kuali.rice.test.data.UnitTestDataUtils;
21
22
23
24
25
26
27
28
29 public class PerSuiteDataLoaderLifecycle implements Lifecycle {
30 private boolean started;
31
32 private Class<? extends RiceTestCase> annotatedClass;
33
34 public PerSuiteDataLoaderLifecycle(Class<? extends RiceTestCase> annotatedClass) {
35 this.annotatedClass = annotatedClass;
36 }
37
38 public boolean isStarted() {
39 return started;
40 }
41
42 public void start() throws Exception {
43 if (annotatedClass.isAnnotationPresent(PerSuiteUnitTestData.class)) {
44 UnitTestData[] data = annotatedClass.getAnnotation(PerSuiteUnitTestData.class).value();
45 UnitTestDataUtils.executeDataLoader(data);
46 }
47 started = true;
48 }
49
50 public void stop() throws Exception {
51 started = false;
52 }
53
54 }