1
|
package eu.dnetlib.enabling.is.sn.resourcestate.hib;
|
2
|
|
3
|
import java.util.Collection;
|
4
|
|
5
|
import eu.dnetlib.enabling.is.sn.resourcestate.AbstractResourceStateSubscriptionRegistryTest;
|
6
|
import eu.dnetlib.enabling.is.sn.resourcestate.ResourceStateSubscription;
|
7
|
import eu.dnetlib.enabling.is.sn.resourcestate.ResourceStateSubscriptionDAO;
|
8
|
import org.junit.After;
|
9
|
import org.junit.runner.RunWith;
|
10
|
import org.springframework.beans.factory.annotation.Autowired;
|
11
|
import org.springframework.test.context.ContextConfiguration;
|
12
|
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
13
|
|
14
|
/**
|
15
|
* Perform ResourceStateSubscriptionRegistryTest tests on a hibernate backed resource state subscription dao instance.
|
16
|
*
|
17
|
* @author marko
|
18
|
*
|
19
|
*/
|
20
|
@RunWith(SpringJUnit4ClassRunner.class)
|
21
|
@ContextConfiguration(locations = { "HibernateResourceStateSubscriptionDAOImplTest-context.xml" })
|
22
|
public class HibernateResourceStateSubscriptionRegistryTest extends AbstractResourceStateSubscriptionRegistryTest { // NOPMD
|
23
|
|
24
|
/**
|
25
|
* hibernate subscription dao.
|
26
|
*/
|
27
|
@Autowired
|
28
|
private transient ResourceStateSubscriptionDAO dao;
|
29
|
|
30
|
/**
|
31
|
* cleanup db. hsql doesn't recreate the database on spring context reload.
|
32
|
*/
|
33
|
@After
|
34
|
public void tearDown() {
|
35
|
final Collection<ResourceStateSubscription> subs = dao.listSubscriptions();
|
36
|
if (subs != null)
|
37
|
for (ResourceStateSubscription r : subs)
|
38
|
dao.removeSubscription(r.getSubscriptionId());
|
39
|
}
|
40
|
|
41
|
/**
|
42
|
* {@inheritDoc}
|
43
|
*
|
44
|
* @see eu.dnetlib.enabling.is.sn.resourcestate.AbstractResourceStateSubscriptionRegistryTest#setUpDao()
|
45
|
*/
|
46
|
@Override
|
47
|
protected void setUpDao() {
|
48
|
getRegistry().setSubscriptionDao(dao);
|
49
|
}
|
50
|
|
51
|
}
|