Revision 379eb203
Added by Andreas Müller over 3 years ago
cdmlib-persistence/src/test/java/eu/etaxonomy/cdm/persistence/dao/hibernate/common/CdmEntityDaoBaseTest.java | ||
---|---|---|
88 | 88 |
|
89 | 89 |
/************ TESTS ********************************/ |
90 | 90 |
|
91 |
|
|
92 |
/** |
|
93 |
* Test method for {@link eu.etaxonomy.cdm.persistence.dao.hibernate.common.CdmEntityDaoBase#CdmEntityDaoBase(java.lang.Class)}. |
|
94 |
* @throws Exception |
|
95 |
*/ |
|
96 | 91 |
@Test |
97 | 92 |
public void testCdmEntityDaoBase() throws Exception { |
98 | 93 |
assertNotNull("cdmEntityDaoBase should exist",cdmEntityDaoBase); |
99 | 94 |
} |
100 | 95 |
|
101 |
/** |
|
102 |
* Test method for {@link eu.etaxonomy.cdm.persistence.dao.hibernate.common.CdmEntityDaoBase#saveOrUpdate(eu.etaxonomy.cdm.model.common.CdmBase)}. |
|
103 |
*/ |
|
104 | 96 |
@Test |
105 | 97 |
@DataSet("CdmEntityDaoBaseTest.xml") |
106 | 98 |
@ExpectedDataSet |
... | ... | |
111 | 103 |
commit(); |
112 | 104 |
} |
113 | 105 |
|
114 |
/** |
|
115 |
* Test method for {@link eu.etaxonomy.cdm.persistence.dao.hibernate.common.CdmEntityDaoBase#saveOrUpdate(eu.etaxonomy.cdm.model.common.CdmBase)}. |
|
116 |
*/ |
|
117 | 106 |
@Test |
118 | 107 |
@DataSet("CdmEntityDaoBaseTest.xml") |
119 | 108 |
@ExpectedDataSet |
... | ... | |
126 | 115 |
commit(); |
127 | 116 |
} |
128 | 117 |
|
129 |
/** |
|
130 |
* Test method for {@link eu.etaxonomy.cdm.persistence.dao.hibernate.common.CdmEntityDaoBase#saveOrUpdate(eu.etaxonomy.cdm.model.common.CdmBase)}. |
|
131 |
*/ |
|
132 | 118 |
@Test |
133 | 119 |
@DataSet("CdmEntityDaoBaseTest.xml") |
134 | 120 |
@ExpectedDataSet |
... | ... | |
168 | 154 |
endTransaction(); |
169 | 155 |
startNewTransaction(); |
170 | 156 |
} |
171 |
|
|
172 | 157 |
} |
173 |
/** |
|
174 |
* Test method for {@link eu.etaxonomy.cdm.persistence.dao.hibernate.common.CdmEntityDaoBase#save(eu.etaxonomy.cdm.model.common.CdmBase)}. |
|
175 |
*/ |
|
158 |
|
|
176 | 159 |
@Test |
177 | 160 |
@DataSet("CdmEntityDaoBaseTest.xml") |
178 | 161 |
@ExpectedDataSet |
... | ... | |
181 | 164 |
commit(); |
182 | 165 |
} |
183 | 166 |
|
184 |
|
|
185 |
/** |
|
186 |
* Test method for {@link eu.etaxonomy.cdm.persistence.dao.hibernate.common.CdmEntityDaoBase#save(eu.etaxonomy.cdm.model.common.CdmBase)}. |
|
187 |
*/ |
|
188 | 167 |
@Test |
189 | 168 |
@DataSet("CdmEntityDaoBaseTest.xml") |
190 | 169 |
public void testSaveWithAuthenticationFailedPermissionEvaluation() throws Exception { |
... | ... | |
203 | 182 |
startNewTransaction(); |
204 | 183 |
} |
205 | 184 |
Assert.assertNotNull("evaluation must fail since the user has no permission", securityException); |
206 |
|
|
207 | 185 |
} |
208 | 186 |
|
209 |
/** |
|
210 |
* Test method for {@link eu.etaxonomy.cdm.persistence.dao.hibernate.common.CdmEntityDaoBase#save(eu.etaxonomy.cdm.model.common.CdmBase)}. |
|
211 |
*/ |
|
212 | 187 |
@Test |
213 | 188 |
@DataSet("CdmEntityDaoBaseTest.xml") |
214 | 189 |
@ExpectedDataSet |
... | ... | |
230 | 205 |
Assert.assertNull("evaluation must not fail since the user is permitted, CAUSE :" + (securityException != null ? securityException.getMessage() : ""), securityException); |
231 | 206 |
} |
232 | 207 |
|
233 |
/** |
|
234 |
* Test method for {@link eu.etaxonomy.cdm.persistence.dao.hibernate.common.CdmEntityDaoBase#update(eu.etaxonomy.cdm.model.common.CdmBase)}. |
|
235 |
*/ |
|
236 | 208 |
@Test |
237 | 209 |
@DataSet("CdmEntityDaoBaseTest.xml") |
238 | 210 |
@ExpectedDataSet |
... | ... | |
265 | 237 |
startNewTransaction(); |
266 | 238 |
} |
267 | 239 |
Assert.assertNull("evaluation must not fail since the user is permitted, CAUSE :" + (securityException != null ? securityException.getMessage() : ""), securityException); |
268 |
|
|
269 | 240 |
} |
270 | 241 |
|
271 |
/** |
|
272 |
* Test method for {@link eu.etaxonomy.cdm.persistence.dao.hibernate.common.CdmEntityDaoBase#findById(int)}. |
|
273 |
*/ |
|
274 | 242 |
@Test |
275 | 243 |
@DataSet("CdmEntityDaoBaseTest.xml") |
276 | 244 |
public void testFindById() { |
... | ... | |
278 | 246 |
assertNotNull("There should be an entity with an id of 1",cdmBase); |
279 | 247 |
} |
280 | 248 |
|
281 |
/** |
|
282 |
* Test method for {@link eu.etaxonomy.cdm.persistence.dao.hibernate.common.CdmEntityDaoBase#findByUuid(java.util.UUID)}. |
|
283 |
*/ |
|
284 | 249 |
@Test |
285 | 250 |
@DataSet("CdmEntityDaoBaseTest.xml") |
286 | 251 |
public void testFindByUuid() { |
... | ... | |
288 | 253 |
assertNotNull("testFindByUuid() an entity with a uuid of " + uuid.toString(),cdmBase); |
289 | 254 |
} |
290 | 255 |
|
291 |
/** |
|
292 |
* Test method for {@link eu.etaxonomy.cdm.persistence.dao.hibernate.common.CdmEntityDaoBase#exists(java.util.UUID)}. |
|
293 |
*/ |
|
294 | 256 |
@Test |
295 | 257 |
@DataSet("CdmEntityDaoBaseTest.xml") |
296 | 258 |
public void testExists() { |
... | ... | |
300 | 262 |
assertFalse("exists() should return false for any other uuid", existsRandom); |
301 | 263 |
} |
302 | 264 |
|
303 |
/** |
|
304 |
* Test method for {@link eu.etaxonomy.cdm.persistence.dao.hibernate.common.CdmEntityDaoBase#list(int, int)}. |
|
305 |
*/ |
|
306 | 265 |
@Test |
307 | 266 |
@DataSet("CdmEntityDaoBaseTest.xml") |
308 | 267 |
public void testList() { |
... | ... | |
311 | 270 |
assertEquals("list() should return a list with two entities in it",list.size(),2); |
312 | 271 |
} |
313 | 272 |
|
314 |
/** |
|
315 |
* Test method for {@link eu.etaxonomy.cdm.persistence.dao.hibernate.common.CdmEntityDaoBase#list(Class, Integer, Integer, List, List)}. |
|
316 |
*/ |
|
317 | 273 |
@Test |
318 | 274 |
@DataSet("CdmEntityDaoBaseTest.xml") |
319 | 275 |
public void testRandomOrder() { |
... | ... | |
324 | 280 |
assertEquals("list() should return a list with two entities in it", list.size(), 2); |
325 | 281 |
} |
326 | 282 |
|
327 |
/** |
|
328 |
* Test method for {@link eu.etaxonomy.cdm.persistence.dao.hibernate.common.CdmEntityDaoBase#list(java.util.Collection, Integer, Integer, List, List)}. |
|
329 |
*/ |
|
330 | 283 |
@Test |
331 | 284 |
@DataSet("CdmEntityDaoBaseTest.xml") |
332 | 285 |
public void testListByUuids() { |
... | ... | |
338 | 291 |
assertEquals("list() should return a list with two entities in it",list.size(),2); |
339 | 292 |
} |
340 | 293 |
|
341 |
/** |
|
342 |
* Test method for {@link eu.etaxonomy.cdm.persistence.dao.hibernate.common.CdmEntityDaoBase#loadList(java.util.Collection, List)}. |
|
343 |
*/ |
|
344 | 294 |
@Test |
345 | 295 |
@DataSet("CdmEntityDaoBaseTest.xml") |
346 | 296 |
public void testListByIds() { |
... | ... | |
352 | 302 |
assertEquals("list() should return a list with two entities in it",2,list.size()); |
353 | 303 |
} |
354 | 304 |
|
355 |
/** |
|
356 |
* Test method for {@link eu.etaxonomy.cdm.persistence.dao.hibernate.common.CdmEntityDaoBase#delete(eu.etaxonomy.cdm.model.common.CdmBase)}. |
|
357 |
*/ |
|
358 | 305 |
@Test |
359 | 306 |
@DataSet("CdmEntityDaoBaseTest.xml") |
360 | 307 |
@ExpectedDataSet |
Also available in: Unified diff
cleanup