Index: /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/nb-configuration.xml
===================================================================
--- /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/nb-configuration.xml	(revision 4172)
+++ /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/nb-configuration.xml	(revision 4173)
@@ -21,4 +21,13 @@
             <config-file>src/main/resources/spring-config/applicationContext-security.xml</config-file>
             <config-file>src/main/resources/spring-config/securityDataSource.xml</config-file>
+            <config-file>src/test/resources/spring-test-config/jaxbMarshallerFactory.xml</config-file>
+            <config-file>src/test/resources/spring-integrity-test-config/dataSource.xml</config-file>
+            <config-file>src/test/resources/spring-integrity-test-config/annotationDao.xml</config-file>
+            <config-file>src/test/resources/spring-integrity-test-config/userDao.xml</config-file>
+            <config-file>src/test/resources/spring-integrity-test-config/targetDao.xml</config-file>
+            <config-file>src/test/resources/spring-integrity-test-config/cachedRepresentationDao.xml</config-file>
+            <config-file>src/test/resources/spring-integrity-test-config/componentscan.xml</config-file>
+            <config-file>src/test/resources/spring-integrity-test-config/dbIntegrityService.xml</config-file>
+            <config-file>src/test/resources/spring-integrity-test-config/JaxbMarshallerFactory.xml</config-file>
         </config-files>
         <config-file-groups/>
Index: /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/pom.xml
===================================================================
--- /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/pom.xml	(revision 4172)
+++ /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/pom.xml	(revision 4173)
@@ -243,8 +243,8 @@
             <version>${slf4j.version}</version>
         </dependency>
-         <dependency>
-            <groupId>joda-time</groupId>
-            <artifactId>joda-time</artifactId>
-            <version>2.1</version>
+        <dependency>
+            <groupId>org.glassfish.jersey.core</groupId>
+            <artifactId>jersey-server</artifactId>
+            <version>2.3.1</version>
         </dependency>
     </dependencies>
Index: /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/Helpers.java
===================================================================
--- /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/Helpers.java	(revision 4172)
+++ /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/Helpers.java	(revision 4173)
@@ -19,11 +19,5 @@
 
 import java.io.IOException;
-import java.sql.Timestamp;
-import java.util.GregorianCalendar;
 import java.util.Map;
-import java.util.TimeZone;
-import javax.xml.datatype.DatatypeConfigurationException;
-import javax.xml.datatype.DatatypeFactory;
-import javax.xml.datatype.XMLGregorianCalendar;
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
@@ -34,6 +28,4 @@
 import org.w3c.dom.ls.LSSerializer;
 import org.xml.sax.SAXException;
