Changeset 3477 for DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/dao/impl/DBIntegrityServiceTest.java
- Timestamp:
- 08/26/13 15:41:57 (11 years ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/dao/impl/DBIntegrityServiceTest.java
r3455 r3477 61 61 "/spring-test-config/mockUserDao.xml", "/spring-test-config/mockNotebookDao.xml", 62 62 "/spring-test-config/mockSourceDao.xml", "/spring-test-config/mockVersionDao.xml", "/spring-test-config/mockCachedRepresentationDao.xml", 63 "/spring-config/d aoDispatcher.xml"})64 public class D aoDispatcherTest {65 66 @Autowired 67 private D aoDispatcherImpl daoDispatcher;63 "/spring-config/dbIntegrityService.xml"}) 64 public class DBIntegrityServiceTest { 65 66 @Autowired 67 private DBIntegrityServiceImlp dbIntegrityService; 68 68 @Autowired 69 69 private Mockery mockery; … … 82 82 TestInstances testInstances = new TestInstances(); 83 83 84 public D aoDispatcherTest() {84 public DBIntegrityServiceTest() { 85 85 } 86 86 87 87 ///////// GETTERS ///////////// 88 88 /** 89 * Test of getAnnotationInternalIdentifier method, of class D aoDispatcherImpl.89 * Test of getAnnotationInternalIdentifier method, of class DBIntegrityServiceImlp. 90 90 */ 91 91 @Test … … 100 100 } 101 101 }); 102 assertEquals(2, d aoDispatcher.getAnnotationInternalIdentifier(externalID));103 } 104 105 /** 106 * Test of getAnnotationExternalIdentifier method, of class D aoDispatcherImpl.102 assertEquals(2, dbIntegrityService.getAnnotationInternalIdentifier(externalID)); 103 } 104 105 /** 106 * Test of getAnnotationExternalIdentifier method, of class DBIntegrityServiceImlp. 107 107 */ 108 108 @Test … … 117 117 } 118 118 }); 119 assertEquals(TestBackendConstants._TEST_ANNOT_2_EXT, d aoDispatcher.getAnnotationExternalIdentifier(2).toString());120 } 121 122 /** 123 * Test of getUserInternalIdentifier method, of class D aoDispatcherImpl.119 assertEquals(TestBackendConstants._TEST_ANNOT_2_EXT, dbIntegrityService.getAnnotationExternalIdentifier(2).toString()); 120 } 121 122 /** 123 * Test of getUserInternalIdentifier method, of class DBIntegrityServiceImlp. 124 124 */ 125 125 @Test … … 135 135 } 136 136 }); 137 assertEquals(5, d aoDispatcher.getUserInternalIdentifier(externalID));138 } 139 140 /** 141 * Test of getUserExternalIdentifier method, of class D aoDispatcherImpl.137 assertEquals(5, dbIntegrityService.getUserInternalIdentifier(externalID)); 138 } 139 140 /** 141 * Test of getUserExternalIdentifier method, of class DBIntegrityServiceImlp. 142 142 */ 143 143 @Test … … 152 152 } 153 153 }); 154 assertEquals(TestBackendConstants._TEST_USER_5_EXT_ID, d aoDispatcher.getUserExternalIdentifier(5).toString());155 } 156 157 /** 158 * Test of getAnnotation method, of class D aoDispatcherImpl.154 assertEquals(TestBackendConstants._TEST_USER_5_EXT_ID, dbIntegrityService.getUserExternalIdentifier(5).toString()); 155 } 156 157 /** 158 * Test of getAnnotation method, of class DBIntegrityServiceImlp. 159 159 */ 160 160 @Test … … 210 210 }); 211 211 212 Annotation result = d aoDispatcher.getAnnotation(1);212 Annotation result = dbIntegrityService.getAnnotation(1); 213 213 assertEquals(TestBackendConstants._TEST_ANNOT_2_EXT, result.getURI()); 214 214 assertEquals(TestBackendConstants._TEST_ANNOT_2_BODY, result.getBody().getAny().get(0)); … … 225 225 226 226 /** 227 * Test of getFilteredAnnotationIDs method, of class D aoDispatcherImpl.227 * Test of getFilteredAnnotationIDs method, of class DBIntegrityServiceImlp. 228 228 */ 229 229 @Test … … 269 269 270 270 271 List result = d aoDispatcher.getFilteredAnnotationIDs(link, text, access, namespace, owner, after, before);271 List result = dbIntegrityService.getFilteredAnnotationIDs(link, text, access, namespace, owner, after, before); 272 272 assertEquals(1, result.size()); 273 273 assertEquals(2, result.get(0)); … … 276 276 ////////////// ADDERS ///////////////////////// 277 277 /** 278 * Test of addCachedForVersion method, of class D aoDispatcherImpl.278 * Test of addCachedForVersion method, of class DBIntegrityServiceImlp. 279 279 */ 280 280 @Test … … 305 305 306 306 307 Number[] result = d aoDispatcher.addCachedForVersion(versionID, newCached);307 Number[] result = dbIntegrityService.addCachedForVersion(versionID, newCached); 308 308 assertEquals(2, result.length); 309 309 assertEquals(1, result[0]); … … 312 312 313 313 /** 314 * Test of addSiblingVersionForSource method, of class D aoDispatcherImpl.314 * Test of addSiblingVersionForSource method, of class DBIntegrityServiceImlp. 315 315 */ 316 316 @Test … … 337 337 }); 338 338 339 Number[] result = d aoDispatcher.addSiblingVersionForSource(1, mockVersion);339 Number[] result = dbIntegrityService.addSiblingVersionForSource(1, mockVersion); 340 340 assertEquals(2, result.length); 341 341 assertEquals(1, result[0]); … … 358 358 } 359 359 }); 360 Number[] resultTwo = d aoDispatcher.addSiblingVersionForSource(1, mockVersionTwo);360 Number[] resultTwo = dbIntegrityService.addSiblingVersionForSource(1, mockVersionTwo); 361 361 assertEquals(2, resultTwo.length); 362 362 assertEquals(1, resultTwo[0]); … … 365 365 366 366 /** 367 * Test of addSourcesForAnnotation method, of class D aoDispatcherImpl.367 * Test of addSourcesForAnnotation method, of class DBIntegrityServiceImlp. 368 368 */ 369 369 @Test … … 392 392 }); 393 393 394 Map<String, String> result = d aoDispatcher.addSourcesForAnnotation(1, mockSourceSOne);394 Map<String, String> result = dbIntegrityService.addSourcesForAnnotation(1, mockSourceSOne); 395 395 assertEquals(0, result.size()); 396 396 … … 405 405 mockSourceSTwo.add(testSourceTwo); 406 406 407 // final Source mockNewSource = d aoDispatcher.createSource(testNewSource);408 // final Version mockNewVersion = d aoDispatcher.createVersion(testNewSource);407 // final Source mockNewSource = dbIntegrityService.createSource(testNewSource); 408 // final Version mockNewVersion = dbIntegrityService.createVersion(testNewSource); 409 409 410 410 mockery.checking(new Expectations() { … … 432 432 }); 433 433 434 Map<String, String> resultTwo = d aoDispatcher.addSourcesForAnnotation(1, mockSourceSTwo);434 Map<String, String> resultTwo = dbIntegrityService.addSourcesForAnnotation(1, mockSourceSTwo); 435 435 assertEquals(1, resultTwo.size()); 436 436 assertFalse(null == resultTwo.get(testNewSource.getId())); … … 439 439 440 440 /** 441 * Test of addUsersAnnotation method, of class D aoDispatcherImpl.441 * Test of addUsersAnnotation method, of class DBIntegrityServiceImlp. 442 442 */ 443 443 @Test … … 470 470 }); 471 471 472 Number result = d aoDispatcher.addUsersAnnotation(testAnnotation, 5);472 Number result = dbIntegrityService.addUsersAnnotation(testAnnotation, 5); 473 473 assertEquals(6, result); 474 474 } … … 476 476 //////////////////// DELETERS //////////////// 477 477 /** 478 * Test of deleteCachedForVersion method, of class D aoDispatcherImpl.478 * Test of deleteCachedForVersion method, of class DBIntegrityServiceImlp. 479 479 */ 480 480 @Test … … 492 492 }); 493 493 494 int[] result = d aoDispatcher.deleteCachedOfVersion(6, 5);494 int[] result = dbIntegrityService.deleteCachedOfVersion(6, 5); 495 495 assertEquals(2, result.length); 496 496 assertEquals(1, result[0]); … … 524 524 }); 525 525 526 int[] result = d aoDispatcher.deleteAllCachedOfVersion(6);526 int[] result = dbIntegrityService.deleteAllCachedOfVersion(6); 527 527 assertEquals(1, result[0]); //version 528 528 assertEquals(1, result[1]); // versions-cached … … 540 540 541 541 542 int[] resultTwo = d aoDispatcher.deleteAllCachedOfVersion(5); // version is in use by the source 4542 int[] resultTwo = dbIntegrityService.deleteAllCachedOfVersion(5); // version is in use by the source 4 543 543 assertEquals(0, resultTwo[0]); 544 544 assertEquals(0, resultTwo[1]); … … 557 557 }); 558 558 559 int[] result = d aoDispatcher.deleteAllVersionsOfSource(1); //the source is in use, should not be deleted559 int[] result = dbIntegrityService.deleteAllVersionsOfSource(1); //the source is in use, should not be deleted 560 560 assertEquals(0, result[0]); // 561 561 assertEquals(0, result[1]); … … 592 592 593 593 594 int[] resultTwo = d aoDispatcher.deleteAllVersionsOfSource(5);// the source will be deleted because it is not referred by any annotation594 int[] resultTwo = dbIntegrityService.deleteAllVersionsOfSource(5);// the source will be deleted because it is not referred by any annotation 595 595 assertEquals(3, resultTwo.length); 596 596 assertEquals(1, resultTwo[0]); // source 7 is deleted … … 600 600 601 601 /** 602 * Test of deleteAnnotationWithSources method, of class D aoDispatcherImpl.602 * Test of deleteAnnotationWithSources method, of class DBIntegrityServiceImlp. 603 603 */ 604 604 @Test … … 628 628 } 629 629 }); 630 int[] result = d aoDispatcher.deleteAnnotation(3);// the source will be deleted because it is not referred by any annotation630 int[] result = dbIntegrityService.deleteAnnotation(3);// the source will be deleted because it is not referred by any annotation 631 631 assertEquals(4, result.length); 632 632 assertEquals(1, result[0]); // annotation 3 is deleted … … 643 643 // newSourceInfo.setVersion(null); 644 644 // 645 // Source result = d aoDispatcher.createSource(newSourceInfo);645 // Source result = dbIntegrityService.createSource(newSourceInfo); 646 646 // assertEquals(TestBackendConstants._TEST_NEW_SOURCE_LINK, result.getLink()); 647 647 // assertFalse(null == result.getURI()); … … 655 655 // newSourceInfo.setVersion(null); 656 656 // 657 // Version result = d aoDispatcher.createVersion(newSourceInfo);657 // Version result = dbIntegrityService.createVersion(newSourceInfo); 658 658 // assertFalse(null == result.getVersion()); // will be chnaged once the schema for version is fixed: ID is added 659 659 //
Note: See TracChangeset
for help on using the changeset viewer.