# HG changeset patch # User ymh # Date 1362791989 -3600 # Node ID 9af0874ce43f4899a4d268880a81838ce8c011ac # Parent 47b3125130a2aecb7d68dddbfd6159aebb8cb0d5 First version of space level. diff -r 47b3125130a2 -r 9af0874ce43f .classpath --- a/.classpath Fri Mar 01 19:14:30 2013 +0100 +++ b/.classpath Sat Mar 09 02:19:49 2013 +0100 @@ -46,9 +46,19 @@ - - + + + + + + + + + + + + diff -r 47b3125130a2 -r 9af0874ce43f server/pom.xml --- a/server/pom.xml Fri Mar 01 19:14:30 2013 +0100 +++ b/server/pom.xml Sat Mar 09 02:19:49 2013 +0100 @@ -12,11 +12,14 @@ 1.0 1.17 3.2.1.RELEASE + 3.1.3.RELEASE 8.1.9.v20130131 4.10 2.0.15 2.5.1 + 2.1.4 + 2.1 UTF-8 @@ -99,7 +102,7 @@ - + spring-maven-release Spring Maven Release Repository @@ -196,6 +199,12 @@ + + com.sun.jersey.jersey-test-framework + jersey-test-framework-grizzly2 + ${jersey-version} + test + org.mongodb mongo-java-driver @@ -204,7 +213,7 @@ org.slf4j slf4j-log4j12 - 1.6.6 + 1.7.2 org.springframework @@ -296,7 +305,7 @@ com.fasterxml.jackson.jaxrs jackson-jaxrs-json-provider - 2.1.2 + ${jackson-version} commons-codec @@ -327,6 +336,31 @@ org.eclipse.jetty jetty-util ${jetty-version} + + + org.springframework.security + spring-security-core + ${spring-security-version} + + + org.springframework.security + spring-security-web + ${spring-security-version} + + + org.springframework.security + spring-security-config + ${spring-security-version} + + + de.undercouch + bson4jackson + 2.1.1 + + + joda-time + joda-time + ${joda-version} diff -r 47b3125130a2 -r 9af0874ce43f server/src/main/java/org/iri_research/renkan/controller/RenkanRootController.java --- a/server/src/main/java/org/iri_research/renkan/controller/RenkanRootController.java Fri Mar 01 19:14:30 2013 +0100 +++ b/server/src/main/java/org/iri_research/renkan/controller/RenkanRootController.java Sat Mar 09 02:19:49 2013 +0100 @@ -1,16 +1,22 @@ package org.iri_research.renkan.controller; import java.util.HashMap; +import java.util.List; import java.util.Map; import org.iri_research.renkan.models.Project; +import org.iri_research.renkan.models.Space; import org.iri_research.renkan.repositories.ProjectsRepository; +import org.iri_research.renkan.repositories.SpacesRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.client.HttpClientErrorException; import org.springframework.web.servlet.ModelAndView; @@ -18,22 +24,50 @@ @RequestMapping("/") public class RenkanRootController { - @SuppressWarnings("unused") private final Logger logger = LoggerFactory.getLogger(RenkanRootController.class); @Autowired - private ProjectsRepository projectRepository; + private ProjectsRepository projectsRepository; + + @Autowired + private SpacesRepository spacesRepository; @RequestMapping(value="", method = RequestMethod.GET, produces={"text/html;charset=UTF-8"}) public ModelAndView renkanIndex() { Map model = new HashMap(); - Iterable projects = this.projectRepository.findAll(); + Iterable spaces = this.spacesRepository.findAll(); + + model.put("spaces", spaces); + + return new ModelAndView("renkanIndex", model); + } + + @RequestMapping(value="/s/{space_id}", method = RequestMethod.GET, produces={"text/html;charset=UTF-8"}) + public ModelAndView spaceIndex(@PathVariable("space_id") String spaceId) { + + logger.debug("SpaceId : " + (spaceId== null ? "null" : spaceId)); + + Map model = new HashMap(); + + if("_".equals(spaceId)) { + spaceId = null; + } + + Space space = this.spacesRepository.findOne(spaceId); + + if(null == space) { + throw new HttpClientErrorException(HttpStatus.NOT_FOUND, "Space " + spaceId + " not found."); + } + + model.put("space", space); + + List projects = this.projectsRepository.findBySpaceId(spaceId); model.put("projects", projects); - return new ModelAndView("renkanIndex", model); + return new ModelAndView("projectIndex", model); } diff -r 47b3125130a2 -r 9af0874ce43f server/src/main/java/org/iri_research/renkan/coweb/event/NodeSyncEventManager.java --- a/server/src/main/java/org/iri_research/renkan/coweb/event/NodeSyncEventManager.java Fri Mar 01 19:14:30 2013 +0100 +++ b/server/src/main/java/org/iri_research/renkan/coweb/event/NodeSyncEventManager.java Sat Mar 09 02:19:49 2013 +0100 @@ -69,7 +69,7 @@ String node_id = (String)values.get("id"); - Node node = new Node(node_id, (String)values.get("title"), (String)values.get("description"), (String)values.get("uri"), (String)values.get("color"), project_id, creator_id, nodePosition, image); + Node node = new Node(node_id, (String)values.get("title"), (String)values.get("description"), (String)values.get("uri"), (String)values.get("color"), creator_id, nodePosition, image, project_id); Integer position = (Integer)data.get("position"); diff -r 47b3125130a2 -r 9af0874ce43f server/src/main/java/org/iri_research/renkan/models/Edge.java --- a/server/src/main/java/org/iri_research/renkan/models/Edge.java Fri Mar 01 19:14:30 2013 +0100 +++ b/server/src/main/java/org/iri_research/renkan/models/Edge.java Sat Mar 09 02:19:49 2013 +0100 @@ -2,6 +2,9 @@ import org.springframework.data.mongodb.core.mapping.DBRef; import org.springframework.data.mongodb.core.mapping.Document; +import org.springframework.data.mongodb.core.mapping.Field; + +import com.fasterxml.jackson.annotation.JsonProperty; @Document(collection="edges") @@ -13,27 +16,32 @@ @DBRef private Node to; - private String project_id; + @Field("project_id") + @JsonProperty("project_id") + private String projectId; - private String created_by; + @Field("created_by") + @JsonProperty("created_by") + private String createdBy; - public Edge(String id, String title, String description, String uri, String color, Node from, Node to, String created_by, String project_id) { + public Edge(String id, String title, String description, String uri, String color, Node from, Node to, String createdBy, String projectId) { super(id,title, description, uri, color); this.from = from; this.to = to; - this.created_by = created_by; - this.project_id = project_id; + this.createdBy = createdBy; + this.projectId = projectId; } - public String getProject_id() { - return project_id; + @JsonProperty("project_id") + public String getProjectId() { + return projectId; } - public String getCreated_by() { - return created_by; + public String getCreatedBy() { + return createdBy; } public String getFrom() { diff -r 47b3125130a2 -r 9af0874ce43f server/src/main/java/org/iri_research/renkan/models/Node.java --- a/server/src/main/java/org/iri_research/renkan/models/Node.java Fri Mar 01 19:14:30 2013 +0100 +++ b/server/src/main/java/org/iri_research/renkan/models/Node.java Sat Mar 09 02:19:49 2013 +0100 @@ -2,23 +2,30 @@ import org.springframework.data.mongodb.core.geo.Point; import org.springframework.data.mongodb.core.mapping.Document; +import org.springframework.data.mongodb.core.mapping.Field; + +import com.fasterxml.jackson.annotation.JsonProperty; @Document(collection="nodes") public class Node extends AbstractRenkanModel { - public Node(String id, String title, String description, String uri, String color, String project_id, String created_by, Point position, String image) { + public Node(String id, String title, String description, String uri, String color, String createdBy, Point position, String image, String projectId) { super(id, title, description, uri, color); - this.project_id = project_id; - this.created_by = created_by; + this.projectId = projectId; + this.createdBy = createdBy; this.position = position; this.image = image; } - - private String project_id = null; - private String created_by = null; + @Field("project_id") + @JsonProperty("project_id") + private String projectId = null; + + @Field("created_by") + @JsonProperty("created_by") + private String createdBy = null; private Point position = null; @@ -32,12 +39,14 @@ return image; } - public String getProject_id() { - return project_id; + @JsonProperty("project_id") + public String getProjectId() { + return projectId; } - public String getCreated_by() { - return created_by; + @JsonProperty("created_by") + public String getCreatedBy() { + return createdBy; } } diff -r 47b3125130a2 -r 9af0874ce43f server/src/main/java/org/iri_research/renkan/models/Project.java --- a/server/src/main/java/org/iri_research/renkan/models/Project.java Fri Mar 01 19:14:30 2013 +0100 +++ b/server/src/main/java/org/iri_research/renkan/models/Project.java Sat Mar 09 02:19:49 2013 +0100 @@ -15,6 +15,9 @@ import org.slf4j.LoggerFactory; import org.springframework.data.mongodb.core.mapping.DBRef; import org.springframework.data.mongodb.core.mapping.Document; +import org.springframework.data.mongodb.core.mapping.Field; + +import com.fasterxml.jackson.annotation.JsonProperty; @Document(collection="projects") public class Project extends AbstractRenkanModel { @@ -22,10 +25,16 @@ @SuppressWarnings("unused") private static Logger logger = LoggerFactory.getLogger(Project.class); + @Field("rev_counter") private int revCounter = 1; - private Date created; - + private Date created; + + // Space + @Field("space_id") + @JsonProperty("space_id") + private String spaceId = null; + // Nodes @DBRef private List nodes = new ArrayList(); @@ -39,18 +48,19 @@ private List users = new ArrayList(); - public Project(String id, String title, String description, String uri, Date created, + public Project(String spaceId, String id, String title, String description, String uri, Date created, int revCounter) { super(id,title, description, uri, null); this.revCounter = revCounter; + this.spaceId = spaceId; this.created = created; if(this.created == null) { this.created = new Date(); } } - public Project(String id, String title, String description, String uri, Date created) { - this(id,title, description, uri, created, 1); + public Project(String spaceId, String id, String title, String description, String uri, Date created) { + this(spaceId, id,title, description, uri, created, 1); } @SuppressWarnings("unused") diff -r 47b3125130a2 -r 9af0874ce43f server/src/main/java/org/iri_research/renkan/models/Space.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/src/main/java/org/iri_research/renkan/models/Space.java Sat Mar 09 02:19:49 2013 +0100 @@ -0,0 +1,68 @@ +package org.iri_research.renkan.models; + +import java.util.Date; + +import org.springframework.data.mongodb.core.mapping.Document; +import org.springframework.data.mongodb.core.mapping.Field; + +import com.fasterxml.jackson.annotation.JsonProperty; + +@Document(collection="spaces") +public class Space extends AbstractRenkanModel { + + + public Space(String id, String title, String description, String binConfig, String uri, String color, String createdBy, String image, Date created) { + super(id, title, description, uri, color); + + this.binConfig = binConfig; + this.createdBy = createdBy; + this.image = image; + this.created = created; + if(this.created == null) { + this.created = new Date(); + } + } + + @SuppressWarnings("unused") + private Space() { + } + + @Field("bin_config") + @JsonProperty("bin_config") + private String binConfig; + + @Field("created_by") + @JsonProperty("created_by") + private String createdBy = null; + private String image; + private Date created; + + public String getImage() { + return image; + } + + @JsonProperty("created_by") + public String getCreatedBy() { + return createdBy; + } + + public Date getCreated() { + return created; + } + + public void setCreated(Date date) { + this.created = date; + + } + + @JsonProperty("bin_config") + public String getBinConfig() { + return binConfig; + } + + @JsonProperty("bin_config") + public void setBinConfig(String bin_config) { + this.binConfig = bin_config; + } + +} \ No newline at end of file diff -r 47b3125130a2 -r 9af0874ce43f server/src/main/java/org/iri_research/renkan/repositories/ProjectsRepository.java --- a/server/src/main/java/org/iri_research/renkan/repositories/ProjectsRepository.java Fri Mar 01 19:14:30 2013 +0100 +++ b/server/src/main/java/org/iri_research/renkan/repositories/ProjectsRepository.java Sat Mar 09 02:19:49 2013 +0100 @@ -1,7 +1,11 @@ package org.iri_research.renkan.repositories; +import java.util.List; + import org.iri_research.renkan.models.Project; public interface ProjectsRepository extends IRenkanRepository, ProjectsRepositoryCustom { + + List findBySpaceId(String spaceId); } diff -r 47b3125130a2 -r 9af0874ce43f server/src/main/java/org/iri_research/renkan/repositories/ProjectsRepositoryImpl.java --- a/server/src/main/java/org/iri_research/renkan/repositories/ProjectsRepositoryImpl.java Fri Mar 01 19:14:30 2013 +0100 +++ b/server/src/main/java/org/iri_research/renkan/repositories/ProjectsRepositoryImpl.java Sat Mar 09 02:19:49 2013 +0100 @@ -16,7 +16,7 @@ @Override public int getRevCounter(String projectId) { - Project p = this.mongoTemplate.findAndModify(query(where("id").is(projectId)), new Update().inc("revCounter", 1), Project.class); + Project p = this.mongoTemplate.findAndModify(query(where("id").is(projectId)), new Update().inc("rev_counter", 1), Project.class); if(p == null) { return -1; diff -r 47b3125130a2 -r 9af0874ce43f server/src/main/java/org/iri_research/renkan/repositories/SpacesRepository.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/src/main/java/org/iri_research/renkan/repositories/SpacesRepository.java Sat Mar 09 02:19:49 2013 +0100 @@ -0,0 +1,7 @@ +package org.iri_research.renkan.repositories; + +import org.iri_research.renkan.models.Space; + +public interface SpacesRepository extends IRenkanRepository { + +} diff -r 47b3125130a2 -r 9af0874ce43f server/src/main/java/org/iri_research/renkan/rest/ObjectMapperProvider.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/src/main/java/org/iri_research/renkan/rest/ObjectMapperProvider.java Sat Mar 09 02:19:49 2013 +0100 @@ -0,0 +1,23 @@ +package org.iri_research.renkan.rest; + +import javax.ws.rs.ext.ContextResolver; +import javax.ws.rs.ext.Provider; + +import org.springframework.stereotype.Component; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; + +@Component +@Provider +public class ObjectMapperProvider implements ContextResolver { + + @Override + public ObjectMapper getContext(Class type) { + ObjectMapper objectMapper = new ObjectMapper(); + objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false); + + return objectMapper; + } + +} diff -r 47b3125130a2 -r 9af0874ce43f server/src/main/java/org/iri_research/renkan/rest/ProjectsResource.java --- a/server/src/main/java/org/iri_research/renkan/rest/ProjectsResource.java Fri Mar 01 19:14:30 2013 +0100 +++ b/server/src/main/java/org/iri_research/renkan/rest/ProjectsResource.java Sat Mar 09 02:19:49 2013 +0100 @@ -1,168 +1,55 @@ package org.iri_research.renkan.rest; -import java.util.ArrayList; +import java.util.Arrays; import java.util.Date; import java.util.List; import java.util.UUID; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.Response.Status; -import javax.ws.rs.core.UriInfo; import org.iri_research.renkan.models.Project; +import org.iri_research.renkan.repositories.IRenkanRepository; import org.iri_research.renkan.repositories.ProjectsRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import com.mongodb.BasicDBObject; -import com.mongodb.DBCollection; -import com.mongodb.DBCursor; -import com.mongodb.DBObject; -import com.mongodb.util.JSON; import com.sun.jersey.spi.resource.Singleton; @Singleton @Path("projects") @Component -public class ProjectsResource { +public class ProjectsResource extends RenkanResource { + @SuppressWarnings("unused") private Logger logger = LoggerFactory.getLogger(ProjectsResource.class); @Autowired - private ProjectsRepository projectRepository; - - @Context - private UriInfo uriInfo; - - private DBCollection getCollection() { - return projectRepository.getCollection(); + private ProjectsRepository projectsRepository; + + @Override + protected IRenkanRepository getRepository() { + return this.projectsRepository; } - @GET - @Path("{id : [a-zA-Z\\-0-9]+}") - @Produces(MediaType.APPLICATION_JSON + ";charset=utf-8") - public Project getProject(@PathParam("id") String projectId) { - - this.logger.debug("GetProject: " + projectId); - - Project project = this.projectRepository.findOne(projectId); - - if (null == project) { - throw new WebApplicationException(Status.NOT_FOUND); - } - - return project; - } - - @DELETE - @Path("{id : [a-zA-Z\\-0-9]+}") - @Produces(MediaType.TEXT_PLAIN + ";charset=utf-8") - public Response deleteProject(@PathParam("id") String projectId) { - - this.logger.debug("DeleteProject : id " + projectId); - - this.projectRepository.delete(projectId); - return Response.ok(this.uriInfo.getAbsolutePathBuilder().segment(projectId).build().toString() + " deleted").build(); - - } - - - /** - * test: curl -i -X PUT -H 'Content-Type: application/json' -d @test-data.json http://localhost:8080/renkan/rest/projects/12eff140-e65c-11e1-aff1-0800200c9a66 - * @param projectId - * @param projectContent - */ - @PUT - @Path("{id : [a-zA-Z\\-0-9]+}") - @Consumes(MediaType.APPLICATION_JSON + ";charset=utf-8") - public Response putProject(@PathParam("id") String projectId, Project project) { - - if(!projectId.equals(project.getId())) { - throw new WebApplicationException(Response.status(Status.BAD_REQUEST).entity("Id parameter and id in JSON do not match").build()); - } - if(project.getCreated() == null) { - project.setCreated(new Date()); - } - this.projectRepository.save(project); - return Response.noContent().build(); - + @Override + protected String getNewId() { + return UUID.randomUUID().toString(); } - - @POST - @Consumes(MediaType.APPLICATION_JSON + ";charset=utf-8") - public Response postProject(Project project) { - if(project.getId() != null) { - throw new WebApplicationException(Response.status(Status.BAD_REQUEST).entity("Id in JSON must be null").build()); + @Override + protected void prepareObject(Project obj) { + if(obj.getCreated() == null) { + obj.setCreated(new Date()); } - - project.setId(UUID.randomUUID().toString()); - if(project.getCreated() == null) { - project.setCreated(new Date()); - } - project = this.projectRepository.save(project); - return Response.created(this.uriInfo.getAbsolutePathBuilder().segment(project.getId()).build()).entity(project).build(); } - - @GET - @Produces(MediaType.APPLICATION_JSON + ";charset=utf-8") - public String getProjectList() { - - DBCollection projectCollection = this.getCollection(); - BasicDBObject keys = new BasicDBObject(); - keys.put("description", 1); - keys.put("title", 1); - keys.put("uri", 1); - keys.put("created", 1); - DBCursor cursor = projectCollection.find(new BasicDBObject(), keys); - - List res = new ArrayList(); - - try { - while(cursor.hasNext()) { - DBObject obj = cursor.next(); - DBObject links = new BasicDBObject(); - - DBObject linkdef = new BasicDBObject(); - linkdef.put("href", this.uriInfo.getAbsolutePathBuilder().path(obj.get("_id").toString()).build().toString()); - linkdef.put("method", "get"); - linkdef.put("produces", MediaType.APPLICATION_JSON + ";charset=utf-8"); - links.put("view", linkdef); - - linkdef = new BasicDBObject(); - linkdef.put("href", this.uriInfo.getAbsolutePathBuilder().path(obj.get("_id").toString()).build().toString()); - linkdef.put("method", "put"); - linkdef.put("consumes", MediaType.APPLICATION_JSON + ";charset=utf-8"); - links.put("update", linkdef); - linkdef = new BasicDBObject(); - linkdef.put("href", this.uriInfo.getAbsolutePathBuilder().path(obj.get("_id").toString()).build().toString()); - linkdef.put("method", "delete"); - links.put("delete", linkdef); - - obj.put("__links", links); - res.add(obj); - } - } - finally { - cursor.close(); - } - - return JSON.serialize(res); + @Override + protected List getObjectListFieldList() { + return Arrays.asList(this.baseObjectListFieldList); } + } diff -r 47b3125130a2 -r 9af0874ce43f server/src/main/java/org/iri_research/renkan/rest/RenkanResource.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/src/main/java/org/iri_research/renkan/rest/RenkanResource.java Sat Mar 09 02:19:49 2013 +0100 @@ -0,0 +1,172 @@ +package org.iri_research.renkan.rest; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.WebApplicationException; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.Response.Status; +import javax.ws.rs.core.UriInfo; + +import org.iri_research.renkan.models.IRenkanModel; +import org.iri_research.renkan.repositories.IRenkanRepository; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; +import com.mongodb.BasicDBObject; +import com.mongodb.DBCollection; +import com.mongodb.DBCursor; +import com.mongodb.DBObject; + +public abstract class RenkanResource, ID extends Serializable> { + + private Logger logger = LoggerFactory.getLogger(RenkanResource.class); + + protected String[] baseObjectListFieldList = {"description","title","uri","created", "color"}; + + abstract protected IRenkanRepository getRepository(); + abstract protected ID getNewId(); + abstract protected List getObjectListFieldList(); + + @Context + private UriInfo uriInfo; + + protected DBCollection getCollection() { + return this.getRepository().getCollection(); + } + + abstract protected void prepareObject(T obj); + + @GET + @Path("{id : [a-zA-Z\\-0-9]+}") + @Produces(MediaType.APPLICATION_JSON + ";charset=utf-8") + public T getObject(@PathParam("id") ID objectId) { + + this.logger.debug("GetObject: " + objectId); + + T obj = this.getRepository().findOne(objectId); + + if (null == obj) { + throw new WebApplicationException(Status.NOT_FOUND); + } + + return obj; + } + + @DELETE + @Path("{id : [a-zA-Z\\-0-9]+}") + @Produces(MediaType.TEXT_PLAIN + ";charset=utf-8") + public Response deleteObject(@PathParam("id") ID objectId) { + + this.logger.debug("DeleteObject : id " + objectId); + + this.getRepository().delete(objectId); + return Response.ok(this.uriInfo.getAbsolutePathBuilder().build().toString() + " deleted").build(); + + } + + /** + * test: curl -i -X PUT -H 'Content-Type: application/json' -d @test-data.json http://localhost:8080/renkan/rest/spaces/12eff140-e65c-11e1-aff1-0800200c9a66 + * @param objId + * @param objectContent + */ + @PUT + @Path("{id : [a-zA-Z\\-0-9]+}") + @Consumes(MediaType.APPLICATION_JSON + ";charset=utf-8") + public Response putRenkanObject(@PathParam("id") ID objId, T obj) { + + if(!objId.equals(obj.getId())) { + throw new WebApplicationException(Response.status(Status.BAD_REQUEST).entity("Id parameter and id in JSON do not match").build()); + } + + if(!this.getRepository().exists(objId)) { + throw new WebApplicationException(Response.status(Status.NOT_FOUND).build()); + } + + this.prepareObject(obj); + this.getRepository().save(obj); + return Response.noContent().build(); + + } + + @POST + @Consumes(MediaType.APPLICATION_JSON + ";charset=utf-8") + @Produces(MediaType.APPLICATION_JSON + ";charset=utf-8") + public Response postRenkanObject(T obj) { + + if(obj.getId() != null) { + throw new WebApplicationException(Response.status(Status.BAD_REQUEST).entity("Id in JSON must be null").build()); + } + + obj.setId(getNewId()); + this.prepareObject(obj); + obj = this.getRepository().save(obj); + return Response.created(this.uriInfo.getAbsolutePathBuilder().segment(obj.getId().toString()).build()).entity(obj).build(); + } + + + @GET + @Produces(MediaType.APPLICATION_JSON + ";charset=utf-8") + public String getObjectList() throws JsonProcessingException { + + BasicDBObject keys = new BasicDBObject(); + + for (String fieldname : this.getObjectListFieldList()) { + keys.put(fieldname, 1); + } + DBCursor cursor = this.getCollection().find(new BasicDBObject(), keys); + + List res = new ArrayList(); + + try { + while(cursor.hasNext()) { + DBObject obj = cursor.next(); + obj.put("id", obj.get("_id")); + DBObject links = new BasicDBObject(); + + DBObject linkdef = new BasicDBObject(); + linkdef.put("href", this.uriInfo.getAbsolutePathBuilder().path(obj.get("_id").toString()).build().toString()); + linkdef.put("method", "get"); + linkdef.put("produces", MediaType.APPLICATION_JSON + ";charset=utf-8"); + links.put("view", linkdef); + + linkdef = new BasicDBObject(); + linkdef.put("href", this.uriInfo.getAbsolutePathBuilder().path(obj.get("_id").toString()).build().toString()); + linkdef.put("method", "put"); + linkdef.put("consumes", MediaType.APPLICATION_JSON + ";charset=utf-8"); + links.put("update", linkdef); + + linkdef = new BasicDBObject(); + linkdef.put("href", this.uriInfo.getAbsolutePathBuilder().path(obj.get("_id").toString()).build().toString()); + linkdef.put("method", "delete"); + links.put("delete", linkdef); + + obj.put("__links", links); + res.add(obj); + } + } + finally { + cursor.close(); + } + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false); + return mapper.writeValueAsString(res); + } + + + +} diff -r 47b3125130a2 -r 9af0874ce43f server/src/main/java/org/iri_research/renkan/rest/SpacesResource.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/src/main/java/org/iri_research/renkan/rest/SpacesResource.java Sat Mar 09 02:19:49 2013 +0100 @@ -0,0 +1,64 @@ +package org.iri_research.renkan.rest; + + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; +import java.util.List; +import java.util.UUID; + +import javax.ws.rs.Path; + +import org.iri_research.renkan.models.Space; +import org.iri_research.renkan.repositories.IRenkanRepository; +import org.iri_research.renkan.repositories.SpacesRepository; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import com.sun.jersey.spi.resource.Singleton; + +@Singleton +@Path("spaces") +@Component +public class SpacesResource extends RenkanResource { + + @SuppressWarnings("unused") + private Logger logger = LoggerFactory.getLogger(SpacesResource.class); + + private String[] spaceObjectListFieldList = {"created_by","bin_config","image"}; + + @Autowired + private SpacesRepository spacesRepository; + + @Override + protected IRenkanRepository getRepository() { + return spacesRepository; + } + + + @Override + protected String getNewId() { + return UUID.randomUUID().toString(); + } + + + @Override + protected void prepareObject(Space obj) { + if(obj.getCreated() == null) { + obj.setCreated(new Date()); + } + } + + + @Override + protected List getObjectListFieldList() { + ArrayList fieldList = new ArrayList<>(this.baseObjectListFieldList.length + this.spaceObjectListFieldList.length); + fieldList.addAll(Arrays.asList(this.baseObjectListFieldList)); + fieldList.addAll(Arrays.asList(this.spaceObjectListFieldList)); + return fieldList; + } + + +} diff -r 47b3125130a2 -r 9af0874ce43f server/src/main/resources/log4j.xml --- a/server/src/main/resources/log4j.xml Fri Mar 01 19:14:30 2013 +0100 +++ b/server/src/main/resources/log4j.xml Sat Mar 09 02:19:49 2013 +0100 @@ -1,5 +1,5 @@ - + diff -r 47b3125130a2 -r 9af0874ce43f server/src/main/webapp/WEB-INF/i18n/messages_en.properties --- a/server/src/main/webapp/WEB-INF/i18n/messages_en.properties Fri Mar 01 19:14:30 2013 +0100 +++ b/server/src/main/webapp/WEB-INF/i18n/messages_en.properties Sat Mar 09 02:19:49 2013 +0100 @@ -2,11 +2,20 @@ date.format = yyyy/MM/dd HH:mm renkanIndex.new_renkan = New Renkan +renkanIndex.new_space = New Space renkanIndex.renkan_title = or create/open a Renkan with the title renkanIndex.project_list = Project list renkanIndex.project_name = Name renkanIndex.project_creation = Creation renkanIndex.project_edit = Edit -renkanIndex.project_edit_link = Edit projet +renkanIndex.project_edit_link = Edit project + +renkanIndex.space_list = Spaces list +renkanIndex.space_name = Name +renkanIndex.space_title = Title +renkanIndex.space_creation = Creation +renkanIndex.space_open = Open +renkanIndex.space_open_link = Open space + renkanIndex.js.empty_name_error = Please enter a title \ No newline at end of file diff -r 47b3125130a2 -r 9af0874ce43f server/src/main/webapp/WEB-INF/i18n/messages_fr.properties --- a/server/src/main/webapp/WEB-INF/i18n/messages_fr.properties Fri Mar 01 19:14:30 2013 +0100 +++ b/server/src/main/webapp/WEB-INF/i18n/messages_fr.properties Sat Mar 09 02:19:49 2013 +0100 @@ -2,12 +2,22 @@ date.format = dd/MM/yyyy HH:mm renkanIndex.new_renkan = Nouveau Renkan +renkanIndex.new_space = Nouvel Espace renkanIndex.renkan_titre = ou bien créer un Renkan avec le titre + renkanIndex.project_list = Liste des projets renkanIndex.project_title = Titre renkanIndex.project_creation = Creation renkanIndex.project_edit = Edition renkanIndex.project_edit_link = Editer proj. +renkanIndex.space_list = Liste des espace +renkanIndex.space_name = Nom +renkanIndex.space_title = Titre +renkanIndex.space_creation = Creation +renkanIndex.space_open = Ouvrir +renkanIndex.space_open_link = Ouvrir esp. + + renkanIndex.js.empty_name_error = Veuillez entrer un titre diff -r 47b3125130a2 -r 9af0874ce43f server/src/main/webapp/WEB-INF/templates/projectIndex.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/src/main/webapp/WEB-INF/templates/projectIndex.html Sat Mar 09 02:19:49 2013 +0100 @@ -0,0 +1,188 @@ + + + Renkan + + + + + + + + + + + + + +
+
+
New Renkan
+
Create a Renkan with the title
+
+ + +
+
+

