Changeset 3190


Ignore:
Timestamp:
07/25/13 09:19:47 (11 years ago)
Author:
olhsha
Message:

getting getAllNotebooks is tested fully. Serialization works well for the output list of annotation identifiers.

Location:
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/rest/NotebookResource.java

    r3189 r3190  
    135135            @DefaultValue("0") @QueryParam(value = "orderingMode") final int orderingMode) {
    136136        List<AnnotationIdentifier> annotationIds  = notebookDao.getAnnotationExternalIDs(new NotebookIdentifier(notebookId));               
     137       
    137138        return annotationIds;
    138139        // TODO implement optional parameters!!
  • DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/rest/AnnotationsTest.java

    r3186 r3190  
    2525import eu.dasish.annotation.backend.identifiers.AnnotationIdentifier;
    2626import eu.dasish.annotation.schema.Annotation;
    27 import eu.dasish.annotation.schema.Annotation;
    2827import eu.dasish.annotation.schema.ObjectFactory;
    2928import java.sql.SQLException;
    3029import javax.ws.rs.core.GenericEntity;
    3130import javax.ws.rs.core.MediaType;
    32 import javax.xml.bind.JAXBElement;
    3331import org.jmock.Expectations;
    3432import org.junit.Test;
  • DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/rest/NotebookResourceTest.java

    r3189 r3190  
    5454    @Autowired
    5555    private NotebookDao notebookDao;
    56     @Autowired
    57     private AnnotationDao annotationDao;   
    5856    @Autowired
    5957    private NotebookResource notebookResource;
     
    167165   
    168166    @Test
    169     public void testAllAnnotations() {
     167    public void testGetAllAnnotations() {
    170168        System.out.println("test getAllAnnotations");       
    171169        final String notebookIdentifier= TestBackendConstants._TEST_NOTEBOOK_1_EXT;
  • DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/rest/NotebooksTest.java

    r3189 r3190  
    2626import eu.dasish.annotation.backend.identifiers.NotebookIdentifier;
    2727import eu.dasish.annotation.backend.identifiers.UserIdentifier;
    28 import eu.dasish.annotation.schema.Annotation;
    2928import eu.dasish.annotation.schema.Notebook;
    3029import eu.dasish.annotation.schema.NotebookInfo;
     
    3635import java.util.List;
    3736import java.util.UUID;
     37import javax.ws.rs.core.EntityTag;
    3838import javax.ws.rs.core.MediaType;
    3939import javax.xml.bind.JAXBElement;
     
    175175     */
    176176    @Test
    177     @Ignore
    178177    public void testGetAllAnnotations() {
    179         System.out.println("testGetAllAnnotations");
    180        
    181         System.out.println("test GetMetadata");
    182        
    183         final String notebookIdentifier= TestBackendConstants._TEST_NOTEBOOK_1_EXT;
    184         /*final int notebookID = TestBackendConstants._TEST_NOTEBOOK_1_INT;
    185         final NotebookInfo testInfo = new ObjectFactory().createNotebookInfo();
    186        
    187         mockery.checking(new Expectations() {
    188             {
    189                 oneOf(notebookDao).getNotebookID(new NotebookIdentifier(notebookIdentifier));               
    190                 will(returnValue(notebookID));
     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);
     182        final List<AnnotationIdentifier> annotationIds = new ArrayList<AnnotationIdentifier>();
     183        annotationIds.add(aIdOne);
     184        annotationIds.add(aIdTwo);
     185       
     186        mockery.checking(new Expectations() {
     187            {
     188                oneOf(notebookDao).getAnnotationExternalIDs(new NotebookIdentifier(notebookIdentifier));               
     189                will(returnValue(annotationIds));
    191190               
    192                 oneOf(notebookDao).getNotebookInfo(notebookID);
    193                will(returnValue(testInfo));
    194             }
    195         });*/
     191            }
     192        });
    196193       
    197194        final String requestUrl = "notebooks/"+notebookIdentifier;
    198        
    199        
    200195        ClientResponse response = resource().path(requestUrl)
    201196                .queryParam("maximumAnnotations", "123")
     
    205200                .get(ClientResponse.class);
    206201        System.out.println("requestUrl: " + requestUrl);
    207        
    208        
    209         assertEquals(200, response.getStatus());
    210        
     202        assertEquals(200, response.getStatus());
     203        List<AnnotationIdentifier> result = response.getEntity(new GenericType<List<AnnotationIdentifier>>() {});
     204        assertEquals(aIdOne, result.get(0));
     205        assertEquals(aIdTwo, result.get(1));
    211206    }
    212207
Note: See TracChangeset for help on using the changeset viewer.