Changeset 3211
- Timestamp:
- 07/30/13 15:04:02 (11 years ago)
- Location:
- DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/nb-configuration.xml
r3205 r3211 14 14 Any value defined here will override the pom.xml file value but is only applicable to the current project. 15 15 --> 16 <org-netbeans-modules-maven-jaxws.rest_2e_config_2e_type>ide</org-netbeans-modules-maven-jaxws.rest_2e_config_2e_type> 16 <org-netbeans-modules-maven-jaxws.rest_2e_config_2e_type>dd</org-netbeans-modules-maven-jaxws.rest_2e_config_2e_type> 17 <org-netbeans-modules-maven-jaxws.rest_2e_jersey_2e_type>server</org-netbeans-modules-maven-jaxws.rest_2e_jersey_2e_type> 17 18 </properties> 18 <spring-data xmlns="http://www.netbeans.org/ns/spring-data/1">19 <config-files>20 <config-file>src/main/resources/spring-config/userDao.xml</config-file>21 <config-file>src/test/resources/mockUserDao.xml</config-file>22 </config-files>23 <config-file-groups/>24 </spring-data>25 19 </project-shared-configuration> -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/sql/DashishAnnotatorCreate.sql
r3206 r3211 167 167 CREATE TABLE annotations_target_sources ( 168 168 annotation_id integer REFERENCES annotation(annotation_id), -- defining a foreign key: there must be a uniquely defined row in "annotation", that is defined by "annotation_id" 169 source_id integer REFERENCES target_source(source_id),170 unique(annotation_id, source_id),169 -- source_id integer REFERENCES target_source(source_id), 170 -- unique(annotation_id, source_id), 171 171 ); 172 172 -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/TestBackendConstants.java
r3210 r3211 33 33 34 34 // testing jdbcAnnotationDao 35 public static final String _TEST_NOTEBOOK_ 1_EXT = "00000000-0000-0000-0000-000000000011";36 public static final String _TEST_NOTEBOOK_ 2_EXT = "00000000-0000-0000-0000-000000000012";37 public static final String _TEST_NOTEBOOK_ 3_EXT = "00000000-0000-0000-0000-000000000013";35 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 38 39 public static final String _TEST_NOTEBOOK_ 1_TITLE = "Notebook 11";40 public static final String _TEST_NOTEBOOK_ 2_TITLE = "Notebook 12";41 public static final String _TEST_NOTEBOOK_ 3_TITLE = "Notebook 13";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 42 43 public static final int _TEST_NOTEBOOK_1_INT = 11; 44 public static final int _TEST_NOTEBOOK_2_INT = 12; 45 public static final int _TEST_NOTEBOOK_3_INT = 13; 46 47 public static final String _TEST_ANNOT_1_EXT = "00000000-0000-0000-0000-000000000021"; 48 public static final String _TEST_ANNOT_2_EXT = "00000000-0000-0000-0000-000000000022"; 49 public static final String _TEST_ANNOT_3_EXT = "00000000-0000-0000-0000-000000000023"; 50 public static final String _TEST_ANNOT_4_EXT_NOT_IN_THE_DB = "00000000-0000-0000-0000-000000000024"; 51 public static final String _TEST_ANNOT_5_EXT_TO_BE_DELETED = "00000000-0000-0000-0000-000000000025"; 52 53 54 public static final int _TEST_ANNOT_1_INT = 21; 55 public static final int _TEST_ANNOT_2_INT = 22; 56 public static final int _TEST_ANNOT_3_INT = 23; 57 public static final int _TEST_ANNOT_4_INT_NOT_IN_THE_DB = 24; 58 public static final int _TEST_ANNOT_5_INT_TO_BE_DELETED = 25; 59 60 public static final String _TEST_ANNOT_1_HEADLINE = "Sagrada Famiglia"; 61 public static final String _TEST_ANNOT_2_HEADLINE = "Gaudi"; 62 public static final String _TEST_ANNOT_3_HEADLINE = "Art Nuveau"; 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"; 63 52 public static final String _TEST_ANNOT_TO_ADD_HEADLINE = "Annotation to add to test DAO"; 64 53 65 public static final int _TEST_ANNOT_1_OWNER = 3; 66 public static final int _TEST_ANNOT_2_OWNER = 4; 67 public static final int _TEST_ANNOT_3_OWNER = 5; 68 public static final int _TEST_ANNOT_TO_ADD_OWNER = 5; 54 public static final int _TEST_ANNOT_2_OWNER = 3; 55 public static final int _TEST_ANNOT_3_OWNER = 4; 56 public static final int _TEST_ANNOT_4_OWNER = 5; 69 57 70 public static final String _TEST_ANNOT_ 1_BODY = "<html><body>some html 1</body></html>";58 public static final String _TEST_ANNOT_2_BODY = "<html><body>some html 1</body></html>"; 71 59 public static final String _TEST_ANNOT_TO_ADD_BODY = "<html><body>the stuff to be added</body></html>"; 72 60 … … 74 62 75 63 public static final String _TEST_USER_3_EXT_ID = "00000000-0000-0000-0000-000000000111"; 76 public static final String _TEST_ OWNER_4_EXT_ID = "00000000-0000-0000-0000-000000000112";77 public static final String _TEST_ OWNER_5_EXT_ID = "00000000-0000-0000-0000-000000000113";64 public static final String _TEST_USER_4_EXT_ID = "00000000-0000-0000-0000-000000000112"; 65 public static final String _TEST_USER_5_EXT_ID = "00000000-0000-0000-0000-000000000113"; 78 66 79 67 public static final String _TEST_USER_XXX_EXT_ID = "00000000-0000-0000-0000-000000000666"; -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/TestInstances.java
r3180 r3211 40 40 41 41 private Annotation makeAnnotationOne(){ 42 Annotation result = makeAnnotation(TestBackendConstants._TEST_ANNOT_ 1_BODY, TestBackendConstants._TEST_ANNOT_1_HEADLINE, TestBackendConstants._TEST_ANNOT_1_OWNER);42 Annotation result = makeAnnotation(TestBackendConstants._TEST_ANNOT_2_BODY, TestBackendConstants._TEST_ANNOT_2_HEADLINE, TestBackendConstants._TEST_ANNOT_2_OWNER); 43 43 return result; 44 44 } 45 45 46 46 private Annotation makeAnnotationToAdd(){ 47 Annotation result = makeAnnotation(TestBackendConstants._TEST_ANNOT_TO_ADD_BODY, TestBackendConstants._TEST_ANNOT_TO_ADD_HEADLINE, TestBackendConstants._TEST_ANNOT_TO_ADD_OWNER);47 Annotation result = makeAnnotation(TestBackendConstants._TEST_ANNOT_TO_ADD_BODY, TestBackendConstants._TEST_ANNOT_TO_ADD_HEADLINE, 5); 48 48 return result; 49 49 } -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/dao/impl/JdbcAnnotationDaoTest.java
r3206 r3211 48 48 TestInstances testInstances = new TestInstances(); 49 49 50 @Test 51 public void testIsNotebookInTheDataBase(){ 52 super.testIsNotebookInTheDataBase(jdbcAnnotationDao); 53 } 54 50 55 51 56 52 … … 63 59 System.out.println("getAnnotationInfos"); 64 60 List<Number> annotIds = new ArrayList<Number>(); 65 annotIds.add( TestBackendConstants._TEST_ANNOT_1_INT);66 annotIds.add( TestBackendConstants._TEST_ANNOT_2_INT);67 annotIds.add( TestBackendConstants._TEST_ANNOT_3_INT);61 annotIds.add(2); 62 annotIds.add(3); 63 annotIds.add(4); 68 64 69 65 final List<AnnotationInfo> annotationInfos = jdbcAnnotationDao.getAnnotationInfos(annotIds); 70 66 assertEquals(3, annotationInfos.size()); 71 67 72 assertEquals(TestBackendConstants._TEST_ANNOT_ 1_HEADLINE, annotationInfos.get(0).getHeadline());73 assertEquals(String.valueOf(TestBackendConstants._TEST_ANNOT_ 1_OWNER), annotationInfos.get(0).getOwner().getRef());68 assertEquals(TestBackendConstants._TEST_ANNOT_2_HEADLINE, annotationInfos.get(0).getHeadline()); 69 assertEquals(String.valueOf(TestBackendConstants._TEST_ANNOT_2_OWNER), annotationInfos.get(0).getOwner().getRef()); 74 70 //assertEquals(TestBackendConstants._TEST_ANNOT_1_TARGETS, annotationInfos.get(0).getTargetSources()); 75 71 76 assertEquals(TestBackendConstants._TEST_ANNOT_ 2_HEADLINE, annotationInfos.get(1).getHeadline());77 assertEquals(String.valueOf(TestBackendConstants._TEST_ANNOT_ 2_OWNER), annotationInfos.get(1).getOwner().getRef());72 assertEquals(TestBackendConstants._TEST_ANNOT_3_HEADLINE, annotationInfos.get(1).getHeadline()); 73 assertEquals(String.valueOf(TestBackendConstants._TEST_ANNOT_3_OWNER), annotationInfos.get(1).getOwner().getRef()); 78 74 //assertEquals(TestBackendConstants._TEST_ANNOT_2_TARGETS, annotationInfos.get(1).getTargetSources()); 79 75 80 assertEquals(TestBackendConstants._TEST_ANNOT_ 3_HEADLINE, annotationInfos.get(2).getHeadline());81 assertEquals(String.valueOf(TestBackendConstants._TEST_ANNOT_ 3_OWNER), annotationInfos.get(2).getOwner().getRef());76 assertEquals(TestBackendConstants._TEST_ANNOT_4_HEADLINE, annotationInfos.get(2).getHeadline()); 77 assertEquals(String.valueOf(TestBackendConstants._TEST_ANNOT_4_OWNER), annotationInfos.get(2).getOwner().getRef()); 82 78 //assertEquals(TestBackendConstants._TEST_ANNOT_3_TARGETS, annotationInfos.get(2).getTargetSources()); 83 79 … … 100 96 System.out.println("getAnnotationREFs"); 101 97 List<Number> annotIds = new ArrayList<Number>(); 102 annotIds.add(TestBackendConstants._TEST_ANNOT_1_INT); 103 annotIds.add(TestBackendConstants._TEST_ANNOT_2_INT); 104 annotIds.add(TestBackendConstants._TEST_ANNOT_3_INT); 105 annotIds.add(TestBackendConstants._TEST_ANNOT_4_INT_NOT_IN_THE_DB); 98 annotIds.add(2); 99 annotIds.add(3); 100 annotIds.add(4); 106 101 107 102 final List<ResourceREF> testList = jdbcAnnotationDao.getAnnotationREFs(annotIds); 108 103 assertEquals(3, testList.size()); 109 assertEquals(String.valueOf( TestBackendConstants._TEST_ANNOT_1_INT), testList.get(0).getRef());110 assertEquals(String.valueOf( TestBackendConstants._TEST_ANNOT_2_INT), testList.get(1).getRef());111 assertEquals(String.valueOf( TestBackendConstants._TEST_ANNOT_3_INT), testList.get(2).getRef());104 assertEquals(String.valueOf(2), testList.get(0).getRef()); 105 assertEquals(String.valueOf(3), testList.get(1).getRef()); 106 assertEquals(String.valueOf(4), testList.get(2).getRef()); 112 107 113 108 final List<ResourceREF> testListTwo = jdbcAnnotationDao.getAnnotationREFs(new ArrayList<Number>()); … … 127 122 System.out.println("getAnnotationID"); 128 123 129 final Number annotaionId = jdbcAnnotationDao.getAnnotationID(new AnnotationIdentifier(TestBackendConstants._TEST_ANNOT_ 1_EXT));130 assertEquals( TestBackendConstants._TEST_ANNOT_1_INT, annotaionId.intValue());131 132 final Number annotaionIdNE = jdbcAnnotationDao.getAnnotationID(new AnnotationIdentifier(TestBackendConstants._TEST_ANNOT_ 4_EXT_NOT_IN_THE_DB));124 final Number annotaionId = jdbcAnnotationDao.getAnnotationID(new AnnotationIdentifier(TestBackendConstants._TEST_ANNOT_2_EXT)); 125 assertEquals(2, annotaionId.intValue()); 126 127 final Number annotaionIdNE = jdbcAnnotationDao.getAnnotationID(new AnnotationIdentifier(TestBackendConstants._TEST_ANNOT_7_EXT_NOT_IN_DB)); 133 128 assertEquals(null, annotaionIdNE); 134 129 … … 146 141 System.out.println("getAnnotation"); 147 142 148 final Annotation annotaion = jdbcAnnotationDao.getAnnotation(TestBackendConstants._TEST_ANNOT_1_INT); 149 assertEquals(TestBackendConstants._TEST_ANNOT_1_HEADLINE, annotaion.getHeadline()); 150 assertEquals(String.valueOf(TestBackendConstants._TEST_ANNOT_1_OWNER), annotaion.getOwner().getRef()); 151 assertEquals(TestBackendConstants._TEST_ANNOT_1_BODY, annotaion.getBody().getAny().get(0)); // when the body is elaborated it will be changed 152 153 final Annotation annotaionNE = jdbcAnnotationDao.getAnnotation(TestBackendConstants._TEST_ANNOT_4_INT_NOT_IN_THE_DB); 154 assertEquals(null, annotaionNE); 155 143 final Annotation annotaion = jdbcAnnotationDao.getAnnotation(2); 144 assertEquals(TestBackendConstants._TEST_ANNOT_2_HEADLINE, annotaion.getHeadline()); 145 assertEquals(String.valueOf(TestBackendConstants._TEST_ANNOT_2_OWNER), annotaion.getOwner().getRef()); 146 assertEquals(TestBackendConstants._TEST_ANNOT_2_BODY, annotaion.getBody().getAny().get(0)); // when the body is elaborated it will be changed 147 156 148 final Annotation annotaionNull = jdbcAnnotationDao.getAnnotation(null); 157 149 assertEquals(null, annotaionNull); … … 164 156 public void testDeleteAnnotation() throws SQLException{ 165 157 System.out.println("deleteAnnotation"); 166 int result = jdbcAnnotationDao.deleteAnnotation( TestBackendConstants._TEST_ANNOT_5_INT_TO_BE_DELETED);158 int result = jdbcAnnotationDao.deleteAnnotation(5); 167 159 assertEquals(1, result); 168 160 // now, try to delete the same annotation one more time 169 161 // if it has been already deleted then the method under testing should return 0 170 result = jdbcAnnotationDao.deleteAnnotation( TestBackendConstants._TEST_ANNOT_5_INT_TO_BE_DELETED);162 result = jdbcAnnotationDao.deleteAnnotation(5); 171 163 assertEquals(0, result); 172 164 } … … 180 172 System.out.println("test_addAnnotation"); 181 173 Annotation annotationToAdd = testInstances.getAnnotationToAdd(); 182 Annotation result = jdbcAnnotationDao.addAnnotation(annotationToAdd, TestBackendConstants._TEST_ANNOT_TO_ADD_OWNER);174 Annotation result = jdbcAnnotationDao.addAnnotation(annotationToAdd, 5); 183 175 assertFalse(result == null); 184 176 … … 188 180 assertEquals(annotationToAdd.getBody().getAny().get(0), addedAnnotation.getBody().getAny().get(0)); 189 181 assertEquals(annotationToAdd.getHeadline(), addedAnnotation.getHeadline()); 190 assertEquals(String.valueOf( TestBackendConstants._TEST_ANNOT_TO_ADD_OWNER), addedAnnotation.getOwner().getRef());182 assertEquals(String.valueOf(5), addedAnnotation.getOwner().getRef()); 191 183 assertEquals(annotationToAdd.getPermissions(), addedAnnotation.getPermissions()); 192 184 assertEquals(annotationToAdd.getTargetSources(), addedAnnotation.getTargetSources()); … … 205 197 System.out.println("getAnnotationID"); 206 198 207 final AnnotationIdentifier externalId = jdbcAnnotationDao.getExternalID(TestBackendConstants._TEST_ANNOT_1_INT); 208 assertEquals(new AnnotationIdentifier(TestBackendConstants._TEST_ANNOT_1_EXT), externalId); 209 210 final AnnotationIdentifier externalIdTwo = jdbcAnnotationDao.getExternalID(TestBackendConstants._TEST_ANNOT_4_INT_NOT_IN_THE_DB); 211 assertEquals(null, externalIdTwo); 199 final AnnotationIdentifier externalId = jdbcAnnotationDao.getExternalID(2); 200 assertEquals(new AnnotationIdentifier(TestBackendConstants._TEST_ANNOT_2_EXT), externalId); 201 212 202 213 203 final AnnotationIdentifier externalIdThree = jdbcAnnotationDao.getExternalID(null); -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/dao/impl/JdbcNotebookDaoTest.java
r3206 r3211 60 60 private Mockery mockery; 61 61 62 @Test 63 public void testIsNotebookInTheDataBase(){ 64 super.testIsNotebookInTheDataBase(jdbcNotebookDao); 65 } 66 62 67 63 68 64 /** … … 148 144 149 145 // test one, 2-element notebook 150 final List<Number> annotationIDs = jdbcNotebookDao.getAnnotationIDs( TestBackendConstants._TEST_NOTEBOOK_1_INT);146 final List<Number> annotationIDs = jdbcNotebookDao.getAnnotationIDs(3); 151 147 assertEquals(2, annotationIDs.size()); 152 assertEquals( TestBackendConstants._TEST_ANNOT_1_INT, annotationIDs.get(0).intValue());153 assertEquals( TestBackendConstants._TEST_ANNOT_2_INT, annotationIDs.get(1).intValue());148 assertEquals(2, annotationIDs.get(0).intValue()); 149 assertEquals(3, annotationIDs.get(1).intValue()); 154 150 155 151 // test two, 1-element notebook 156 final List<Number> annotationIDsTwo = jdbcNotebookDao.getAnnotationIDs( TestBackendConstants._TEST_NOTEBOOK_2_INT);152 final List<Number> annotationIDsTwo = jdbcNotebookDao.getAnnotationIDs(4); 157 153 assertEquals(1, annotationIDsTwo.size()); 158 assertEquals( TestBackendConstants._TEST_ANNOT_3_INT, annotationIDsTwo.get(0).intValue());154 assertEquals(4, annotationIDsTwo.get(0).intValue()); 159 155 160 156 // test three, empty notebook 161 final List<Number> annotationIDsThree = jdbcNotebookDao.getAnnotationIDs( TestBackendConstants._TEST_NOTEBOOK_3_INT);157 final List<Number> annotationIDsThree = jdbcNotebookDao.getAnnotationIDs(5); 162 158 assertEquals(0, annotationIDsThree.size()); 163 159 … … 166 162 assertEquals(null, annotationIDsFour); 167 163 168 //test five, the notebook not in the DB169 final List<Number> annotationIDsFive = jdbcNotebookDao.getAnnotationIDs(TestBackendConstants._TEST_ANNOT_4_INT_NOT_IN_THE_DB);170 assertEquals(null, annotationIDsFive);171 164 172 165 } … … 184 177 // test One 185 178 setMockeryNotebookOne(); 186 List<ResourceREF> testList = jdbcNotebookDao.getAnnotationREFsOfNotebook( TestBackendConstants._TEST_NOTEBOOK_1_INT);179 List<ResourceREF> testList = jdbcNotebookDao.getAnnotationREFsOfNotebook(3); 187 180 assertEquals(2, testList.size()); 188 assertEquals(String.valueOf( TestBackendConstants._TEST_ANNOT_1_INT), testList.get(0).getRef());189 assertEquals(String.valueOf( TestBackendConstants._TEST_ANNOT_2_INT), testList.get(1).getRef());181 assertEquals(String.valueOf(2), testList.get(0).getRef()); 182 assertEquals(String.valueOf(3), testList.get(1).getRef()); 190 183 191 184 // test Two 192 185 setMockeryNotebookTwo(); 193 List<ResourceREF> testListTwo = jdbcNotebookDao.getAnnotationREFsOfNotebook( TestBackendConstants._TEST_NOTEBOOK_2_INT);186 List<ResourceREF> testListTwo = jdbcNotebookDao.getAnnotationREFsOfNotebook(4); 194 187 assertEquals(1, testListTwo.size()); 195 assertEquals(String.valueOf( TestBackendConstants._TEST_ANNOT_3_INT), testListTwo.get(0).getRef());188 assertEquals(String.valueOf(4), testListTwo.get(0).getRef()); 196 189 197 190 // test Three "empty" 198 191 setMockeryNotebookThreeEmpty(); 199 List<ResourceREF> testListThree = jdbcNotebookDao.getAnnotationREFsOfNotebook( TestBackendConstants._TEST_NOTEBOOK_3_INT);192 List<ResourceREF> testListThree = jdbcNotebookDao.getAnnotationREFsOfNotebook(5); 200 193 assertEquals(0, testListThree.size()); 201 202 // test Four, non-existing notebook 203 setMockeryNotebookNonExisting(); 204 List<ResourceREF> testListFour = jdbcNotebookDao.getAnnotationREFsOfNotebook(TestBackendConstants._TEST_ANNOT_4_INT_NOT_IN_THE_DB); 205 assertEquals(null, testListFour); 206 194 207 195 // test Five Null-notebook 208 196 setMockeryNotebookNonExisting(); … … 221 209 // test One 222 210 setMockeryNotebookOne(); 223 Annotations annotations = jdbcNotebookDao.getAnnotations( TestBackendConstants._TEST_NOTEBOOK_1_INT);211 Annotations annotations = jdbcNotebookDao.getAnnotations(3); 224 212 assertEquals(2, annotations.getAnnotation().size()); 225 assertEquals(String.valueOf( TestBackendConstants._TEST_ANNOT_1_INT), annotations.getAnnotation().get(0).getRef());226 assertEquals(String.valueOf( TestBackendConstants._TEST_ANNOT_2_INT), annotations.getAnnotation().get(1).getRef());213 assertEquals(String.valueOf(2), annotations.getAnnotation().get(0).getRef()); 214 assertEquals(String.valueOf(3), annotations.getAnnotation().get(1).getRef()); 227 215 228 216 // test Two 229 217 setMockeryNotebookTwo(); 230 Annotations annotationsTwo = jdbcNotebookDao.getAnnotations( TestBackendConstants._TEST_NOTEBOOK_2_INT);218 Annotations annotationsTwo = jdbcNotebookDao.getAnnotations(4); 231 219 assertEquals(1, annotationsTwo.getAnnotation().size()); 232 assertEquals(String.valueOf( TestBackendConstants._TEST_ANNOT_3_INT), annotationsTwo.getAnnotation().get(0).getRef());220 assertEquals(String.valueOf(4), annotationsTwo.getAnnotation().get(0).getRef()); 233 221 234 222 // test Three "empty" list of annotations … … 236 224 // therefore: no annotations in the notebook ==> Annotations-pbject must be null :( 237 225 setMockeryNotebookThreeEmpty(); 238 Annotations annotationsThree = jdbcNotebookDao.getAnnotations( TestBackendConstants._TEST_NOTEBOOK_3_INT);226 Annotations annotationsThree = jdbcNotebookDao.getAnnotations(5); 239 227 assertEquals(null, annotationsThree); 240 228 241 // test Five, non-existing notebook 242 setMockeryNotebookNonExisting(); 243 Annotations annotationsFour = jdbcNotebookDao.getAnnotations(TestBackendConstants._TEST_ANNOT_4_INT_NOT_IN_THE_DB); 244 assertEquals(null, annotationsFour); 245 229 246 230 // test Five Null-notebook 247 231 setMockeryNotebookNonExisting(); … … 258 242 259 243 // test One 260 NotebookInfo info = jdbcNotebookDao.getNotebookInfo(TestBackendConstants._TEST_NOTEBOOK_1_INT); 261 assertEquals(String.valueOf(TestBackendConstants._TEST_NOTEBOOK_1_EXT), info.getRef()); 262 assertEquals(String.valueOf(TestBackendConstants._TEST_NOTEBOOK_1_TITLE), info.getTitle()); 263 264 // test Two, non-existing notebook 265 NotebookInfo infoTwo = jdbcNotebookDao.getNotebookInfo(TestBackendConstants._TEST_ANNOT_4_INT_NOT_IN_THE_DB); 266 assertEquals(null, infoTwo); 267 244 NotebookInfo info = jdbcNotebookDao.getNotebookInfo(3); 245 assertEquals(TestBackendConstants._TEST_NOTEBOOK_3_EXT, info.getRef()); 246 assertEquals(TestBackendConstants._TEST_NOTEBOOK_3_TITLE, info.getTitle()); 247 248 268 249 // test Three Null-notebook 269 250 NotebookInfo infoThree = jdbcNotebookDao.getNotebookInfo(null); … … 279 260 280 261 // test One 281 Number resultOne= jdbcNotebookDao.getNotebookID(new NotebookIdentifier(TestBackendConstants._TEST_NOTEBOOK_1_EXT)); 282 assertEquals(TestBackendConstants._TEST_NOTEBOOK_1_INT, resultOne.intValue()); 283 284 // test Two, non-existing notebook 285 Number resultTwo= jdbcNotebookDao.getNotebookID(new NotebookIdentifier(TestBackendConstants._TEST_ANNOT_4_EXT_NOT_IN_THE_DB)); 286 assertEquals(null, resultTwo); 287 262 Number resultOne= jdbcNotebookDao.getNotebookID(new NotebookIdentifier(TestBackendConstants._TEST_NOTEBOOK_3_EXT)); 263 assertEquals(3, resultOne.intValue()); 264 265 288 266 // test Three Null-notebook 289 267 Number resultThree= jdbcNotebookDao.getNotebookID(null); … … 299 277 mockery.checking(new Expectations() { 300 278 { 301 oneOf(annotationDao).getExternalID( TestBackendConstants._TEST_ANNOT_1_INT);302 will(returnValue(new AnnotationIdentifier(TestBackendConstants._TEST_ANNOT_ 1_EXT)));279 oneOf(annotationDao).getExternalID(2); 280 will(returnValue(new AnnotationIdentifier(TestBackendConstants._TEST_ANNOT_2_EXT))); 303 281 304 oneOf(annotationDao).getExternalID( TestBackendConstants._TEST_ANNOT_2_INT);305 will(returnValue(new AnnotationIdentifier(TestBackendConstants._TEST_ANNOT_ 2_EXT)));282 oneOf(annotationDao).getExternalID(3); 283 will(returnValue(new AnnotationIdentifier(TestBackendConstants._TEST_ANNOT_3_EXT))); 306 284 } 307 285 }); 308 286 309 List<AnnotationIdentifier> resultOne= jdbcNotebookDao.getAnnotationExternalIDs(new NotebookIdentifier(TestBackendConstants._TEST_NOTEBOOK_1_EXT)); 310 assertEquals(TestBackendConstants._TEST_ANNOT_1_EXT, resultOne.get(0).toString()); 311 assertEquals(TestBackendConstants._TEST_ANNOT_2_EXT, resultOne.get(1).toString()); 312 313 314 List<AnnotationIdentifier> resultTwo= jdbcNotebookDao.getAnnotationExternalIDs(new NotebookIdentifier(TestBackendConstants._TEST_ANNOT_4_EXT_NOT_IN_THE_DB)); 315 assertEquals(null, resultTwo); 316 287 List<AnnotationIdentifier> resultOne= jdbcNotebookDao.getAnnotationExternalIDs(new NotebookIdentifier(TestBackendConstants._TEST_NOTEBOOK_3_EXT)); 288 assertEquals(TestBackendConstants._TEST_ANNOT_2_EXT, resultOne.get(0).toString()); 289 assertEquals(TestBackendConstants._TEST_ANNOT_3_EXT, resultOne.get(1).toString()); 290 291 292 317 293 // test Two, non-existing notebook 318 294 List<AnnotationIdentifier> resultThree= jdbcNotebookDao.getAnnotationExternalIDs(null); … … 328 304 private void setMockeryNotebookOne(){ 329 305 ResourceREF testRefOne = new ResourceREF(); 330 testRefOne.setRef(String.valueOf( TestBackendConstants._TEST_ANNOT_1_INT));306 testRefOne.setRef(String.valueOf(2)); 331 307 ResourceREF testRefTwo = new ResourceREF(); 332 testRefTwo.setRef(String.valueOf( TestBackendConstants._TEST_ANNOT_2_INT));308 testRefTwo.setRef(String.valueOf(3)); 333 309 final List<ResourceREF> testResult = Arrays.asList(new ResourceREF[] {testRefOne, testRefTwo}); 334 310 335 311 mockery.checking(new Expectations() { 336 312 { 337 oneOf(annotationDao).getAnnotationREFs(Arrays.asList(new Number[] { TestBackendConstants._TEST_ANNOT_1_INT, TestBackendConstants._TEST_ANNOT_2_INT}));313 oneOf(annotationDao).getAnnotationREFs(Arrays.asList(new Number[] {2, 3})); 338 314 will(returnValue(testResult)); 339 315 } … … 343 319 private void setMockeryNotebookTwo(){ 344 320 ResourceREF testRef = new ResourceREF(); 345 testRef.setRef(String.valueOf( TestBackendConstants._TEST_ANNOT_3_INT));321 testRef.setRef(String.valueOf(4)); 346 322 final List<ResourceREF> testResultTwo = Arrays.asList(new ResourceREF[] {testRef}); 347 323 348 324 mockery.checking(new Expectations() { 349 325 { 350 oneOf(annotationDao).getAnnotationREFs(Arrays.asList(new Number[] { TestBackendConstants._TEST_ANNOT_3_INT}));326 oneOf(annotationDao).getAnnotationREFs(Arrays.asList(new Number[] {4})); 351 327 will(returnValue(testResultTwo)); 352 328 } -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/dao/impl/JdbcResourceDaoTest.java
r3146 r3211 82 82 } 83 83 84 85 /** 86 * Test-helper of isNotebookInTheDataBase method, of class JdbcResourceDao. 87 * boolean isNotebookInTheDataBase(Number notebookID) 88 */ 89 protected <T extends JdbcResourceDao> void testIsNotebookInTheDataBase(T jdbcResourceDao) { 90 System.out.println("isNotebookInTheDataBase"); 91 92 final boolean testOne = jdbcResourceDao.isNotebookInTheDataBase(TestBackendConstants._TEST_NOTEBOOK_1_INT); 93 assertEquals(true, testOne); 94 95 final boolean testTwo = jdbcResourceDao.isNotebookInTheDataBase(TestBackendConstants._TEST_NOTEBOOK_2_INT); 96 assertEquals(true, testTwo); 97 98 final boolean testThree = jdbcResourceDao.isNotebookInTheDataBase(TestBackendConstants._TEST_NOTEBOOK_3_INT); 99 assertEquals(true, testThree); 100 101 final boolean testFour = jdbcResourceDao.isNotebookInTheDataBase(TestBackendConstants._TEST_ANNOT_4_INT_NOT_IN_THE_DB); 102 assertEquals(false, testFour); 103 104 final boolean testFive = jdbcResourceDao.isNotebookInTheDataBase(null); 105 assertEquals(false, testFive); 106 } 107 84 108 85 109 86 } -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/dao/impl/JdbcUserDaoTest.java
r3210 r3211 39 39 @Autowired 40 40 private JdbcUserDao jdbcUserDao; 41 42 43 41 TestInstances testInstances = new TestInstances(); 44 42 -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/rest/AnnotationResourceTest.java
r3206 r3211 71 71 public void testGetAnnotation() throws SQLException { 72 72 System.out.println("getAnnotation"); 73 final String annotationIdentifier= TestBackendConstants._TEST_ANNOT_ 1_EXT;74 final int annotationID = TestBackendConstants._TEST_ANNOT_1_INT;73 final String annotationIdentifier= TestBackendConstants._TEST_ANNOT_2_EXT; 74 final int annotationID = 2; 75 75 final Annotation expectedAnnotation = (new TestInstances()).getAnnotationOne(); 76 76 // the result of the mocking chain is the same as the expected annotation. … … 97 97 mockery.checking(new Expectations() { 98 98 { 99 oneOf(annotationDao).getAnnotationID(new AnnotationIdentifier(TestBackendConstants._TEST_ANNOT_5_EXT _TO_BE_DELETED));100 will(returnValue( TestBackendConstants._TEST_ANNOT_5_INT_TO_BE_DELETED));99 oneOf(annotationDao).getAnnotationID(new AnnotationIdentifier(TestBackendConstants._TEST_ANNOT_5_EXT)); 100 will(returnValue(5)); 101 101 102 oneOf(annotationDao).deleteAnnotation( TestBackendConstants._TEST_ANNOT_5_INT_TO_BE_DELETED);102 oneOf(annotationDao).deleteAnnotation(5); 103 103 will(returnValue(1)); 104 104 } 105 105 }); 106 106 107 String result = annotationResource.deleteAnnotation(TestBackendConstants._TEST_ANNOT_5_EXT _TO_BE_DELETED);107 String result = annotationResource.deleteAnnotation(TestBackendConstants._TEST_ANNOT_5_EXT); 108 108 assertEquals("1", result); 109 109 … … 112 112 mockery.checking(new Expectations() { 113 113 { 114 oneOf(annotationDao).getAnnotationID(new AnnotationIdentifier(TestBackendConstants._TEST_ANNOT_5_EXT _TO_BE_DELETED));115 will(returnValue( TestBackendConstants._TEST_ANNOT_5_INT_TO_BE_DELETED));114 oneOf(annotationDao).getAnnotationID(new AnnotationIdentifier(TestBackendConstants._TEST_ANNOT_5_EXT)); 115 will(returnValue(5)); 116 116 117 oneOf(annotationDao).deleteAnnotation( TestBackendConstants._TEST_ANNOT_5_INT_TO_BE_DELETED);117 oneOf(annotationDao).deleteAnnotation(5); 118 118 will(returnValue(0)); 119 119 } 120 120 }); 121 121 122 result = annotationResource.deleteAnnotation(TestBackendConstants._TEST_ANNOT_5_EXT _TO_BE_DELETED);122 result = annotationResource.deleteAnnotation(TestBackendConstants._TEST_ANNOT_5_EXT); 123 123 assertEquals("0", result); 124 124 } … … 136 136 addedAnnotation.setURI(annotationIdentifier.toString()); 137 137 ResourceREF ownerRef = new ResourceREF(); 138 ownerRef.setRef(String.valueOf( TestBackendConstants._TEST_ANNOT_TO_ADD_OWNER));138 ownerRef.setRef(String.valueOf(5)); 139 139 addedAnnotation.setOwner(ownerRef); 140 140 … … 142 142 mockery.checking(new Expectations() { 143 143 { 144 oneOf(userDao).getInternalID(new UserIdentifier(TestBackendConstants._TEST_ OWNER_5_EXT_ID));145 will(returnValue( TestBackendConstants._TEST_ANNOT_TO_ADD_OWNER));144 oneOf(userDao).getInternalID(new UserIdentifier(TestBackendConstants._TEST_USER_5_EXT_ID)); 145 will(returnValue(5)); 146 146 147 oneOf(annotationDao).addAnnotation(annotationToAdd, TestBackendConstants._TEST_ANNOT_TO_ADD_OWNER);147 oneOf(annotationDao).addAnnotation(annotationToAdd, 5); 148 148 will(returnValue(addedAnnotation)); 149 149 } … … 153 153 154 154 final MockHttpServletRequest httpServletRequest = new MockHttpServletRequest(); 155 httpServletRequest.setRemoteUser(TestBackendConstants._TEST_ OWNER_5_EXT_ID);155 httpServletRequest.setRemoteUser(TestBackendConstants._TEST_USER_5_EXT_ID); 156 156 annotationResource.setHttpRequest(httpServletRequest); 157 157 158 158 JAXBElement<Annotation> result = annotationResource.createAnnotation(annotationToAdd); 159 assertEquals(String.valueOf( TestBackendConstants._TEST_ANNOT_TO_ADD_OWNER), result.getValue().getOwner().getRef());159 assertEquals(String.valueOf(5), result.getValue().getOwner().getRef()); 160 160 assertEquals(annotationIdentifier.toString(), result.getValue().getURI()); 161 161 -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/rest/AnnotationsTest.java
r3206 r3211 59 59 public void testGetAnnotation() throws SQLException{ 60 60 System.out.println("testGetAnnotation"); 61 final String annotationIdentifier= TestBackendConstants._TEST_ANNOT_ 1_EXT;62 final int annotationID = TestBackendConstants._TEST_ANNOT_1_INT;61 final String annotationIdentifier= TestBackendConstants._TEST_ANNOT_2_EXT; 62 final int annotationID = 2; 63 63 final Annotation testAnnotation = new ObjectFactory().createAnnotation(); 64 64 … … 97 97 mockery.checking(new Expectations() { 98 98 { 99 oneOf(annotationDao).getAnnotationID(new AnnotationIdentifier(TestBackendConstants._TEST_ANNOT_5_EXT _TO_BE_DELETED));100 will(returnValue( TestBackendConstants._TEST_ANNOT_5_INT_TO_BE_DELETED));99 oneOf(annotationDao).getAnnotationID(new AnnotationIdentifier(TestBackendConstants._TEST_ANNOT_5_EXT)); 100 will(returnValue(5)); 101 101 102 oneOf(annotationDao).deleteAnnotation( TestBackendConstants._TEST_ANNOT_5_INT_TO_BE_DELETED);102 oneOf(annotationDao).deleteAnnotation(5); 103 103 will(returnValue(1)); 104 104 } 105 105 }); 106 106 107 final String requestUrl = "annotations/" + TestBackendConstants._TEST_ANNOT_5_EXT _TO_BE_DELETED;107 final String requestUrl = "annotations/" + TestBackendConstants._TEST_ANNOT_5_EXT; 108 108 System.out.println("requestUrl: " + requestUrl); 109 109 ClientResponse response = resource().path(requestUrl).delete(ClientResponse.class); … … 116 116 mockery.checking(new Expectations() { 117 117 { 118 oneOf(annotationDao).getAnnotationID(new AnnotationIdentifier(TestBackendConstants._TEST_ANNOT_5_EXT _TO_BE_DELETED));119 will(returnValue( TestBackendConstants._TEST_ANNOT_5_INT_TO_BE_DELETED));118 oneOf(annotationDao).getAnnotationID(new AnnotationIdentifier(TestBackendConstants._TEST_ANNOT_5_EXT)); 119 will(returnValue(5)); 120 120 121 oneOf(annotationDao).deleteAnnotation( TestBackendConstants._TEST_ANNOT_5_INT_TO_BE_DELETED);121 oneOf(annotationDao).deleteAnnotation(5); 122 122 will(returnValue(0)); 123 123 } -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/rest/NotebookResourceTest.java
r3206 r3211 143 143 System.out.println("test GetMetadata"); 144 144 145 final String notebookIdentifier= TestBackendConstants._TEST_NOTEBOOK_ 1_EXT;146 final int notebookID = TestBackendConstants._TEST_NOTEBOOK_1_INT;145 final String notebookIdentifier= TestBackendConstants._TEST_NOTEBOOK_3_EXT; 146 final int notebookID = 3; 147 147 final NotebookInfo testInfo = new ObjectFactory().createNotebookInfo(); 148 148 … … 167 167 public void testGetAllAnnotations() { 168 168 System.out.println("test getAllAnnotations"); 169 final String notebookIdentifier= TestBackendConstants._TEST_NOTEBOOK_ 1_EXT;170 final AnnotationIdentifier aIdOne= new AnnotationIdentifier(TestBackendConstants._TEST_ANNOT_ 1_EXT);171 final AnnotationIdentifier aIdTwo= new AnnotationIdentifier(TestBackendConstants._TEST_ANNOT_ 2_EXT);169 final String notebookIdentifier= TestBackendConstants._TEST_NOTEBOOK_3_EXT; 170 final AnnotationIdentifier aIdOne= new AnnotationIdentifier(TestBackendConstants._TEST_ANNOT_2_EXT); 171 final AnnotationIdentifier aIdTwo= new AnnotationIdentifier(TestBackendConstants._TEST_ANNOT_3_EXT); 172 172 final List<AnnotationIdentifier> annotationIds = new ArrayList<AnnotationIdentifier>(); 173 173 annotationIds.add(aIdOne); -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/rest/NotebooksTest.java
r3191 r3211 138 138 System.out.println("test GetMetadata"); 139 139 140 final String notebookIdentifier= TestBackendConstants._TEST_NOTEBOOK_ 1_EXT;141 final int notebookID = TestBackendConstants._TEST_NOTEBOOK_1_INT;140 final String notebookIdentifier= TestBackendConstants._TEST_NOTEBOOK_3_EXT; 141 final int notebookID = 3; 142 142 final NotebookInfo testInfo = new ObjectFactory().createNotebookInfo(); 143 143 … … 177 177 public void testGetAllAnnotations() { 178 178 System.out.println("test GetMetadata"); 179 final String notebookIdentifier= TestBackendConstants._TEST_NOTEBOOK_ 1_EXT;180 final AnnotationIdentifier aIdOne= new AnnotationIdentifier(TestBackendConstants._TEST_ANNOT_ 1_EXT);181 final AnnotationIdentifier aIdTwo= new AnnotationIdentifier(TestBackendConstants._TEST_ANNOT_ 2_EXT);179 final String notebookIdentifier= TestBackendConstants._TEST_NOTEBOOK_3_EXT; 180 final AnnotationIdentifier aIdOne= new AnnotationIdentifier(TestBackendConstants._TEST_ANNOT_2_EXT); 181 final AnnotationIdentifier aIdTwo= new AnnotationIdentifier(TestBackendConstants._TEST_ANNOT_3_EXT); 182 182 final List<AnnotationIdentifier> annotationIds = new ArrayList<AnnotationIdentifier>(); 183 183 annotationIds.add(aIdOne); -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/resources/test-data/InsertTestData.sql
r3210 r3211 20 20 INSERT INTO principal (principal_name, external_id) VALUES ('b user', '00000000-0000-0000-0000-000000000004');-- 2 21 21 22 INSERT INTO notebook (title, owner_id, external_id) VALUES ('a notebook', 2, '00000000-0000-0000-0000-000000000001'); 22 INSERT INTO notebook (title, owner_id, external_id) VALUES ('a notebook', 2, '00000000-0000-0000-0000-000000000001'); -- 1 23 23 -- INSERT INTO notebook (title, owner_id, external_id) VALUES ('a notebook', 1, 1); 24 INSERT INTO annotation (owner_id,headline,body_xml, external_id) VALUES (1, 'a headline','<html><body>some html</body></html>', '00000000-0000-0000-0000-000000000005'); 24 INSERT INTO annotation (owner_id,headline,body_xml, external_id) VALUES (1, 'a headline','<html><body>some html</body></html>', '00000000-0000-0000-0000-000000000005'); --1 25 25 26 INSERT INTO notebook (title, owner_id, external_id) VALUES ('a second notebook', 2, '00000000-0000-0000-0000-000000000002'); 26 INSERT INTO notebook (title, owner_id, external_id) VALUES ('a second notebook', 2, '00000000-0000-0000-0000-000000000002'); --2 27 27 -- INSERT INTO notebook (title, owner_id, external_id) VALUES ('a second notebook', 1, 2); 28 28 INSERT INTO notebooks_annotations (notebook_id,annotation_id) VALUES (1,1); … … 36 36 INSERT INTO principal (principal_name, external_id) VALUES ('Olha', '00000000-0000-0000-0000-000000000113'); -- 5 37 37 38 INSERT INTO notebook ( notebook_id, title, owner_id, external_id) VALUES (11, 'Notebook 11', 3, '00000000-0000-0000-0000-000000000011');39 INSERT INTO notebook ( notebook_id, title, owner_id, external_id) VALUES (12, 'Notebook 12', 4, '00000000-0000-0000-0000-000000000012');40 INSERT INTO notebook ( notebook_id, title, owner_id, external_id) VALUES (13, 'Notebook 13', 5, '00000000-0000-0000-0000-000000000013');38 INSERT INTO notebook (title, owner_id, external_id) VALUES ('Notebook 3', 3, '00000000-0000-0000-0000-000000000011'); -- 3 39 INSERT INTO notebook (title, owner_id, external_id) VALUES ('Notebook 4', 4, '00000000-0000-0000-0000-000000000012'); --4 40 INSERT INTO notebook (title, owner_id, external_id) VALUES ('Notebook 5', 5, '00000000-0000-0000-0000-000000000013'); --5 41 41 42 INSERT INTO annotation ( annotation_id, owner_id,headline,body_xml, external_id) VALUES (21, 3, 'Sagrada Famiglia','<html><body>some html 1</body></html>', '00000000-0000-0000-0000-000000000021');43 INSERT INTO annotation ( annotation_id, owner_id,headline,body_xml, external_id) VALUES (22, 4, 'Gaudi','<html><body>some html 2 </body></html>', '00000000-0000-0000-0000-000000000022');44 INSERT INTO annotation ( annotation_id, owner_id,headline,body_xml, external_id) VALUES (23, 5, 'Art Nuveau','<html><body>some html 3</body></html>', '00000000-0000-0000-0000-000000000023');45 INSERT INTO annotation ( annotation_id, owner_id,headline,body_xml, external_id) VALUES (25, 3, 'Annotation to delete','<html><body>some html 4</body></html>', '00000000-0000-0000-0000-000000000025');42 INSERT INTO annotation (owner_id,headline,body_xml, external_id) VALUES (3, 'Sagrada Famiglia','<html><body>some html 1</body></html>', '00000000-0000-0000-0000-000000000021'); --2 43 INSERT INTO annotation (owner_id,headline,body_xml, external_id) VALUES (4, 'Gaudi','<html><body>some html 2 </body></html>', '00000000-0000-0000-0000-000000000022'); --3 44 INSERT INTO annotation (owner_id,headline,body_xml, external_id) VALUES (5, 'Art Nuveau','<html><body>some html 3</body></html>', '00000000-0000-0000-0000-000000000023'); --4 45 INSERT INTO annotation (owner_id,headline,body_xml, external_id) VALUES (3, 'Annotation to delete','<html><body>some html 4</body></html>', '00000000-0000-0000-0000-000000000024'); --5 46 46 47 47 48 48 49 INSERT INTO notebooks_annotations (notebook_id,annotation_id) VALUES ( 11,21);50 INSERT INTO notebooks_annotations (notebook_id,annotation_id) VALUES ( 11,22);51 INSERT INTO notebooks_annotations (notebook_id,annotation_id) VALUES ( 12,23);49 INSERT INTO notebooks_annotations (notebook_id,annotation_id) VALUES (3,2); 50 INSERT INTO notebooks_annotations (notebook_id,annotation_id) VALUES (3,3); 51 INSERT INTO notebooks_annotations (notebook_id,annotation_id) VALUES (4,4); 52 52 53 53 … … 77 77 78 78 79 INSERT INTO target_source (external_id, link_uri, version_id) VALUES ('00000000-0000-0000-0000-000000000031', 'http://nl.wikipedia.org/wiki/Sagrada_Fam%C3%ADlia', 1); 80 INSERT INTO target_source (external_id, link_uri, version_id) VALUES ('00000000-0000-0000-0000-000000000032', 'http://nl.wikipedia.org/wiki/Antoni_Gaud%C3%AD', 3); 81 INSERT INTO target_source (external_id, link_uri, version_id) VALUES ('00000000-0000-0000-0000-000000000033', 'http://en.wikipedia.org/wiki/Art_Nouveau', 4); 79 INSERT INTO target_source (external_id, link_uri, version_id) VALUES ('00000000-0000-0000-0000-000000000031', 'http://nl.wikipedia.org/wiki/Sagrada_Fam%C3%ADlia', 1); -- 1 80 INSERT INTO target_source (external_id, link_uri, version_id) VALUES ('00000000-0000-0000-0000-000000000032', 'http://nl.wikipedia.org/wiki/Antoni_Gaud%C3%AD', 3); --2 81 INSERT INTO target_source (external_id, link_uri, version_id) VALUES ('00000000-0000-0000-0000-000000000033', 'http://en.wikipedia.org/wiki/Art_Nouveau', 4); --3 82 82 83 -- CREATE TABLE annotations_target_sources ( 84 -- annotation_id integer REFERENCES annotation(annotation_id), -- defining a foreign key: there must be a uniquely defined row in "annotation", that is defined by "annotation_id" 85 -- source_id integer REFERENCES target_source(source_id), 86 -- unique(annotation_id, source_id), 87 -- ); 88 89 -- INSERT INTO annotations_target_sources (annotation_id, source_id) VALUES (2, 1); 90 -- INSERT INTO annotations_target_sources (annotation_id, source_id) VALUES (2, 2); 91 -- INSERT INTO annotations_target_sources (annotation_id, source_id) VALUES (3, 2); 92 -- INSERT INTO annotations_target_sources (annotation_id, source_id) VALUES (4, 3); 93
Note: See TracChangeset
for help on using the changeset viewer.