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_test.xml", |
---|
23 | // "classpath:hibernate_test.cfg.xml", |
---|
24 | }; |
---|
25 | } |
---|
26 | |
---|
27 | @SuppressWarnings("rawtypes") |
---|
28 | public static Class[] getAllKnownDomainClasses() |
---|
29 | { |
---|
30 | return new Class[] { |
---|
31 | Plateform.class,}; |
---|
32 | } |
---|
33 | |
---|
34 | /** |
---|
35 | * Executes operations before running test. |
---|
36 | */ |
---|
37 | protected abstract void beforeServiceTest() throws Exception; |
---|
38 | |
---|
39 | /** |
---|
40 | * Executes operations after running test. |
---|
41 | */ |
---|
42 | protected final void afterServiceTest() throws Exception |
---|
43 | { |
---|
44 | //deleteAllKnownData(); |
---|
45 | } |
---|
46 | |
---|
47 | protected final void beforeHibernateTest() throws Exception |
---|
48 | { |
---|
49 | beforeServiceTest(); |
---|
50 | } |
---|
51 | |
---|
52 | protected final void afterHibernateTest() throws Exception |
---|
53 | { |
---|
54 | afterServiceTest(); |
---|
55 | } |
---|
56 | |
---|
57 | protected final SERVICE getService() |
---|
58 | { |
---|
59 | return getBean(); |
---|
60 | } |
---|
61 | |
---|
62 | private static final Log LOGGER = LogFactory.getLog(ServiceTestHelper.class); |
---|
63 | private static final String DEFAULT_SESSION_FACTORY_BEAN_NAME = "sessionFactory"; |
---|
64 | } |
---|