Project list

+ + + + + + + + + + + + + +
NameCreationEdit
titledateEdit projet
+
+ + + diff -r 47b3125130a2 -r 9af0874ce43f server/src/main/webapp/WEB-INF/templates/renkanIndex.html --- a/server/src/main/webapp/WEB-INF/templates/renkanIndex.html Fri Mar 01 19:14:30 2013 +0100 +++ b/server/src/main/webapp/WEB-INF/templates/renkanIndex.html Sat Mar 09 02:19:49 2013 +0100 @@ -126,25 +126,25 @@
-
New Renkan
+
New Space
Create a Renkan with the title
-

Project list

+

Space list

- + - - - - + + + +
NameCreationEditNameCreationEdit
titledateEdit projet
titledateOpen space
@@ -167,15 +167,15 @@ uri: null }; - var post_url = /*[[@{/rest/projects/}]]*/"/rest/projects/"; + var post_url = /*[[@{/rest/spaces/}]]*/"/rest/spaces/"; $.ajax(post_url, { data:JSON.stringify(new_renkan), type: "POST", dataType: "json", contentType: "application/json; charset=UTF-8" - }).done(function(project){ - var template_url = /*[[@{'/p/<%=project_id%>'(cowebkey='')}]]*/"p/<%=project_id%>?cowebkey=<%=project_key%>"; - window.location = _.template(template_url+'<%=project_key%>', {project_id: project.id, project_key: project.key}); + }).done(function(space){ + var template_url = /*[[@{'/s/<%=space_id%>'}]]*/"s/<%=space_id%>"; + window.location = _.template(template_url, {space_id: space.id}); }); //? window.location = "p/" + renkantitle : alert(/*[[#{renkanIndex.js.empty_name_error}]]*/"Please enter a name"); diff -r 47b3125130a2 -r 9af0874ce43f server/src/main/webapp/WEB-INF/web.xml --- a/server/src/main/webapp/WEB-INF/web.xml Fri Mar 01 19:14:30 2013 +0100 +++ b/server/src/main/webapp/WEB-INF/web.xml Sat Mar 09 02:19:49 2013 +0100 @@ -63,7 +63,7 @@ com.sun.jersey.spi.spring.container.servlet.SpringServlet com.sun.jersey.config.property.packages - org.iri_research.renkan.rest + org.iri_research.renkan.rest;com.fasterxml.jackson.jaxrs com.sun.jersey.api.json.POJOMappingFeature diff -r 47b3125130a2 -r 9af0874ce43f server/src/test/java/org/iri_research/renkan/test/repositories/ProjectSyncsRepositoryTest.java --- a/server/src/test/java/org/iri_research/renkan/test/repositories/ProjectSyncsRepositoryTest.java Fri Mar 01 19:14:30 2013 +0100 +++ b/server/src/test/java/org/iri_research/renkan/test/repositories/ProjectSyncsRepositoryTest.java Sat Mar 09 02:19:49 2013 +0100 @@ -3,12 +3,15 @@ import java.util.ArrayList; import java.util.Date; +import java.util.UUID; import org.iri_research.renkan.RenkanException; import org.iri_research.renkan.models.Project; import org.iri_research.renkan.models.ProjectSync; +import org.iri_research.renkan.models.Space; import org.iri_research.renkan.repositories.ProjectSyncsRepository; import org.iri_research.renkan.repositories.ProjectsRepository; +import org.iri_research.renkan.repositories.SpacesRepository; import org.junit.After; import org.junit.Assert; import org.junit.Before; @@ -33,6 +36,9 @@ @Autowired private ProjectSyncsRepository projectSyncsRepository; + @Autowired + private SpacesRepository spacesRepository; + private ArrayList testProjects = new ArrayList(); @@ -42,10 +48,12 @@ @Before public void setup() { - logger.debug("Setup"); + logger.debug("Setup"); + Space testSpace = new Space(UUID.randomUUID().toString(), "test", "Test space", null, null, null, "test_user", null, null); + testSpace = spacesRepository.save(testSpace); ArrayList pl = new ArrayList(); - pl.add(new Project(null, "test1", "desc1", "http://localhost:8080/rest/projects/id1", new Date())); - pl.add(new Project(null, "test2", "desc2", "http://localhost:8080/rest/projects/id2", new Date())); + pl.add(new Project(testSpace.getId(), null, "test1", "desc1", "http://localhost:8080/rest/projects/id1", new Date())); + pl.add(new Project(testSpace.getId(), null, "test2", "desc2", "http://localhost:8080/rest/projects/id2", new Date())); logger.debug("Setup : new Project "); for(Project p: projectRepository.save(pl)) { this.testProjects.add(p); diff -r 47b3125130a2 -r 9af0874ce43f server/src/test/java/org/iri_research/renkan/test/repositories/ProjectsRepositoryTest.java --- a/server/src/test/java/org/iri_research/renkan/test/repositories/ProjectsRepositoryTest.java Fri Mar 01 19:14:30 2013 +0100 +++ b/server/src/test/java/org/iri_research/renkan/test/repositories/ProjectsRepositoryTest.java Sat Mar 09 02:19:49 2013 +0100 @@ -6,7 +6,9 @@ import java.util.UUID; import org.iri_research.renkan.models.Project; +import org.iri_research.renkan.models.Space; import org.iri_research.renkan.repositories.ProjectsRepository; +import org.iri_research.renkan.repositories.SpacesRepository; import org.junit.After; import org.junit.Assert; import org.junit.Before; @@ -26,7 +28,10 @@ private Logger logger = LoggerFactory.getLogger(ProjectsRepositoryTest.class); @Autowired - private ProjectsRepository projectRepository; + private ProjectsRepository projectsRepository; + + @Autowired + private SpacesRepository spacesRepository; private ArrayList testProjects = new ArrayList(); @@ -38,12 +43,14 @@ @Before public void setup() { - logger.debug("Setup"); + logger.debug("Setup"); + Space testSpace = new Space(UUID.randomUUID().toString(), "test", "Test space", null, null, null, "test_user", null, this.creationDate); + testSpace = spacesRepository.save(testSpace); ArrayList pl = new ArrayList(); - pl.add(new Project(UUID.randomUUID().toString(), "test1", "desc1", "http://localhost:8080/rest/projects/id1", this.creationDate)); - pl.add(new Project(UUID.randomUUID().toString(), "test2", "desc2", "http://localhost:8080/rest/projects/id2", this.creationDate)); + pl.add(new Project(testSpace.getId(), UUID.randomUUID().toString(), "test1", "desc1", "http://localhost:8080/rest/projects/id1", this.creationDate)); + pl.add(new Project(testSpace.getId(), UUID.randomUUID().toString(), "test2", "desc2", "http://localhost:8080/rest/projects/id2", this.creationDate)); logger.debug("Setup : new Project "); - for(Project p: projectRepository.save(pl)) { + for(Project p: projectsRepository.save(pl)) { this.testProjects.add(p); } } @@ -51,13 +58,13 @@ @After public void teardown() { logger.debug("Teardown"); - projectRepository.deleteAll(); + projectsRepository.deleteAll(); } @Test public void testInitialRevCounter() { - Project p = projectRepository.findOne(this.testProjects.get(0).getId()); + Project p = projectsRepository.findOne(this.testProjects.get(0).getId()); Assert.assertEquals("Initial rev counter should be 1", 1, p.getRevCounter()); } @@ -65,22 +72,22 @@ @Test public void testIncrementRevCounter() { - int revCounter = projectRepository.getRevCounter(this.testProjects.get(0).getId()); + int revCounter = projectsRepository.getRevCounter(this.testProjects.get(0).getId()); Assert.assertEquals("After 1 call rev counter should be 1", 1, revCounter); - revCounter = projectRepository.getRevCounter(this.testProjects.get(0).getId()); + revCounter = projectsRepository.getRevCounter(this.testProjects.get(0).getId()); Assert.assertEquals("After 2 calls rev counter should be 2", 2, revCounter); for(int i=0; i<10; i++) { - revCounter = projectRepository.getRevCounter(this.testProjects.get(0).getId()); + revCounter = projectsRepository.getRevCounter(this.testProjects.get(0).getId()); } Assert.assertEquals("After 10 more calls rev counter should be 12", 12, revCounter); - Project p = projectRepository.findOne(this.testProjects.get(0).getId()); + Project p = projectsRepository.findOne(this.testProjects.get(0).getId()); Assert.assertEquals("next rev counter should be 13", 13, p.getRevCounter()); - p = projectRepository.findOne(this.testProjects.get(1).getId()); + p = projectsRepository.findOne(this.testProjects.get(1).getId()); Assert.assertEquals("other project next rev counter should be 1", 1, p.getRevCounter()); @@ -90,7 +97,7 @@ @Test public void testIncrementNonExisting() { - int revCounter = projectRepository.getRevCounter("aaaa"); + int revCounter = projectsRepository.getRevCounter("aaaa"); Assert.assertEquals("Rev counter non existing == -1", -1, revCounter); } @@ -98,7 +105,7 @@ @Test public void testIncrementNull() { - int revCounter = projectRepository.getRevCounter(null); + int revCounter = projectsRepository.getRevCounter(null); Assert.assertEquals("Rev counter null == -1", -1, revCounter); } @@ -106,7 +113,7 @@ @Test public void testIncrementEmpty() { - int revCounter = projectRepository.getRevCounter(""); + int revCounter = projectsRepository.getRevCounter(""); Assert.assertEquals("Rev counter empty == -1", -1, revCounter); } @@ -114,7 +121,7 @@ @Test public void testDateCreation() { - for (Project p : projectRepository.findAll()) { + for (Project p : projectsRepository.findAll()) { Assert.assertEquals(this.creationDate, p.getCreated()); } } diff -r 47b3125130a2 -r 9af0874ce43f server/src/test/java/org/iri_research/renkan/test/repositories/SpacesRepositoryTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/src/test/java/org/iri_research/renkan/test/repositories/SpacesRepositoryTest.java Sat Mar 09 02:19:49 2013 +0100 @@ -0,0 +1,99 @@ +package org.iri_research.renkan.test.repositories; + +import java.util.Date; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.iri_research.renkan.models.Space; +import org.iri_research.renkan.repositories.SpacesRepository; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.mongodb.core.MongoTemplate; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +import com.mongodb.DBCollection; +import com.mongodb.DBObject; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration("repositories-context.xml") +public class SpacesRepositoryTest { + + private Logger logger = LoggerFactory.getLogger(SpacesRepositoryTest.class); + + @Autowired + private SpacesRepository spacesRepository; + + @Autowired + private MongoTemplate mongoTemplate; + + private Map spacesList = new HashMap(); + + + @Before + public void setup() { + + logger.debug("Setup"); + spacesRepository.deleteAll(); + Date creationDate = new Date(); + String uuid = UUID.randomUUID().toString(); + Space testSpace = new Space(uuid, "test", "Test space", "{}", "http://ldt.iri.centrepompidou.fr", "#ababab", "test_user", "http://ldt.iri.centrepompidou.fr", creationDate); + testSpace = spacesRepository.save(testSpace); + this.spacesList.put(uuid, testSpace); + } + + @Test + public void testFieldMapping() { + // query json directly with mongodb driver + // check field values + DBCollection coll = mongoTemplate.getCollection(mongoTemplate.getCollectionName(Space.class)); + + for(DBObject obj: coll.find()) { + Assert.assertTrue("mongo object must have _id field", obj.containsField("_id")); + + String id = obj.get("_id").toString(); + + Space sp = this.spacesList.get(id); + + Assert.assertTrue("mongo object must have title field", obj.containsField("title")); + Assert.assertEquals("Titles must be the same", obj.get("title"), sp.getTitle()); + + Assert.assertTrue("mongo object must have description field", obj.containsField("description")); + Assert.assertEquals("description must be the same", obj.get("description"), sp.getDescription()); + + Assert.assertTrue("mongo object must have color field", obj.containsField("color")); + Assert.assertEquals("Color must be the same", obj.get("color"), sp.getColor()); + + Assert.assertTrue("mongo object must have uri field", obj.containsField("uri")); + Assert.assertEquals("Uri must be the same", obj.get("uri"), sp.getUri()); + + Assert.assertTrue("mongo object must have image field", obj.containsField("image")); + Assert.assertEquals("Image must be the same", obj.get("image"), sp.getImage()); + + Assert.assertTrue("mongo object must have created field", obj.containsField("created")); + Assert.assertEquals("Created must be the same", obj.get("created"), sp.getCreated()); + + Assert.assertTrue("mongo object must have bin_config field", obj.containsField("bin_config")); + Assert.assertEquals("Uri must be the same", obj.get("bin_config"), sp.getBinConfig()); + + Assert.assertTrue("mongo object must have created_by field", obj.containsField("created_by")); + Assert.assertEquals("created by must be the same", obj.get("created_by"), sp.getCreatedBy()); + + } + + } + + @After + public void teardown() { + spacesRepository.deleteAll(); + } + + +} diff -r 47b3125130a2 -r 9af0874ce43f server/src/test/java/org/iri_research/renkan/test/rest/SpaceRestTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/src/test/java/org/iri_research/renkan/test/rest/SpaceRestTest.java Sat Mar 09 02:19:49 2013 +0100 @@ -0,0 +1,721 @@ +package org.iri_research.renkan.test.rest; + +import java.io.IOException; +import java.net.URI; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response.Status; + +import junit.framework.Assert; + +import org.iri_research.renkan.models.Space; +import org.iri_research.renkan.repositories.SpacesRepository; +import org.joda.time.DateTime; +import org.joda.time.format.DateTimeFormatter; +import org.joda.time.format.ISODateTimeFormat; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.web.context.ContextLoaderListener; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.sun.jersey.api.client.ClientHandlerException; +import com.sun.jersey.api.client.ClientResponse; +import com.sun.jersey.api.client.UniformInterfaceException; +import com.sun.jersey.api.client.WebResource; +import com.sun.jersey.spi.spring.container.servlet.SpringServlet; +import com.sun.jersey.test.framework.AppDescriptor; +import com.sun.jersey.test.framework.JerseyTest; +import com.sun.jersey.test.framework.WebAppDescriptor; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration("rest-context.xml") +public class SpaceRestTest extends JerseyTest { + + private Logger logger = LoggerFactory.getLogger(SpaceRestTest.class); + + @Autowired + private SpacesRepository spacesRepository; + + private Map spacesList = new HashMap(); + private String firstSpaceUUID = null; + + + public SpaceRestTest() { + } + + @Override + protected AppDescriptor configure() { + return new WebAppDescriptor.Builder("org.iri_research.renkan.rest") + .contextPath("rest") + .contextParam("contextConfigLocation", "classpath:/org/iri_research/renkan/test/rest/rest-context.xml") + .initParam("com.sun.jersey.config.property.packages", "org.iri_research.renkan.rest;com.fasterxml.jackson.jaxrs") + .servletClass(SpringServlet.class) + .contextListenerClass(ContextLoaderListener.class) + .build(); + }; + + @Before + public void setup() { + + logger.debug("Setup"); + spacesRepository.deleteAll(); + Date creationDate = new Date(); + this.firstSpaceUUID = UUID.randomUUID().toString(); + Space testSpace = new Space(firstSpaceUUID, "test", "Test space", "{}", "http://ldt.iri.centrepompidou.fr", "#ababab", "test_user", "http://ldt.iri.centrepompidou.fr", creationDate); + testSpace = spacesRepository.save(testSpace); + this.spacesList.put(firstSpaceUUID, testSpace); + } + + @After + public void teardown() { + //spacesRepository.deleteAll(); + } + + + @Test + public void testSetup() throws JsonProcessingException, IOException { + + WebResource webResource = this.resource(); + String respString = webResource.path("spaces").get(String.class); + + Assert.assertNotNull("The response string for the list of spaces must not be null", respString); + + logger.debug("RESPONSE : " + respString); + + Assert.assertTrue("The length of the space list resp. string must be > 0", respString.length() > 0); + + + ObjectMapper mapper = new ObjectMapper(); + JsonNode spacesList = mapper.readTree(respString); + + Assert.assertTrue("The spaceList must be an array", spacesList.isArray()); + Assert.assertEquals("The spaceList length must be = " + this.spacesList.size(), this.spacesList.size(), spacesList.size()); + + for (JsonNode jsonNode : spacesList) { + Assert.assertTrue("the space must have an id", jsonNode.hasNonNull("id")); + String id = jsonNode.get("id").asText(); + Assert.assertTrue("The id must be in the spacesList", this.spacesList.containsKey(id)); + Space space = this.spacesList.get(id); + Assert.assertNotNull("The object must in the spacesList must not be null", space); + + } + + } + + @Test + public void testTitle() throws JsonProcessingException, IOException { + + WebResource webResource = this.resource(); + String respString = webResource.path("spaces").get(String.class); + logger.debug("RESPONSE : " + respString); + ObjectMapper mapper = new ObjectMapper(); + JsonNode spacesList = mapper.readTree(respString); + + for (JsonNode jsonNode : spacesList) { + String id = jsonNode.get("_id").asText(); + Space space = this.spacesList.get(id); + + Assert.assertTrue("the space must have a title", jsonNode.hasNonNull("title")); + String title = jsonNode.get("title").asText(); + Assert.assertEquals("space title must be equals to " + space.getTitle(), space.getTitle(), title); + } + + } + + @Test + public void testDescription() throws JsonProcessingException, IOException { + + WebResource webResource = this.resource(); + String respString = webResource.path("spaces").get(String.class); + logger.debug("RESPONSE : " + respString); + ObjectMapper mapper = new ObjectMapper(); + JsonNode spacesList = mapper.readTree(respString); + + for (JsonNode jsonNode : spacesList) { + String id = jsonNode.get("id").asText(); + Space space = this.spacesList.get(id); + + Assert.assertTrue("the space must have a description", jsonNode.hasNonNull("description")); + String description = jsonNode.get("description").asText(); + Assert.assertEquals("space description must be equals to " + space.getDescription(), space.getDescription(), description); + } + + } + + @Test + public void testUri() throws JsonProcessingException, IOException { + + WebResource webResource = this.resource(); + String respString = webResource.path("spaces").get(String.class); + logger.debug("RESPONSE : " + respString); + ObjectMapper mapper = new ObjectMapper(); + JsonNode spacesList = mapper.readTree(respString); + + for (JsonNode jsonNode : spacesList) { + String id = jsonNode.get("id").asText(); + Space space = this.spacesList.get(id); + + Assert.assertTrue("the space must have a uri", jsonNode.hasNonNull("uri")); + String uri = jsonNode.get("uri").asText(); + Assert.assertEquals("space uri must be equals to " + space.getUri(), space.getUri(), uri); + } + + } + + @Test + public void testColor() throws JsonProcessingException, IOException { + + WebResource webResource = this.resource(); + String respString = webResource.path("spaces").get(String.class); + logger.debug("RESPONSE : " + respString); + ObjectMapper mapper = new ObjectMapper(); + JsonNode spacesList = mapper.readTree(respString); + + for (JsonNode jsonNode : spacesList) { + String id = jsonNode.get("id").asText(); + Space space = this.spacesList.get(id); + + Assert.assertTrue("the space must have a color", jsonNode.hasNonNull("color")); + String color = jsonNode.get("color").asText(); + Assert.assertEquals("space color must be equals to " + space.getColor(), space.getColor(), color); + } + + } + + + + @Test + public void testBinConfig() throws JsonProcessingException, IOException { + + WebResource webResource = this.resource(); + String respString = webResource.path("spaces").get(String.class); + logger.debug("RESPONSE : " + respString); + ObjectMapper mapper = new ObjectMapper(); + JsonNode spacesList = mapper.readTree(respString); + + for (JsonNode jsonNode : spacesList) { + String id = jsonNode.get("id").asText(); + Space space = this.spacesList.get(id); + + Assert.assertTrue("the space must have a bin_config", jsonNode.hasNonNull("bin_config")); + String binConfig = jsonNode.get("bin_config").asText(); + Assert.assertEquals("space bin_config must be equals to " + space.getBinConfig(), space.getBinConfig(), binConfig); + } + + } + + @Test + public void testCreatedBy() throws JsonProcessingException, IOException { + + WebResource webResource = this.resource(); + String respString = webResource.path("spaces").get(String.class); + logger.debug("RESPONSE : " + respString); + ObjectMapper mapper = new ObjectMapper(); + JsonNode spacesList = mapper.readTree(respString); + + for (JsonNode jsonNode : spacesList) { + String id = jsonNode.get("id").asText(); + Space space = this.spacesList.get(id); + + Assert.assertTrue("the space must have a created_by", jsonNode.hasNonNull("created_by")); + String createdBy = jsonNode.get("created_by").asText(); + Assert.assertEquals("space created_by must be equals to " + space.getCreatedBy(), space.getCreatedBy(), createdBy); + } + + } + + + @Test + public void testCreated() throws JsonProcessingException, IOException { + + WebResource webResource = this.resource(); + String respString = webResource.path("spaces").get(String.class); + logger.debug("RESPONSE : " + respString); + ObjectMapper mapper = new ObjectMapper(); + JsonNode spacesList = mapper.readTree(respString); + + for (JsonNode jsonNode : spacesList) { + String id = jsonNode.get("id").asText(); + Space space = this.spacesList.get(id); + + Assert.assertTrue("the space must have a created", jsonNode.hasNonNull("created")); + + String dateStr = jsonNode.get("created").asText(); + + DateTimeFormatter fmt = ISODateTimeFormat.dateTime(); + DateTime date = fmt.parseDateTime(dateStr); + + Assert.assertEquals("Created date must be the same", space.getCreated(), date.toDate()); + + } + + } + + @Test + public void testImage() throws JsonProcessingException, IOException { + + WebResource webResource = this.resource(); + String respString = webResource.path("spaces").get(String.class); + logger.debug("RESPONSE : " + respString); + ObjectMapper mapper = new ObjectMapper(); + JsonNode spacesList = mapper.readTree(respString); + + for (JsonNode jsonNode : spacesList) { + String id = jsonNode.get("id").asText(); + Space space = this.spacesList.get(id); + + Assert.assertTrue("the space must have a image", jsonNode.hasNonNull("image")); + String image = jsonNode.get("image").asText(); + Assert.assertEquals("space image must be equals to " + space.getImage(), space.getImage(), image); + } + + } + + @Test + public void testSingleCreated() throws JsonProcessingException, IOException { + + Space space = this.spacesList.get(this.firstSpaceUUID); + WebResource webResource = this.resource(); + String respString = webResource.path("spaces").path(this.firstSpaceUUID).get(String.class); + logger.debug("RESPONSE : " + respString); + ObjectMapper mapper = new ObjectMapper(); + JsonNode jsonNode = mapper.readTree(respString); + + String id = jsonNode.get("id").asText(); + Assert.assertEquals("id must be equals", space.getId(), id); + + Assert.assertTrue("the space must have a created", jsonNode.hasNonNull("created")); + + String dateStr = jsonNode.get("created").asText(); + + DateTimeFormatter fmt = ISODateTimeFormat.dateTime(); + DateTime date = fmt.parseDateTime(dateStr); + + Assert.assertEquals("Created date must be the same", space.getCreated(), date.toDate()); + + } + + @Test + public void testSingleTitle() throws JsonProcessingException, IOException { + + Space space = this.spacesList.get(this.firstSpaceUUID); + WebResource webResource = this.resource(); + String respString = webResource.path("spaces").path(this.firstSpaceUUID).get(String.class); + logger.debug("RESPONSE : " + respString); + ObjectMapper mapper = new ObjectMapper(); + JsonNode jsonNode = mapper.readTree(respString); + + Assert.assertTrue("the space must have a title", jsonNode.hasNonNull("title")); + String title = jsonNode.get("title").asText(); + Assert.assertEquals("space title must be equals to " + space.getTitle(), space.getTitle(), title); + } + + @Test + public void testSingleDescription() throws JsonProcessingException, IOException { + + Space space = this.spacesList.get(this.firstSpaceUUID); + WebResource webResource = this.resource(); + String respString = webResource.path("spaces").path(this.firstSpaceUUID).get(String.class); + logger.debug("RESPONSE : " + respString); + ObjectMapper mapper = new ObjectMapper(); + JsonNode jsonNode = mapper.readTree(respString); + + Assert.assertTrue("the space must have a description", jsonNode.hasNonNull("description")); + String description = jsonNode.get("description").asText(); + Assert.assertEquals("space description must be equals to " + space.getDescription(), space.getDescription(), description); + } + + @Test + public void testSingleUri() throws JsonProcessingException, IOException { + + Space space = this.spacesList.get(this.firstSpaceUUID); + WebResource webResource = this.resource(); + String respString = webResource.path("spaces").path(this.firstSpaceUUID).get(String.class); + logger.debug("RESPONSE : " + respString); + ObjectMapper mapper = new ObjectMapper(); + JsonNode jsonNode = mapper.readTree(respString); + + Assert.assertTrue("the space must have a uri", jsonNode.hasNonNull("uri")); + String uri = jsonNode.get("uri").asText(); + Assert.assertEquals("space uri must be equals to " + space.getUri(), space.getUri(), uri); + } + + @Test + public void testSingleColor() throws JsonProcessingException, IOException { + + Space space = this.spacesList.get(this.firstSpaceUUID); + WebResource webResource = this.resource(); + String respString = webResource.path("spaces").path(this.firstSpaceUUID).get(String.class); + logger.debug("RESPONSE : " + respString); + ObjectMapper mapper = new ObjectMapper(); + JsonNode jsonNode = mapper.readTree(respString); + + Assert.assertTrue("the space must have a color", jsonNode.hasNonNull("color")); + String color = jsonNode.get("color").asText(); + Assert.assertEquals("space color must be equals to " + space.getColor(), space.getColor(), color); + } + + + + @Test + public void testSingleBinConfig() throws JsonProcessingException, IOException { + + Space space = this.spacesList.get(this.firstSpaceUUID); + WebResource webResource = this.resource(); + String respString = webResource.path("spaces").path(this.firstSpaceUUID).get(String.class); + logger.debug("RESPONSE : " + respString); + ObjectMapper mapper = new ObjectMapper(); + JsonNode jsonNode = mapper.readTree(respString); + + Assert.assertTrue("the space must have a bin_config", jsonNode.hasNonNull("bin_config")); + String binConfig = jsonNode.get("bin_config").asText(); + Assert.assertEquals("space bin_config must be equals to " + space.getBinConfig(), space.getBinConfig(), binConfig); + } + + @Test + public void testSingleCreatedBy() throws JsonProcessingException, IOException { + + Space space = this.spacesList.get(this.firstSpaceUUID); + WebResource webResource = this.resource(); + String respString = webResource.path("spaces").path(this.firstSpaceUUID).get(String.class); + logger.debug("RESPONSE : " + respString); + ObjectMapper mapper = new ObjectMapper(); + JsonNode jsonNode = mapper.readTree(respString); + + Assert.assertTrue("the space must have a created_by", jsonNode.hasNonNull("created_by")); + String createdBy = jsonNode.get("created_by").asText(); + Assert.assertEquals("space created_by must be equals to " + space.getCreatedBy(), space.getCreatedBy(), createdBy); + } + + + @Test + public void testSingleImage() throws JsonProcessingException, IOException { + + Space space = this.spacesList.get(this.firstSpaceUUID); + WebResource webResource = this.resource(); + String respString = webResource.path("spaces").path(this.firstSpaceUUID).get(String.class); + logger.debug("RESPONSE : " + respString); + ObjectMapper mapper = new ObjectMapper(); + JsonNode jsonNode = mapper.readTree(respString); + + Assert.assertTrue("the space must have a image", jsonNode.hasNonNull("image")); + String image = jsonNode.get("image").asText(); + Assert.assertEquals("space image must be equals to " + space.getImage(), space.getImage(), image); + } + + + @Test + public void testPost() throws JsonProcessingException, ClientHandlerException, UniformInterfaceException, IOException { + + String title = "test_post"; + String description = "test space post"; + String uri = "http://ldt.iri.centrepompidou.fr/test_post"; + String color = "#bcbcbc"; + String image = "http://ldt.iri.centrepompidou.fr/test_post/image"; + String created = "2013-01-01T01:01:01.001+0000"; + String bin_config = "{name: 'test_post_config'}"; + String created_by = "test_user_post"; + + String spaceJson = String.format("{" + + "\"title\":\"%s\"," + + "\"description\":\"%s\"," + + "\"uri\":\"%s\"," + + "\"color\":\"%s\"," + + "\"image\":\"%s\"," + + "\"created\":\"%s\"," + + "\"bin_config\":\"%s\"," + + "\"created_by\":\"%s\"" + + "}", + title, + description, + uri, + color, + image, + created, + bin_config, + created_by); + + WebResource webResource = this.resource(); + ClientResponse resp = webResource.path("spaces").type(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON).entity(spaceJson).post(ClientResponse.class); + + String respStr = resp.getEntity(String.class); + + Assert.assertEquals("Resp status = created : " + respStr, Status.CREATED.getStatusCode(), resp.getStatus()); + Assert.assertTrue("Resp must be application/json", resp.getType().isCompatible(MediaType.APPLICATION_JSON_TYPE)); + + ObjectMapper mapper = new ObjectMapper(); + JsonNode objNode = mapper.readTree(respStr); + + Assert.assertTrue("the space must have an id", objNode.hasNonNull("id")); + String idStr = objNode.get("id").asText(); + Assert.assertFalse("The id str must not be empty", idStr.length()==0); + + Assert.assertTrue("the space must have a title", objNode.hasNonNull("title")); + String titleStr = objNode.get("title").asText(); + Assert.assertEquals("space title must be equals to " + title, title, titleStr); + + Assert.assertTrue("the space must have a description", objNode.hasNonNull("description")); + String descriptionStr = objNode.get("description").asText(); + Assert.assertEquals("space description must be equals to " + description, description, descriptionStr); + + Assert.assertTrue("the space must have a uri", objNode.hasNonNull("uri")); + String uriStr = objNode.get("uri").asText(); + Assert.assertEquals("space uri must be equals to " + uri, uri, uriStr); + + Assert.assertTrue("the space must have a color", objNode.hasNonNull("color")); + String colorStr = objNode.get("color").asText(); + Assert.assertEquals("space color must be equals to " + color, color, colorStr); + + Assert.assertTrue("the space must have a bin_config", objNode.hasNonNull("bin_config")); + String bin_configStr = objNode.get("bin_config").asText(); + Assert.assertEquals("space bin_config must be equals to " + bin_config, bin_config, bin_configStr); + + Assert.assertTrue("the space must have a created_by", objNode.hasNonNull("created_by")); + String created_byStr = objNode.get("created_by").asText(); + Assert.assertEquals("space created_by must be equals to " + created_by, created_by, created_byStr); + + Assert.assertTrue("the space must have a created", objNode.hasNonNull("created")); + String createdStr = objNode.get("created").asText(); + Assert.assertEquals("space created must be equals to " + created, created, createdStr); + + // object must be created + Space sp = this.spacesRepository.findOne(idStr); + + Assert.assertNotNull("Space object must be in rep", sp); + + Assert.assertEquals("space title must be equals to " + title, title, sp.getTitle()); + Assert.assertEquals("space description must be equals to " + description, description, sp.getDescription()); + Assert.assertEquals("space uri must be equals to " + uri, uri, sp.getUri()); + Assert.assertEquals("space color must be equals to " + color, color, sp.getColor()); + Assert.assertEquals("space bin_config must be equals to " + bin_config, bin_config, sp.getBinConfig()); + Assert.assertEquals("space created_by must be equals to " + created_by, created_by, sp.getCreatedBy()); + DateTimeFormatter fmt = ISODateTimeFormat.dateTime(); + DateTime created_date = fmt.parseDateTime(created); + Assert.assertEquals("space created must be equals to " + created, created_date.toDate(), sp.getCreated()); + + } + + + @Test + public void testPostWithId() { + + String id = UUID.randomUUID().toString(); + String title = "test_post"; + String description = "test space post"; + String uri = "http://ldt.iri.centrepompidou.fr/test_post"; + String color = "#bcbcbc"; + String image = "http://ldt.iri.centrepompidou.fr/test_post/image"; + String created = "2013-01-01T01:01:01.001+0000"; + String bin_config = "{name: 'test_post_config'}"; + String created_by = "test_user_post"; + + String spaceJson = String.format("{" + + "\"id\":\"%s\"," + + "\"title\":\"%s\"," + + "\"description\":\"%s\"," + + "\"uri\":\"%s\"," + + "\"color\":\"%s\"," + + "\"image\":\"%s\"," + + "\"created\":\"%s\"," + + "\"bin_config\":\"%s\"," + + "\"created_by\":\"%s\"" + + "}", + id, + title, + description, + uri, + color, + image, + created, + bin_config, + created_by); + + WebResource webResource = this.resource(); + ClientResponse resp = webResource.path("spaces").type(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON).entity(spaceJson).post(ClientResponse.class); + + String respStr = resp.getEntity(String.class); + + Assert.assertEquals("Resp status = Bad Request : " + respStr, Status.BAD_REQUEST.getStatusCode(), resp.getStatus()); + Assert.assertEquals("Error message", "Id in JSON must be null", respStr); + + } + + @Test + public void testPut() throws JsonProcessingException, IOException { + + String id = this.firstSpaceUUID; + String title = "test_post"; + String description = "test space put"; + String uri = "http://ldt.iri.centrepompidou.fr/test_put"; + String color = "#bcbcbc"; + String image = "http://ldt.iri.centrepompidou.fr/test_put/image"; + String created = "2013-01-01T01:01:01.001+0000"; + String bin_config = "{name: 'test_put_config'}"; + String created_by = "test_user_put"; + + String spaceJson = String.format("{" + + "\"id\":\"%s\"," + + "\"title\":\"%s\"," + + "\"description\":\"%s\"," + + "\"uri\":\"%s\"," + + "\"color\":\"%s\"," + + "\"image\":\"%s\"," + + "\"created\":\"%s\"," + + "\"bin_config\":\"%s\"," + + "\"created_by\":\"%s\"" + + "}", + id, + title, + description, + uri, + color, + image, + created, + bin_config, + created_by); + + WebResource webResource = this.resource(); + ClientResponse resp = webResource.path("spaces").path(this.firstSpaceUUID).type(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON).entity(spaceJson).put(ClientResponse.class); + + String respStr = ""; + + if(resp.getStatus() != 204) { + respStr = resp.getEntity(String.class); + } + + Assert.assertEquals("Resp status = created : " + respStr, Status.NO_CONTENT.getStatusCode(), resp.getStatus()); + Assert.assertNull("Resp type must be null", resp.getType()); + + + // object must be updated + Space sp = this.spacesRepository.findOne(id); + + Assert.assertNotNull("Space object must be in rep", sp); + + Assert.assertEquals("space title must be equals to " + title, title, sp.getTitle()); + Assert.assertEquals("space description must be equals to " + description, description, sp.getDescription()); + Assert.assertEquals("space uri must be equals to " + uri, uri, sp.getUri()); + Assert.assertEquals("space color must be equals to " + color, color, sp.getColor()); + Assert.assertEquals("space bin_config must be equals to " + bin_config, bin_config, sp.getBinConfig()); + Assert.assertEquals("space created_by must be equals to " + created_by, created_by, sp.getCreatedBy()); + DateTimeFormatter fmt = ISODateTimeFormat.dateTime(); + DateTime created_date = fmt.parseDateTime(created); + Assert.assertEquals("space created must be equals to " + created, created_date.toDate(), sp.getCreated()); + + } + + @Test + public void testPutWithoutId() { + + String title = "test_put"; + String description = "test space put"; + String uri = "http://ldt.iri.centrepompidou.fr/test_put"; + String color = "#bcbcbc"; + String image = "http://ldt.iri.centrepompidou.fr/test_put/image"; + String created = "2013-01-01T01:01:01.001+0000"; + String bin_config = "{name: 'test_put_config'}"; + String created_by = "test_user_put"; + + String spaceJson = String.format("{" + + "\"title\":\"%s\"," + + "\"description\":\"%s\"," + + "\"uri\":\"%s\"," + + "\"color\":\"%s\"," + + "\"image\":\"%s\"," + + "\"created\":\"%s\"," + + "\"bin_config\":\"%s\"," + + "\"created_by\":\"%s\"" + + "}", + title, + description, + uri, + color, + image, + created, + bin_config, + created_by); + + WebResource webResource = this.resource(); + ClientResponse resp = webResource.path("spaces").path(this.firstSpaceUUID).type(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON).entity(spaceJson).put(ClientResponse.class); + + String respStr = resp.getEntity(String.class); + + Assert.assertEquals("Resp status = Bad Request : " + respStr, Status.BAD_REQUEST.getStatusCode(), resp.getStatus()); + Assert.assertEquals("Error message", "Id parameter and id in JSON do not match", respStr); + } + + @Test + public void testPutBadId() { + + String id = UUID.randomUUID().toString(); + String title = "test_post"; + String description = "test space put"; + String uri = "http://ldt.iri.centrepompidou.fr/test_put"; + String color = "#bcbcbc"; + String image = "http://ldt.iri.centrepompidou.fr/test_put/image"; + String created = "2013-01-01T01:01:01.001+0000"; + String bin_config = "{name: 'test_put_config'}"; + String created_by = "test_user_put"; + + String spaceJson = String.format("{" + + "\"id\":\"%s\"," + + "\"title\":\"%s\"," + + "\"description\":\"%s\"," + + "\"uri\":\"%s\"," + + "\"color\":\"%s\"," + + "\"image\":\"%s\"," + + "\"created\":\"%s\"," + + "\"bin_config\":\"%s\"," + + "\"created_by\":\"%s\"" + + "}", + id, + title, + description, + uri, + color, + image, + created, + bin_config, + created_by); + + WebResource webResource = this.resource(); + ClientResponse resp = webResource.path("spaces").path(id).type(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON).entity(spaceJson).put(ClientResponse.class); + + String respStr = resp.getEntity(String.class); + + Assert.assertEquals("Resp status = Bad Request : " + respStr, Status.NOT_FOUND.getStatusCode(), resp.getStatus()); + + } + + @Test + public void testDelete() { + + WebResource webResource = this.resource(); + ClientResponse resp = webResource.path("spaces").path(this.firstSpaceUUID).accept(MediaType.TEXT_PLAIN).delete(ClientResponse.class); + + String respStr = resp.getEntity(String.class); + URI reqUri = webResource.getUriBuilder().path("spaces").path(this.firstSpaceUUID).build(); + + Assert.assertEquals("Status must be deleted : " + respStr, Status.OK.getStatusCode(), resp.getStatus()); + Assert.assertEquals(String.format("Message must be \"%s deleted\"", reqUri), String.format("%s deleted",reqUri) , respStr); + + // object must be updated + Space sp = this.spacesRepository.findOne(this.firstSpaceUUID); + + Assert.assertNull("Space object must be in rep", sp); + + } +} diff -r 47b3125130a2 -r 9af0874ce43f server/src/test/resources/org/iri_research/renkan/test/repositories/mongo-config.xml --- a/server/src/test/resources/org/iri_research/renkan/test/repositories/mongo-config.xml Fri Mar 01 19:14:30 2013 +0100 +++ b/server/src/test/resources/org/iri_research/renkan/test/repositories/mongo-config.xml Sat Mar 09 02:19:49 2013 +0100 @@ -19,7 +19,7 @@ - + diff -r 47b3125130a2 -r 9af0874ce43f server/src/test/resources/org/iri_research/renkan/test/rest/mongo-config.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/src/test/resources/org/iri_research/renkan/test/rest/mongo-config.xml Sat Mar 09 02:19:49 2013 +0100 @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + diff -r 47b3125130a2 -r 9af0874ce43f server/src/test/resources/org/iri_research/renkan/test/rest/rest-context.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/src/test/resources/org/iri_research/renkan/test/rest/rest-context.xml Sat Mar 09 02:19:49 2013 +0100 @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file