Project

General

Profile

« Previous | Next » 

Revision f528c666

Added by Andreas Kohlbecker almost 6 years ago

ref #7648 free configurable TaxonGraphHibernateListener ready

View differences:

cdmlib-services/src/test/java/eu/etaxonomy/cdm/api/service/taxonGraph/TaxonGraphHibernateListenerTest.java
23 23
import org.unitils.dbunit.annotation.DataSet;
24 24
import org.unitils.spring.annotation.SpringBeanByType;
25 25

  
26
import eu.etaxonomy.cdm.api.application.IRunAs;
27
import eu.etaxonomy.cdm.api.application.RunAsAdmin;
26 28
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
27 29
import eu.etaxonomy.cdm.model.metadata.CdmPreference.PrefKey;
28 30
import eu.etaxonomy.cdm.model.name.Rank;
......
86 88
    private static TaxonGraphHibernateListener taxonGraphHibernateListener = new TaxonGraphHibernateListener();
87 89

  
88 90
    @Before
89
    public void registerListener() {
91
    public void registerListener() throws NoSuchMethodException, SecurityException {
90 92

  
91 93
        if(!TaxonGraphHibernateListenerTest.isRegistered){
92 94
            EventListenerRegistry listenerRegistry = ((SessionFactoryImpl) sessionFactory).getServiceRegistry().getService(EventListenerRegistry.class);
......
94 96
            listenerRegistry.appendListeners(EventType.POST_INSERT, taxonGraphHibernateListener);
95 97
            TaxonGraphHibernateListenerTest.isRegistered = true;
96 98
        }
97
        taxonGraphHibernateListener.registerProcessClass(TaxonGraphBeforeTransactionCompleteProcess.class);
99
        //
100
        taxonGraphHibernateListener.registerProcessClass(TaxonGraphBeforeTransactionCompleteProcess.class, new Object[]{new RunAsAdmin()}, new Class[]{IRunAs.class});
98 101
    }
99 102

  
100 103

  
......
113 116
    }
114 117

  
115 118
    @Test
116
    @DataSet(loadStrategy=CleanSweepInsertLoadStrategy.class, value="xml")
119
    @DataSet(loadStrategy=CleanSweepInsertLoadStrategy.class, value="TaxonGraphTest.xml")
117 120
    public void testNewTaxonName() throws TaxonGraphException{
118 121

  
119 122
        try{
......
139 142
    }
140 143

  
141 144
    @Test
142
    @DataSet(loadStrategy=CleanSweepInsertLoadStrategy.class, value="xml")
145
    @DataSet(loadStrategy=CleanSweepInsertLoadStrategy.class, value="TaxonGraphTest.xml")
143 146
    public void testNewGenusName() throws TaxonGraphException{
144 147

  
145 148
        try{
......
165 168
    }
166 169

  
167 170
    @Test
168
    @DataSet(loadStrategy=CleanSweepInsertLoadStrategy.class, value="xml")
171
    @DataSet(loadStrategy=CleanSweepInsertLoadStrategy.class, value="TaxonGraphTest.xml")
169 172
    public void testChangeNomRef() throws TaxonGraphException{
170 173
        try {
171 174
            setUuidPref();
......
181 184

  
182 185
            // printDataSet(System.err,"TaxonRelationship");
183 186

  
184
            List<TaxonGraphEdgeDTO> edges = taxonGraphDao.edges(n_trachelomonas_a, nameDao.load(uuid_n_trachelomonas), true);
187
            List<TaxonGraphEdgeDTO> edges = taxonGraphDao.edges(nameDao.load(uuid_n_trachelomonas_a), nameDao.load(uuid_n_trachelomonas), true);
185 188
            Assert.assertEquals(1, edges.size());
186 189
            Assert.assertEquals(refX.getUuid(), edges.get(0).getCitationUuid());
187 190

  
......
191 194
    }
192 195

  
193 196
    @Test
194
    @DataSet(loadStrategy=CleanSweepInsertLoadStrategy.class, value="xml")
197
    @DataSet(loadStrategy=CleanSweepInsertLoadStrategy.class, value="TaxonGraphTest.xml")
195 198
    public void testChangeRank() throws TaxonGraphException{
196 199

  
197 200
        try {
......
218 221
    }
219 222

  
220 223
    @Test
221
    @DataSet(loadStrategy=CleanSweepInsertLoadStrategy.class, value="xml")
224
    @DataSet(loadStrategy=CleanSweepInsertLoadStrategy.class, value="TaxonGraphTest.xml")
222 225
    public void testChangeGenus() throws TaxonGraphException{
223 226

  
224 227
        try {
......
251 254
    }
252 255

  
253 256
    @Test
254
    @DataSet(loadStrategy=CleanSweepInsertLoadStrategy.class, value="xml")
257
    @DataSet(loadStrategy=CleanSweepInsertLoadStrategy.class, value="TaxonGraphTest.xml")
255 258
    public void testChangeSpecificEpithet_of_InfraSpecific() throws TaxonGraphException{
256 259

  
257 260
        try {
......
282 285
    }
283 286

  
284 287
    @Test
285
    @DataSet(loadStrategy=CleanSweepInsertLoadStrategy.class, value="xml")
288
    @DataSet(loadStrategy=CleanSweepInsertLoadStrategy.class, value="TaxonGraphTest.xml")
286 289
    public void testChangeSpecificEpithet_of_Species() throws TaxonGraphException{
287 290

  
288 291
        try {

Also available in: Unified diff