Changeset 3452


Ignore:
Timestamp:
08/21/13 09:47:33 (11 years ago)
Author:
olhsha
Message:

making interface and bean for DaoDispatcher?. AnnotationResourceTest? passed with 3 methods: get, add and delete annotations. AnnotationsTest? still have problems.

Location:
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend
Files:
2 added
6 edited
2 moved

Legend:

Unmodified
Added
Removed
  • DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/nb-configuration.xml

    r3450 r3452  
    2424            <config-file>src/test/resources/spring-test-config/mockVersionDao.xml</config-file>
    2525            <config-file>src/test/resources/spring-test-config/mockDaoDispatcher.xml</config-file>
     26            <config-file>src/main/resources/spring-config/daoDispatcher.xml</config-file>
    2627        </config-files>
    2728        <config-file-groups/>
  • DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/dao/impl/DaoDispatcherImpl.java

    r3448 r3452  
    1616 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
    1717 */
    18 package eu.dasish.annotation.backend.rest;
     18package eu.dasish.annotation.backend.dao.impl;
    1919
    2020import eu.dasish.annotation.backend.Helpers;
    2121import eu.dasish.annotation.backend.dao.AnnotationDao;
    2222import eu.dasish.annotation.backend.dao.CachedRepresentationDao;
     23import eu.dasish.annotation.backend.dao.DaoDispatcher;
    2324import eu.dasish.annotation.backend.dao.NotebookDao;
    2425import eu.dasish.annotation.backend.dao.SourceDao;
     
    4546import java.util.Map;
    4647import org.springframework.beans.factory.annotation.Autowired;
    47 import org.springframework.stereotype.Component;
    4848
    4949/**
     
    5151 * @author olhsha
    5252 */
    53 @Component
    54 public class DaoDispatcher {
     53public class DaoDispatcherImpl implements DaoDispatcher
     54{
    5555
    5656    @Autowired
     
    6969    ///////////// GETTERS //////////////////////////
    7070
     71    @Override
    7172    public Number getAnnotationInternalIdentifier(AnnotationIdentifier annotationIdentifier) {
    7273        return annotationDao.getInternalID(annotationIdentifier);
    7374    }
    7475
     76    @Override
    7577    public AnnotationIdentifier getAnnotationExternalIdentifier(Number annotationID) {
    7678        return annotationDao.getExternalID(annotationID);
    7779    }
    7880
     81    @Override
    7982    public Number getUserInternalIdentifier(UserIdentifier userIdentifier) {
    8083        return userDao.getInternalID(userIdentifier);
    8184    }
    8285
     86    @Override
    8387    public UserIdentifier getUserExternalIdentifier(Number userID) {
    8488        return userDao.getExternalID(userID);
    8589    }
    8690
     91    @Override
    8792      public Annotation getAnnotation(Number annotationID) throws SQLException {
    8893        Annotation result = annotationDao.getAnnotationWithoutSources(annotationID);
     
    104109
    105110    ////////////////////////////////////////////////////////////////////////
     111    @Override
    106112    public List<Number> getFilteredAnnotationIDs(String link, String text, String access, String namespace, UserIdentifier owner, Timestamp after, Timestamp before) {
    107113
     
    127133   
    128134   
     135    @Override
    129136    public Number[] addCachedForVersion(Number versionID, CachedRepresentationInfo cached) {
    130137        Number[] result = new Number[2];
     
    139146   
    140147   
     148    @Override
    141149      public Number[] addSiblingVersionForSource(Number sourceID, Version version) throws SQLException {
    142150        Number[] result = new Number[2];
     
    150158
    151159     
     160    @Override
    152161       public Map<String, String> addSourcesForAnnotation(Number annotationID, List<NewOrExistingSourceInfo> sources) throws SQLException {
    153162        Map<String, String> result = new HashMap<String, String>();
     
    170179
    171180   
     181    @Override
    172182    public Number addUsersAnnotation(Annotation annotation, Number userID) throws SQLException {
    173183
     
    190200      ////////////// DELETERS //////////////////
    191201     
     202    @Override
    192203    public int[] deleteCachedOfVersion(Number versionID, Number cachedID) {
    193204        int[] result = new int[2];
     
    202213    }
    203214
     215    @Override
    204216    public int[] deleteAllCachedOfVersion(Number versionID) {
    205217        int[] result = new int[3];
     
    223235 
    224236
     237    @Override
    225238    public int[] deleteAllVersionsOfSource(Number sourceID) throws SQLException {
    226239        int[] result = new int[3];
     
    244257
    245258 
     259    @Override
    246260    public int[] deleteAnnotation(Number annotationID) throws SQLException {
    247261        int[] result = new int[4];
  • DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/rest/AnnotationResource.java

    r3448 r3452  
    1919
    2020import eu.dasish.annotation.backend.BackendConstants;
     21import eu.dasish.annotation.backend.dao.DaoDispatcher;
    2122import eu.dasish.annotation.backend.identifiers.AnnotationIdentifier;
    2223import eu.dasish.annotation.backend.identifiers.UserIdentifier;
     
    3536import javax.ws.rs.core.MediaType;
    3637import javax.xml.bind.JAXBElement;
     38import org.springframework.beans.factory.annotation.Autowired;
    3739import org.springframework.stereotype.Component;
    3840
     
    4446@Path("/annotations")
    4547public class AnnotationResource {
    46 
     48   
     49    @Autowired
    4750    private DaoDispatcher daoDispatcher;
    4851    @Context
  • DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/MockObjectsFactory.java

    r3450 r3452  
    2424import eu.dasish.annotation.backend.dao.UserDao;
    2525import eu.dasish.annotation.backend.dao.VersionDao;
    26 import eu.dasish.annotation.backend.rest.DaoDispatcher;
     26import eu.dasish.annotation.backend.dao.DaoDispatcher;
    2727import org.jmock.Mockery;
    2828
  • DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/dao/impl/DaoDispatcherTest.java

    r3448 r3452  
    1616 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
    1717 */
    18 package eu.dasish.annotation.backend.rest;
     18package eu.dasish.annotation.backend.dao.impl;
    1919
    2020import eu.dasish.annotation.backend.Helpers;
     
    4545import java.sql.Timestamp;
    4646import java.util.ArrayList;
    47 import java.util.HashMap;
    4847import java.util.List;
    4948import java.util.Map;
     
    6564@ContextConfiguration({"/spring-test-config/dataSource.xml", "/spring-test-config/mockery.xml", "/spring-test-config/mockAnnotationDao.xml",
    6665    "/spring-test-config/mockUserDao.xml", "/spring-test-config/mockNotebookDao.xml",
    67     "/spring-test-config/mockSourceDao.xml", "/spring-test-config/mockVersionDao.xml", "/spring-test-config/mockCachedRepresentationDao.xml"})
     66    "/spring-test-config/mockSourceDao.xml", "/spring-test-config/mockVersionDao.xml", "/spring-test-config/mockCachedRepresentationDao.xml",
     67    "/spring-config/daoDispatcher.xml"})
    6868public class DaoDispatcherTest {
    6969
    7070    @Autowired
    71     private DaoDispatcher daoDispatcher;
     71    private DaoDispatcherImpl daoDispatcher;
    7272    @Autowired
    7373    private Mockery mockery;
     
    9191    ///////// GETTERS /////////////
    9292    /**
    93      * Test of getAnnotationInternalIdentifier method, of class DaoDispatcher.
     93     * Test of getAnnotationInternalIdentifier method, of class DaoDispatcherImpl.
    9494     */
    9595    @Test
     
    108108
    109109    /**
    110      * Test of getAnnotationExternalIdentifier method, of class DaoDispatcher.
     110     * Test of getAnnotationExternalIdentifier method, of class DaoDispatcherImpl.
    111111     */
    112112    @Test
     
    125125
    126126    /**
    127      * Test of getUserInternalIdentifier method, of class DaoDispatcher.
     127     * Test of getUserInternalIdentifier method, of class DaoDispatcherImpl.
    128128     */
    129129    @Test
     
    143143
    144144    /**
    145      * Test of getUserExternalIdentifier method, of class DaoDispatcher.
     145     * Test of getUserExternalIdentifier method, of class DaoDispatcherImpl.
    146146     */
    147147    @Test
     
    160160
    161161    /**
    162      * Test of getAnnotation method, of class DaoDispatcher.
     162     * Test of getAnnotation method, of class DaoDispatcherImpl.
    163163     */
    164164    @Test
     
    229229
    230230    /**
    231      * Test of getFilteredAnnotationIDs method, of class DaoDispatcher.
     231     * Test of getFilteredAnnotationIDs method, of class DaoDispatcherImpl.
    232232     */
    233233    @Test
     
    280280    ////////////// ADDERS /////////////////////////
    281281    /**
    282      * Test of addCachedForVersion method, of class DaoDispatcher.
     282     * Test of addCachedForVersion method, of class DaoDispatcherImpl.
    283283     */
    284284    @Test
     
    316316
    317317    /**
    318      * Test of addSiblingVersionForSource method, of class DaoDispatcher.
     318     * Test of addSiblingVersionForSource method, of class DaoDispatcherImpl.
    319319     */
    320320    @Test
     
    369369
    370370    /**
    371      * Test of addSourcesForAnnotation method, of class DaoDispatcher.
     371     * Test of addSourcesForAnnotation method, of class DaoDispatcherImpl.
    372372     */
    373373    @Test
     
    443443
    444444    /**
    445      * Test of addUsersAnnotation method, of class DaoDispatcher.
     445     * Test of addUsersAnnotation method, of class DaoDispatcherImpl.
    446446     */
    447447    @Test
     
    480480    //////////////////// DELETERS ////////////////
    481481    /**
    482      * Test of deleteCachedForVersion method, of class DaoDispatcher.
     482     * Test of deleteCachedForVersion method, of class DaoDispatcherImpl.
    483483     */
    484484    @Test
     
    604604
    605605    /**
    606      * Test of deleteAnnotationWithSources method, of class DaoDispatcher.
     606     * Test of deleteAnnotationWithSources method, of class DaoDispatcherImpl.
    607607     */
    608608    @Test
  • DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/dao/impl/JdbcNotebookDaoTest.java

    r3413 r3452  
    5454    "/spring-test-config/mockSourceDao.xml", "/spring-test-config/mockUserDao.xml",
    5555    "/spring-test-config/mockCachedRepresentationDao.xml", "/spring-test-config/mockVersionDao.xml",
    56     "/spring-test-config/dataSource.xml", "/spring-config/notebookDao.xml"})
     56    "/spring-test-config/dataSource.xml", "/spring-test-config/mockDaoDispatcher.xml","/spring-config/notebookDao.xml"})
    5757public class JdbcNotebookDaoTest extends JdbcResourceDaoTest{
    5858
  • DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/rest/AnnotationResourceTest.java

    r3450 r3452  
    1818package eu.dasish.annotation.backend.rest;
    1919
     20import eu.dasish.annotation.backend.dao.DaoDispatcher;
    2021import com.sun.jersey.api.client.GenericType;
     22import eu.dasish.annotation.backend.Helpers;
    2123import eu.dasish.annotation.backend.TestBackendConstants;
    2224import eu.dasish.annotation.backend.TestInstances;
     
    2426import eu.dasish.annotation.backend.identifiers.UserIdentifier;
    2527import eu.dasish.annotation.schema.Annotation;
     28import eu.dasish.annotation.schema.ResourceREF;
    2629import java.sql.SQLException;
    2730import javax.xml.bind.JAXBElement;
     
    3538import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
    3639import java.lang.InstantiationException;
     40import java.sql.Timestamp;
    3741import javax.servlet.ServletException;
     42import javax.xml.datatype.DatatypeConfigurationException;
     43import org.junit.Ignore;
    3844import org.springframework.mock.web.MockHttpServletRequest;
    3945/**
     
    4349
    4450@RunWith(value = SpringJUnit4ClassRunner.class)
    45 @ContextConfiguration(locations = {"/spring-test-config/dataSource.xml", "/spring-test-config/mockDaoDispatcher.xml",
    46     "/spring-test-config/mockery.xml", })
     51@ContextConfiguration(locations = { "/spring-test-config/mockery.xml", "/spring-test-config/mockDaoDispatcher.xml",
     52"/spring-test-config/mockAnnotationDao.xml","/spring-test-config/mockUserDao.xml", "/spring-test-config/mockNotebookDao.xml",
     53"/spring-test-config/mockSourceDao.xml", "/spring-test-config/mockVersionDao.xml", "/spring-test-config/mockCachedRepresentationDao.xml"})
    4754public class AnnotationResourceTest {
    4855   
     
    93100        //int[] resultDelete = daoDispatcher.deleteAnnotation(annotationID);
    94101       
     102        final int[] mockDelete = new int[4];
     103        mockDelete[0]=1; // # deleted annotations
     104        mockDelete[3]=1; // # deleted annotation_prinipal_permissions
     105        mockDelete[2]=2; // # deleted  annotations_target_sources, (5,3), (5,4)
     106        mockDelete[3]=1; // # deletd sources, 4
    95107        mockery.checking(new Expectations() {
    96108            { 
     
    99111               
    100112                oneOf(daoDispatcher).deleteAnnotation(5);
    101                 will(returnValue(1));
     113                will(returnValue(mockDelete));
    102114            }
    103115        });
     
    111123     */
    112124    @Test
    113     public void testCreateAnnotation() throws SQLException, InstantiationException, IllegalAccessException, ServletException {
     125    public void testCreateAnnotation() throws SQLException, InstantiationException, IllegalAccessException, ServletException, DatatypeConfigurationException {
    114126        System.out.println("test createAnnotation");
    115127        final Annotation annotationToAdd = new GenericType<Annotation>(){}.getRawClass().newInstance();
     
    121133//        Number newAnnotationID =  daoDispatcher.addUsersAnnotation(annotation, userID);
    122134//        Annotation newAnnotation = daoDispatcher.getAnnotation(newAnnotationID);
     135        final String ownerString = "5";
     136        final Number ownerID =  5;
     137        final Number newAnnotationID = 6;
     138        final Annotation addedAnnotation = annotationToAdd;
     139        ResourceREF owner = new ResourceREF();
     140        owner.setRef(ownerString);
     141        addedAnnotation.setOwner(owner);
     142        addedAnnotation.setURI((new AnnotationIdentifier()).toString());
    123143       
     144        addedAnnotation.setTimeStamp(Helpers.setXMLGregorianCalendar(Timestamp.valueOf("2013-08-12 11:25:00.383000")));
    124145        mockery.checking(new Expectations() {
    125146            {
    126147                oneOf(daoDispatcher).getUserInternalIdentifier(with(aNonNull(UserIdentifier.class)));
    127                 will(returnValue(5));
     148                will(returnValue(ownerID));
    128149               
    129                 oneOf(daoDispatcher).addUsersAnnotation(annotationToAdd, 5);
    130                 will(returnValue(1));
     150                oneOf(daoDispatcher).addUsersAnnotation(annotationToAdd, ownerID);
     151                will(returnValue(newAnnotationID));
     152               
     153                oneOf(daoDispatcher).getAnnotation(newAnnotationID);
     154                will(returnValue(addedAnnotation));
    131155            }
    132156        });
     
    139163       
    140164        JAXBElement<Annotation> result = annotationResource.createAnnotation(annotationToAdd);
    141         assertEquals(String.valueOf(5), result.getValue().getOwner().getRef());
    142         assertFalse(null == result.getValue().getURI());
     165        assertEquals(addedAnnotation.getOwner().getRef(), result.getValue().getOwner().getRef());
     166        assertEquals(addedAnnotation.getURI(), result.getValue().getURI());
     167        assertEquals(addedAnnotation.getHeadline(), result.getValue().getHeadline());
     168        assertEquals(addedAnnotation.getPermissions(), result.getValue().getPermissions());
     169        assertEquals(addedAnnotation.getTargetSources(), result.getValue().getTargetSources());
     170        assertEquals(addedAnnotation.getTimeStamp(), result.getValue().getTimeStamp());
     171        assertEquals(addedAnnotation.getBody(), result.getValue().getBody());
    143172       
    144173    }
  • DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/rest/AnnotationsTest.java

    r3408 r3452  
    1818package eu.dasish.annotation.backend.rest;
    1919
     20import eu.dasish.annotation.backend.dao.DaoDispatcher;
    2021import com.sun.jersey.api.client.ClientResponse;
    21 import com.sun.jersey.api.client.GenericType;
     22import eu.dasish.annotation.backend.Helpers;
    2223import eu.dasish.annotation.backend.TestBackendConstants;
    23 import eu.dasish.annotation.backend.dao.AnnotationDao;
    24 import eu.dasish.annotation.backend.dao.NotebookDao;
     24import eu.dasish.annotation.backend.TestInstances;
    2525import eu.dasish.annotation.backend.identifiers.AnnotationIdentifier;
    2626import eu.dasish.annotation.backend.identifiers.UserIdentifier;
    2727import eu.dasish.annotation.schema.Annotation;
    2828import eu.dasish.annotation.schema.ObjectFactory;
     29import eu.dasish.annotation.schema.ResourceREF;
    2930import java.sql.SQLException;
     31import java.sql.Timestamp;
    3032import javax.ws.rs.core.MediaType;
    3133import javax.xml.bind.JAXBElement;
     34import javax.xml.datatype.DatatypeConfigurationException;
    3235import javax.xml.namespace.QName;
    3336import org.jmock.Expectations;
    3437import org.junit.Test;
    3538import static org.junit.Assert.*;
    36 import org.junit.Ignore;
    3739/**
    3840 *
     
    4143public class AnnotationsTest extends ResourcesTest{
    4244   
    43     private AnnotationDao annotationDao;
    44     private NotebookDao notebookDao;
     45    private DaoDispatcher daoDispatcher;
    4546   
    4647    public AnnotationsTest() {
    4748        super(AnnotationResource.class.getPackage().getName());       
    48         annotationDao = webAppContext.getBean(AnnotationDao.class);
    49         notebookDao = webAppContext.getBean(NotebookDao.class);
     49        daoDispatcher = webAppContext.getBean(DaoDispatcher.class);
    5050    }
    5151   
     
    6161        final int annotationID = 2;
    6262        final Annotation testAnnotation = new ObjectFactory().createAnnotation();
     63        final Annotation expectedAnnotation = (new TestInstances()).getAnnotationOne();
    6364       
    64 //        mockery.checking(new Expectations() {
    65 //            {
    66 //                oneOf(annotationDao).getInternalID(new AnnotationIdentifier(annotationIdentifier));               
    67 //                will(returnValue(annotationID));
    68 //               
    69 //                oneOf(annotationDao).getAnnotation(annotationID);
    70 //               will(returnValue(testAnnotation));
    71 //            }
    72 //        });
     65        //final Number annotationID = daoDispatcher.getAnnotationInternalIdentifier(new AnnotationIdentifier(annotationIdentifier));
     66        //final Annotation annotation = daoDispatcher.getAnnotation(annotationID);
     67        mockery.checking(new Expectations() {
     68            {
     69                oneOf(daoDispatcher).getAnnotationInternalIdentifier(with(aNonNull(AnnotationIdentifier.class)));               
     70                will(returnValue(annotationID));               
     71               
     72                oneOf(daoDispatcher).getAnnotation(annotationID);               
     73                will(returnValue(expectedAnnotation));
     74            }
     75        });
    7376       
    7477        final String requestUrl = "annotations/" + annotationIdentifier;
     
    9396    public void testDeleteAnnotation() throws SQLException{
    9497        System.out.println("testDeleteAnnotation");
    95        
     98         //final Number annotationID = daoDispatcher.getAnnotationInternalIdentifier(new AnnotationIdentifier(annotationIdentifier));
     99        //int[] resultDelete = daoDispatcher.deleteAnnotation(annotationID);
     100       
     101        final int[] mockDelete = new int[4];
     102        mockDelete[0]=1; // # deleted annotations
     103        mockDelete[3]=1; // # deleted annotation_prinipal_permissions
     104        mockDelete[2]=2; // # deleted  annotations_target_sources, (5,3), (5,4)
     105        mockDelete[3]=1; // # deletd sources, 4
    96106        mockery.checking(new Expectations() {
    97             {
    98                 oneOf(annotationDao).getInternalID(new AnnotationIdentifier(TestBackendConstants._TEST_ANNOT_5_EXT));               
    99                 will(returnValue(5));
     107            { 
     108                oneOf(daoDispatcher).getAnnotationInternalIdentifier(with(aNonNull(AnnotationIdentifier.class)));             
     109                will(returnValue(5));     
    100110               
    101                 oneOf(annotationDao).deleteAnnotation(5);
    102                 will(returnValue(1));
     111                oneOf(daoDispatcher).deleteAnnotation(5);
     112                will(returnValue(mockDelete));
    103113            }
    104114        });
    105        
    106115        final String requestUrl = "annotations/" + TestBackendConstants._TEST_ANNOT_5_EXT;
    107116        System.out.println("requestUrl: " + requestUrl);
     
    110119        assertEquals("1", response.getEntity(String.class));
    111120       
    112          // now, try to delete the same annotation one more time
    113         // if it has been already deleted then the method under testing should return 0
    114        
    115         mockery.checking(new Expectations() {
    116             {
    117                 oneOf(annotationDao).getInternalID(new AnnotationIdentifier(TestBackendConstants._TEST_ANNOT_5_EXT));               
    118                 will(returnValue(5));
    119                
    120                 oneOf(annotationDao).deleteAnnotation(5);
    121                 will(returnValue(0));
    122             }
    123         });
    124        
    125         response = resource().path(requestUrl).delete(ClientResponse.class);
    126         assertEquals(200, response.getStatus());
    127         assertEquals("0", response.getEntity(String.class));
     121     
    128122    }
    129123    /**
     
    132126     */
    133127    @Test
    134     @Ignore
    135     public void testCreateAnnotation() throws SQLException, InstantiationException, IllegalAccessException{
     128    public void testCreateAnnotation() throws SQLException, InstantiationException, IllegalAccessException, DatatypeConfigurationException{
    136129        System.out.println("test createAnnotation");
    137130        final Annotation annotationToAdd = new ObjectFactory().createAnnotation();
     131       
     132//        Number userID = null;
     133//        if (remoteUser != null) {
     134//            userID = daoDispatcher.getUserInternalIdentifier(new UserIdentifier(remoteUser));
     135//        }
     136//        Number newAnnotationID =  daoDispatcher.addUsersAnnotation(annotation, userID);
     137//        Annotation newAnnotation = daoDispatcher.getAnnotation(newAnnotationID);
     138        final String ownerString = "5";
     139        final Number ownerID =  5;
     140        final Number newAnnotationID = 6;
     141        final Annotation addedAnnotation = annotationToAdd;
     142        ResourceREF owner = new ResourceREF();
     143        owner.setRef(ownerString);
     144        addedAnnotation.setOwner(owner);
     145        addedAnnotation.setURI((new AnnotationIdentifier()).toString());
     146       
     147        addedAnnotation.setTimeStamp(Helpers.setXMLGregorianCalendar(Timestamp.valueOf("2013-08-12 11:25:00.383000")));
     148        mockery.checking(new Expectations() {
     149            {
     150                oneOf(daoDispatcher).getUserInternalIdentifier(with(aNonNull(UserIdentifier.class)));
     151                will(returnValue(ownerID));
     152               
     153                oneOf(daoDispatcher).addUsersAnnotation(annotationToAdd, ownerID);
     154                will(returnValue(newAnnotationID));
     155               
     156                oneOf(daoDispatcher).getAnnotation(newAnnotationID);
     157                will(returnValue(addedAnnotation));
     158            }
     159        });
    138160       
    139161         // Peter's workaround on absence of "ObjectFactory.create... for annotations       
    140162        final JAXBElement<Annotation> jaxbElement = new JAXBElement<Annotation>(new QName("http://www.dasish.eu/ns/addit", "annotation"), Annotation.class, null, annotationToAdd);
    141163       
    142        
    143         final Annotation addedAnnotation = annotationToAdd;
    144         final AnnotationIdentifier annotationIdentifier = new GenericType<AnnotationIdentifier>(){}.getRawClass().newInstance();
    145         addedAnnotation.setURI(annotationIdentifier.toString());
    146         final UserIdentifier owner = new UserIdentifier(TestBackendConstants._TEST_USER_5_EXT_ID);
    147 //        mockery.checking(new Expectations() {
    148 //            {   
    149 //               
    150 //            // TODO sould be mpre strict demands on  inputs  when the user handling mechanism is settled
    151 //                oneOf(annotationDao).addAnnotation(with(aNonNull(Annotation.class)), with(any(Number.class)));
    152 //                will(returnValue(addedAnnotation));
    153 //               
    154 //                oneOf(permissionsDao).addAnnotationPrincipalPermission(with(aNonNull(AnnotationIdentifier.class)), with(aNonNull(UserIdentifier.class)), with(aNonNull(Permission.class)));
    155 //                will(returnValue(1));
    156 //            }
    157 //        });
    158        
    159      
    160        
    161164        final String requestUrl = "annotations";
    162165        System.out.println("requestUrl: " + requestUrl);
    163        
    164         // Peter's workaround on absence of "ObjectFactory.create... for annotations
    165        
    166166        ClientResponse response = resource().path(requestUrl).accept(MediaType.APPLICATION_XML).type(MediaType.APPLICATION_XML).post(ClientResponse.class, jaxbElement);
    167167        assertEquals(200, response.getStatus());
Note: See TracChangeset for help on using the changeset viewer.