Changeset 3192
- Timestamp:
- 07/25/13 09:52:01 (11 years ago)
- 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 18 18 package eu.dasish.annotation.backend.rest; 19 19 20 import eu.dasish.annotation.backend.AnnotationRooted;21 20 import eu.dasish.annotation.backend.BackendConstants; 22 21 import eu.dasish.annotation.backend.dao.AnnotationDao; … … 70 69 @Produces(MediaType.APPLICATION_XML) 71 70 @Path("") 72 public JAXBElement<Annotation> createAnnotation(Annotation Rootedannotation) {71 public JAXBElement<Annotation> createAnnotation(Annotation annotation) { 73 72 AnnotationIdentifier newAnnotationIdentifier = annotationDao.addAnnotation(annotation); 74 73 //return newAnnotationIdentifier.toString(); -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/rest/AnnotationResourceTest.java
r3188 r3192 19 19 20 20 import com.sun.jersey.api.client.GenericType; 21 import eu.dasish.annotation.backend.AnnotationRooted;22 21 import eu.dasish.annotation.backend.TestBackendConstants; 23 22 import eu.dasish.annotation.backend.TestInstances; … … 122 121 public void testCreateAnnotation() throws SQLException, InstantiationException, IllegalAccessException { 123 122 System.out.println("test createAnnotation"); 124 final Annotation Rooted annotationToAdd = new GenericType<AnnotationRooted>(){}.getRawClass().newInstance();123 final Annotation annotationToAdd = new GenericType<Annotation>(){}.getRawClass().newInstance(); 125 124 final AnnotationIdentifier newAnnotationID = new GenericType<AnnotationIdentifier>(){}.getRawClass().newInstance(); 126 125 -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/rest/AnnotationsTest.java
r3190 r3192 20 20 import com.sun.jersey.api.client.ClientResponse; 21 21 import com.sun.jersey.api.client.GenericType; 22 import eu.dasish.annotation.backend.AnnotationRooted;23 22 import eu.dasish.annotation.backend.TestBackendConstants; 24 23 import eu.dasish.annotation.backend.dao.AnnotationDao; 25 24 import eu.dasish.annotation.backend.identifiers.AnnotationIdentifier; 26 25 import eu.dasish.annotation.schema.Annotation; 26 import eu.dasish.annotation.schema.Notebook; 27 27 import eu.dasish.annotation.schema.ObjectFactory; 28 28 import java.sql.SQLException; 29 29 import javax.ws.rs.core.GenericEntity; 30 30 import javax.ws.rs.core.MediaType; 31 import javax.xml.bind.JAXBElement; 32 import javax.xml.namespace.QName; 31 33 import org.jmock.Expectations; 32 34 import org.junit.Test; … … 128 130 @Test 129 131 //@Ignore 130 public void test AddAnnotation() throws SQLException, InstantiationException, IllegalAccessException{132 public void testCreateAnnotation() throws SQLException, InstantiationException, IllegalAccessException{ 131 133 System.out.println("test createAnnotation"); 132 134 //final Annotation annotationToAdd = new ObjectFactory().createAnnotation(); 133 final Annotation Rooted annotationToAdd = new GenericType<AnnotationRooted>(){}.getRawClass().newInstance();135 final Annotation annotationToAdd = new GenericType<Annotation>(){}.getRawClass().newInstance(); 134 136 final AnnotationIdentifier newAnnotationID = new GenericType<AnnotationIdentifier>(){}.getRawClass().newInstance(); 135 137 136 138 mockery.checking(new Expectations() { 137 139 { 138 oneOf(annotationDao).addAnnotation(with(aNonNull(Annotation Rooted.class)));140 oneOf(annotationDao).addAnnotation(with(aNonNull(Annotation.class))); 139 141 will(returnValue(newAnnotationID)); 140 142 } … … 146 148 System.out.println("requestUrl: " + requestUrl); 147 149 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); 149 154 assertEquals(200, response.getStatus()); 150 155
Note: See TracChangeset
for help on using the changeset viewer.