Changeset 3192


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

removing AnnotationRooted?.class. Using Peter's work-aroun to make an annotation JAXB-able, for now, before the schema is updated.

Location:
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src
Files:
1 deleted
3 edited

Legend:

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

    r3186 r3192  
    1818package eu.dasish.annotation.backend.rest;
    1919
    20 import eu.dasish.annotation.backend.AnnotationRooted;
    2120import eu.dasish.annotation.backend.BackendConstants;
    2221import eu.dasish.annotation.backend.dao.AnnotationDao;
     
    7069    @Produces(MediaType.APPLICATION_XML)
    7170    @Path("")
    72     public JAXBElement<Annotation> createAnnotation(AnnotationRooted annotation) {
     71    public JAXBElement<Annotation> createAnnotation(Annotation annotation) {
    7372        AnnotationIdentifier newAnnotationIdentifier = annotationDao.addAnnotation(annotation);
    7473        //return newAnnotationIdentifier.toString();
  • DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/rest/AnnotationResourceTest.java

    r3188 r3192  
    1919
    2020import com.sun.jersey.api.client.GenericType;
    21 import eu.dasish.annotation.backend.AnnotationRooted;
    2221import eu.dasish.annotation.backend.TestBackendConstants;
    2322import eu.dasish.annotation.backend.TestInstances;
     
    122121    public void testCreateAnnotation() throws SQLException, InstantiationException, IllegalAccessException {
    123122        System.out.println("test createAnnotation");
    124         final AnnotationRooted annotationToAdd = new GenericType<AnnotationRooted>(){}.getRawClass().newInstance();
     123        final Annotation annotationToAdd = new GenericType<Annotation>(){}.getRawClass().newInstance();
    125124        final AnnotationIdentifier newAnnotationID = new GenericType<AnnotationIdentifier>(){}.getRawClass().newInstance();
    126125       
  • DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/rest/AnnotationsTest.java

    r3190 r3192  
    2020import com.sun.jersey.api.client.ClientResponse;
    2121import com.sun.jersey.api.client.GenericType;
    22 import eu.dasish.annotation.backend.AnnotationRooted;
    2322import eu.dasish.annotation.backend.TestBackendConstants;
    2423import eu.dasish.annotation.backend.dao.AnnotationDao;
    2524import eu.dasish.annotation.backend.identifiers.AnnotationIdentifier;
    2625import eu.dasish.annotation.schema.Annotation;
     26import eu.dasish.annotation.schema.Notebook;
    2727import eu.dasish.annotation.schema.ObjectFactory;
    2828import java.sql.SQLException;
    2929import javax.ws.rs.core.GenericEntity;
    3030import javax.ws.rs.core.MediaType;
     31import javax.xml.bind.JAXBElement;
     32import javax.xml.namespace.QName;
    3133import org.jmock.Expectations;
    3234import org.junit.Test;
     
    128130    @Test
    129131    //@Ignore
    130     public void testAddAnnotation() throws SQLException, InstantiationException, IllegalAccessException{
     132    public void testCreateAnnotation() throws SQLException, InstantiationException, IllegalAccessException{
    131133        System.out.println("test createAnnotation");
    132134        //final Annotation annotationToAdd = new ObjectFactory().createAnnotation();
    133        final AnnotationRooted annotationToAdd = new GenericType<AnnotationRooted>(){}.getRawClass().newInstance();
     135       final Annotation annotationToAdd = new GenericType<Annotation>(){}.getRawClass().newInstance();
    134136       final AnnotationIdentifier newAnnotationID = new GenericType<AnnotationIdentifier>(){}.getRawClass().newInstance();
    135137       
    136138        mockery.checking(new Expectations() {
    137139            {
    138                 oneOf(annotationDao).addAnnotation(with(aNonNull(AnnotationRooted.class)));
     140                oneOf(annotationDao).addAnnotation(with(aNonNull(Annotation.class)));
    139141                will(returnValue(newAnnotationID));
    140142            }
     
    146148        System.out.println("requestUrl: " + requestUrl);
    147149       
    148         ClientResponse response = resource().path(requestUrl).type(MediaType.APPLICATION_XML).post(ClientResponse.class, new GenericEntity<AnnotationRooted>(annotationToAdd){});
     150        // Peter's workaround on absence of "PnjectFactory.create... for annotations
     151        final JAXBElement<Annotation> jaxbElement = new JAXBElement<Annotation>(new QName("http://www.dasish.eu/ns/addit", "annotation"), Annotation.class, null, annotationToAdd);
     152               
     153        ClientResponse response = resource().path(requestUrl).type(MediaType.APPLICATION_XML).post(ClientResponse.class, jaxbElement);
    149154        assertEquals(200, response.getStatus());
    150155       
Note: See TracChangeset for help on using the changeset viewer.