source: ether_statistics/service/test/com/ether/ServiceTestHelper.java

Last change on this file was 572, checked in by vmipsl, 12 years ago

clean

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