-import org.joda.time.DateTime;
-import org.joda.time.DateTimeZone;
 
 /**
Index: /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/dao/impl/JdbcAnnotationDao.java
===================================================================
--- /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/dao/impl/JdbcAnnotationDao.java	(revision 4172)
+++ /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/dao/impl/JdbcAnnotationDao.java	(revision 4173)
@@ -316,5 +316,5 @@
         StringBuilder sql = new StringBuilder("UPDATE ");
         sql.append(annotationTableName).append(" SET ").
-                append(last_modified).append("=  current_timestamp AT TIME ZONE INTERVAL '00:00',").
+                append(last_modified).append("=  current_timestamp AT TIME ZONE INTERVAL '00:00' HOUR TO MINUTE,").
                 append(body_text).append("= '").append(text).
                 append("' WHERE ").append(annotation_id).append("= ?");
@@ -334,5 +334,5 @@
         StringBuilder sql = new StringBuilder("UPDATE ");
         sql.append(annotationTableName).append(" SET ").
-                append(last_modified).append("=  current_timestamp AT TIME ZONE 'UTC',").
+                append(last_modified).append("=  current_timestamp AT TIME ZONE 'UTC' HOUR TO MINUTE,").
                 append(body_text).append("= :bodyText, ").
                 append(body_mimetype).append("= :bodyMimeType, ").
@@ -362,5 +362,5 @@
                 append(body_mimetype).append("= :bodyMimeType ,").
                 append(headline).append("=  :headline ,").
-                append(last_modified).append("=  current_timestamp AT TIME ZONE 'UTC',").
+                append(last_modified).append("=  current_timestamp AT TIME ZONE 'UTC' HOUR TO MINUTE,").
                 append(is_xml).append("= :isXml").
                 append(" WHERE ").append(external_id).append("= :externalID");
@@ -403,5 +403,5 @@
         StringBuilder sql = new StringBuilder("INSERT INTO ");
         sql.append(annotationTableName).append("(").append(external_id).append(",").append(owner_id);
-        sql.append(",").append(headline).append(",").append(body_text).append(",").append(body_mimetype).append(",").append(is_xml).append(",").append(last_modified).append(" ) VALUES (:externalId, :ownerId, :headline, :bodyText, :bodyMimeType, :isXml, current_timestamp AT TIME ZONE INTERVAL '00:00')");
+        sql.append(",").append(headline).append(",").append(body_text).append(",").append(body_mimetype).append(",").append(is_xml).append(",").append(last_modified).append(" ) VALUES (:externalId, :ownerId, :headline, :bodyText, :bodyMimeType, :isXml, current_timestamp AT TIME ZONE INTERVAL '00:00' HOUR TO MINUTE)");
         int affectedRows = getSimpleJdbcTemplate().update(sql.toString(), params);
         return ((affectedRows > 0) ? getInternalID(externalID) : null);
Index: /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/dao/impl/JdbcTargetDao.java
===================================================================
--- /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/dao/impl/JdbcTargetDao.java	(revision 4172)
+++ /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/dao/impl/JdbcTargetDao.java	(revision 4173)
@@ -171,5 +171,5 @@
         params.put("version", target.getVersion());
         StringBuilder sql = new StringBuilder("INSERT INTO ");
-        sql.append(targetTableName).append("(").append(external_id).append(",").append(link_uri).append(",").append(version).append(",").append(last_modified).append(" ) VALUES (:externalId, :linkUri,  :version, current_timestamp AT TIME ZONE INTERVAL '00:00')");
+        sql.append(targetTableName).append("(").append(external_id).append(",").append(link_uri).append(",").append(version).append(",").append(last_modified).append(" ) VALUES (:externalId, :linkUri,  :version, current_timestamp AT TIME ZONE INTERVAL '00:00' HOUR TO MINUTE)");
         final int affectedRows = getSimpleJdbcTemplate().update(sql.toString(), params);
         return (affectedRows > 0 ? getInternalID(UUID.fromString(externalID.toString())) : null);
Index: /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/rest/AnnotationResource.java
===================================================================
--- /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/rest/AnnotationResource.java	(revision 4172)
+++ /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/rest/AnnotationResource.java	(revision 4173)
@@ -33,4 +33,6 @@
 import eu.dasish.annotation.schema.ResponseBody;
 import java.io.IOException;
+import java.net.URI;
+import java.security.Principal;
 import java.sql.Timestamp;
 import java.util.ArrayList;
@@ -50,4 +52,5 @@
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.SecurityContext;
 import javax.ws.rs.core.UriInfo;
 import javax.ws.rs.ext.Providers;
@@ -77,4 +80,6 @@
     @Context
     private Providers providers;
+    
+    
     final String default_permission = "reader";
     private static final Logger logger = LoggerFactory.getLogger(AnnotationResource.class);
@@ -92,4 +97,6 @@
     }
 
+  
+    
     public void setProviders(Providers providers) {
         this.providers = providers;
@@ -104,7 +111,10 @@
     @Secured("ROLE_USER")
     public JAXBElement<Annotation> getAnnotation(@PathParam("annotationid") String ExternalIdentifier) {
-        dbIntegrityService.setServiceURI(uriInfo.getBaseUri().toString());
+        URI baseURI = uriInfo.getBaseUri();
+        String baseURIstr = baseURI.toString();
+        dbIntegrityService.setServiceURI(baseURIstr);
         final Number annotationID = dbIntegrityService.getAnnotationInternalIdentifier(UUID.fromString(ExternalIdentifier));
-        final Number userID = dbIntegrityService.getUserInternalIDFromRemoteID(httpServletRequest.getRemoteUser());
+        String remoteUser = httpServletRequest.getRemoteUser();
+        final Number userID = dbIntegrityService.getUserInternalIDFromRemoteID(remoteUser);
         if (canRead(userID, annotationID)) {
             final Annotation annotation = dbIntegrityService.getAnnotation(annotationID);
Index: /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/MockObjectsFactoryRest.java
===================================================================
--- /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/MockObjectsFactoryRest.java	(revision 4172)
+++ /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/MockObjectsFactoryRest.java	(revision 4173)
@@ -46,4 +46,5 @@
         return context.mock(UriInfo.class);
     }
+   
     
      public Providers newProviders() {
Index: /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/TestBackendConstants.java
===================================================================
--- /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/TestBackendConstants.java	(revision 4172)
+++ /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/TestBackendConstants.java	(revision 4173)
@@ -62,5 +62,5 @@
     public static final String _TEST_ANNOT_TO_ADD_BODY = "<html><body>the stuff to be added</body></html>";
     
-    public static final String _TEST_ANNOT_2_TIME_STAMP = "2013-08-12T09:25:00.383Z";
+    public static final String _TEST_ANNOT_2_TIME_STAMP = "2013-08-12T09:25:00.383000Z";
     
     public static final String annotaiontoDeleteInDB="INSERT INTO annotation (annotation_id, owner_id,headline,body_text, body_mimetype, external_id) VALUES (25, 111, 'Annotation to delete','<html><body>some html 4</body></html>', 'text/html', 00000000-0000-0000-0000-000000000025');";
@@ -95,4 +95,5 @@
     public static final String _TEST_NEW_Target_LINK = "http://www.sagradafamilia.cat/docs_instit/historia.php ";
     
+    public static final String _TEST_SERVLET_URI = "http://localhost:8080/annotator-backend/api/";
     public static final String _TEST_SERVLET_URI_annotations = "http://localhost:8080/annotator-backend/api/annotations/";
     public static final String _TEST_SERVLET_URI_Targets = "http://localhost:8080/annotator-backend/api/Targets/";
Index: /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/TestInstances.java
===================================================================
--- /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/TestInstances.java	(revision 4172)
+++ /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/TestInstances.java	(revision 4173)
@@ -23,4 +23,6 @@
 import eu.dasish.annotation.schema.TargetInfo;
 import eu.dasish.annotation.schema.TargetInfoList;
+import javax.xml.datatype.DatatypeConfigurationException;
+import javax.xml.datatype.DatatypeFactory;
 
 /**
@@ -33,17 +35,23 @@
     final private Annotation _annotationToAdd;
     
-    public TestInstances(){
-        _annotationOne = makeAnnotationOne();
-        _annotationToAdd = makeAnnotationToAdd();    
+    public TestInstances(String baseURI){
+        _annotationOne = makeAnnotationOne(baseURI);
+        _annotationToAdd = makeAnnotationToAdd(baseURI);    
     }
     
     
-    private Annotation makeAnnotationOne(){
-        Annotation result = makeAnnotation(TestBackendConstants._TEST_ANNOT_2_BODY, TestBackendConstants._TEST_BODY_MIMETYPE_HTML, TestBackendConstants._TEST_ANNOT_2_HEADLINE, TestBackendConstants._TEST_ANNOT_2_OWNER);
+    private Annotation makeAnnotationOne(String baseURI){
+        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);
+        try {
+        result.setLastModified(DatatypeFactory.newInstance().newXMLGregorianCalendar(TestBackendConstants._TEST_ANNOT_2_TIME_STAMP));
+        } catch (DatatypeConfigurationException dce) {
+            System.out.println("wrongly-formatted test timestamp "+TestBackendConstants._TEST_ANNOT_2_TIME_STAMP);
+            result.setLastModified(null);
+        }
         return result;
     }
     
-    private Annotation makeAnnotationToAdd(){
-       Annotation result = makeAnnotation(TestBackendConstants._TEST_ANNOT_TO_ADD_BODY, TestBackendConstants._TEST_BODY_MIMETYPE_TEXT, TestBackendConstants._TEST_ANNOT_TO_ADD_HEADLINE, 5);
+    private Annotation makeAnnotationToAdd(String baseURI){
+       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);
        
        TargetInfo TargetInfo =  new TargetInfo();
@@ -60,5 +68,5 @@
     
 
-    private Annotation makeAnnotation(String bodyTxt, String bodyMimeType, String headline, int ownerId){
+    private Annotation makeAnnotation(String baseURI, String bodyTxt, String bodyMimeType, String headline, String ownerID){
         Annotation result = new Annotation();
         AnnotationBody body = new AnnotationBody();
@@ -70,5 +78,5 @@
        
         result.setHeadline(headline);
-        result.setOwnerRef(String.valueOf(ownerId)); 
+        result.setOwnerRef(baseURI+"users/"+ownerID); 
         
         result.setLastModified(null); 
Index: /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/dao/impl/DBIntegrityServiceTest.java
===================================================================
--- /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/dao/impl/DBIntegrityServiceTest.java	(revision 4172)
+++ /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/dao/impl/DBIntegrityServiceTest.java	(revision 4173)
@@ -79,5 +79,5 @@
     @Autowired
     private AnnotationDao annotationDao;
-    TestInstances testInstances = new TestInstances();
+    TestInstances testInstances = new TestInstances(TestBackendConstants._TEST_SERVLET_URI);
 
     public DBIntegrityServiceTest() {
Index: /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/dao/impl/JdbcAnnotationDaoTest.java
===================================================================
--- /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/dao/impl/JdbcAnnotationDaoTest.java	(revision 4172)
+++ /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/dao/impl/JdbcAnnotationDaoTest.java	(revision 4173)
@@ -48,5 +48,5 @@
     @Autowired
     JdbcAnnotationDao jdbcAnnotationDao;    
-    TestInstances testInstances = new TestInstances();
+    TestInstances testInstances = new TestInstances(TestBackendConstants._TEST_SERVLET_URI);
     
      /**
@@ -229,5 +229,4 @@
      */
     @Test
