Changeset 3211


Ignore:
Timestamp:
07/30/13 15:04:02 (11 years ago)
Author:
olhsha
Message:

reparing test data base so that internal id-a are not added any more, but generated internally by the DB. Data in testing files are changed correspondingly

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  
    1414Any value defined here will override the pom.xml file value but is only applicable to the current project.
    1515-->
    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>
    1718    </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>
    2519</project-shared-configuration>
  • DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/sql/DashishAnnotatorCreate.sql

    r3206 r3211  
    167167CREATE TABLE annotations_target_sources (
    168168   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),
    171171);
    172172
  • DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/TestBackendConstants.java

    r3210 r3211  
    3333   
    3434    // 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";
    3838   
    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";
    4242   
    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";
    6352    public static final String _TEST_ANNOT_TO_ADD_HEADLINE = "Annotation to add to test DAO";
    6453   
    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;
    6957   
    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>";
    7159    public static final String _TEST_ANNOT_TO_ADD_BODY = "<html><body>the stuff to be added</body></html>";
    7260   
     
    7462   
    7563    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"; 
    7866   
    7967    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  
    4040   
    4141    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);
    4343        return result;
    4444    }
    4545   
    4646    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);
    4848        return result;
    4949    }
  • DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/dao/impl/JdbcAnnotationDaoTest.java

    r3206 r3211  
    4848    TestInstances testInstances = new TestInstances();
    4949   
    50     @Test
    51     public void testIsNotebookInTheDataBase(){
    52         super.testIsNotebookInTheDataBase(jdbcAnnotationDao);
    53     }
    54    
     50   
    5551 
    5652
     
    6359        System.out.println("getAnnotationInfos");
    6460        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);
    6864       
    6965        final List<AnnotationInfo> annotationInfos = jdbcAnnotationDao.getAnnotationInfos(annotIds);
    7066        assertEquals(3, annotationInfos.size());
    7167       
    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());
    7470        //assertEquals(TestBackendConstants._TEST_ANNOT_1_TARGETS, annotationInfos.get(0).getTargetSources());
    7571       
    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());
    7874        //assertEquals(TestBackendConstants._TEST_ANNOT_2_TARGETS, annotationInfos.get(1).getTargetSources());
    7975       
    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());
    8278        //assertEquals(TestBackendConstants._TEST_ANNOT_3_TARGETS, annotationInfos.get(2).getTargetSources());
    8379       
     
    10096        System.out.println("getAnnotationREFs");
    10197        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);
    106101       
    107102        final  List<ResourceREF> testList = jdbcAnnotationDao.getAnnotationREFs(annotIds);
    108103        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());
    112107       
    113108        final  List<ResourceREF> testListTwo = jdbcAnnotationDao.getAnnotationREFs(new ArrayList<Number>());
     
    127122       System.out.println("getAnnotationID");
    128123       
    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));
    133128       assertEquals(null, annotaionIdNE);   
    134129     
     
    146141       System.out.println("getAnnotation");
    147142       
    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             
    156148       final Annotation annotaionNull = jdbcAnnotationDao.getAnnotation(null);
    157149       assertEquals(null, annotaionNull);
     
    164156    public void testDeleteAnnotation() throws SQLException{
    165157        System.out.println("deleteAnnotation");       
    166         int result = jdbcAnnotationDao.deleteAnnotation(TestBackendConstants._TEST_ANNOT_5_INT_TO_BE_DELETED);
     158        int result = jdbcAnnotationDao.deleteAnnotation(5);
    167159        assertEquals(1, result);
    168160        // now, try to delete the same annotation one more time
    169161        // 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);
    171163        assertEquals(0, result);
    172164    }
     
    180172        System.out.println("test_addAnnotation");
    181173        Annotation annotationToAdd = testInstances.getAnnotationToAdd();
    182         Annotation result = jdbcAnnotationDao.addAnnotation(annotationToAdd, TestBackendConstants._TEST_ANNOT_TO_ADD_OWNER);
     174        Annotation result = jdbcAnnotationDao.addAnnotation(annotationToAdd, 5);
    183175        assertFalse(result == null);
    184176       
     
    188180        assertEquals(annotationToAdd.getBody().getAny().get(0), addedAnnotation.getBody().getAny().get(0));
    189181        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());
    191183        assertEquals(annotationToAdd.getPermissions(), addedAnnotation.getPermissions());
    192184        assertEquals(annotationToAdd.getTargetSources(), addedAnnotation.getTargetSources());
     
    205197       System.out.println("getAnnotationID");
    206198       
    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       
    212202       
    213203       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  
    6060    private Mockery mockery;
    6161
    62     @Test
    63     public void testIsNotebookInTheDataBase(){
    64         super.testIsNotebookInTheDataBase(jdbcNotebookDao);
    65     }
    66    
     62   
    6763   
    6864    /**
     
    148144       
    149145        // 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);
    151147        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());
    154150       
    155151        // 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);
    157153        assertEquals(1, annotationIDsTwo.size());
    158         assertEquals(TestBackendConstants._TEST_ANNOT_3_INT, annotationIDsTwo.get(0).intValue());
     154        assertEquals(4, annotationIDsTwo.get(0).intValue());
    159155       
    160156        // test three, empty notebook
    161         final List<Number> annotationIDsThree = jdbcNotebookDao.getAnnotationIDs(TestBackendConstants._TEST_NOTEBOOK_3_INT);
     157        final List<Number> annotationIDsThree = jdbcNotebookDao.getAnnotationIDs(5);
    162158        assertEquals(0, annotationIDsThree.size());
    163159       
     
    166162        assertEquals(null, annotationIDsFour);
    167163       
    168         //test five, the notebook not in the DB
    169         final List<Number> annotationIDsFive = jdbcNotebookDao.getAnnotationIDs(TestBackendConstants._TEST_ANNOT_4_INT_NOT_IN_THE_DB);
    170         assertEquals(null, annotationIDsFive);
    171164       
    172165    }
     
    184177        // test One         
    185178        setMockeryNotebookOne();         
    186         List<ResourceREF> testList = jdbcNotebookDao.getAnnotationREFsOfNotebook(TestBackendConstants._TEST_NOTEBOOK_1_INT);
     179        List<ResourceREF> testList = jdbcNotebookDao.getAnnotationREFsOfNotebook(3);
    187180        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());
    190183       
    191184        // test Two
    192185        setMockeryNotebookTwo();
    193         List<ResourceREF> testListTwo = jdbcNotebookDao.getAnnotationREFsOfNotebook(TestBackendConstants._TEST_NOTEBOOK_2_INT);
     186        List<ResourceREF> testListTwo = jdbcNotebookDao.getAnnotationREFsOfNotebook(4);
    194187        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());
    196189       
    197190        // test Three  "empty"
    198191        setMockeryNotebookThreeEmpty();         
    199         List<ResourceREF> testListThree = jdbcNotebookDao.getAnnotationREFsOfNotebook(TestBackendConstants._TEST_NOTEBOOK_3_INT);
     192        List<ResourceREF> testListThree = jdbcNotebookDao.getAnnotationREFsOfNotebook(5);
    200193        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       
    207195        // test Five Null-notebook
    208196        setMockeryNotebookNonExisting();
     
    221209         // test One
    222210        setMockeryNotebookOne();
    223         Annotations annotations = jdbcNotebookDao.getAnnotations(TestBackendConstants._TEST_NOTEBOOK_1_INT);
     211        Annotations annotations = jdbcNotebookDao.getAnnotations(3);
    224212        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());
    227215       
    228216        // test Two
    229217        setMockeryNotebookTwo();
    230         Annotations annotationsTwo = jdbcNotebookDao.getAnnotations(TestBackendConstants._TEST_NOTEBOOK_2_INT);
     218        Annotations annotationsTwo = jdbcNotebookDao.getAnnotations(4);
    231219        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());
    233221       
    234222        // test Three  "empty" list of annotations
     
    236224        // therefore: no annotations in the notebook ==> Annotations-pbject must be null :(
    237225        setMockeryNotebookThreeEmpty();
    238         Annotations annotationsThree = jdbcNotebookDao.getAnnotations(TestBackendConstants._TEST_NOTEBOOK_3_INT);
     226        Annotations annotationsThree = jdbcNotebookDao.getAnnotations(5);
    239227        assertEquals(null, annotationsThree);
    240228       
    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       
    246230        // test Five Null-notebook
    247231        setMockeryNotebookNonExisting();
     
    258242       
    259243         // 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               
    268249        // test Three Null-notebook
    269250       NotebookInfo infoThree = jdbcNotebookDao.getNotebookInfo(null);
     
    279260       
    280261         // 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     
    288266        // test Three Null-notebook
    289267       Number resultThree= jdbcNotebookDao.getNotebookID(null);
     
    299277        mockery.checking(new Expectations() {
    300278            {
    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)));
    303281             
    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)));
    306284            }
    307285        });
    308286       
    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     
    317293        // test Two, non-existing notebook
    318294        List<AnnotationIdentifier> resultThree= jdbcNotebookDao.getAnnotationExternalIDs(null);
     
    328304    private void setMockeryNotebookOne(){       
    329305        ResourceREF testRefOne = new ResourceREF();
    330         testRefOne.setRef(String.valueOf(TestBackendConstants._TEST_ANNOT_1_INT));
     306        testRefOne.setRef(String.valueOf(2));
    331307        ResourceREF testRefTwo = new ResourceREF();
    332         testRefTwo.setRef(String.valueOf(TestBackendConstants._TEST_ANNOT_2_INT));
     308        testRefTwo.setRef(String.valueOf(3));
    333309        final List<ResourceREF> testResult = Arrays.asList(new ResourceREF[] {testRefOne, testRefTwo});
    334310       
    335311        mockery.checking(new Expectations() {
    336312            {
    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}));
    338314              will(returnValue(testResult));
    339315            }
     
    343319     private void setMockeryNotebookTwo(){
    344320        ResourceREF testRef = new ResourceREF();
    345         testRef.setRef(String.valueOf(TestBackendConstants._TEST_ANNOT_3_INT));
     321        testRef.setRef(String.valueOf(4));
    346322        final List<ResourceREF> testResultTwo = Arrays.asList(new ResourceREF[] {testRef});
    347323       
    348324        mockery.checking(new Expectations() {
    349325            {
    350               oneOf(annotationDao).getAnnotationREFs(Arrays.asList(new Number[] {TestBackendConstants._TEST_ANNOT_3_INT}));
     326              oneOf(annotationDao).getAnnotationREFs(Arrays.asList(new Number[] {4}));
    351327              will(returnValue(testResultTwo));
    352328            }
  • DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/dao/impl/JdbcResourceDaoTest.java

    r3146 r3211  
    8282    }
    8383   
    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   
    10885
    10986}
  • DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/dao/impl/JdbcUserDaoTest.java

    r3210 r3211  
    3939    @Autowired
    4040    private JdbcUserDao jdbcUserDao;
    41    
    42  
    4341    TestInstances testInstances = new TestInstances();
    4442
  • DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/rest/AnnotationResourceTest.java

    r3206 r3211  
    7171    public void testGetAnnotation() throws SQLException {
    7272        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;       
    7575        final Annotation expectedAnnotation = (new TestInstances()).getAnnotationOne();
    7676        // the result of the mocking chain is the same as the expected annotation.       
     
    9797        mockery.checking(new Expectations() {
    9898            {
    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));
    101101               
    102                 oneOf(annotationDao).deleteAnnotation(TestBackendConstants._TEST_ANNOT_5_INT_TO_BE_DELETED);
     102                oneOf(annotationDao).deleteAnnotation(5);
    103103                will(returnValue(1));
    104104            }
    105105        });
    106106       
    107         String result = annotationResource.deleteAnnotation(TestBackendConstants._TEST_ANNOT_5_EXT_TO_BE_DELETED);
     107        String result = annotationResource.deleteAnnotation(TestBackendConstants._TEST_ANNOT_5_EXT);
    108108        assertEquals("1", result);
    109109       
     
    112112        mockery.checking(new Expectations() {
    113113            {
    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));
    116116               
    117                 oneOf(annotationDao).deleteAnnotation(TestBackendConstants._TEST_ANNOT_5_INT_TO_BE_DELETED);
     117                oneOf(annotationDao).deleteAnnotation(5);
    118118                will(returnValue(0));
    119119            }
    120120        });
    121121       
    122         result = annotationResource.deleteAnnotation(TestBackendConstants._TEST_ANNOT_5_EXT_TO_BE_DELETED);
     122        result = annotationResource.deleteAnnotation(TestBackendConstants._TEST_ANNOT_5_EXT);
    123123        assertEquals("0", result);
    124124    }
     
    136136        addedAnnotation.setURI(annotationIdentifier.toString());
    137137        ResourceREF ownerRef = new ResourceREF();
    138         ownerRef.setRef(String.valueOf(TestBackendConstants._TEST_ANNOT_TO_ADD_OWNER));
     138        ownerRef.setRef(String.valueOf(5));
    139139        addedAnnotation.setOwner(ownerRef);
    140140       
     
    142142        mockery.checking(new Expectations() {
    143143            {
    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));
    146146               
    147                 oneOf(annotationDao).addAnnotation(annotationToAdd, TestBackendConstants._TEST_ANNOT_TO_ADD_OWNER);
     147                oneOf(annotationDao).addAnnotation(annotationToAdd, 5);
    148148                will(returnValue(addedAnnotation));
    149149            }
     
    153153       
    154154        final MockHttpServletRequest httpServletRequest = new MockHttpServletRequest();
    155         httpServletRequest.setRemoteUser(TestBackendConstants._TEST_OWNER_5_EXT_ID);       
     155        httpServletRequest.setRemoteUser(TestBackendConstants._TEST_USER_5_EXT_ID);       
    156156        annotationResource.setHttpRequest(httpServletRequest);
    157157       
    158158        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());
    160160        assertEquals(annotationIdentifier.toString(), result.getValue().getURI());
    161161       
  • DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/rest/AnnotationsTest.java

    r3206 r3211  
    5959    public void testGetAnnotation() throws SQLException{
    6060        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;
    6363        final Annotation testAnnotation = new ObjectFactory().createAnnotation();
    6464       
     
    9797        mockery.checking(new Expectations() {
    9898            {
    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));
    101101               
    102                 oneOf(annotationDao).deleteAnnotation(TestBackendConstants._TEST_ANNOT_5_INT_TO_BE_DELETED);
     102                oneOf(annotationDao).deleteAnnotation(5);
    103103                will(returnValue(1));
    104104            }
    105105        });
    106106       
    107         final String requestUrl = "annotations/" + TestBackendConstants._TEST_ANNOT_5_EXT_TO_BE_DELETED;
     107        final String requestUrl = "annotations/" + TestBackendConstants._TEST_ANNOT_5_EXT;
    108108        System.out.println("requestUrl: " + requestUrl);
    109109        ClientResponse response = resource().path(requestUrl).delete(ClientResponse.class);
     
    116116        mockery.checking(new Expectations() {
    117117            {
    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));
    120120               
    121                 oneOf(annotationDao).deleteAnnotation(TestBackendConstants._TEST_ANNOT_5_INT_TO_BE_DELETED);
     121                oneOf(annotationDao).deleteAnnotation(5);
    122122                will(returnValue(0));
    123123            }
  • DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/rest/NotebookResourceTest.java

    r3206 r3211  
    143143        System.out.println("test GetMetadata");
    144144       
    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;
    147147        final NotebookInfo testInfo = new ObjectFactory().createNotebookInfo();
    148148       
     
    167167    public void testGetAllAnnotations() {
    168168        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);
    172172        final List<AnnotationIdentifier> annotationIds = new ArrayList<AnnotationIdentifier>();
    173173        annotationIds.add(aIdOne);
  • DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/rest/NotebooksTest.java

    r3191 r3211  
    138138        System.out.println("test GetMetadata");
    139139       
    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;
    142142        final NotebookInfo testInfo = new ObjectFactory().createNotebookInfo();
    143143       
     
    177177    public void testGetAllAnnotations() {
    178178        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);
    182182        final List<AnnotationIdentifier> annotationIds = new ArrayList<AnnotationIdentifier>();
    183183        annotationIds.add(aIdOne);
  • DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/resources/test-data/InsertTestData.sql

    r3210 r3211  
    2020INSERT INTO principal (principal_name, external_id) VALUES ('b user', '00000000-0000-0000-0000-000000000004');-- 2
    2121
    22 INSERT INTO notebook (title, owner_id, external_id) VALUES ('a notebook', 2, '00000000-0000-0000-0000-000000000001');
     22INSERT INTO notebook (title, owner_id, external_id) VALUES ('a notebook', 2, '00000000-0000-0000-0000-000000000001'); -- 1
    2323-- 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');
     24INSERT 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
    2525
    26 INSERT INTO notebook (title, owner_id, external_id) VALUES ('a second notebook', 2, '00000000-0000-0000-0000-000000000002');
     26INSERT INTO notebook (title, owner_id, external_id) VALUES ('a second notebook', 2, '00000000-0000-0000-0000-000000000002'); --2
    2727-- INSERT INTO notebook (title, owner_id, external_id) VALUES ('a second notebook', 1, 2);
    2828INSERT INTO notebooks_annotations (notebook_id,annotation_id) VALUES (1,1);
     
    3636INSERT INTO principal (principal_name, external_id) VALUES ('Olha', '00000000-0000-0000-0000-000000000113'); -- 5
    3737
    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');
     38INSERT INTO notebook (title, owner_id, external_id) VALUES ('Notebook 3', 3, '00000000-0000-0000-0000-000000000011'); -- 3
     39INSERT INTO notebook (title, owner_id, external_id) VALUES ('Notebook 4', 4, '00000000-0000-0000-0000-000000000012'); --4
     40INSERT INTO notebook (title, owner_id, external_id) VALUES ('Notebook 5', 5, '00000000-0000-0000-0000-000000000013'); --5
    4141
    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');
     42INSERT 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
     43INSERT 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
     44INSERT 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
     45INSERT 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
    4646
    4747
    4848
    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);
     49INSERT INTO notebooks_annotations (notebook_id,annotation_id) VALUES (3,2);
     50INSERT INTO notebooks_annotations (notebook_id,annotation_id) VALUES (3,3);
     51INSERT INTO notebooks_annotations (notebook_id,annotation_id) VALUES (4,4);
    5252
    5353
     
    7777
    7878
    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);
     79INSERT 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
     80INSERT 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
     81INSERT INTO target_source (external_id, link_uri, version_id) VALUES ('00000000-0000-0000-0000-000000000033', 'http://en.wikipedia.org/wiki/Art_Nouveau', 4); --3
    8282
     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.