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

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

Nouveau projet

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