Fix mindmaping controller tests.

This commit is contained in:
Paulo Gustavo Veiga
2014-01-25 04:21:59 -03:00
parent 9b3f1c79a6
commit 0493d66daa
5 changed files with 37 additions and 12 deletions

View File

@@ -204,7 +204,7 @@ public class MindmapController extends BaseController {
@RequestMapping(method = RequestMethod.PUT, value = "/maps/{id}/document", consumes = {"application/xml", "application/json"}, produces = {"application/json", "application/xml"})
@ResponseBody
public long updateDocument(@RequestBody RestMindmap restMindmap, @PathVariable int id, @RequestParam(required = false) boolean minor, @RequestParam(required = false) Long timestamp, @RequestParam(required = false) Long session) throws WiseMappingException, IOException {
public Long updateDocument(@RequestBody RestMindmap restMindmap, @PathVariable int id, @RequestParam(required = false) boolean minor, @RequestParam(required = false) Long timestamp, @RequestParam(required = false) Long session) throws WiseMappingException, IOException {
final Mindmap mindmap = findMindmapById(id);
final User user = Utils.getUser();
@@ -256,6 +256,22 @@ public class MindmapController extends BaseController {
return xmlStr.getBytes("UTF-8");
}
@ApiIgnore
@RequestMapping(method = RequestMethod.PUT, value = {"/maps/{id}/document/xml"}, consumes = {"text/plain"})
@ResponseBody
public void updateDocument(@PathVariable int id, @RequestBody String xmlDoc) throws WiseMappingException, IOException {
final Mindmap mindmap = findMindmapById(id);
final User user = Utils.getUser();
if (xmlDoc != null && !xmlDoc.isEmpty()) {
mindmap.setXmlStr(xmlDoc);
}
mindmap.setXmlStr(xmlDoc);
saveMindmapDocument(false,mindmap,user);
}
@RequestMapping(method = RequestMethod.GET, value = {"/maps/{id}/{hid}/document/xml"}, consumes = {"text/plain"}, produces = {"application/xml"})
@ResponseBody
public byte[] retrieveDocument(@PathVariable int id, @PathVariable int hid, @NotNull HttpServletResponse response) throws WiseMappingException, IOException {
@@ -562,7 +578,7 @@ public class MindmapController extends BaseController {
createMap(new RestMindmap(mindMap, null), response, title, description);
}
@RequestMapping(method = RequestMethod.POST, value = "/maps/{id}", consumes = {"application/xml", "application/json"})
@RequestMapping(method = RequestMethod.POST, value = "/maps/{id}", consumes = {"application/xml", "application/json"},produces = {"application/xml", "application/json","text/plain"})
@ResponseStatus(value = HttpStatus.CREATED)
public void createDuplicate(@RequestBody RestMindmapInfo restMindmap, @PathVariable int id, @NotNull HttpServletResponse response) throws IOException, WiseMappingException {
// Validate ...

View File

@@ -27,7 +27,7 @@ public class ValidationException extends WiseMappingException{
private Errors errors;
public ValidationException(@NotNull Errors errors) {
super("Validation Exceptions");
super("Validation Exceptions:"+errors);
this.errors = errors;
}

View File

@@ -61,6 +61,10 @@ public class RestMindmapInfo {
this.collaborator = collaborator;
}
public void setCreationTime(String value){
// Ignore
}
public String getCreationTime() {
final Calendar creationTime = mindmap.getCreationTime();
return creationTime != null ? TimeUtils.toISO8601(creationTime.getTime()) : null;
@@ -115,7 +119,7 @@ public class RestMindmapInfo {
return collaboration != null ? collaboration.getRole().getLabel() : "none";
}
public void setRole() {
public void setRole(String value) {
// Do nothing ...
}
@@ -143,7 +147,7 @@ public class RestMindmapInfo {
return mindmap.isStarred(collaborator);
}
public void setStarred(int value) {
public void setStarred(boolean value) {
}