-    @Ignore
     public void getAnnotationWithoutTargetsAndPermissions() throws SQLException, DatatypeConfigurationException {
         System.out.println("test getAnnotationWithoutTargets");
@@ -269,6 +268,5 @@
      * Test of addAnnotation method, of class JdbcAnnotationDao.
      */
-    @Test
-    @Ignore    
+    @Test  
     public void testAddAnnotation() throws SQLException, Exception {
         System.out.println("test_addAnnotation ");
@@ -378,6 +376,5 @@
     
     //////////////////////////////////
-    @Test
-    @Ignore    
+    @Test 
     public void testUpdateBodyText() throws SQLException{
         System.out.println("test updateBodyText");
Index: /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/dao/impl/JdbcResourceDaoTest.java
===================================================================
--- /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/dao/impl/JdbcResourceDaoTest.java	(revision 4172)
+++ /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/dao/impl/JdbcResourceDaoTest.java	(revision 4173)
@@ -72,5 +72,5 @@
 
     private String getTestDataInsertSql() throws FileNotFoundException, URISyntaxException {
-        final URL sqlUrl = JdbcNotebookDaoTest.class.getResource("/test-data/InsertTestData.sql");
+        final URL sqlUrl = JdbcResourceDaoTest.class.getResource("/test-data/InsertTestData.sql");
         String sqlString = new Scanner(new File(sqlUrl.toURI()), "UTF8").useDelimiter("\\Z").next();
         return sqlString;
Index: /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/dao/impl/JdbcTargetDaoTest.java
===================================================================
--- /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/dao/impl/JdbcTargetDaoTest.java	(revision 4172)
+++ /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/dao/impl/JdbcTargetDaoTest.java	(revision 4173)
@@ -161,5 +161,4 @@
      */
     @Test
-    @Ignore
     public void testAddTarget() throws SQLException {
         System.out.println("addTarget");
Index: /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/dao/impl/JdbcUserDaoTest.java
===================================================================
--- /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/dao/impl/JdbcUserDaoTest.java	(revision 4172)
+++ /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/dao/impl/JdbcUserDaoTest.java	(revision 4173)
@@ -39,5 +39,5 @@
     @Autowired
     JdbcUserDao jdbcUserDao;
-    TestInstances testInstances = new TestInstances();
+    TestInstances testInstances = new TestInstances(TestBackendConstants._TEST_SERVLET_URI);
     
      /**
Index: /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/rest/AnnotationResourceTest.java
===================================================================
--- /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/rest/AnnotationResourceTest.java	(revision 4172)
+++ /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/rest/AnnotationResourceTest.java	(revision 4173)
@@ -19,5 +19,4 @@
 
 import eu.dasish.annotation.backend.dao.DBIntegrityService;
-import eu.dasish.annotation.backend.Helpers;
 import eu.dasish.annotation.backend.MockObjectsFactoryRest;
 import eu.dasish.annotation.backend.TestBackendConstants;
@@ -45,5 +44,4 @@
 import java.lang.InstantiationException;
 import java.net.URI;
-import java.sql.Timestamp;
 import java.util.ArrayList;
 import java.util.List;
@@ -74,7 +72,7 @@
     private DBIntegrityService mockDbIntegrityService;
     @Autowired
+    UriInfo mockUriInfo;    
+    @Autowired
     private AnnotationResource annotationResource;
-    @Autowired
-    UriInfo mockUriInfo;
     
     private MockHttpServletRequest mockRequest;
@@ -94,5 +92,5 @@
         System.out.println("getAnnotation");
         final String externalIDstring= TestBackendConstants._TEST_ANNOT_2_EXT;
-        final Annotation expectedAnnotation = (new TestInstances()).getAnnotationOne();       
+        final Annotation expectedAnnotation = (new TestInstances(TestBackendConstants._TEST_SERVLET_URI)).getAnnotationOne();       
         annotationResource.setHttpServletRequest(mockRequest);        
         annotationResource.setUriInfo(mockUriInfo);       
Index: /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/rest/AnnotationsTest.java
===================================================================
--- /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/rest/AnnotationsTest.java	(revision 4172)
+++ /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/rest/AnnotationsTest.java	(revision 4173)
@@ -18,8 +18,15 @@
 package eu.dasish.annotation.backend.rest;
 
-import eu.dasish.annotation.backend.dao.DBIntegrityService;
 import com.sun.jersey.api.client.ClientResponse;
-import eu.dasish.annotation.backend.Helpers;
+import com.sun.jersey.api.client.WebResource;
+import com.sun.jersey.api.client.WebResource.Builder;
+import com.sun.jersey.api.client.filter.HTTPBasicAuthFilter;
+import com.sun.jersey.core.util.Base64;
+import com.sun.jersey.spi.spring.container.servlet.SpringServlet;
+import com.sun.jersey.test.framework.JerseyTest;
+import com.sun.jersey.test.framework.WebAppDescriptor;
 import eu.dasish.annotation.backend.TestBackendConstants;
+import eu.dasish.annotation.backend.TestInstances;
+import eu.dasish.annotation.backend.dao.impl.JdbcResourceDaoTest;
 import eu.dasish.annotation.schema.Annotation;
 import eu.dasish.annotation.schema.ObjectFactory;
@@ -27,117 +34,158 @@
 import eu.dasish.annotation.schema.TargetInfo;
 import eu.dasish.annotation.schema.TargetInfoList;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.net.URISyntaxException;
+import java.net.URL;
 import java.sql.SQLException;
-import java.sql.Timestamp;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Scanner;
 import java.util.UUID;
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.HttpHeaders;
 import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.UriInfo;
 import javax.xml.bind.JAXBElement;
 import javax.xml.datatype.DatatypeConfigurationException;
 import javax.xml.datatype.DatatypeFactory;
-import org.jmock.Expectations;
 import org.junit.Test;
 import static org.junit.Assert.*;
+import org.junit.Before;
 import org.junit.Ignore;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.dao.DataAccessException;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.mock.web.MockHttpServletRequest;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.web.context.ContextLoaderListener;
+import org.springframework.web.context.request.RequestContextListener;
+
 /**
  *
  * @author olhsha
  */
-public class AnnotationsTest extends ResourcesTest{
-    
-    private DBIntegrityService daoDispatcher;
-    
-    private UriInfo uriInfo;
+@RunWith(value = SpringJUnit4ClassRunner.class)
+@ContextConfiguration({"/spring-integrity-test-config/dataSource.xml"})
+public class AnnotationsTest extends JerseyTest {    
+    
+    @Autowired
+    private JdbcTemplate jdbcTemplate;
     
     public AnnotationsTest() {
-        super(AnnotationResource.class.getPackage().getName());        
-        daoDispatcher = webAppContext.getBean(DBIntegrityService.class);
-        uriInfo = webAppContext.getBean(UriInfo.class);
-    }
-    
-
-     /**
-     * Test of getAnnotation method, of class annotationResource. Get <aid>.
-     * GET api/annotations/<aid>
+        super(new WebAppDescriptor.Builder(AnnotationResource.class.getPackage().getName())
+                .servletClass(SpringServlet.class)
+                .contextParam("contextConfigLocation", "classpath*:spring-integrity-test-config/*.xml")
+                .addFilter(DummySecurityFilter.class, "DummySecurityFilter")
+                .requestListenerClass(RequestContextListener.class)
+                .contextListenerClass(ContextLoaderListener.class)
+                .build());
+        
+    }
+    
+    private String getNormalisedSql() throws FileNotFoundException, URISyntaxException {
+        // remove the unsupported sql for the test
+        final URL sqlUrl = JdbcResourceDaoTest.class.getResource("/sql/DashishAnnotatorCreate.sql");
+        String sqlString = new Scanner(new File(sqlUrl.toURI()), "UTF8").useDelimiter("\\Z").next();
+        for (String unknownToken : new String[]{
+                    "SET client_encoding",
+                    "CREATE DATABASE",
+                    "\\\\connect",
+                    "SET default_with_oids",
+                    "ALTER SEQUENCE",
+                    "ALTER TABLE ONLY",
+                    "ADD CONSTRAINT",
+                    "CREATE INDEX", // "ALTER TABLE ONLY [a-z]* ALTER COLUMN",
+                // "ALTER TABLE ONLY [^A]* ADD CONSTRAINT"
+                }) {
+            sqlString = sqlString.replaceAll(unknownToken, "-- " + unknownToken);
+        }
+        // obsolete(?) Peter's stuff, before body has been decided to be a text with its mimetype: sqlString = sqlString.replaceAll("body_xml xml", "body_xml text");
+        sqlString = sqlString.replaceAll("CACHE 1;", "; -- CACHE 1;");
+        //sqlString = sqlString.replaceAll("UUID", "text");
+        sqlString = sqlString.replaceAll("SERIAL NOT NULL", "INTEGER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY");
+        return sqlString;
+    }
+    
+    private String getTestDataInsertSql() throws FileNotFoundException, URISyntaxException {
+        final URL sqlUrl = AnnotationsTest.class.getResource("/test-data/InsertTestData.sql");
+        String sqlString = new Scanner(new File(sqlUrl.toURI()), "UTF8").useDelimiter("\\Z").next();
+        return sqlString;
+    }
+    
+    
+    
+    @Override
+    @Before
+    public void setUp() throws DataAccessException, FileNotFoundException, URISyntaxException, Exception {
+        super.setUp();
+        jdbcTemplate.execute("DROP SCHEMA PUBLIC CASCADE");
+        // consume the DashishAnnotatorCreate sql script to create the database
+        jdbcTemplate.execute(getNormalisedSql());
+        jdbcTemplate.execute(getTestDataInsertSql());
+    }
+
+    
+    @Override
+    public void tearDown() throws Exception {
+        super.tearDown();
+    }
+    /**
+     * Test of getAnnotation method, of class annotationResource. Get <aid>. GET
+     * api/annotations/<aid>
+     */
+    @Test
+    public void testGetAnnotation() throws SQLException, DatatypeConfigurationException {
+        System.out.println("testGetAnnotation");
+        final String externalIDstring = TestBackendConstants._TEST_ANNOT_2_EXT;
+        final Annotation testAnnotation = (new TestInstances(resource().getURI().toString())).getAnnotationOne();        
+        
+        final String requestUrl = "annotations/" + externalIDstring;
+        System.out.println("requestUrl: " + requestUrl);
+        
+        Builder responseBuilder = getAuthenticatedResource(resource().path(requestUrl)).accept(MediaType.TEXT_XML);
+        
+        ClientResponse response = responseBuilder.get(ClientResponse.class);        
+        
+        assertEquals(200, response.getStatus());
+        Annotation entity = response.getEntity(Annotation.class);
+        assertEquals(testAnnotation.getBody().getTextBody().getValue(), entity.getBody().getTextBody().getValue());
+        assertEquals(testAnnotation.getHeadline(), entity.getHeadline());
+        assertEquals(testAnnotation.getOwnerRef(), entity.getOwnerRef());
+        assertEquals(3, entity.getPermissions().getUserWithPermission().size());
+        assertEquals("owner", entity.getPermissions().getUserWithPermission().get(0).getPermission().value());        
+        assertEquals(resource().getURI()+"users/"+TestBackendConstants._TEST_USER_3_EXT_ID, entity.getPermissions().getUserWithPermission().get(0).getRef()); 
+        assertEquals("writer", entity.getPermissions().getUserWithPermission().get(1).getPermission().value());
+        assertEquals(resource().getURI()+"users/"+TestBackendConstants._TEST_USER_4_EXT_ID, entity.getPermissions().getUserWithPermission().get(1).getRef()); 
+        assertEquals("reader", entity.getPermissions().getUserWithPermission().get(2).getPermission().value()); 
+        assertEquals(resource().getURI()+"users/"+TestBackendConstants._TEST_USER_5_EXT_ID, entity.getPermissions().getUserWithPermission().get(2).getRef()); 
+        assertEquals(2, entity.getTargets().getTargetInfo().size());
+        assertEquals(resource().getURI().toString()+"targets/"+TestBackendConstants._TEST_Target_1_EXT_ID, entity.getTargets().getTargetInfo().get(0).getRef());
+        assertEquals(resource().getURI().toString()+"targets/"+TestBackendConstants._TEST_Target_2_EXT_ID, entity.getTargets().getTargetInfo().get(1).getRef());
+        assertEquals(testAnnotation.getLastModified(), entity.getLastModified());
+        assertEquals(resource().getURI()+requestUrl, entity.getURI());
+    }
+
+    /**
+     * Test of deleteAnnotation method, of class AnnotationResource. Delete
+     * <nid>. DELETE api/annotations/<aid>
      */
     @Test
     @Ignore
-    public void testGetAnnotation() throws SQLException, DatatypeConfigurationException{
-        System.out.println("testGetAnnotation");
-        final String externalIDstring= TestBackendConstants._TEST_ANNOT_2_EXT;
-        final int annotationID = 2;
-        final Annotation testAnnotation = new Annotation();
-        testAnnotation.setOwnerRef("5");
-        testAnnotation.setURI(externalIDstring);
-        testAnnotation.setLastModified(DatatypeFactory.newInstance().newXMLGregorianCalendar(TestBackendConstants._TEST_ANNOT_2_TIME_STAMP));
-        
+    public void testDeleteAnnotation() throws SQLException {
+        System.out.println("testDeleteAnnotation");
         //final Number annotationID = daoDispatcher.getAnnotationInternalIdentifier(UUID.fromString(UUID));
-        //final Annotation annotation = daoDispatcher.getAnnotation(annotationID);
-        mockeryRest.checking(new Expectations() {
-            {
-                 
-                oneOf(uriInfo).getBaseUri();
-                will(returnValue("http://localhost:8080/annotator-backend/api/"));
-                
-                
-                oneOf(daoDispatcher).setServiceURI(with(any(String.class)));
-                will(doAll());
-                
-                oneOf(daoDispatcher).getAnnotationInternalIdentifier(with(aNonNull(UUID.class)));                
-                will(returnValue(annotationID));                
-                
-                oneOf(daoDispatcher).getAnnotation(annotationID);                
-                will(returnValue(testAnnotation));
-            }
-        });
-        
-        final String requestUrl = "annotations/" + externalIDstring;
-        System.out.println("requestUrl: " + requestUrl);
-        ClientResponse response = resource().path(requestUrl).accept(MediaType.TEXT_XML).get(ClientResponse.class);
-        assertEquals(200, response.getStatus());
-        Annotation entity = response.getEntity(Annotation.class);
-        assertEquals(testAnnotation.getBody(), entity.getBody());
-        assertEquals(testAnnotation.getHeadline(), entity.getHeadline());
-        assertEquals(testAnnotation.getOwnerRef(), entity.getOwnerRef());
-        assertEquals(testAnnotation.getPermissions(), entity.getPermissions());
-        assertEquals(testAnnotation.getTargets(), entity.getTargets());
-        assertEquals(testAnnotation.getLastModified(), entity.getLastModified());
-        assertEquals(testAnnotation.getURI(), entity.getURI());
-    }  
-    
-     /**
-     * Test of deleteAnnotation method, of class AnnotationResource. Delete <nid>.
-     * DELETE api/annotations/<aid>
-     */
-    @Test
-    @Ignore
-    public void testDeleteAnnotation() throws SQLException{
-        System.out.println("testDeleteAnnotation");
-         //final Number annotationID = daoDispatcher.getAnnotationInternalIdentifier(UUID.fromString(UUID));
         //int[] resultDelete = daoDispatcher.deleteAnnotation(annotationID);
-       
+        
         final int[] mockDelete = new int[4];
-        mockDelete[0]=1; // # deleted annotations
-        mockDelete[3]=1; // # deleted annotation_prinipal_permissions
-        mockDelete[2]=2; // # deleted  annotations_target_Targets, (5,3), (5,4)
-        mockDelete[3]=1; // # deletd Targets, 4
-        mockeryRest.checking(new Expectations() {
-            {  
-                  
-                oneOf(uriInfo).getBaseUri();
-                will(returnValue("http://localhost:8080/annotator-backend/api/"));
-                
-                
-                oneOf(daoDispatcher).setServiceURI(with(any(String.class)));
-                will(doAll());
-                
-                oneOf(daoDispatcher).getAnnotationInternalIdentifier(with(aNonNull(UUID.class)));              
-                will(returnValue(5));     
-                
-                oneOf(daoDispatcher).deleteAnnotation(5);
-                will(returnValue(mockDelete));
-            }
-        });
+        mockDelete[0] = 1; // # deleted annotations
+        mockDelete[3] = 1; // # deleted annotation_prinipal_permissions
+        mockDelete[2] = 2; // # deleted  annotations_target_Targets, (5,3), (5,4)
+        mockDelete[3] = 1; // # deletd Targets, 4
+        
+        final String baseURI = this.getBaseURI().toString();
+        
         final String requestUrl = "annotations/" + TestBackendConstants._TEST_ANNOT_5_EXT;
         System.out.println("requestUrl: " + requestUrl);
@@ -146,13 +194,14 @@
         assertEquals("1 annotation(s) deleted.", response.getEntity(String.class));
         
-      
-    }
+        
+    }
+
     /**
-     * Test of createAnnotation method, of class AnnotationResource. 
-     * POST api/annotations/
+     * Test of createAnnotation method, of class AnnotationResource. POST
+     * api/annotations/
      */
     @Test
     @Ignore
-    public void testCreateAnnotation() throws SQLException, InstantiationException, IllegalAccessException, DatatypeConfigurationException, Exception{
+    public void testCreateAnnotation() throws SQLException, InstantiationException, IllegalAccessException, DatatypeConfigurationException, Exception {
         System.out.println("test createAnnotation");
         // Peter's workaround on absence of "ObjectFactory.create... for annotations        
@@ -160,5 +209,5 @@
         
         final String ownerString = "5";
-        final Number ownerID =  5;
+        final Number ownerID = 5;
         final Number newAnnotationID = 6;
         
@@ -173,5 +222,5 @@
         addedAnnotation.setTargets(TargetInfoList);
         addedAnnotation.setOwnerRef(ownerString);
-        addedAnnotation.setURI(TestBackendConstants._TEST_SERVLET_URI_annotations+UUID.randomUUID().toString());        
+        addedAnnotation.setURI(TestBackendConstants._TEST_SERVLET_URI_annotations + UUID.randomUUID().toString());        
         addedAnnotation.setLastModified(DatatypeFactory.newInstance().newXMLGregorianCalendar(TestBackendConstants._TEST_ANNOT_2_TIME_STAMP));        
         TargetInfo TargetInfo = new TargetInfo();
@@ -179,35 +228,10 @@
         TargetInfo.setRef(UUID.randomUUID().toString());
         TargetInfo.setVersion("vandaag");
-        TargetInfoList.getTargetInfo().add(TargetInfo); 
+        TargetInfoList.getTargetInfo().add(TargetInfo);        
         
         final List<Number> Targets = new ArrayList<Number>();
         Targets.add(6);
         
-        mockeryRest.checking(new Expectations() {
-            {
-                 
-                oneOf(uriInfo).getBaseUri();
-                will(returnValue("http://localhost:8080/annotator-backend/api/"));
-                
-                
-                oneOf(daoDispatcher).setServiceURI(with(any(String.class)));
-                will(doAll());
-                
-                oneOf(daoDispatcher).getUserInternalIdentifier(with(any(UUID.class)));
-                will(returnValue(ownerID));
-                
-                //oneOf(daoDispatcher).addUsersAnnotation(annotToAddJB, ownerID);
-                oneOf(daoDispatcher).addUsersAnnotation(with(aNonNull(Number.class)), with(aNonNull(Annotation.class)));
-                will(returnValue(newAnnotationID));
-                
-                oneOf(daoDispatcher).getAnnotation(newAnnotationID);
-                will(returnValue(addedAnnotation));
-                
-                oneOf(daoDispatcher).getTargetsWithNoCachedRepresentation(newAnnotationID);
-                will(returnValue(Targets));
-            }
-        });
-        
-              
+        final String baseURI = this.getBaseURI().toString();
         
         final String requestUrl = "annotations";
@@ -216,5 +240,5 @@
         assertEquals(200, response.getStatus());
         
-        ResponseBody entity = response.getEntity(ResponseBody.class); 
+        ResponseBody entity = response.getEntity(ResponseBody.class);        
         Annotation entityA = entity.getAnnotation();
         assertEquals(addedAnnotation.getBody(), entityA.getBody());
@@ -227,3 +251,9 @@
         assertEquals(addedAnnotation.getOwnerRef(), entityA.getOwnerRef());
     }
+    
+    
+   
+    protected Builder getAuthenticatedResource(WebResource resource) {
+	return resource.header(HttpHeaders.AUTHORIZATION, "Basic "  + new String(Base64.encode(DummyPrincipal.DUMMY_PRINCIPAL.getName()+":olhapassword")));
+    }
 }
Index: /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/rest/DummyPrincipal.java
===================================================================
--- /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/rest/DummyPrincipal.java	(revision 4173)
+++ /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/rest/DummyPrincipal.java	(revision 4173)
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2013 DASISH
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+package eu.dasish.annotation.backend.rest;
+
+/**
+ *
+ * @author olhsha
+ */
+
+import java.security.Principal;
+
+
+public final class DummyPrincipal implements Principal {
+
+    public static final DummyPrincipal DUMMY_ADMIN_PRINCIPAL = new DummyPrincipal("JUnit.Admin@test.com");
+    public static final DummyPrincipal DUMMY_PRINCIPAL = new DummyPrincipal("JUnit@test.com");
+    public static final UserCredentials DUMMY_CREDENTIALS = new UserCredentials(DUMMY_PRINCIPAL) {
+
+	@Override
+	public String getDisplayName() {
+	    return "J.Unit";
+	}
+    };
+    
+    public static final UserCredentials DUMMY_ADMIN_CREDENTIALS = new UserCredentials(DUMMY_ADMIN_PRINCIPAL);
+    
+    private final String username;
+
+    public DummyPrincipal(String username) {
+	this.username = username;
+    }
+
+    @Override
+    public String getName() {
+	return username;
+    }
+
+    public UserCredentials getCredentials() {
+	return new UserCredentials(this);
+    }
+}
Index: /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/rest/DummySecurityFilter.java
===================================================================
--- /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/rest/DummySecurityFilter.java	(revision 4173)
+++ /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/rest/DummySecurityFilter.java	(revision 4173)
@@ -0,0 +1,150 @@
+/*
+ * Copyright (C) 2013 DASISH
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+package eu.dasish.annotation.backend.rest;
+
+/**
+ *
+ * @author olhsha
+ */
+import java.io.IOException;
+import java.security.Principal;
+import java.util.Arrays;
+import java.util.List;
+
+import javax.naming.AuthenticationException;
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletRequestWrapper;
+import javax.ws.rs.core.HttpHeaders;
+
+import com.sun.jersey.api.container.MappableContainerException;
+import com.sun.jersey.core.util.Base64;
+
+/**
+ * Dummy security filter, very handy for unit testing.
+ *
+ */
+public class DummySecurityFilter implements Filter {
+
+    private final List<String> ALLOWED_USERS = Arrays.asList(DummyPrincipal.DUMMY_PRINCIPAL.getName());
+
+    /**
+     * Dummy validation for unit tests
+     *
+     * @param username
+     * @param password
+     * @return
+     */
+    private boolean isValid(String username, String password) {
+        return ALLOWED_USERS.contains(username);
+    }
+
+    @Override
+    public void destroy() {
+    }
+
+    @Override
+    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
+        Principal principalResult = null;
+        HttpServletRequest req = (HttpServletRequest) request;
+        String authentication = req.getHeader(HttpHeaders.AUTHORIZATION);
+
+        if (authentication != null) { //if no authentication then do nothing
+            if (!authentication.startsWith("Basic ")) {
+                throw new MappableContainerException(new AuthenticationException("Only HTTP Basic authentication is supported"));
+            }
+            authentication = authentication.substring("Basic ".length());
+            String base64Decode = new String(Base64.decode(authentication.getBytes()));
+            String[] values = base64Decode.split(":");
+            if (values.length < 2) {
+                throw new MappableContainerException(new AuthenticationException("Invalid syntax for username and password"));
+            }
+            final String username = values[0];
+            String password = values[1];
+            if ((username == null) || (password == null)) {
+                throw new MappableContainerException(new AuthenticationException("Missing username or password"));
+            }
+            if (!isValid(username, password)) {
+                throw new MappableContainerException(new AuthenticationException("Invalid user/password"));
+            }
+            
+            principalResult = new DummyPrincipal(username);
+            final Principal principal = principalResult;
+            HttpServletRequestWrapper wrapper = new HttpServletRequestWrapper(req) {
+                public boolean isUserInRole(String role) {
+                    return true;
+                }
+
+                public boolean isSecure() {
+                    return false;
+                }
+
+                public Principal getUserPrincipal() {
+                    return principal;
+                }
+
+                @Override
+                public String getAuthType() {
+                    return HttpServletRequest.BASIC_AUTH;
+                }
+
+                @Override
+                public String getRemoteUser() {
+                    return username;
+                }
+            };
+
+            chain.doFilter(wrapper, response);
+        } else {
+            final Principal principal = principalResult;
+            HttpServletRequestWrapper wrapper = new HttpServletRequestWrapper(req) {
+                public boolean isUserInRole(String role) {
+                    return true;
+                }
+
+                public boolean isSecure() {
+                    return false;
+                }
+
+                public Principal getUserPrincipal() {
+                    return principal;
+                }
+
+                @Override
+                public String getAuthType() {
+                    return HttpServletRequest.BASIC_AUTH;
+                }
+
+                @Override
+                public String getRemoteUser() {
+                    return null;
+                }
+            };
+            chain.doFilter(wrapper, response);
+        }
+    }
+
+    @Override
+    public void init(FilterConfig filterConfig) throws ServletException {
+    }
+}
Index: SISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/rest/NotebooksTest.java
===================================================================
--- /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/rest/NotebooksTest.java	(revision 4172)
+++ 	(revision )
@@ -1,280 +1,0 @@
-/*
- * Copyright (C) 2013 DASISH
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
- */
-package eu.dasish.annotation.backend.rest;
-
-import eu.dasish.annotation.backend.dao.DBIntegrityService;
-import javax.ws.rs.core.UriInfo;
-
-/**
- * Created on : Jun 12, 2013, 11:31 AM
- *
- * @author Peter Withers <peter.withers@mpi.nl>
- */
-public class NotebooksTest extends ResourcesTest {
-
-    private DBIntegrityService daoDispatcher;
-    
-    private UriInfo uriInfo;
-
-    public NotebooksTest() {
-        super(AnnotationResource.class.getPackage().getName());        
-        daoDispatcher = webAppContext.getBean(DBIntegrityService.class);
-        uriInfo = webAppContext.getBean(UriInfo.class);
-    }
-    
-//
-//    /**
-//     * Test of getNotebookInfo method, of class NotebookResource. Returns
-//     * notebook-infos for the notebooks accessible to the current user. GET
-//     * api/notebooks
-//     */
-//    @Test
-//    public void testGetNotebookInfo() {
-//        System.out.println("testGetNotebookInfo");
-//        mockeryRest.checking(new Expectations() {
-//            {
-//                oneOf(notebookDao).getNotebookInfos(with(any(UUID.class)));
-//                will(returnValue(new ArrayList<NotebookInfo>()));
-//            }
-//        });
-//        client().addFilter(new HTTPBasicAuthFilter("userid", "userpass"));
-//        ClientResponse response = Resource().path("notebooks").accept(MediaType.TEXT_XML).get(ClientResponse.class);
-//        assertEquals(200, response.getStatus());
-//        assertEquals(0, response.getEntity(new GenericType<NotebookInfoList>() {
-//        }).getNotebook().size());
-//    }
-//
-//    /**
-//     * Test of getUsersNotebooks method, of class NotebookResource. Returns the
-//     * list of all notebooks owned by the current logged user. GET
-//     * api/notebooks/owned
-//     */
-//    @Test
-//    public void testGetUsersNotebooks() {
-//        System.out.println("testGetUsersNotebooks");
-//        mockeryRest.checking(new Expectations() {
-//            {
-//                oneOf(notebookDao).getUsersNotebooks(with(any(UUID.class)));
-//                will(returnValue(new ArrayList<Notebook>()));
-//            }
-//        });
-//        client().addFilter(new HTTPBasicAuthFilter("userid", "userpass"));
-//        ClientResponse response = Resource().path("notebooks/owned").accept(MediaType.TEXT_XML).get(ClientResponse.class);
-//        assertEquals(200, response.getStatus());
-//        assertEquals(0, response.getEntity(new GenericType<List<Notebook>>() {
-//        }).size());
-//    }
-//
-//    /**
-//     * Test of getReaders method, of class NotebookResource. Returns the list of
-//     * <uid>
-//     * who allowed to read the annotations from notebook. GET
-//     * api/notebooks/<nid>/readers
-//     */
-//    @Test
-//    public void testGetReaders() {
-//        System.out.println("testGetReaders");
-//        ClientResponse response = Resource().path("notebooks/_nid_/readers").get(ClientResponse.class);
-//        assertEquals(200, response.getStatus());
-//        assertEquals("readers for _nid_", response.getEntity(String.class));
-//    }
-//
-//    /**
-//     * Test of getWriters method, of class NotebookResource. Returns the list of
-//     * <uid>
-//     * that can add annotations to the notebook. GET api/notebooks/<nid>/writers
-//     */
-//    @Test
-//    public void testGetWriters() {
-//        System.out.println("testGetWriters");
-//        ClientResponse response = Resource().path("notebooks/_nid_/writers").get(ClientResponse.class);
-//        assertEquals(200, response.getStatus());
-//        assertEquals("writers for _nid_", response.getEntity(String.class));
-//    }
-//
-//    /**
-//     * Test of getMetadata method, of class NotebookResource. Get all metadata
-//     * about a specified notebook <nid>, including the information if it is
-//     * private or not. GET api/notebooks/<nid>/metadata
-//     */
-//    @Test
-//    public void testGetMetadata() {
-//        System.out.println("test GetMetadata");
-//        
-//        final String externalIDstring= TestBackendConstants._TEST_NOTEBOOK_3_EXT;
-//        final int notebookID = 3;
-//        final NotebookInfo testInfo = new ObjectFactory().createNotebookInfo();
-//        
-//        mockeryRest.checking(new Expectations() {
-//            {
-//                oneOf(notebookDao).getInternalID(UUID.fromString(externalIDstring));                
-//                will(returnValue(notebookID));
-//                
-//                oneOf(notebookDao).getNotebookInfo(notebookID); 
-//               will(returnValue(testInfo)); 
-//            }
-//        });
-//        
-//        final String requestUrl = "notebooks/" + externalIDstring+"/metadata";
-//        System.out.println("requestUrl: " + requestUrl);
-//        ClientResponse response = Resource().path(requestUrl).type(MediaType.TEXT_XML).get(ClientResponse.class);
-//        assertEquals(200, response.getStatus());
-//        NotebookInfo entity = response.getEntity(NotebookInfo.class);
-//        assertEquals(testInfo.getRef(), entity.getRef());
-//        assertEquals(testInfo.getTitle(), entity.getTitle());
-//    }
-//
-//    /**
-//     * Test of getAllAnnotations method, of class NotebookResource. Get the list
-//     * of all annotations <aid>-s contained within a Notebook with related
-//     * metadata. Parameters: <nid>, optional maximumAnnotations specifies the
-//     * maximum number of annotations to retrieve (default -1, all annotations),
-//     * optional startAnnotation specifies the starting point from which the
-//     * annotations will be retrieved (default: -1, start from the first
-//     * annotation), optional orderby, specifies the RDF property used to order
-//     * the annotations (default: dc:created ), optional orderingMode specifies
-//     * if the results should be sorted using a descending order desc=1 or an
-//     * ascending order desc=0 (default: 0 ). GET
-//     * api/notebooks/<nid>?maximumAnnotations=limit&startAnnotation=offset&orderby=orderby&orderingMode=1|0
-//     */
-//    @Test
-//    public void testGetAllAnnotations() {
-//        System.out.println("test GetMetadata");       
-//        final String externalIDstring= TestBackendConstants._TEST_NOTEBOOK_3_EXT; 
-//        final UUID aIdOne= UUID.fromString(TestBackendConstants._TEST_ANNOT_2_EXT);
-//        final UUID aIdTwo= UUID.fromString(TestBackendConstants._TEST_ANNOT_3_EXT);
-//        final List<UUID> annotationIds = new ArrayList<UUID>();
-//        annotationIds.add(aIdOne);
-//        annotationIds.add(aIdTwo);
-//        
-//        mockeryRest.checking(new Expectations() {
-//            {
-//                oneOf(notebookDao).getAnnotationExternalIDs(with(aNonNull(UUID.class)));                
-//                will(returnValue(annotationIds));
-//                
-//            }
-//        });
-//        
-//        final String requestUrl = "notebooks/"+externalIDstring;
-//        ClientResponse response = Resource().path(requestUrl)
-//                .queryParam("maximumAnnotations", "123")
-//                .queryParam("startAnnotation", "456")
-//                .queryParam("orderby", "dc:789")
-//                .queryParam("orderingMode", "1")
-//                .get(ClientResponse.class);
-//        System.out.println("requestUrl: " + requestUrl);
-//        assertEquals(200, response.getStatus());
-//        List<JAXBElement<UUID>> result = response.getEntity(new GenericType<List<JAXBElement<UUID>>>() {});
-//        assertEquals(aIdOne, result.get(0).getValue());
-//        assertEquals(aIdTwo, result.get(1).getValue());
-//    }
-//
-//    /**
-//     * Test of modifyNotebook method, of class NotebookResource. Modify metadata
-//     * of
-//     * <nid>. The new notebookâs name must be sent in requestâs body. PUT
-//     * /notebooks/<nid>
-//     */
-//    @Test
-//    @Ignore
-//    public void testModifyNotebook_String() {
-//        System.out.println("testModifyNotebook_String");
-//        final Notebook notebook = new Notebook();        
-//        notebook.setTitle("a title");
-//        /*
-//        // this JAXBElement should be returned by the generated ObjectFactory, however it is not. This could be due to name space polution in the schema?
-//        // todo: this JAXBElement should be removed and replaced by the same as returned by the ObjectFactory when cause of it not being auto generated is resolved, in the mean time this line below makes it clear where the issue starts from.
-//        // see ticket #348
-//        final JAXBElement<Notebook> jaxbElement = new JAXBElement<Notebook>(new QName("http://www.dasish.eu/ns/addit", "notebook"), Notebook.class, null, notebook);
-//        */
-//        
-//        final JAXBElement<Notebook> notebookJAXB = (new ObjectFactory()).createNotebook(notebook);
-//        ClientResponse response = Resource().path("notebooks/_nid_").type(MediaType.APPLICATION_XML).accept(MediaType.APPLICATION_XML).put(ClientResponse.class, notebookJAXB);
-//        assertEquals(200, response.getStatus());
-//        assertEquals("modifyNotebook _nid_a title", response.getEntity(String.class));
-//    }
-//
-//    /**
-//     * Test of modifyNotebook method, of class NotebookResource. Adds an
-//     * annotation
-//     * <aid> to the list of annotations of <nid>. PUT /notebooks/<nid>/<aid>
-//     */
-//    @Test
-//    public void testAddAnnotation_String_String() {
-//        System.out.println("testAddAnnotation_String_String");
-//        ClientResponse response = Resource().path("notebooks/_nid_/_aid_").put(ClientResponse.class);
-//        assertEquals(200, response.getStatus());
-//        assertEquals("addAnnotation _nid_ : _aid_", response.getEntity(String.class));
-//    }
-//
-//    /**
-//     * Test of createNotebook method, of class NotebookResource. Creates a new
-//     * notebook. This API returns the <nid> of the created Notebook in
-//     * responseâs payload and the full URL of the notebook adding a Location
-//     * header into the HTTP response. The name of the new notebook can be
-//     * specified sending a specific payload. POST api/notebooks/
-//     */
-//    @Test
-//    public void testCreateNotebook() throws URISyntaxException {
-//        System.out.println("testCreateNotebook");
-//        mockeryRest.checking(new Expectations() {
-//            {
-//                oneOf(notebookDao).addNotebook(with(any(UUID.class)), with(any(String.class)));
-//                will(returnValue(UUID.fromString(TestBackendConstants._TEST_NOTEBOOK_1_EXT_ID)));
-//            }
-//        });
-//        ClientResponse response = Resource().path("notebooks").post(ClientResponse.class);
-//        assertEquals(200, response.getStatus());
-//        assertEquals("/api/notebooks/00000000-0000-0000-0000-000000000001", new URI(response.getEntity(String.class)).getPath());
-//    }
-//
-//    /**
-//     * Test of createAnnotation method, of class NotebookResource. Creates a new
-//     * annotation in <nid>. The content of an annotation is given in the request
-//     * body. In fact this is a short cut of two actions: POST
-//     * api/notebooks/<nid>
-//     */
-//    @Test
-//    public void testCreateAnnotation() {
-//        System.out.println("testCreateAnnotation");
-//        ClientResponse response = Resource().path("notebooks/_nid_").post(ClientResponse.class);
-//        assertEquals(200, response.getStatus());
-//        assertEquals("annotation _nid_ : api/notebooks/_nid_", response.getEntity(String.class));
-//    }
-//
-//    /**
-//     * Test of deleteNotebook method, of class NotebookResource. Delete <nid>.
-//     * Annotations stay, they just lose connection to <nid>. DELETE
-//     * api/notebooks/<nid>
-//     */
-//    @Test
-//    public void testDeleteNotebook() {
-//        System.out.println("testModifyNotebook_String");
-//        mockeryRest.checking(new Expectations() {
-//            {
-//                oneOf(notebookDao).deleteNotebook(UUID.fromString(TestBackendConstants._TEST_NOTEBOOK_2_EXT_ID));
-//                will(returnValue(1));
-//            }
-//        });
-//        final String requestUrl = "notebooks/" + TestBackendConstants._TEST_NOTEBOOK_2_EXT_ID;
-//        System.out.println("requestUrl: " + requestUrl);
-//        ClientResponse response = Resource().path(requestUrl).delete(ClientResponse.class);
-//        assertEquals(200, response.getStatus());
-//        assertEquals("1", response.getEntity(String.class));
-//    }
-}
Index: SISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/rest/ResourcesTest.java
===================================================================
--- /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/rest/ResourcesTest.java	(revision 4172)
+++ 	(revision )
@@ -1,54 +1,0 @@
-/*
- * Copyright (C) 2013 DASISH
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
- */
-package eu.dasish.annotation.backend.rest;
-
-import com.sun.jersey.spi.spring.container.servlet.SpringServlet;
-import com.sun.jersey.test.framework.JerseyTest;
-import com.sun.jersey.test.framework.WebAppDescriptor;
-import org.jmock.Mockery;
-import org.springframework.web.context.ContextLoaderListener;
-import org.springframework.web.context.WebApplicationContext;
-
-/**
- *
- * @author olhsha
- */
-public class ResourcesTest extends JerseyTest{
-    
-    protected Mockery mockeryRest;    
-    final protected WebApplicationContext webAppContext;
-    
-    public ResourcesTest(String packageName) {
-        
-        // debug
-        
-        
-        super(new WebAppDescriptor.Builder(packageName)
-                .servletClass(SpringServlet.class)
-                .contextParam("contextConfigLocation", "classpath*:spring-test-config/**/*.xml")
-                .contextListenerClass(ContextLoaderListener.class)
-                .build());
-
-        // Get the web application context that has been instantiated in the Grizzly container
-        webAppContext = ContextLoaderListener.getCurrentWebApplicationContext();
-
-        // Get the context and mock objects from the context by their type
-        mockeryRest = webAppContext.getBean(Mockery.class);
-    }
-
-}
Index: /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/rest/UserCredentials.java
===================================================================
--- /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/rest/UserCredentials.java	(revision 4173)
+++ /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/rest/UserCredentials.java	(revision 4173)
@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 2013 DASISH
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+package eu.dasish.annotation.backend.rest;
+
+/**
+ *
+ * @author olhsha
+ */
+
+import java.security.Principal;
+//import java.util.List;
+//
+//import org.apache.commons.codec.digest.DigestUtils;
+//
+//import de.mpg.aai.shhaa.model.AuthAttribute;
+//import de.mpg.aai.shhaa.model.AuthAttributes;
+//import de.mpg.aai.shhaa.model.AuthPrincipal;
+
+/**
+ * Wrapper class to hold the userPrincipal and a displayName
+ * 
+ */
+public class UserCredentials {
+
+    private final Principal userPrincipal;
+
+    public UserCredentials(Principal userPrincipal) {
+        this.userPrincipal = userPrincipal;
+    }
+
+    public Principal getPrincipal() {
+        return userPrincipal;
+    }
+
+    public String getPrincipalName() {
+        return userPrincipal.getName();
+    }
+
+//    public String getPrincipalNameMD5Hex() {
+//        return getPrincipalNameMD5Hex(userPrincipal.getName());
+//    }
+//
+//    public static String getPrincipalNameMD5Hex(String name){
+//	return DigestUtils.md5Hex(name);
+//    }
+
+    public String getDisplayName() {
+        String result = null;
+//        if (userPrincipal instanceof AuthPrincipal) {
+//            List<String> displayNamesAttributes = Configuration.getInstance().getDisplayNameShibbolethKeys();
+//            AuthPrincipal authPrincipal = (AuthPrincipal) userPrincipal;
+//            for (String key : displayNamesAttributes) {
+//                result = getValue(authPrincipal, key);
+//                if (result != null) {
+//                    break;
+//                }
+//            }
+//        }
+        if (result == null) {
+            result = getPrincipalName();
+        }
+        return result;
+    }
+
+//    private String getValue(AuthPrincipal authPrincipal, String key) {
+//        String result = null;
+//        AuthAttributes attributes = authPrincipal.getAttribues();
+//        if (attributes != null) {
+//            AuthAttribute<String> authAttribute = (AuthAttribute<String>) attributes.get(key);
+//            if (authAttribute != null) {
+//                result = authAttribute.getValue();
+//            }
+//        }
+//        return result;
+//    }
+
+    @Override
+    public String toString() {
+	return getPrincipal().toString();
+    }
+}
+
Index: /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/resources/spring-integrity-test-config/JaxbMarshallerFactory.xml
===================================================================
--- /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/resources/spring-integrity-test-config/JaxbMarshallerFactory.xml	(revision 4173)
+++ /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/resources/spring-integrity-test-config/JaxbMarshallerFactory.xml	(revision 4173)
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Copyright (C) 2013 DASISH
+
+    This program is free software; you can redistribute it and/or
+    modify it under the terms of the GNU General Public License
+    as published by the Free Software Foundation; either version 2
+    of the License, or (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
+       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+">
+    
+    <!-- Load properties from context.xml via servlet container -->
+    <bean
+        class="org.springframework.web.context.support.ServletContextPropertyPlaceholderConfigurer">
+        <property name="ignoreUnresolvablePlaceholders" value="true" />
+    </bean>
+    <bean id="jaxbMarshallerFactory" class="eu.dasish.annotation.backend.rest.JaxbMarshallerFactory">
+        <property name="schemaLocation"
+                 value="${eu.dasish.annotation.backend.schemaLocation}" />
+    </bean>
+</beans>
Index: /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/resources/spring-integrity-test-config/annotationDao.xml
===================================================================
--- /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/resources/spring-integrity-test-config/annotationDao.xml	(revision 4173)
+++ /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/resources/spring-integrity-test-config/annotationDao.xml	(revision 4173)
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Copyright (C) 2013 DASISH
+
+    This program is free software; you can redistribute it and/or
+    modify it under the terms of the GNU General Public License
+    as published by the Free Software Foundation; either version 2
+    of the License, or (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
+       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+">
+    <bean class="eu.dasish.annotation.backend.dao.impl.JdbcAnnotationDao">
+        <constructor-arg ref="dataSource"/>
+    </bean>
+</beans>
Index: /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/resources/spring-integrity-test-config/cachedRepresentationDao.xml
===================================================================
--- /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/resources/spring-integrity-test-config/cachedRepresentationDao.xml	(revision 4173)
+++ /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/resources/spring-integrity-test-config/cachedRepresentationDao.xml	(revision 4173)
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Copyright (C) 2013 DASISH
+
+    This program is free software; you can redistribute it and/or
+    modify it under the terms of the GNU General Public License
+    as published by the Free Software Foundation; either version 2
+    of the License, or (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
+       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+">
+<bean class="eu.dasish.annotation.backend.dao.impl.JdbcCachedRepresentationDao">
+        <constructor-arg ref="dataSource"/>
+    </bean>
+</beans>
Index: /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/resources/spring-integrity-test-config/componentscan.xml
===================================================================
--- /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/resources/spring-integrity-test-config/componentscan.xml	(revision 4173)
+++ /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/resources/spring-integrity-test-config/componentscan.xml	(revision 4173)
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Copyright (C) 2013 DASISH
+
+    This program is free software; you can redistribute it and/or
+    modify it under the terms of the GNU General Public License
+    as published by the Free Software Foundation; either version 2
+    of the License, or (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:context="http://www.springframework.org/schema/context"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+          http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
+    <context:component-scan base-package="eu.dasish.annotation.backend.rest" />
+</beans>
Index: /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/resources/spring-integrity-test-config/dataSource.xml
===================================================================
--- /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/resources/spring-integrity-test-config/dataSource.xml	(revision 4173)
+++ /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/resources/spring-integrity-test-config/dataSource.xml	(revision 4173)
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Copyright (C) 2013 DASISH
+
+    This program is free software; you can redistribute it and/or
+    modify it under the terms of the GNU General Public License
+    as published by the Free Software Foundation; either version 2
+    of the License, or (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:context="http://www.springframework.org/schema/context"
+
+       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+          http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
+">
+    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
+        <property name="driverClassName" value="org.hsqldb.jdbcDriver"/>
+        <property name="url" value="jdbc:hsqldb:mem:dasish_annotator;sql.syntax_pgs=true"/>
+        <property name="username" value="sa"/>
+        <property name="password" value=""/>
+    </bean>	
+    
+    <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
+        <property name="dataSource" ref="dataSource"/>
+    </bean>
+</beans>
Index: /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/resources/spring-integrity-test-config/dbIntegrityService.xml
===================================================================
--- /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/resources/spring-integrity-test-config/dbIntegrityService.xml	(revision 4173)
+++ /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/resources/spring-integrity-test-config/dbIntegrityService.xml	(revision 4173)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Copyright (C) 2013 DASISH
+
+    This program is free software; you can redistribute it and/or
+    modify it under the terms of the GNU General Public License
+    as published by the Free Software Foundation; either version 2
+    of the License, or (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
+       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+">
+    <bean class="eu.dasish.annotation.backend.dao.impl.DBIntegrityServiceImlp">
+    </bean>
+</beans>
Index: /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/resources/spring-integrity-test-config/jaxbMarshallerFactory.xml
===================================================================
--- /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/resources/spring-integrity-test-config/jaxbMarshallerFactory.xml	(revision 4173)
+++ /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/resources/spring-integrity-test-config/jaxbMarshallerFactory.xml	(revision 4173)
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Copyright (C) 2013 DASISH
+
+    This program is free software; you can redistribute it and/or
+    modify it under the terms of the GNU General Public License
+    as published by the Free Software Foundation; either version 2
+    of the License, or (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
+       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+">
+    
+    <!-- Load properties from context.xml via servlet container -->
+    <bean
+        class="org.springframework.web.context.support.ServletContextPropertyPlaceholderConfigurer">
+        <property name="ignoreUnresolvablePlaceholders" value="true" />
+    </bean>
+    <bean id="jaxbMarshallerFactory" class="eu.dasish.annotation.backend.rest.JaxbMarshallerFactory">
+        <property name="schemaLocation"
+                 value="${eu.dasish.annotation.backend.schemaLocation}" />
+    </bean>
+</beans>
Index: /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/resources/spring-integrity-test-config/targetDao.xml
===================================================================
--- /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/resources/spring-integrity-test-config/targetDao.xml	(revision 4173)
+++ /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/resources/spring-integrity-test-config/targetDao.xml	(revision 4173)
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Copyright (C) 2013 DASISH
+
+    This program is free software; you can redistribute it and/or
+    modify it under the terms of the GNU General Public License
+    as published by the Free Software Foundation; either version 2
+    of the License, or (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
+       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+">
+   <bean class="eu.dasish.annotation.backend.dao.impl.JdbcTargetDao">
+        <constructor-arg ref="dataSource"/>
+    </bean>
+</beans>
Index: /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/resources/spring-integrity-test-config/userDao.xml
===================================================================
--- /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/resources/spring-integrity-test-config/userDao.xml	(revision 4173)
+++ /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/resources/spring-integrity-test-config/userDao.xml	(revision 4173)
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Copyright (C) 2013 DASISH
+
+    This program is free software; you can redistribute it and/or
+    modify it under the terms of the GNU General Public License
+    as published by the Free Software Foundation; either version 2
+    of the License, or (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
+       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+">
+    <bean class="eu.dasish.annotation.backend.dao.impl.JdbcUserDao">
+        <constructor-arg ref="dataSource"/>
+    </bean>
+</beans>
Index: /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/resources/test-data/InsertTestData.sql
===================================================================
--- /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/resources/test-data/InsertTestData.sql	(revision 4172)
+++ /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/resources/test-data/InsertTestData.sql	(revision 4173)
@@ -39,5 +39,5 @@
 INSERT INTO principal (principal_name, external_id, remote_id, e_mail) VALUES ('Twan', '00000000-0000-0000-0000-000000000111', 'x3', 'twagoo@mpi.nl'); --3 
 INSERT INTO principal (principal_name, external_id, remote_id, e_mail) VALUES ('Peter', '00000000-0000-0000-0000-000000000112', 'y4', 'Peter.Withers@mpi.nl'); -- 4
-INSERT INTO principal (principal_name, external_id, remote_id, e_mail) VALUES ('Olha', '00000000-0000-0000-0000-000000000113', 'z5', 'olhsha@mpi.nl'); -- 5
+INSERT INTO principal (principal_name, external_id, remote_id, e_mail) VALUES ('Olha', '00000000-0000-0000-0000-000000000113', 'JUnit@test.com', 'olhsha@mpi.nl'); -- 5
 INSERT INTO principal (principal_name, external_id, remote_id, e_mail) VALUES ('Eric', '00000000-0000-0000-0000-000000000114', 'v6', 'eriaue@mpi.nl'); -- 6
 
