Ignore:
Timestamp:
12/10/13 15:18:42 (10 years ago)
Author:
olhsha
Message:

lintegrity unit test reconstructed so it does not mock any more. getAnnotation works (the others are "ignored"). Needs refactoring (the subdirectory with beans and DummySecurityFilter? class.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/TestInstances.java

    r4146 r4173  
    2323import eu.dasish.annotation.schema.TargetInfo;
    2424import eu.dasish.annotation.schema.TargetInfoList;
     25import javax.xml.datatype.DatatypeConfigurationException;
     26import javax.xml.datatype.DatatypeFactory;
    2527
    2628/**
     
    3335    final private Annotation _annotationToAdd;
    3436   
    35     public TestInstances(){
    36         _annotationOne = makeAnnotationOne();
    37         _annotationToAdd = makeAnnotationToAdd();   
     37    public TestInstances(String baseURI){
     38        _annotationOne = makeAnnotationOne(baseURI);
     39        _annotationToAdd = makeAnnotationToAdd(baseURI);   
    3840    }
    3941   
    4042   
    41     private Annotation makeAnnotationOne(){
    42         Annotation result = makeAnnotation(TestBackendConstants._TEST_ANNOT_2_BODY, TestBackendConstants._TEST_BODY_MIMETYPE_HTML, TestBackendConstants._TEST_ANNOT_2_HEADLINE, TestBackendConstants._TEST_ANNOT_2_OWNER);
     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);
     45        try {
     46        result.setLastModified(DatatypeFactory.newInstance().newXMLGregorianCalendar(TestBackendConstants._TEST_ANNOT_2_TIME_STAMP));
     47        } catch (DatatypeConfigurationException dce) {
     48            System.out.println("wrongly-formatted test timestamp "+TestBackendConstants._TEST_ANNOT_2_TIME_STAMP);
     49            result.setLastModified(null);
     50        }
    4351        return result;
    4452    }
    4553   
    46     private Annotation makeAnnotationToAdd(){
    47        Annotation result = makeAnnotation(TestBackendConstants._TEST_ANNOT_TO_ADD_BODY, TestBackendConstants._TEST_BODY_MIMETYPE_TEXT, TestBackendConstants._TEST_ANNOT_TO_ADD_HEADLINE, 5);
     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);
    4856       
    4957       TargetInfo TargetInfo =  new TargetInfo();
     
    6068   
    6169
    62     private Annotation makeAnnotation(String bodyTxt, String bodyMimeType, String headline, int ownerId){
     70    private Annotation makeAnnotation(String baseURI, String bodyTxt, String bodyMimeType, String headline, String ownerID){
    6371        Annotation result = new Annotation();
    6472        AnnotationBody body = new AnnotationBody();
     
    7078       
    7179        result.setHeadline(headline);
    72         result.setOwnerRef(String.valueOf(ownerId));
     80        result.setOwnerRef(baseURI+"users/"+ownerID);
    7381       
    7482        result.setLastModified(null);
Note: See TracChangeset for help on using the changeset viewer.