1 | package com.ether; |
---|
2 | |
---|
3 | import org.apache.commons.logging.Log; |
---|
4 | import org.apache.commons.logging.LogFactory; |
---|
5 | |
---|
6 | public abstract class ServiceTestHelper<SERVICE extends Service> |
---|
7 | extends HibernateTestHelper<SERVICE> |
---|
8 | { |
---|
9 | protected ServiceTestHelper(final String serviceBeanName) { |
---|
10 | super(null, serviceBeanName, getAllDependencies(), DEFAULT_SESSION_FACTORY_BEAN_NAME); |
---|
11 | } |
---|
12 | |
---|
13 | protected void deleteAllKnownData() throws Exception |
---|
14 | { |
---|
15 | // deleteAllDatas( getAllKnownDomainClasses() ); |
---|
16 | } |
---|
17 | |
---|
18 | public static String[] getAllDependencies() |
---|
19 | { |
---|
20 | return new String[] { |
---|
21 | "classpath:dao-context.xml", |
---|
22 | "classpath:service-context.xml", |
---|
23 | "classpath:hibernate_test.cfg.xml", }; |
---|
24 | } |
---|
25 | |
---|
26 | @SuppressWarnings("rawtypes") |
---|
27 | public static Class[] getAllKnownDomainClasses() |
---|
28 | { |
---|
29 | return new Class[] { |
---|
30 | Plateform.class,}; |
---|
31 | } |
---|
32 | |
---|
33 | /** |
---|
34 | * Executes operations before running test. |
---|
35 | */ |
---|
36 | protected abstract void beforeServiceTest() throws Exception; |
---|
37 | |
---|
38 | /** |
---|
39 | * Executes operations after running test. |
---|
40 | */ |
---|
41 | protected final void afterServiceTest() throws Exception |
---|
42 | { |
---|
43 | //deleteAllKnownData(); |
---|
44 | } |
---|
45 | |
---|
46 | protected final void beforeHibernateTest() throws Exception |
---|
47 | { |
---|
48 | beforeServiceTest(); |
---|
49 | } |
---|
50 | |
---|
51 | protected final void afterHibernateTest() throws Exception |
---|
52 | { |
---|
53 | afterServiceTest(); |
---|
54 | } |
---|
55 | |
---|
56 | protected final SERVICE getService() |
---|
57 | { |
---|
58 | return getBean(); |
---|
59 | } |
---|
60 | |
---|
61 | private static final Log LOGGER = LogFactory.getLog(ServiceTestHelper.class); |
---|
62 | private static final String DEFAULT_SESSION_FACTORY_BEAN_NAME = "sessionFactory"; |
---|
63 | } |
---|