1 package org.kuali.student.core.test;
2
3 import java.util.Map;
4
5 import org.junit.After;
6 import org.junit.AfterClass;
7 import org.junit.Assert;
8 import org.junit.Before;
9 import org.junit.BeforeClass;
10
11 import org.kuali.rice.core.api.config.property.Config;
12 import org.kuali.rice.core.api.config.property.ConfigContext;
13 import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader;
14 import org.kuali.rice.core.api.resourceloader.ResourceLoader;
15 import org.mortbay.jetty.webapp.WebAppClassLoader;
16
17
18
19
20
21
22
23
24
25
26
27
28 public class BaseCase extends Assert {
29
30 private static final int DEFAULT_PORT = 8090;
31 private static final String CONTEXT_NAME = "/ks-test-dev";
32 private static final String WEBAPP_ROOT = "/src/main/webapp";
33
34
35
36
37
38 @Before
39 public void setUp() throws Exception {
40
41
42 }
43
44 @After
45 public void tearDown() throws Exception {
46
47
48
49
50
51
52
53 }
54
55 @BeforeClass
56 public static void startJettyServer() throws Exception {
57 System.setProperty("kew.bootstrap.spring.file", "SpringBeans.xml");
58
59
60
61
62
63
64
65 }
66
67
68
69
70
71 public static void addWebappsToContext() {
72 for (Map.Entry<ClassLoader, Config> configEntry : ConfigContext.getConfigs()) {
73 if (configEntry.getKey() instanceof WebAppClassLoader) {
74 ResourceLoader rl = GlobalResourceLoader.getResourceLoader(configEntry.getKey());
75 if (rl == null) {
76 Assert.fail("didn't find resource loader for workflow test harness web app");
77 }
78 ConfigContext.overrideConfig(Thread.currentThread().getContextClassLoader(), configEntry.getValue());
79 GlobalResourceLoader.addResourceLoader(rl);
80 }
81 }
82 }
83
84 @AfterClass
85 public static void stopJettyServer() throws Exception {
86
87
88
89
90
91
92
93 }
94
95 }