Changeset 4461
- Timestamp:
- 02/06/14 12:21:44 (10 years ago)
- Location:
- DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/dao/impl/JdbcUserDao.java
r4281 r4461 116 116 String emailCriterion = user.getEMail().toLowerCase(); 117 117 StringBuilder sqlTargets = new StringBuilder("SELECT "); 118 sqlTargets.append(principal_id).append(" FROM ").append(principalTableName).append(" WHERE ").append( e_mail).append("= ? LIMIT 1");118 sqlTargets.append(principal_id).append(" FROM ").append(principalTableName).append(" WHERE ").append("LOWER(").append(e_mail).append(")= ? LIMIT 1"); 119 119 List<Number> resultTargets = getSimpleJdbcTemplate().query(sqlTargets.toString(), principalIDRowMapper, emailCriterion); 120 120 if (resultTargets.size() > 0) { -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/sql/DashishAnnotatorCreate.sql
r4429 r4461 52 52 external_id text UNIQUE NOT NULL, 53 53 owner_id integer REFERENCES principal(principal_id), 54 last_modified timestamp default current_timestamp AT TIME ZONE 'UTC',54 last_modified timestamp default (current_timestamp AT TIME ZONE 'UTC'), 55 55 title text 56 56 ); … … 61 61 external_id text UNIQUE NOT NULL, 62 62 owner_id integer REFERENCES principal(principal_id), 63 last_modified timestamp default current_timestamp AT TIME ZONE 'UTC',63 last_modified timestamp default (current_timestamp AT TIME ZONE 'UTC'), 64 64 headline text, 65 65 body_text text, … … 73 73 target_id SERIAL UNIQUE NOT NULL, 74 74 external_id text UNIQUE NOT NULL, 75 last_modified timestamp default current_timestamp AT TIME ZONE 'UTC',75 last_modified timestamp default (current_timestamp AT TIME ZONE 'UTC'), 76 76 link_uri text, 77 77 version text, … … 85 85 tool text, 86 86 type_ text, 87 file_ b lob87 file_ bytea 88 88 ); 89 89 -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/TestBackendConstants.java
r4181 r4461 25 25 public class TestBackendConstants { 26 26 27 public static final String _TEST_NOTEBOOK_1_EXT_ID ="00000000-0000-0000-0000-000000000001";28 public static final String _TEST_NOTEBOOK_2_EXT_ID ="00000000-0000-0000-0000-000000000002";29 public static final String _TEST_UID_1_ = "00000000-0000-0000-0000-000000000003";30 public static final String _TEST_UID_2_ = "00000000-0000-0000-0000-000000000004";31 public static final String _TEST_AID_1_ = "00000000-0000-0000-0000-000000000005";32 public static final String _TEST_NULL_UUID_ = "00000000-0000-0000-0000-000000000006";33 34 // testing jdbcAnnotationDao35 public static final String _TEST_NOTEBOOK_3_EXT = "00000000-0000-0000-0000-000000000011";36 public static final String _TEST_NOTEBOOK_4_EXT = "00000000-0000-0000-0000-000000000012";37 public static final String _TEST_NOTEBOOK_5_EXT = "00000000-0000-0000-0000-000000000013";38 39 public static final String _TEST_NOTEBOOK_3_TITLE = "Notebook 3";40 public static final String _TEST_NOTEBOOK_4_TITLE = "Notebook 4";41 public static final String _TEST_NOTEBOOK_5_TITLE = "Notebook 5";42 43 public static final String _TEST_ANNOT_2_EXT = "00000000-0000-0000-0000-000000000021";44 public static final String _TEST_ANNOT_3_EXT = "00000000-0000-0000-0000-000000000022";45 public static final String _TEST_ANNOT_4_EXT = "00000000-0000-0000-0000-000000000023";46 public static final String _TEST_ANNOT_5_EXT = "00000000-0000-0000-0000-000000000024";47 public static final String _TEST_ANNOT_7_EXT_NOT_IN_DB = "00000000-0000-0000-0000-000000000026";48 49 public static final String _TEST_ANNOT_2_HEADLINE = "Sagrada Famiglia";50 public static final String _TEST_ANNOT_3_HEADLINE = "Gaudi";51 public static final String _TEST_ANNOT_4_HEADLINE = "Art Nuveau";52 public static final String _TEST_ANNOT_TO_ADD_HEADLINE = "Annotation to add to test DAO";53 54 public static final String _TEST_BODY_MIMETYPE_HTML = "text/html";55 public static final String _TEST_BODY_MIMETYPE_TEXT = "text/plain";56 57 public static final int _TEST_ANNOT_2_OWNER = 3;58 public static final int _TEST_ANNOT_3_OWNER = 4;59 public static final int _TEST_ANNOT_4_OWNER = 5;60 61 public static final String _TEST_ANNOT_2_BODY = "<html><body>some html 1</body></html>";62 public static final String _TEST_ANNOT_TO_ADD_BODY = "<html><body>the stuff to be added</body></html>";63 64 public static final String _TEST_ANNOT_2_TIME_STAMP = "2013-08-12T09:25:00.383000Z";65 66 public static final String annotaiontoDeleteInDB="INSERT INTO annotation (annotation_id, owner_id,headline,body_text, body_mimetype, external_id) VALUES (25, 111, 'Annotation to delete','<html><body>some html 4</body></html>', 'text/html', 00000000-0000-0000-0000-000000000025');";67 68 public static final String _TEST_USER_3_EXT_ID = "00000000-0000-0000-0000-000000000111";69 public static final String _TEST_USER_4_EXT_ID = "00000000-0000-0000-0000-000000000112";70 public static final String _TEST_USER_5_EXT_ID = "00000000-0000-0000-0000-000000000113";71 72 public static final String _TEST_USER_XXX_EXT_ID = "00000000-0000-0000-0000-000000000666";73 74 75 public static final String _TEST_Target_1_EXT_ID = "00000000-0000-0000-0000-000000000031";76 public static final String _TEST_Target_2_EXT_ID = "00000000-0000-0000-0000-000000000032";77 78 public static final String _TEST_Target_1_LINK = "http://nl.wikipedia.org/wiki/Sagrada_Fam%C3%ADlia";79 public static final String _TEST_Target_2_LINK = "http://nl.wikipedia.org/wiki/Antoni_Gaud%C3%AD";80 81 public static final String _TEST_Target_1_FRAGMENT = "de_Opdracht";82 83 84 public static final String _TEST_Target_1_VERSION = "version 1.0";85 public static final String _TEST_Target_2_VERSION = "version 1.0";86 87 public static final String _TEST_CACHED_REPRESENTATION_1_EXT_ID_ = "00000000-0000-0000-0000-000000000051";88 public static final String _TEST_CACHED_REPRESENTATION_1_MIME_TYPE_ = "text/html";89 public static final String _TEST_CACHED_REPRESENTATION_1_TOOL_ = "latex";90 public static final String _TEST_CACHED_REPRESENTATION_1_TYPE_ = "text";91 public static final int _TEST_CACHED_REPRESENTATION_1_BLOB_BYTE_1 = 16;92 public static final int _TEST_CACHED_REPRESENTATION_1_BLOB_BYTE_2 = 1;93 94 95 public static final String _TEST_TEMP_Target_ID = "Barcelona-1";96 public static final String _TEST_ANNOT_TO_ADD_NEW_Target_BODY = "refers to "+_TEST_TEMP_Target_ID;97 public static final String _TEST_ANNOT_TO_ADD_NEW_Target_HEADLINE = "SF in Catalan";98 public static final String _TEST_NEW_Target_LINK = "http://www.sagradafamilia.cat/docs_instit/historia.php ";99 100 27 public static final String _TEST_SERVLET_URI = "http://localhost:8080/annotator-backend/api/"; 101 28 public static final String _TEST_SERVLET_URI_annotations = "http://localhost:8080/annotator-backend/api/annotations/"; -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/TestInstances.java
r4276 r4461 42 42 43 43 private Annotation makeAnnotationOne(String baseURI){ 44 Annotation result = makeAnnotation(baseURI, TestBackendConstants._TEST_ANNOT_2_BODY, TestBackendConstants._TEST_BODY_MIMETYPE_HTML, TestBackendConstants._TEST_ANNOT_2_HEADLINE, TestBackendConstants._TEST_USER_3_EXT_ID);44 Annotation result = makeAnnotation(baseURI, "<html><body>some html 1</body></html>", "text/html", "Sagrada Famiglia", "00000000-0000-0000-0000-000000000111"); 45 45 try { 46 result.setLastModified(DatatypeFactory.newInstance().newXMLGregorianCalendar( TestBackendConstants._TEST_ANNOT_2_TIME_STAMP));46 result.setLastModified(DatatypeFactory.newInstance().newXMLGregorianCalendar("2013-08-12T09:25:00.383000Z")); 47 47 } catch (DatatypeConfigurationException dce) { 48 System.out.println("wrongly-formatted test timestamp "+ TestBackendConstants._TEST_ANNOT_2_TIME_STAMP);48 System.out.println("wrongly-formatted test timestamp "+"2013-08-12T09:25:00.383000Z"); 49 49 result.setLastModified(null); 50 50 } … … 53 53 54 54 private Annotation makeAnnotationToAdd(String baseURI){ 55 Annotation result = makeAnnotation(baseURI, TestBackendConstants._TEST_ANNOT_TO_ADD_BODY, TestBackendConstants._TEST_BODY_MIMETYPE_TEXT, TestBackendConstants._TEST_ANNOT_TO_ADD_HEADLINE, TestBackendConstants._TEST_USER_3_EXT_ID);55 Annotation result = makeAnnotation(baseURI, "<html><body>some html 1</body></html>", "text/plain", "Annotation to add to test DAO", "00000000-0000-0000-0000-000000000111"); 56 56 57 57 TargetInfo TargetInfo = new TargetInfo(); 58 TargetInfo.setLink( TestBackendConstants._TEST_Target_1_LINK);59 TargetInfo.setRef( TestBackendConstants._TEST_Target_1_EXT_ID);60 TargetInfo.setVersion( TestBackendConstants._TEST_Target_1_VERSION);58 TargetInfo.setLink("http://nl.wikipedia.org/wiki/Sagrada_Fam%C3%ADlia"); 59 TargetInfo.setRef("00000000-0000-0000-0000-000000000031"); 60 TargetInfo.setVersion("version 1.0"); 61 61 62 62 TargetInfoList targetInfos = new TargetInfoList(); -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/dao/impl/DBIntegrityServiceTest.java
r4429 r4461 91 91 public void testGetAnnotationInternalIdentifier() { 92 92 System.out.println("getAnnotationInternalIdentifier"); 93 final UUID externalID = UUID.fromString( TestBackendConstants._TEST_ANNOT_2_EXT);93 final UUID externalID = UUID.fromString("00000000-0000-0000-0000-000000000021"); 94 94 95 95 mockeryDao.checking(new Expectations() { 96 96 { 97 97 oneOf(annotationDao).getInternalID(externalID); 98 will(returnValue( 2));99 } 100 }); 101 assertEquals( 2, dbIntegrityService.getAnnotationInternalIdentifier(externalID));98 will(returnValue(1)); 99 } 100 }); 101 assertEquals(1, dbIntegrityService.getAnnotationInternalIdentifier(externalID)); 102 102 } 103 103 … … 110 110 public void testGetAnnotationExternalIdentifier() { 111 111 System.out.println("getAnnotationExternalIdentifier"); 112 final UUID externalID = UUID.fromString( TestBackendConstants._TEST_ANNOT_2_EXT);113 114 mockeryDao.checking(new Expectations() { 115 { 116 oneOf(annotationDao).getExternalID( 2);112 final UUID externalID = UUID.fromString("00000000-0000-0000-0000-000000000021"); 113 114 mockeryDao.checking(new Expectations() { 115 { 116 oneOf(annotationDao).getExternalID(1); 117 117 will(returnValue(externalID)); 118 118 } 119 119 }); 120 assertEquals( TestBackendConstants._TEST_ANNOT_2_EXT, dbIntegrityService.getAnnotationExternalIdentifier(2).toString());120 assertEquals("00000000-0000-0000-0000-000000000021", dbIntegrityService.getAnnotationExternalIdentifier(1).toString()); 121 121 } 122 122 … … 130 130 System.out.println("getUserInternalIdentifier"); 131 131 132 final UUID externalID = UUID.fromString( TestBackendConstants._TEST_USER_5_EXT_ID);132 final UUID externalID = UUID.fromString("00000000-0000-0000-0000-000000000111"); 133 133 134 134 mockeryDao.checking(new Expectations() { 135 135 { 136 136 oneOf(userDao).getInternalID(externalID); 137 will(returnValue( 5));138 } 139 }); 140 assertEquals( 5, dbIntegrityService.getUserInternalIdentifier(externalID));137 will(returnValue(1)); 138 } 139 }); 140 assertEquals(1, dbIntegrityService.getUserInternalIdentifier(externalID)); 141 141 } 142 142 … … 149 149 public void testGetUserExternalIdentifier() { 150 150 System.out.println("getUserExternalIdentifier"); 151 final UUID externalID = UUID.fromString( TestBackendConstants._TEST_USER_5_EXT_ID);152 153 mockeryDao.checking(new Expectations() { 154 { 155 oneOf(userDao).getExternalID( 5);151 final UUID externalID = UUID.fromString("00000000-0000-0000-0000-000000000111"); 152 153 mockeryDao.checking(new Expectations() { 154 { 155 oneOf(userDao).getExternalID(1); 156 156 will(returnValue(externalID)); 157 157 } 158 158 }); 159 assertEquals( TestBackendConstants._TEST_USER_5_EXT_ID, dbIntegrityService.getUserExternalIdentifier(5).toString());159 assertEquals("00000000-0000-0000-0000-000000000111", dbIntegrityService.getUserExternalIdentifier(1).toString()); 160 160 } 161 161 … … 168 168 169 169 final Annotation mockAnnotation = new Annotation();// corresponds to the annotation # 2 170 mockAnnotation.setURI(TestBackendConstants._TEST_SERVLET_URI_annotations + TestBackendConstants._TEST_ANNOT_2_EXT);171 mockAnnotation.setHeadline( TestBackendConstants._TEST_ANNOT_2_HEADLINE);172 XMLGregorianCalendar mockTimeStamp = DatatypeFactory.newInstance().newXMLGregorianCalendar( TestBackendConstants._TEST_ANNOT_2_TIME_STAMP);170 mockAnnotation.setURI(TestBackendConstants._TEST_SERVLET_URI_annotations +"00000000-0000-0000-0000-000000000021"); 171 mockAnnotation.setHeadline("Sagrada Famiglia"); 172 XMLGregorianCalendar mockTimeStamp = DatatypeFactory.newInstance().newXMLGregorianCalendar("2013-08-12T09:25:00.383000Z"); 173 173 mockAnnotation.setLastModified(mockTimeStamp); 174 174 mockAnnotation.setOwnerRef("3"); … … 178 178 mockBody.setTextBody(textBody); 179 179 textBody.setMimeType("text/plain"); 180 textBody.setBody( TestBackendConstants._TEST_ANNOT_2_BODY);180 textBody.setBody("<html><body>some html 1</body></html>"); 181 181 mockAnnotation.setBody(mockBody); 182 182 mockAnnotation.setTargets(null); … … 188 188 189 189 final Target mockTargetOne = new Target(); 190 mockTargetOne.setLink( TestBackendConstants._TEST_Target_1_LINK);191 mockTargetOne.setURI(TestBackendConstants._TEST_SERVLET_URI_Targets + TestBackendConstants._TEST_Target_1_EXT_ID);192 mockTargetOne.setVersion( TestBackendConstants._TEST_Target_1_EXT_ID);190 mockTargetOne.setLink("http://nl.wikipedia.org/wiki/Sagrada_Fam%C3%ADlia"); 191 mockTargetOne.setURI(TestBackendConstants._TEST_SERVLET_URI_Targets +"00000000-0000-0000-0000-000000000031"); 192 mockTargetOne.setVersion("00000000-0000-0000-0000-000000000031"); 193 193 194 194 final Target mockTargetTwo = new Target(); 195 mockTargetTwo.setLink( TestBackendConstants._TEST_Target_2_LINK);196 mockTargetTwo.setURI(TestBackendConstants._TEST_SERVLET_URI_Targets + TestBackendConstants._TEST_Target_2_EXT_ID);197 mockTargetTwo.setVersion( TestBackendConstants._TEST_Target_2_EXT_ID);195 mockTargetTwo.setLink("http://nl.wikipedia.org/wiki/Antoni_Gaud%C3%AD"); 196 mockTargetTwo.setURI(TestBackendConstants._TEST_SERVLET_URI_Targets +"00000000-0000-0000-0000-000000000032"); 197 mockTargetTwo.setVersion("00000000-0000-0000-0000-000000000032"); 198 198 199 199 final List<Map<Number, String>> listMap = new ArrayList<Map<Number, String>>(); … … 208 208 listMap.add(map5); 209 209 210 final String uri3 = TestBackendConstants._TEST_SERVLET_URI_users + TestBackendConstants._TEST_USER_3_EXT_ID;211 final String uri4 = TestBackendConstants._TEST_SERVLET_URI_users + TestBackendConstants._TEST_USER_4_EXT_ID;212 final String uri5 = TestBackendConstants._TEST_SERVLET_URI_users + TestBackendConstants._TEST_USER_5_EXT_ID;210 final String uri3 = TestBackendConstants._TEST_SERVLET_URI_users +"00000000-0000-0000-0000-000000000111"; 211 final String uri4 = TestBackendConstants._TEST_SERVLET_URI_users +"00000000-0000-0000-0000-000000000112"; 212 final String uri5 = TestBackendConstants._TEST_SERVLET_URI_users +"00000000-0000-0000-0000-000000000113"; 213 213 214 214 … … 250 250 251 251 Annotation result = dbIntegrityService.getAnnotation(2); 252 assertEquals(TestBackendConstants._TEST_SERVLET_URI_annotations+ TestBackendConstants._TEST_ANNOT_2_EXT, result.getURI());252 assertEquals(TestBackendConstants._TEST_SERVLET_URI_annotations+"00000000-0000-0000-0000-000000000021", result.getURI()); 253 253 assertEquals("text/plain", result.getBody().getTextBody().getMimeType()); 254 assertEquals( TestBackendConstants._TEST_ANNOT_2_BODY, result.getBody().getTextBody().getBody());255 assertEquals( TestBackendConstants._TEST_ANNOT_2_HEADLINE, result.getHeadline());256 assertEquals( TestBackendConstants._TEST_ANNOT_2_TIME_STAMP, result.getLastModified().toString());257 assertEquals(TestBackendConstants._TEST_SERVLET_URI_users+ TestBackendConstants._TEST_USER_3_EXT_ID, result.getOwnerRef());254 assertEquals("<html><body>some html 1</body></html>", result.getBody().getTextBody().getBody()); 255 assertEquals("Sagrada Famiglia", result.getHeadline()); 256 assertEquals("2013-08-12T09:25:00.383000Z", result.getLastModified().toString()); 257 assertEquals(TestBackendConstants._TEST_SERVLET_URI_users+"00000000-0000-0000-0000-000000000111", result.getOwnerRef()); 258 258 259 259 assertEquals(mockTargetOne.getLink(), result.getTargets().getTargetInfo().get(0).getLink()); … … 345 345 346 346 oneOf(targetDao).getURIFromInternalID(1); 347 will(returnValue(TestBackendConstants._TEST_SERVLET_URI_Targets+ TestBackendConstants._TEST_Target_1_EXT_ID));347 will(returnValue(TestBackendConstants._TEST_SERVLET_URI_Targets+"00000000-0000-0000-0000-000000000031")); 348 348 349 349 oneOf(targetDao).getURIFromInternalID(2); 350 will(returnValue(TestBackendConstants._TEST_SERVLET_URI_Targets+ TestBackendConstants._TEST_Target_2_EXT_ID));350 will(returnValue(TestBackendConstants._TEST_SERVLET_URI_Targets+"00000000-0000-0000-0000-000000000032")); 351 351 352 352 } … … 355 355 ReferenceList result = dbIntegrityService.getAnnotationTargets(annotationID); 356 356 assertEquals(2, result.getRef().size()); 357 assertEquals(TestBackendConstants._TEST_SERVLET_URI_Targets+ TestBackendConstants._TEST_Target_1_EXT_ID, result.getRef().get(0));358 assertEquals(TestBackendConstants._TEST_SERVLET_URI_Targets+ TestBackendConstants._TEST_Target_2_EXT_ID, result.getRef().get(1));357 assertEquals(TestBackendConstants._TEST_SERVLET_URI_Targets+"00000000-0000-0000-0000-000000000031", result.getRef().get(0)); 358 assertEquals(TestBackendConstants._TEST_SERVLET_URI_Targets+"00000000-0000-0000-0000-000000000032", result.getRef().get(1)); 359 359 360 360 } … … 392 392 393 393 final String text = "some html"; 394 final UUID ownerUUID = UUID.fromString( TestBackendConstants._TEST_USER_4_EXT_ID);394 final UUID ownerUUID = UUID.fromString("00000000-0000-0000-0000-000000000112"); 395 395 final String after = (new Timestamp(0)).toString(); 396 396 final String before = (new Timestamp(System.currentTimeMillis())).toString(); … … 401 401 final AnnotationInfo mockAnnotInfo = new AnnotationInfo(); 402 402 403 mockAnnotInfo.setHeadline( TestBackendConstants._TEST_ANNOT_3_HEADLINE);404 mockAnnotInfo.setRef(TestBackendConstants._TEST_SERVLET_URI_annotations + TestBackendConstants._TEST_ANNOT_3_EXT);403 mockAnnotInfo.setHeadline("Gaudi"); 404 mockAnnotInfo.setRef(TestBackendConstants._TEST_SERVLET_URI_annotations + "00000000-0000-0000-0000-000000000022"); 405 405 406 406 final List<Number> TargetIDs = new ArrayList<Number>(); … … 451 451 452 452 oneOf(targetDao).getURIFromInternalID(2); 453 will(returnValue(TestBackendConstants._TEST_SERVLET_URI_Targets + TestBackendConstants._TEST_Target_2_EXT_ID));453 will(returnValue(TestBackendConstants._TEST_SERVLET_URI_Targets +"00000000-0000-0000-0000-000000000032")); 454 454 455 455 … … 462 462 AnnotationInfo resultAnnotInfo = result.getAnnotationInfo().get(0); 463 463 assertEquals(mockAnnotInfo.getHeadline(), resultAnnotInfo.getHeadline()); 464 assertEquals(TestBackendConstants._TEST_SERVLET_URI_users + TestBackendConstants._TEST_USER_4_EXT_ID, resultAnnotInfo.getOwnerRef());464 assertEquals(TestBackendConstants._TEST_SERVLET_URI_users +"00000000-0000-0000-0000-000000000112", resultAnnotInfo.getOwnerRef()); 465 465 assertEquals(mockAnnotInfo.getRef(),result.getAnnotationInfo().get(0).getRef() ); 466 assertEquals(TestBackendConstants._TEST_SERVLET_URI_Targets + TestBackendConstants._TEST_Target_2_EXT_ID, resultAnnotInfo.getTargets().getRef().get(0));466 assertEquals(TestBackendConstants._TEST_SERVLET_URI_Targets +"00000000-0000-0000-0000-000000000032", resultAnnotInfo.getTargets().getRef().get(0)); 467 467 468 468 } … … 585 585 // test 1: adding an existing Target 586 586 TargetInfo testTargetOne = new TargetInfo(); 587 testTargetOne.setLink( TestBackendConstants._TEST_Target_1_LINK);588 testTargetOne.setRef(TestBackendConstants._TEST_SERVLET_URI_Targets + TestBackendConstants._TEST_Target_1_EXT_ID);589 testTargetOne.setVersion( TestBackendConstants._TEST_Target_2_VERSION);587 testTargetOne.setLink("http://nl.wikipedia.org/wiki/Sagrada_Fam%C3%ADlia"); 588 testTargetOne.setRef(TestBackendConstants._TEST_SERVLET_URI_Targets + "00000000-0000-0000-0000-000000000031"); 589 testTargetOne.setVersion("version 1.1"); 590 590 final List<TargetInfo> mockTargetListOne = new ArrayList<TargetInfo>(); 591 591 mockTargetListOne.add(testTargetOne); … … 628 628 final String tempTargetID = UUID.randomUUID().toString(); 629 629 testTargetTwo.setRef(TestBackendConstants._TEST_SERVLET_URI_Targets + tempTargetID); 630 testTargetTwo.setLink( TestBackendConstants._TEST_NEW_Target_LINK);630 testTargetTwo.setLink("http://www.sagradafamilia.cat/docs_instit/historia.php"); 631 631 testTargetTwo.setVersion("version 1.0"); 632 632 final List<TargetInfo> mockTargetListTwo = new ArrayList<TargetInfo>(); -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/dao/impl/JdbcAnnotationDaoTest.java
r4429 r4461 84 84 public void testRetrieveTargetIDs() { 85 85 System.out.println("retrieveTargetIDs"); 86 Number annotationID = 2;86 Number annotationID = 1; 87 87 List<Number> result = jdbcAnnotationDao.retrieveTargetIDs(annotationID); 88 88 assertEquals(2, result.size()); … … 95 95 public void testDeleteAllAnnotationTarget() throws SQLException{ 96 96 System.out.println("test deleteAllAnnotationTargets"); 97 assertEquals(2, jdbcAnnotationDao.deleteAllAnnotationTarget( 2));98 assertEquals(0, jdbcAnnotationDao.deleteAllAnnotationTarget( 2));97 assertEquals(2, jdbcAnnotationDao.deleteAllAnnotationTarget(1)); 98 assertEquals(0, jdbcAnnotationDao.deleteAllAnnotationTarget(1)); 99 99 } 100 100 … … 103 103 public void testDeleteAnnotationPrinciplePermissions() throws SQLException{ 104 104 System.out.println("test deleteAllAnnotationTargets"); 105 int result = jdbcAnnotationDao.deleteAnnotationPrincipalPermissions( 2);105 int result = jdbcAnnotationDao.deleteAnnotationPrincipalPermissions(1); 106 106 assertEquals(2, result); 107 assertEquals(0, jdbcAnnotationDao.deleteAnnotationPrincipalPermissions( 2));107 assertEquals(0, jdbcAnnotationDao.deleteAnnotationPrincipalPermissions(1)); 108 108 } 109 109 … … 112 112 public void testAddAnnotationPrinciplePermission() throws SQLException{ 113 113 System.out.println("test addAnnotationTargets"); 114 int result = jdbcAnnotationDao.addAnnotationPrincipalPermission( 2, 1, Permission.READER);114 int result = jdbcAnnotationDao.addAnnotationPrincipalPermission(1, 1, Permission.READER); 115 115 assertEquals(1, result); 116 116 } … … 120 120 public void testAddAnnotationTarget() throws SQLException{ 121 121 System.out.println("test addAnnotationTargetPair"); 122 assertEquals(1, jdbcAnnotationDao.addAnnotationTarget(1, 2));122 assertEquals(1, jdbcAnnotationDao.addAnnotationTarget(1,3)); 123 123 } 124 124 … … 137 137 // assertEquals(3, annotationInfos.size()); 138 138 // 139 // assertEquals( TestBackendConstants._TEST_ANNOT_2_HEADLINE, annotationInfos.get(0).getHeadline());139 // assertEquals("Sagrada Famiglia", annotationInfos.get(0).getHeadline()); 140 140 // assertEquals(String.valueOf(TestBackendConstants._TEST_ANNOT_2_OWNER), annotationInfos.get(0).getOwnerRef()); 141 // assertEquals(TestBackendConstants._TEST_SERVLET_URI_annotations + TestBackendConstants._TEST_ANNOT_2_EXT,141 // assertEquals(TestBackendConstants._TEST_SERVLET_URI_annotations +"00000000-0000-0000-0000-000000000021", 142 142 // annotationInfos.get(0).getRef()); 143 143 // //assertEquals(TestBackendConstants._TEST_ANNOT_1_TARGETS, annotationInfos.get(0).getTargetTargets()); 144 144 // 145 // assertEquals( TestBackendConstants._TEST_ANNOT_3_HEADLINE, annotationInfos.get(1).getHeadline());145 // assertEquals("Gaudi", annotationInfos.get(1).getHeadline()); 146 146 // assertEquals(String.valueOf(TestBackendConstants._TEST_ANNOT_3_OWNER), annotationInfos.get(1).getOwnerRef()); 147 // assertEquals(TestBackendConstants._TEST_SERVLET_URI_annotations + TestBackendConstants._TEST_ANNOT_3_EXT,147 // assertEquals(TestBackendConstants._TEST_SERVLET_URI_annotations + "00000000-0000-0000-0000-000000000022", 148 148 // annotationInfos.get(1).getRef()); 149 149 // //assertEquals(TestBackendConstants._TEST_ANNOT_2_TARGETS, annotationInfos.get(1).getTargetTargets()); … … 151 151 // assertEquals(TestBackendConstants._TEST_ANNOT_4_HEADLINE, annotationInfos.get(2).getHeadline()); 152 152 // assertEquals(String.valueOf(TestBackendConstants._TEST_ANNOT_4_OWNER), annotationInfos.get(2).getOwnerRef()); 153 // assertEquals(TestBackendConstants._TEST_SERVLET_URI_annotations + TestBackendConstants._TEST_ANNOT_4_EXT,153 // assertEquals(TestBackendConstants._TEST_SERVLET_URI_annotations + "00000000-0000-0000-0000-000000000023", 154 154 // annotationInfos.get(2).getRef()); 155 155 // //assertEquals(TestBackendConstants._TEST_ANNOT_3_TARGETS, annotationInfos.get(2).getTargetTargets()); … … 172 172 System.out.println("getAnnotationREFs"); 173 173 List<Number> annotIds = new ArrayList<Number>(); 174 annotIds.add(1); 174 175 annotIds.add(2); 175 176 annotIds.add(3); 176 annotIds.add(4);177 177 178 178 jdbcAnnotationDao.setServiceURI(TestBackendConstants._TEST_SERVLET_URI_annotations); 179 179 final List<String> testList = jdbcAnnotationDao.getAnnotationREFs(annotIds); 180 180 assertEquals(3, testList.size()); 181 assertEquals(TestBackendConstants._TEST_SERVLET_URI_annotations+ TestBackendConstants._TEST_ANNOT_2_EXT, testList.get(0));182 assertEquals(TestBackendConstants._TEST_SERVLET_URI_annotations+ TestBackendConstants._TEST_ANNOT_3_EXT, testList.get(1));183 assertEquals(TestBackendConstants._TEST_SERVLET_URI_annotations+ TestBackendConstants._TEST_ANNOT_4_EXT, testList.get(2));181 assertEquals(TestBackendConstants._TEST_SERVLET_URI_annotations+"00000000-0000-0000-0000-000000000021", testList.get(0)); 182 assertEquals(TestBackendConstants._TEST_SERVLET_URI_annotations+"00000000-0000-0000-0000-000000000022", testList.get(1)); 183 assertEquals(TestBackendConstants._TEST_SERVLET_URI_annotations+"00000000-0000-0000-0000-000000000023", testList.get(2)); 184 184 185 185 final List<String> testListTwo = jdbcAnnotationDao.getAnnotationREFs(new ArrayList<Number>()); … … 200 200 System.out.println("test getInternalID"); 201 201 202 final Number annotaionId = jdbcAnnotationDao.getInternalID(UUID.fromString( TestBackendConstants._TEST_ANNOT_2_EXT));203 assertEquals( 2, annotaionId.intValue());204 205 final Number annotaionIdNE = jdbcAnnotationDao.getInternalID(UUID.fromString( TestBackendConstants._TEST_ANNOT_7_EXT_NOT_IN_DB));202 final Number annotaionId = jdbcAnnotationDao.getInternalID(UUID.fromString("00000000-0000-0000-0000-000000000021")); 203 assertEquals(1, annotaionId.intValue()); 204 205 final Number annotaionIdNE = jdbcAnnotationDao.getInternalID(UUID.fromString("00000000-0000-0000-0000-0000000000cc")); 206 206 assertEquals(null, annotaionIdNE); 207 207 … … 217 217 System.out.println("test getInternalIDFromURI"); 218 218 jdbcAnnotationDao.setServiceURI(TestBackendConstants._TEST_SERVLET_URI_annotations); 219 String uri = TestBackendConstants._TEST_SERVLET_URI_annotations+ TestBackendConstants._TEST_ANNOT_2_EXT;219 String uri = TestBackendConstants._TEST_SERVLET_URI_annotations+"00000000-0000-0000-0000-000000000021"; 220 220 Number result = jdbcAnnotationDao.getInternalIDFromURI(uri); 221 assertEquals( 2, result.intValue());221 assertEquals(1, result.intValue()); 222 222 } 223 223 … … 231 231 System.out.println("test getAnnotationWithoutTargets"); 232 232 jdbcAnnotationDao.setServiceURI(TestBackendConstants._TEST_SERVLET_URI_annotations); 233 final Annotation result= jdbcAnnotationDao.getAnnotationWithoutTargetsAndPermissions( 2);234 235 assertEquals( TestBackendConstants._TEST_ANNOT_2_HEADLINE, result.getHeadline());236 assertEquals( TestBackendConstants._TEST_ANNOT_2_BODY, result.getBody().getTextBody().getBody());237 assertEquals( TestBackendConstants._TEST_BODY_MIMETYPE_HTML, result.getBody().getTextBody().getMimeType());233 final Annotation result= jdbcAnnotationDao.getAnnotationWithoutTargetsAndPermissions(1); 234 235 assertEquals("Sagrada Famiglia", result.getHeadline()); 236 assertEquals("<html><body>some html 1</body></html>", result.getBody().getTextBody().getBody()); 237 assertEquals("text/html", result.getBody().getTextBody().getMimeType()); 238 238 assertEquals(TestBackendConstants._TEST_SERVLET_URI_annotations+ 239 TestBackendConstants._TEST_ANNOT_2_EXT, result.getURI());240 assertEquals(DatatypeFactory.newInstance().newXMLGregorianCalendar( TestBackendConstants._TEST_ANNOT_2_TIME_STAMP), result.getLastModified());239 "00000000-0000-0000-0000-000000000021", result.getURI()); 240 assertEquals(DatatypeFactory.newInstance().newXMLGregorianCalendar("2013-08-12T09:25:00.383000Z"), result.getLastModified()); 241 241 } 242 242 … … 254 254 255 255 // to provide integrity, first delete rows in the joint tables 256 jdbcAnnotationDao.deleteAllAnnotationTarget( 5);257 jdbcAnnotationDao.deleteAnnotationPrincipalPermissions( 5);258 259 assertEquals(1, jdbcAnnotationDao.deleteAnnotation( 5));260 assertEquals(0, jdbcAnnotationDao.deleteAnnotation( 5));256 jdbcAnnotationDao.deleteAllAnnotationTarget(4); 257 jdbcAnnotationDao.deleteAnnotationPrincipalPermissions(4); 258 259 assertEquals(1, jdbcAnnotationDao.deleteAnnotation(4)); 260 assertEquals(0, jdbcAnnotationDao.deleteAnnotation(4)); 261 261 } 262 262 … … 272 272 assertEquals(null, annotationToAdd.getLastModified()); 273 273 274 Number newAnnotationID = jdbcAnnotationDao.addAnnotation(annotationToAdd, 5);275 assertEquals( 6, newAnnotationID);274 Number newAnnotationID = jdbcAnnotationDao.addAnnotation(annotationToAdd, 3); 275 assertEquals(5, newAnnotationID); 276 276 277 277 // checking 278 Annotation addedAnnotation= jdbcAnnotationDao.getAnnotationWithoutTargetsAndPermissions( 6);278 Annotation addedAnnotation= jdbcAnnotationDao.getAnnotationWithoutTargetsAndPermissions(5); 279 279 assertFalse(null == addedAnnotation.getURI()); 280 280 assertFalse(null == addedAnnotation.getLastModified()); … … 294 294 public void testRetrieveAnnotationList() { 295 295 System.out.println("test retrieveAnnotationlist"); 296 List<Number> Targets = new ArrayList<Number>();297 Targets.add(1);298 Targets.add(2);299 List<Number> result = jdbcAnnotationDao.retrieveAnnotationList( Targets);296 List<Number> targets = new ArrayList<Number>(); 297 targets.add(1); 298 targets.add(2); 299 List<Number> result = jdbcAnnotationDao.retrieveAnnotationList(targets); 300 300 assertEquals (2, result.size()); 301 assertEquals( 2, result.get(0));302 assertEquals( 3, result.get(1));301 assertEquals(1, result.get(0)); 302 assertEquals(2, result.get(1)); 303 303 } 304 304 … … 310 310 System.out.println("getExternalID"); 311 311 312 final UUID externalId = jdbcAnnotationDao.getExternalID( 2);313 assertEquals(UUID.fromString( TestBackendConstants._TEST_ANNOT_2_EXT), externalId);312 final UUID externalId = jdbcAnnotationDao.getExternalID(1); 313 assertEquals(UUID.fromString("00000000-0000-0000-0000-000000000021"), externalId); 314 314 315 315 final UUID externalIdThree = jdbcAnnotationDao.getExternalID(null); … … 332 332 //final String link = "nl.wikipedia.org"; 333 333 final List<Number> annotationIDs = new ArrayList<Number>(); 334 annotationIDs.add(1); 334 335 annotationIDs.add(2); 335 annotationIDs.add(3);336 336 337 337 List<Number> result_1 = jdbcAnnotationDao.getFilteredAnnotationIDs(annotationIDs, null, null, null, null, null); 338 338 assertEquals(2, result_1.size()); 339 assertEquals( 2, result_1.get(0));340 assertEquals( 3, result_1.get(1));339 assertEquals(1, result_1.get(0)); 340 assertEquals(2, result_1.get(1)); 341 341 342 342 343 343 List<Number> result_2 = jdbcAnnotationDao.getFilteredAnnotationIDs(annotationIDs, null, "some html", null, null, null); 344 344 assertEquals(2, result_2.size()); 345 assertEquals( 2, result_2.get(0));346 assertEquals( 3, result_2.get(1));345 assertEquals(1, result_2.get(0)); 346 assertEquals(2, result_2.get(1)); 347 347 348 348 … … 351 351 final String before = (new Timestamp(System.currentTimeMillis())).toString(); 352 352 353 List<Number> result_4 = jdbcAnnotationDao.getFilteredAnnotationIDs(annotationIDs, 4, "some html", null, after, before);353 List<Number> result_4 = jdbcAnnotationDao.getFilteredAnnotationIDs(annotationIDs, 1, "some html", null, after, before); 354 354 assertEquals(1, result_4.size()); 355 assertEquals( 3, result_4.get(0));355 assertEquals(1, result_4.get(0)); 356 356 357 357 final String after_1 = (new Timestamp(System.currentTimeMillis())).toString();// no annotations added after "now" … … 371 371 public void testRetrievePermissions (){ 372 372 System.out.println("test Permissions"); 373 List<Map<Number, String>> result = jdbcAnnotationDao.getPermissions( 2);373 List<Map<Number, String>> result = jdbcAnnotationDao.getPermissions(1); 374 374 assertEquals(2, result.size()); 375 assertEquals("writer", result.get(0).get( 4));376 assertEquals("reader", result.get(1).get( 5));375 assertEquals("writer", result.get(0).get(2)); 376 assertEquals("reader", result.get(1).get(3)); 377 377 378 378 -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/dao/impl/JdbcCachedRepresentationDaoTest.java
r3830 r4461 86 86 System.out.println("getExternalId"); 87 87 Number internalID = 1; 88 UUID expResult = UUID.fromString( TestBackendConstants._TEST_CACHED_REPRESENTATION_1_EXT_ID_);88 UUID expResult = UUID.fromString("00000000-0000-0000-0000-000000000051"); 89 89 UUID result = jdbcCachedRepresentationDao.getExternalID(internalID); 90 90 assertEquals(expResult, result); … … 98 98 public void testGetInternalId() { 99 99 System.out.println("test getInternalID"); 100 UUID externalID = UUID.fromString( TestBackendConstants._TEST_CACHED_REPRESENTATION_1_EXT_ID_);100 UUID externalID = UUID.fromString("00000000-0000-0000-0000-000000000051"); 101 101 Number result = jdbcCachedRepresentationDao.getInternalID(externalID); 102 102 assertEquals(1, result.intValue()); … … 112 112 System.out.println("test getInternalIDFromURI"); 113 113 jdbcCachedRepresentationDao.setServiceURI(TestBackendConstants._TEST_SERVLET_URI_cached); 114 String uri = TestBackendConstants._TEST_SERVLET_URI_cached + TestBackendConstants._TEST_CACHED_REPRESENTATION_1_EXT_ID_;114 String uri = TestBackendConstants._TEST_SERVLET_URI_cached +"00000000-0000-0000-0000-000000000051"; 115 115 Number result = jdbcCachedRepresentationDao.getInternalIDFromURI(uri); 116 116 assertEquals(1, result.intValue()); … … 128 128 jdbcCachedRepresentationDao.setServiceURI(TestBackendConstants._TEST_SERVLET_URI_cached); 129 129 CachedRepresentationInfo result = jdbcCachedRepresentationDao.getCachedRepresentationInfo(1); 130 assertEquals(TestBackendConstants._TEST_SERVLET_URI_cached + TestBackendConstants._TEST_CACHED_REPRESENTATION_1_EXT_ID_, result.getURI());131 assertEquals( TestBackendConstants._TEST_CACHED_REPRESENTATION_1_MIME_TYPE_, result.getMimeType());132 assertEquals( TestBackendConstants._TEST_CACHED_REPRESENTATION_1_TOOL_, result.getTool());133 assertEquals( TestBackendConstants._TEST_CACHED_REPRESENTATION_1_TYPE_, result.getType());134 assertEquals(TestBackendConstants._TEST_SERVLET_URI_cached + TestBackendConstants._TEST_CACHED_REPRESENTATION_1_EXT_ID_, result.getURI());130 assertEquals(TestBackendConstants._TEST_SERVLET_URI_cached + "00000000-0000-0000-0000-000000000051", result.getURI()); 131 assertEquals("text/html", result.getMimeType()); 132 assertEquals("latex", result.getTool()); 133 assertEquals("text", result.getType()); 134 assertEquals(TestBackendConstants._TEST_SERVLET_URI_cached +"00000000-0000-0000-0000-000000000051", result.getURI()); 135 135 } 136 136 -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/dao/impl/JdbcNotebookDaoTest.java
r3838 r4461 198 198 // List<ReTargetREF> testList = jdbcNotebookDao.getAnnotationREFsOfNotebook(3); 199 199 // assertEquals(2, testList.size()); 200 // assertEquals(TestBackendConstants._TEST_SERVLET_URI_annotations+ TestBackendConstants._TEST_ANNOT_2_EXT, testList.get(0).getRef());201 // assertEquals(TestBackendConstants._TEST_SERVLET_URI_annotations+ TestBackendConstants._TEST_ANNOT_3_EXT, testList.get(1).getRef());200 // assertEquals(TestBackendConstants._TEST_SERVLET_URI_annotations+"00000000-0000-0000-0000-000000000021", testList.get(0).getRef()); 201 // assertEquals(TestBackendConstants._TEST_SERVLET_URI_annotations+"00000000-0000-0000-0000-000000000022", testList.get(1).getRef()); 202 202 // 203 203 // // test Two … … 205 205 // List<ReTargetREF> testListTwo = jdbcNotebookDao.getAnnotationREFsOfNotebook(4); 206 206 // assertEquals(1, testListTwo.size()); 207 // assertEquals(TestBackendConstants._TEST_SERVLET_URI_annotations+ TestBackendConstants._TEST_ANNOT_4_EXT, testListTwo.get(0).getRef());207 // assertEquals(TestBackendConstants._TEST_SERVLET_URI_annotations+"00000000-0000-0000-0000-000000000023", testListTwo.get(0).getRef()); 208 208 // 209 209 // // test Three "empty" … … 233 233 // AnnotationList annotations = jdbcNotebookDao.getAnnotations(3); 234 234 // assertEquals(2, annotations.getAnnotation().size()); 235 // assertEquals(TestBackendConstants._TEST_SERVLET_URI_annotations+ TestBackendConstants._TEST_ANNOT_2_EXT, annotations.getAnnotation().get(0).getRef());236 // assertEquals(TestBackendConstants._TEST_SERVLET_URI_annotations+ TestBackendConstants._TEST_ANNOT_3_EXT, annotations.getAnnotation().get(1).getRef());235 // assertEquals(TestBackendConstants._TEST_SERVLET_URI_annotations+"00000000-0000-0000-0000-000000000021", annotations.getAnnotation().get(0).getRef()); 236 // assertEquals(TestBackendConstants._TEST_SERVLET_URI_annotations+"00000000-0000-0000-0000-000000000022", annotations.getAnnotation().get(1).getRef()); 237 237 // 238 238 // // test Two … … 240 240 // AnnotationList annotationsTwo = jdbcNotebookDao.getAnnotations(4); 241 241 // assertEquals(1, annotationsTwo.getAnnotation().size()); 242 // assertEquals(TestBackendConstants._TEST_SERVLET_URI_annotations+ TestBackendConstants._TEST_ANNOT_4_EXT, annotationsTwo.getAnnotation().get(0).getRef());242 // assertEquals(TestBackendConstants._TEST_SERVLET_URI_annotations+"00000000-0000-0000-0000-000000000023", annotationsTwo.getAnnotation().get(0).getRef()); 243 243 // 244 244 // // test Three "empty" list of annotations … … 305 305 // { 306 306 // oneOf(annotationDao).getExternalID(2); 307 // will(returnValue(UUID.fromString( TestBackendConstants._TEST_ANNOT_2_EXT)));307 // will(returnValue(UUID.fromString("00000000-0000-0000-0000-000000000021"))); 308 308 // 309 309 // oneOf(annotationDao).getExternalID(3); 310 // will(returnValue(UUID.fromString( TestBackendConstants._TEST_ANNOT_3_EXT)));310 // will(returnValue(UUID.fromString("00000000-0000-0000-0000-000000000022"))); 311 311 // } 312 312 // }); 313 313 // 314 314 // List<UUID> resultOne= jdbcNotebookDao.getAnnotationExternalIDs(UUID.fromString(TestBackendConstants._TEST_NOTEBOOK_3_EXT)); 315 // assertEquals( TestBackendConstants._TEST_ANNOT_2_EXT, resultOne.get(0).toString());316 // assertEquals( TestBackendConstants._TEST_ANNOT_3_EXT, resultOne.get(1).toString());315 // assertEquals("00000000-0000-0000-0000-000000000021", resultOne.get(0).toString()); 316 // assertEquals("00000000-0000-0000-0000-000000000022", resultOne.get(1).toString()); 317 317 // 318 318 // … … 331 331 // private void setMockeryNotebookOne(){ 332 332 // ReTargetREF testRefOne = new ReTargetREF(); 333 // testRefOne.setRef(TestBackendConstants._TEST_SERVLET_URI_annotations+ TestBackendConstants._TEST_ANNOT_2_EXT);333 // testRefOne.setRef(TestBackendConstants._TEST_SERVLET_URI_annotations+"00000000-0000-0000-0000-000000000021"); 334 334 // ReTargetREF testRefTwo = new ReTargetREF(); 335 // testRefTwo.setRef(TestBackendConstants._TEST_SERVLET_URI_annotations+ TestBackendConstants._TEST_ANNOT_3_EXT);335 // testRefTwo.setRef(TestBackendConstants._TEST_SERVLET_URI_annotations+"00000000-0000-0000-0000-000000000022"); 336 336 // final List<ReTargetREF> testResult = Arrays.asList(new ReTargetREF[] {testRefOne, testRefTwo}); 337 337 // … … 346 346 // private void setMockeryNotebookTwo(){ 347 347 // ReTargetREF testRef = new ReTargetREF(); 348 // testRef.setRef(String.valueOf(TestBackendConstants._TEST_SERVLET_URI_annotations+ TestBackendConstants._TEST_ANNOT_4_EXT));348 // testRef.setRef(String.valueOf(TestBackendConstants._TEST_SERVLET_URI_annotations+"00000000-0000-0000-0000-000000000023")); 349 349 // final List<ReTargetREF> testResultTwo = Arrays.asList(new ReTargetREF[] {testRef}); 350 350 // -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/dao/impl/JdbcResourceDaoTest.java
r4183 r4461 47 47 private JdbcTemplate jdbcTemplate; 48 48 49 privateString getNormalisedSql() throws FileNotFoundException, URISyntaxException {49 public static String getNormalisedSql() throws FileNotFoundException, URISyntaxException { 50 50 // remove the unsupported sql for the test 51 51 final URL sqlUrl = JdbcResourceDaoTest.class.getResource("/sql/DashishAnnotatorCreate.sql"); … … 56 56 "\\\\connect", 57 57 "SET default_with_oids", 58 "ALTER SEQUENCE", 59 "ALTER TABLE ONLY", 60 "ADD CONSTRAINT", 61 "CREATE INDEX", // "ALTER TABLE ONLY [a-z]* ALTER COLUMN", 62 // "ALTER TABLE ONLY [^A]* ADD CONSTRAINT" 58 //"ALTER SEQUENCE", 59 //ALTER TABLE ONLY", 60 //"ADD CONSTRAINT", 61 //"CREATE INDEX", 62 // "ALTER TABLE ONLY [a-z]* ALTER COLUMN", 63 // "ALTER TABLE ONLY [^A]* ADD CONSTRAINT" 63 64 }) { 64 65 sqlString = sqlString.replaceAll(unknownToken, "-- " + unknownToken); 65 66 } 66 // obsolete(?) Peter's stuff, before body has been decided to be a text with its mimetype: sqlString = sqlString.replaceAll("body_xml xml", "body_xml text"); 67 sqlString = sqlString.replaceAll("CACHE 1;", "; -- CACHE 1;"); 67 //sqlString = sqlString.replaceAll("CACHE 1;", "; -- CACHE 1;"); 68 68 //sqlString = sqlString.replaceAll("UUID", "text"); 69 sqlString = sqlString.replaceAll("bytea", "blob"); 69 70 sqlString = sqlString.replaceAll("SERIAL NOT NULL", "INTEGER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY"); 70 sqlString = sqlString.replaceAll(" AT TIME ZONE 'UTC'", "AT TIME ZONE INTERVAL '00:00' HOUR TO MINUTE");71 sqlString = sqlString.replaceAll("\\(current_timestamp AT TIME ZONE 'UTC'\\)", "current_timestamp AT TIME ZONE INTERVAL '00:00' HOUR TO MINUTE"); 71 72 return sqlString; 72 73 } 73 74 74 p rivateString getTestDataInsertSql() throws FileNotFoundException, URISyntaxException {75 public static String getTestDataInsertSql() throws FileNotFoundException, URISyntaxException { 75 76 final URL sqlUrl = JdbcResourceDaoTest.class.getResource("/test-data/InsertTestData.sql"); 76 77 String sqlString = new Scanner(new File(sqlUrl.toURI()), "UTF8").useDelimiter("\\Z").next(); -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/dao/impl/JdbcTargetDaoTest.java
r4181 r4461 81 81 Number internalID = 1; 82 82 UUID result = jdbcTargetDao.getExternalID(internalID); 83 assertEquals( TestBackendConstants._TEST_Target_1_EXT_ID, result.toString());83 assertEquals("00000000-0000-0000-0000-000000000031", result.toString()); 84 84 } 85 85 … … 90 90 public void testGetInternalId() { 91 91 System.out.println("getInternalId"); 92 UUID externalID = UUID.fromString( TestBackendConstants._TEST_Target_1_EXT_ID);92 UUID externalID = UUID.fromString("00000000-0000-0000-0000-000000000031"); 93 93 Number expResult = 1; 94 94 Number result = jdbcTargetDao.getInternalID(externalID); … … 104 104 System.out.println("test getInternalIDFromURI"); 105 105 jdbcTargetDao.setServiceURI(TestBackendConstants._TEST_SERVLET_URI_Targets); 106 String uri = TestBackendConstants._TEST_SERVLET_URI_Targets+ TestBackendConstants._TEST_Target_1_EXT_ID;106 String uri = TestBackendConstants._TEST_SERVLET_URI_Targets+"00000000-0000-0000-0000-000000000031"; 107 107 Number result = jdbcTargetDao.getInternalIDFromURI(uri); 108 108 assertEquals(1, result.intValue()); … … 118 118 jdbcTargetDao.setServiceURI(TestBackendConstants._TEST_SERVLET_URI_Targets); 119 119 Target result = jdbcTargetDao.getTarget(1); 120 assertEquals(TestBackendConstants._TEST_SERVLET_URI_Targets+ TestBackendConstants._TEST_Target_1_EXT_ID, result.getURI());121 assertEquals( TestBackendConstants._TEST_Target_1_LINK+"#"+TestBackendConstants._TEST_Target_1_FRAGMENT, result.getLink());122 assertEquals( TestBackendConstants._TEST_Target_1_VERSION, result.getVersion());120 assertEquals(TestBackendConstants._TEST_SERVLET_URI_Targets+"00000000-0000-0000-0000-000000000031", result.getURI()); 121 assertEquals("http://nl.wikipedia.org/wiki/Sagrada_Fam%C3%ADlia"+"#"+"de_Opdracht", result.getLink()); 122 assertEquals("version 1.0", result.getVersion()); 123 123 // TODO :add time stamp test 124 124 … … 164 164 165 165 Target freshTarget = new Target(); 166 freshTarget.setLink( TestBackendConstants._TEST_Target_1_LINK+"#Het_ontwerp");167 freshTarget.setVersion( TestBackendConstants._TEST_Target_1_VERSION);166 freshTarget.setLink("http://nl.wikipedia.org/wiki/Sagrada_Fam%C3%ADlia"+"#Het_ontwerp"); 167 freshTarget.setVersion("version 1.0"); 168 168 freshTarget.setLastModified(null); 169 169 … … 172 172 // detailed checking 173 173 Target addedTarget = jdbcTargetDao.getTarget(result); 174 assertEquals( TestBackendConstants._TEST_Target_1_LINK+"#Het_ontwerp", addedTarget.getLink());175 assertEquals( TestBackendConstants._TEST_Target_1_VERSION, addedTarget.getVersion());174 assertEquals("http://nl.wikipedia.org/wiki/Sagrada_Fam%C3%ADlia"+"#Het_ontwerp", addedTarget.getLink()); 175 assertEquals("version 1.0", addedTarget.getVersion()); 176 176 assertTrue(addedTarget.getURI().startsWith(TestBackendConstants._TEST_SERVLET_URI_Targets)); 177 177 } … … 189 189 List<TargetInfo> result = jdbcTargetDao.getTargetInfos(test); 190 190 assertEquals(2, result.size()); 191 assertEquals(TestBackendConstants._TEST_SERVLET_URI_Targets+ TestBackendConstants._TEST_Target_1_EXT_ID, result.get(0).getRef());192 assertEquals(TestBackendConstants._TEST_SERVLET_URI_Targets+ TestBackendConstants._TEST_Target_2_EXT_ID, result.get(1).getRef());193 assertEquals( TestBackendConstants._TEST_Target_1_VERSION, result.get(0).getVersion());194 assertEquals( TestBackendConstants._TEST_Target_2_VERSION, result.get(1).getVersion());195 assertEquals( TestBackendConstants._TEST_Target_1_LINK+"#"+TestBackendConstants._TEST_Target_1_FRAGMENT, result.get(0).getLink());196 assertEquals( TestBackendConstants._TEST_Target_2_LINK+"#Vroege_werk", result.get(1).getLink());191 assertEquals(TestBackendConstants._TEST_SERVLET_URI_Targets+"00000000-0000-0000-0000-000000000031", result.get(0).getRef()); 192 assertEquals(TestBackendConstants._TEST_SERVLET_URI_Targets+"00000000-0000-0000-0000-000000000032", result.get(1).getRef()); 193 assertEquals("version 1.0", result.get(0).getVersion()); 194 assertEquals("version 1.1", result.get(1).getVersion()); 195 assertEquals("http://nl.wikipedia.org/wiki/Sagrada_Fam%C3%ADlia"+"#"+"de_Opdracht", result.get(0).getLink()); 196 assertEquals("http://nl.wikipedia.org/wiki/Antoni_Gaud%C3%AD"+"#Vroege_werk", result.get(1).getLink()); 197 197 198 198 } -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/dao/impl/JdbcUserDaoTest.java
r4281 r4461 75 75 @Test 76 76 public void testGetInternalID() { 77 Number testOne = jdbcUserDao.getInternalID(UUID.fromString( TestBackendConstants._TEST_USER_3_EXT_ID));77 Number testOne = jdbcUserDao.getInternalID(UUID.fromString("00000000-0000-0000-0000-000000000113")); 78 78 assertEquals(3, testOne.intValue()); 79 79 80 Number testTwo = jdbcUserDao.getInternalID(UUID.fromString( TestBackendConstants._TEST_USER_XXX_EXT_ID));80 Number testTwo = jdbcUserDao.getInternalID(UUID.fromString("00000000-0000-0000-0000-000000000ccc")); 81 81 assertEquals(null, testTwo); 82 82 … … 89 89 public void testGetExternalID() { 90 90 UUID testOne = jdbcUserDao.getExternalID(3); 91 assertEquals( TestBackendConstants._TEST_USER_3_EXT_ID, testOne.toString());91 assertEquals("00000000-0000-0000-0000-000000000113", testOne.toString()); 92 92 93 93 UUID testTwo = jdbcUserDao.getExternalID(null); … … 99 99 System.out.println("test getUser"); 100 100 jdbcUserDao.setServiceURI(TestBackendConstants._TEST_SERVLET_URI_users); 101 Number internalID = 1; 102 User result = jdbcUserDao.getUser(internalID); 103 assertEquals("a user", result.getDisplayName()); 104 assertEquals("a.user@gmail.com", result.getEMail()); 105 assertEquals(TestBackendConstants._TEST_SERVLET_URI_users+TestBackendConstants._TEST_UID_1_, result.getURI()); 101 User result = jdbcUserDao.getUser(1); 102 assertEquals("Twan", result.getDisplayName()); 103 assertEquals("Twan.Goosen@mpi.nl", result.getEMail()); 104 assertEquals(TestBackendConstants._TEST_SERVLET_URI_users+"00000000-0000-0000-0000-000000000111", result.getURI()); 106 105 } 107 106 … … 118 117 119 118 Number result = jdbcUserDao.addUser(freshUser, "secret X"); 120 assertEquals( 7, result.intValue());119 assertEquals(11, result.intValue()); 121 120 User addedUser = jdbcUserDao.getUser(result); 122 121 assertEquals(freshUserName, addedUser.getDisplayName()); … … 130 129 jdbcUserDao.setServiceURI(TestBackendConstants._TEST_SERVLET_URI_users); 131 130 132 int result = jdbcUserDao.deleteUser( 6);131 int result = jdbcUserDao.deleteUser(10); 133 132 assertEquals(1, result); 134 User check = jdbcUserDao.getUser( 6);133 User check = jdbcUserDao.getUser(10); 135 134 assertTrue(null==check); 136 135 } … … 139 138 @Test 140 139 public void testUserIsInUse(){ 141 assertTrue(jdbcUserDao.userIsInUse( 2));142 assertTrue(jdbcUserDao.userIsInUse( 5));143 assertFalse(jdbcUserDao.userIsInUse( 6));140 assertTrue(jdbcUserDao.userIsInUse(1)); 141 assertTrue(jdbcUserDao.userIsInUse(3)); 142 assertFalse(jdbcUserDao.userIsInUse(10)); 144 143 } 145 144 … … 156 155 User user = new User(); 157 156 user.setDisplayName("Olha"); 158 user.setEMail(" olhsha@mpi.nl");157 user.setEMail("Olha.Shakaravska@mpi.nl"); 159 158 assertTrue(jdbcUserDao.userExists(user)); 160 159 -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/rest/AnnotationResourceTest.java
r4429 r4461 80 80 public AnnotationResourceTest() { 81 81 mockRequest = new MockHttpServletRequest(); 82 mockRequest.setRemoteUser(" twan");82 mockRequest.setRemoteUser("olhsha@mpi.nl"); 83 83 84 84 } … … 91 91 public void testGetAnnotation() throws SQLException, JAXBException, Exception { 92 92 System.out.println("getAnnotation"); 93 final String externalIDstring= TestBackendConstants._TEST_ANNOT_2_EXT;93 final String externalIDstring= "00000000-0000-0000-0000-000000000021"; 94 94 final Annotation expectedAnnotation = (new TestInstances(TestBackendConstants._TEST_SERVLET_URI)).getAnnotationOne(); 95 95 annotationResource.setHttpServletRequest(mockRequest); … … 107 107 will(doAll()); 108 108 109 oneOf(mockDbIntegrityService).getUserInternalIDFromRemoteID(" twan");109 oneOf(mockDbIntegrityService).getUserInternalIDFromRemoteID("olhsha@mpi.nl"); 110 110 will(returnValue(3)); 111 111 … … 139 139 mockDelete[0]=1; // # deleted annotations 140 140 mockDelete[3]=1; // # deleted annotation_prinipal_permissions 141 mockDelete[2]=2; // # deleted annotations_target_Targets, ( 5,3), (5,4)141 mockDelete[2]=2; // # deleted annotations_target_Targets, (4,3), (4,4) 142 142 mockDelete[3]=1; // # deletd Targets, 4 143 143 … … 151 151 152 152 153 oneOf(mockDbIntegrityService).getUserInternalIDFromRemoteID(" twan");154 will(returnValue( 5));153 oneOf(mockDbIntegrityService).getUserInternalIDFromRemoteID("olhsha@mpi.nl"); 154 will(returnValue(3)); 155 155 156 156 oneOf(mockDbIntegrityService).setServiceURI(with(any(String.class))); … … 158 158 159 159 oneOf(mockDbIntegrityService).getAnnotationInternalIdentifier(with(aNonNull(UUID.class))); 160 will(returnValue( 5));161 162 163 oneOf(mockDbIntegrityService).getAnnotationOwner( 5);164 will(returnValue( 5));165 166 oneOf(mockDbIntegrityService).deleteAnnotation( 5);160 will(returnValue(4)); 161 162 163 oneOf(mockDbIntegrityService).getAnnotationOwner(4); 164 will(returnValue(3)); 165 166 oneOf(mockDbIntegrityService).deleteAnnotation(4); 167 167 will(returnValue(mockDelete)); 168 168 } … … 170 170 171 171 172 String result = annotationResource.deleteAnnotation( TestBackendConstants._TEST_ANNOT_5_EXT);172 String result = annotationResource.deleteAnnotation("00000000-0000-0000-0000-000000000024"); 173 173 assertEquals("1 annotation(s) deleted.", result); 174 174 } … … 187 187 annotationToAdd.setTargets(TargetInfoList); 188 188 annotationToAdd.setOwnerRef(null); 189 annotationToAdd.setLastModified(DatatypeFactory.newInstance().newXMLGregorianCalendar( TestBackendConstants._TEST_ANNOT_2_TIME_STAMP));189 annotationToAdd.setLastModified(DatatypeFactory.newInstance().newXMLGregorianCalendar("2013-08-12T09:25:00.383000Z")); 190 190 annotationToAdd.setHeadline("headline"); 191 191 annotationToAdd.setTargets(TargetInfoList); … … 209 209 final Annotation addedAnnotation = (new ObjectFactory()).createAnnotation(annotationToAdd).getValue(); 210 210 addedAnnotation.setURI("http://localhost:8080/annotator-backend/api/annotations/"+UUID.randomUUID().toString()); 211 addedAnnotation.setOwnerRef("http://localhost:8080/annotator-backend/api/users/"+ TestBackendConstants._TEST_USER_3_EXT_ID);211 addedAnnotation.setOwnerRef("http://localhost:8080/annotator-backend/api/users/"+"00000000-0000-0000-0000-000000000111"); 212 212 213 213 annotationResource.setHttpServletRequest(mockRequest); … … 223 223 will(doAll()); 224 224 225 oneOf(mockDbIntegrityService).getUserInternalIDFromRemoteID(" twan");225 oneOf(mockDbIntegrityService).getUserInternalIDFromRemoteID("olhsha@mpi.nl"); 226 226 will(returnValue(3)); 227 227 -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/rest/AnnotationsTest.java
r4429 r4461 92 92 } 93 93 94 private String getNormalisedSql() throws FileNotFoundException, URISyntaxException {95 // remove the unsupported sql for the test96 final URL sqlUrl = JdbcResourceDaoTest.class.getResource("/sql/DashishAnnotatorCreate.sql");97 String sqlString = new Scanner(new File(sqlUrl.toURI()), "UTF8").useDelimiter("\\Z").next();98 for (String unknownToken : new String[]{99 "SET client_encoding",100 "CREATE DATABASE",101 "\\\\connect",102 "SET default_with_oids",103 "ALTER SEQUENCE",104 "ALTER TABLE ONLY",105 "ADD CONSTRAINT",106 "CREATE INDEX", // "ALTER TABLE ONLY [a-z]* ALTER COLUMN",107 // "ALTER TABLE ONLY [^A]* ADD CONSTRAINT"108 }) {109 sqlString = sqlString.replaceAll(unknownToken, "-- " + unknownToken);110 }111 // obsolete(?) Peter's stuff, before body has been decided to be a text with its mimetype: sqlString = sqlString.replaceAll("body_xml xml", "body_xml text");112 sqlString = sqlString.replaceAll("CACHE 1;", "; -- CACHE 1;");113 //sqlString = sqlString.replaceAll("UUID", "text");114 sqlString = sqlString.replaceAll("SERIAL NOT NULL", "INTEGER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY");115 sqlString = sqlString.replaceAll("AT TIME ZONE 'UTC'", "AT TIME ZONE INTERVAL '00:00' HOUR TO MINUTE");116 return sqlString;117 }118 119 private String getTestDataInsertSql() throws FileNotFoundException, URISyntaxException {120 final URL sqlUrl = AnnotationsTest.class.getResource("/test-data/InsertTestData.sql");121 String sqlString = new Scanner(new File(sqlUrl.toURI()), "UTF8").useDelimiter("\\Z").next();122 return sqlString;123 }124 125 94 126 95 … … 131 100 jdbcTemplate.execute("DROP SCHEMA PUBLIC CASCADE"); 132 101 // consume the DashishAnnotatorCreate sql script to create the database 133 jdbcTemplate.execute( getNormalisedSql());134 jdbcTemplate.execute( getTestDataInsertSql());102 jdbcTemplate.execute(JdbcResourceDaoTest.getNormalisedSql()); 103 jdbcTemplate.execute(JdbcResourceDaoTest.getTestDataInsertSql()); 135 104 } 136 105 … … 147 116 public void testGetAnnotation() throws SQLException, DatatypeConfigurationException { 148 117 System.out.println("testGetAnnotation"); 149 final String externalIDstring = TestBackendConstants._TEST_ANNOT_2_EXT;118 final String externalIDstring = "00000000-0000-0000-0000-000000000021"; 150 119 final Annotation testAnnotation = (new TestInstances(resource().getURI().toString())).getAnnotationOne(); 151 120 … … 163 132 assertEquals(2, entity.getPermissions().getUserWithPermission().size()); 164 133 assertEquals("writer", entity.getPermissions().getUserWithPermission().get(0).getPermission().value()); 165 assertEquals(resource().getURI()+"users/"+ TestBackendConstants._TEST_USER_4_EXT_ID, entity.getPermissions().getUserWithPermission().get(0).getRef());134 assertEquals(resource().getURI()+"users/"+"00000000-0000-0000-0000-000000000112", entity.getPermissions().getUserWithPermission().get(0).getRef()); 166 135 assertEquals("reader", entity.getPermissions().getUserWithPermission().get(1).getPermission().value()); 167 assertEquals(resource().getURI()+"users/"+ TestBackendConstants._TEST_USER_5_EXT_ID, entity.getPermissions().getUserWithPermission().get(1).getRef());136 assertEquals(resource().getURI()+"users/"+"00000000-0000-0000-0000-000000000113", entity.getPermissions().getUserWithPermission().get(1).getRef()); 168 137 assertEquals(2, entity.getTargets().getTargetInfo().size()); 169 assertEquals(resource().getURI().toString()+"targets/"+ TestBackendConstants._TEST_Target_1_EXT_ID, entity.getTargets().getTargetInfo().get(0).getRef());170 assertEquals(resource().getURI().toString()+"targets/"+ TestBackendConstants._TEST_Target_2_EXT_ID, entity.getTargets().getTargetInfo().get(1).getRef());138 assertEquals(resource().getURI().toString()+"targets/"+"00000000-0000-0000-0000-000000000031", entity.getTargets().getTargetInfo().get(0).getRef()); 139 assertEquals(resource().getURI().toString()+"targets/"+"00000000-0000-0000-0000-000000000032", entity.getTargets().getTargetInfo().get(1).getRef()); 171 140 assertEquals(testAnnotation.getLastModified(), entity.getLastModified()); 172 141 assertEquals(resource().getURI()+requestUrl, entity.getURI()); … … 180 149 public void testDeleteAnnotation() throws SQLException { 181 150 System.out.println("testDeleteAnnotation"); 182 String externalIDstring = TestBackendConstants._TEST_ANNOT_5_EXT;151 String externalIDstring = "00000000-0000-0000-0000-000000000024"; 183 152 final String requestUrl = "annotations/" + externalIDstring; 184 153 System.out.println("requestUrl: " + requestUrl); … … 198 167 System.out.println("test createAnnotation"); 199 168 System.out.println("POST "+resource().getURI().toString()+"annotations/"); 200 final String ownerString = resource().getURI().toString()+"users/"+ TestBackendConstants._TEST_USER_5_EXT_ID;169 final String ownerString = resource().getURI().toString()+"users/"+"00000000-0000-0000-0000-000000000113"; 201 170 final Annotation annotationToAdd = new Annotation(); 202 171 final JAXBElement<Annotation> jaxbElement = (new ObjectFactory()).createAnnotation(annotationToAdd); … … 204 173 annotationToAdd.setOwnerRef(ownerString); 205 174 annotationToAdd.setURI(resource().getURI().toString()+"annotations/"+ UUID.randomUUID().toString()); 206 annotationToAdd.setLastModified(DatatypeFactory.newInstance().newXMLGregorianCalendar( TestBackendConstants._TEST_ANNOT_2_TIME_STAMP));175 annotationToAdd.setLastModified(DatatypeFactory.newInstance().newXMLGregorianCalendar("2013-08-12T09:25:00.383000Z")); 207 176 208 177 TargetInfoList targetInfoList = new TargetInfoList(); -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/rest/DummyPrincipal.java
r4173 r4461 29 29 30 30 public static final DummyPrincipal DUMMY_ADMIN_PRINCIPAL = new DummyPrincipal("JUnit.Admin@test.com"); 31 public static final DummyPrincipal DUMMY_PRINCIPAL = new DummyPrincipal(" JUnit@test.com");31 public static final DummyPrincipal DUMMY_PRINCIPAL = new DummyPrincipal("olhsha@mpi.nl"); 32 32 public static final UserCredentials DUMMY_CREDENTIALS = new UserCredentials(DUMMY_PRINCIPAL) { 33 33 -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/rest/NotebookResourceTest.java
r4000 r4461 160 160 // System.out.println("test getAllAnnotations"); 161 161 // final String externalID= TestBackendConstants._TEST_NOTEBOOK_3_EXT; 162 // final UUID aIdOne= UUID.fromString( TestBackendConstants._TEST_ANNOT_2_EXT);163 // final UUID aIdTwo= UUID.fromString( TestBackendConstants._TEST_ANNOT_3_EXT);162 // final UUID aIdOne= UUID.fromString("00000000-0000-0000-0000-000000000021"); 163 // final UUID aIdTwo= UUID.fromString("00000000-0000-0000-0000-000000000022"); 164 164 // final List<UUID> annotationIds = new ArrayList<UUID>(); 165 165 // annotationIds.add(aIdOne); -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/resources/test-data/InsertTestData.sql
r4429 r4461 21 21 -- 22 22 23 INSERT INTO principal (principal_name, external_id, remote_id, e_mail, account) VALUES ('a user', '00000000-0000-0000-0000-000000000003', 'a1', 'a.user@gmail.com', 'user'); -- 1 24 INSERT INTO principal (principal_name, external_id, remote_id, e_mail, account) VALUES ('b user', '00000000-0000-0000-0000-000000000004', 'b2', 'b.user@gmail.com', 'user');-- 2 25 26 INSERT INTO notebook (title, owner_id, external_id) VALUES ('a notebook', 2, '00000000-0000-0000-0000-000000000001'); -- 1 27 -- INSERT INTO notebook (title, owner_id, external_id) VALUES ('a notebook', 1, 1); 28 29 INSERT INTO annotation (owner_id, headline, body_text, body_mimetype, external_id, is_xml) VALUES (1, 'a headline', '<html><body>some html</body></html>', 'text/html' , '00000000-0000-0000-0000-000000000005', false); --1 30 31 INSERT INTO notebook (title, owner_id, external_id) VALUES ('a second notebook', 2, '00000000-0000-0000-0000-000000000002'); --2 32 -- INSERT INTO notebook (title, owner_id, external_id) VALUES ('a second notebook', 1, 2); 33 INSERT INTO notebooks_annotations (notebook_id,annotation_id) VALUES (1,1); 34 INSERT INTO notebooks_annotations (notebook_id,annotation_id) VALUES (2,1); 23 INSERT INTO principal (principal_name, external_id, remote_id, e_mail, account) VALUES ('Twan', '00000000-0000-0000-0000-000000000111', 'twagoo@mpi.nl', 'Twan.Goosen@mpi.nl', 'developer'); --1 24 INSERT INTO principal (principal_name, external_id, remote_id, e_mail, account) VALUES ('Peter', '00000000-0000-0000-0000-000000000112', 'petwit@mpi.nl', 'Peter.Withers@mpi.nl', 'developer'); -- 2 25 INSERT INTO principal (principal_name, external_id, remote_id, e_mail, account) VALUES ('Olha', '00000000-0000-0000-0000-000000000113', 'olhsha@mpi.nl', 'Olha.Shakaravska@mpi.nl', 'admin'); -- 3 26 INSERT INTO principal (principal_name, external_id, remote_id, e_mail, account) VALUES ('Eric', '00000000-0000-0000-0000-000000000114', 'ericauser@mpi.nl', 'Eric.Auer@mpi.nl', 'developer'); -- 4 27 INSERT INTO principal (principal_name, external_id, remote_id, e_mail, account) VALUES ('Daan', '00000000-0000-0000-0000-000000000115', 'broeder@mpi.ml', 'Daan.Broeder@mpi.nl', 'developer'); --5 28 INSERT INTO principal (principal_name, external_id, remote_id, e_mail, account) VALUES ('Menzo', '00000000-0000-0000-0000-000000000116', 'menwin@mpi.nl', 'Menzo.Windhouwer@mpi.nl', 'developer'); -- 6 29 INSERT INTO principal (principal_name, external_id, remote_id, e_mail, account) VALUES ('Przemek', '00000000-0000-0000-0000-000000000117', 'przlen@mpi,nl', 'Przemek.Lenkiewicz@mpi.nl', 'user'); -- 7 30 INSERT INTO principal (principal_name, external_id, remote_id, e_mail, account) VALUES ('Stephanie', '00000000-0000-0000-0000-000000000118', 'gusrotst@gu.se', 'stephanie.roth@gu.se', 'developer'); -- 8 31 INSERT INTO principal (principal_name, external_id, remote_id, e_mail, account) VALUES ('Olof', '00000000-0000-0000-0000-000000000119', 'gusolsol@gu.se', 'olof.olsson.2@gu.se', 'developer'); -- 9 32 INSERT INTO principal (principal_name, external_id, remote_id, e_mail, account) VALUES ('Willem', '00000000-0000-0000-0000-000000000220', 'wilelb@mpi.nl', 'Willem.Elbers@mpi.nl', 'developer'); -- 10 35 33 36 34 37 -- Test data for jdbcAnnotationDao -- 35 INSERT INTO notebook (title, owner_id, external_id) VALUES ('Notebook 3', 1, '00000000-0000-0000-0000-000000000011'); -- 1 36 INSERT INTO notebook (title, owner_id, external_id) VALUES ('Notebook 4', 2, '00000000-0000-0000-0000-000000000012'); --2 37 INSERT INTO notebook (title, owner_id, external_id) VALUES ('Notebook 5', 3, '00000000-0000-0000-0000-000000000013'); --3 38 INSERT INTO notebook (title, owner_id, external_id) VALUES ('Notebook 6', 3, '00000000-0000-0000-0000-000000000014'); --4 38 39 39 INSERT INTO principal (principal_name, external_id, remote_id, e_mail, account) VALUES ('Twan', '00000000-0000-0000-0000-000000000111', 'x3', 'twagoo@mpi.nl', 'developer'); --3 40 INSERT INTO principal (principal_name, external_id, remote_id, e_mail, account) VALUES ('Peter', '00000000-0000-0000-0000-000000000112', 'y4', 'Peter.Withers@mpi.nl', 'developer'); -- 4 41 INSERT INTO principal (principal_name, external_id, remote_id, e_mail, account) VALUES ('Olha', '00000000-0000-0000-0000-000000000113', 'JUnit@test.com', 'olhsha@mpi.nl', 'admin'); -- 5 42 INSERT INTO principal (principal_name, external_id, remote_id, e_mail, account) VALUES ('Eric', '00000000-0000-0000-0000-000000000114', 'v6', 'eriaue@mpi.nl', 'developer'); -- 6 43 44 45 INSERT INTO notebook (title, owner_id, external_id) VALUES ('Notebook 3', 3, '00000000-0000-0000-0000-000000000011'); -- 3 46 INSERT INTO notebook (title, owner_id, external_id) VALUES ('Notebook 4', 4, '00000000-0000-0000-0000-000000000012'); --4 47 INSERT INTO notebook (title, owner_id, external_id) VALUES ('Notebook 5', 5, '00000000-0000-0000-0000-000000000013'); --5 48 INSERT INTO notebook (title, owner_id, external_id) VALUES ('Notebook 6', 5, '00000000-0000-0000-0000-000000000014'); --6 49 50 INSERT INTO annotation (owner_id, headline,body_text, body_mimetype, external_id, last_modified, is_xml) VALUES (3, 'Sagrada Famiglia','<html><body>some html 1</body></html>', 'text/html' , '00000000-0000-0000-0000-000000000021', '2013-08-12 09:25:00.383', false); --2 51 INSERT INTO annotation (owner_id, headline,body_text, body_mimetype, external_id, is_xml) VALUES (4, 'Gaudi','<html><body>some html 2</body></html>', 'text/html' , '00000000-0000-0000-0000-000000000022',false); --3 52 INSERT INTO annotation (owner_id, headline,body_text, body_mimetype, external_id, is_xml) VALUES (5, 'Art Nuveau','some plain text', 'text/plain' , '00000000-0000-0000-0000-000000000023', false); --4 53 INSERT INTO annotation (owner_id, headline,body_text, body_mimetype, external_id, is_xml) VALUES (5, 'Annotation to delete','<html><body>some html 4</body></html>', 'text/html' , '00000000-0000-0000-0000-000000000024',false); --5 40 INSERT INTO annotation (owner_id, headline,body_text, body_mimetype, external_id, last_modified, is_xml) VALUES (1, 'Sagrada Famiglia','<html><body>some html 1</body></html>', 'text/html' , '00000000-0000-0000-0000-000000000021', '2013-08-12 09:25:00.383', false); --1 41 INSERT INTO annotation (owner_id, headline,body_text, body_mimetype, external_id, is_xml) VALUES (2, 'Gaudi','<html><body>some html 2</body></html>', 'text/html' , '00000000-0000-0000-0000-000000000022',false); --2 42 INSERT INTO annotation (owner_id, headline,body_text, body_mimetype, external_id, is_xml) VALUES (3, 'Art Nuveau','some plain text', 'text/plain' , '00000000-0000-0000-0000-000000000023', false); --3 43 INSERT INTO annotation (owner_id, headline,body_text, body_mimetype, external_id, is_xml) VALUES (3, 'Annotation to delete','<html><body>some html 4</body></html>', 'text/html' , '00000000-0000-0000-0000-000000000024',false); --4 54 44 55 45 56 46 57 INSERT INTO notebooks_annotations (notebook_id,annotation_id) VALUES ( 3,2);58 INSERT INTO notebooks_annotations (notebook_id,annotation_id) VALUES ( 3,3);59 INSERT INTO notebooks_annotations (notebook_id,annotation_id) VALUES ( 4,4);60 INSERT INTO notebooks_annotations (notebook_id,annotation_id) VALUES ( 5,4);47 INSERT INTO notebooks_annotations (notebook_id,annotation_id) VALUES (1,1); 48 INSERT INTO notebooks_annotations (notebook_id,annotation_id) VALUES (1,2); 49 INSERT INTO notebooks_annotations (notebook_id,annotation_id) VALUES (2,3); 50 INSERT INTO notebooks_annotations (notebook_id,annotation_id) VALUES (4,3); 61 51 62 52 63 53 INSERT INTO target (external_id, link_uri, version, fragment_descriptor) VALUES ('00000000-0000-0000-0000-000000000031', 'http://nl.wikipedia.org/wiki/Sagrada_Fam%C3%ADlia', 'version 1.0', 'de_Opdracht'); -- 1 64 INSERT INTO target (external_id, link_uri, version, fragment_descriptor) VALUES ('00000000-0000-0000-0000-000000000032', 'http://nl.wikipedia.org/wiki/Antoni_Gaud%C3%AD', 'version 1. 0', 'Vroege_werk'); --254 INSERT INTO target (external_id, link_uri, version, fragment_descriptor) VALUES ('00000000-0000-0000-0000-000000000032', 'http://nl.wikipedia.org/wiki/Antoni_Gaud%C3%AD', 'version 1.1', 'Vroege_werk'); --2 65 55 INSERT INTO target (external_id, link_uri, version, fragment_descriptor) VALUES ('00000000-0000-0000-0000-000000000033', 'http://en.wikipedia.org/wiki/Art_Nouveau', 'june 1013', 'Spain'); --3 66 56 INSERT INTO target (external_id, link_uri, version, fragment_descriptor) VALUES ('00000000-0000-0000-0000-000000000034', '???', 'back up', '1111'); --4 67 57 INSERT INTO target (external_id, link_uri, version, fragment_descriptor) VALUES ('00000000-0000-0000-0000-000000000035', '???', 'back up', '111111'); --5 68 58 INSERT INTO target (external_id, link_uri, version, fragment_descriptor) VALUES ('00000000-0000-0000-0000-000000000036', '???', 'version 2.0', '1111111'); --6 not used by any annotation 69 INSERT INTO target (external_id, link_uri, version, fragment_descriptor) VALUES ('00000000-0000-0000-0000-000000000037', '???', 'version 2.0', '11111111'); 59 INSERT INTO target (external_id, link_uri, version, fragment_descriptor) VALUES ('00000000-0000-0000-0000-000000000037', '???', 'version 2.0', '11111111'); --7 70 60 71 61 72 62 73 INSERT INTO annotations_targets (annotation_id, target_id) VALUES ( 2, 1);74 INSERT INTO annotations_targets (annotation_id, target_id) VALUES ( 2, 2);75 INSERT INTO annotations_targets (annotation_id, target_id) VALUES ( 3, 2);76 INSERT INTO annotations_targets (annotation_id, target_id) VALUES ( 4, 3);77 INSERT INTO annotations_targets (annotation_id, target_id) VALUES ( 5, 3); -- Target 3 should not be deleted when annot 5is deleted78 INSERT INTO annotations_targets (annotation_id, target_id) VALUES ( 5, 4); -- Target 4 to be deleted when annot 5is deleted79 INSERT INTO annotations_targets (annotation_id, target_id) VALUES ( 4, 5);80 INSERT INTO annotations_targets (annotation_id, target_id) VALUES ( 4, 7);63 INSERT INTO annotations_targets (annotation_id, target_id) VALUES (1, 1); 64 INSERT INTO annotations_targets (annotation_id, target_id) VALUES (1, 2); 65 INSERT INTO annotations_targets (annotation_id, target_id) VALUES (2, 2); 66 INSERT INTO annotations_targets (annotation_id, target_id) VALUES (3, 3); 67 INSERT INTO annotations_targets (annotation_id, target_id) VALUES (4, 3); -- Target 3 should not be deleted when annot 4 is deleted 68 INSERT INTO annotations_targets (annotation_id, target_id) VALUES (4, 4); -- Target 4 to be deleted when annot 4 is deleted 69 INSERT INTO annotations_targets (annotation_id, target_id) VALUES (3, 5); 70 INSERT INTO annotations_targets (annotation_id, target_id) VALUES (3, 7); 81 71 82 72 INSERT INTO cached_representation (external_id, mime_type, tool, type_, file_) VALUES ('00000000-0000-0000-0000-000000000051', 'text/html', 'latex', 'text', X'1001'); --1 … … 99 89 100 90 101 102 103 104 91 ---- PERMISSIONS -------------------------------------------------------------------------------------------- 105 92 … … 108 95 INSERT INTO permission_(permission_mode) VALUES ('reader'); 109 96 110 INSERT INTO annotations_principals_permissions (annotation_id, principal_id, permission_) VALUES ( 2, 4, 'writer');111 INSERT INTO annotations_principals_permissions (annotation_id, principal_id, permission_) VALUES ( 2, 5, 'reader');97 INSERT INTO annotations_principals_permissions (annotation_id, principal_id, permission_) VALUES (1, 2, 'writer'); 98 INSERT INTO annotations_principals_permissions (annotation_id, principal_id, permission_) VALUES (1, 3, 'reader'); 112 99 113 INSERT INTO annotations_principals_permissions (annotation_id, principal_id, permission_) VALUES ( 3, 3, 'reader');114 INSERT INTO annotations_principals_permissions (annotation_id, principal_id, permission_) VALUES ( 3, 5, 'writer');100 INSERT INTO annotations_principals_permissions (annotation_id, principal_id, permission_) VALUES (2, 1, 'reader'); 101 INSERT INTO annotations_principals_permissions (annotation_id, principal_id, permission_) VALUES (2, 3, 'writer'); 115 102 116 INSERT INTO annotations_principals_permissions (annotation_id, principal_id, permission_) VALUES ( 4, 3, 'reader');117 INSERT INTO annotations_principals_permissions (annotation_id, principal_id, permission_) VALUES ( 4, 4, 'reader');103 INSERT INTO annotations_principals_permissions (annotation_id, principal_id, permission_) VALUES (3, 1, 'reader'); 104 INSERT INTO annotations_principals_permissions (annotation_id, principal_id, permission_) VALUES (3, 2, 'reader'); 118 105 119 INSERT INTO annotations_principals_permissions (annotation_id, principal_id, permission_) VALUES ( 5, 4, 'writer');120 INSERT INTO annotations_principals_permissions (annotation_id, principal_id, permission_) VALUES ( 5, 3, 'writer');106 INSERT INTO annotations_principals_permissions (annotation_id, principal_id, permission_) VALUES (4, 2, 'writer'); 107 INSERT INTO annotations_principals_permissions (annotation_id, principal_id, permission_) VALUES (4, 1, 'writer'); 121 108 -- checking integrity control: 122 109 -- INSERT INTO annotations_principals_permissions (annotation_id, principal_id, permission_) VALUES (5, 5, 'reader');
Note: See TracChangeset
for help on using the changeset viewer.