# HG changeset patch # User one # Date 1349236417 -32400 # Node ID 7112b826a53abb57b7781afa2627d3a746e4afa8 # Parent e246e0dac9c88ab887fb502834f7113186e88962 modified RequestTest.java diff -r e246e0dac9c8 -r 7112b826a53a app/controllers/Claim.java --- a/app/controllers/Claim.java Wed Oct 03 04:44:45 2012 +0900 +++ b/app/controllers/Claim.java Wed Oct 03 12:53:37 2012 +0900 @@ -7,6 +7,7 @@ import models.TPGraph; import com.tinkerpop.blueprints.Graph; +import com.tinkerpop.blueprints.Vertex; import play.mvc.BodyParser; import play.mvc.Controller; @@ -81,7 +82,19 @@ return created(); } - private static Result checkClaimData() { + public static Result getClaimTree(String id) { + TPGraph tpGraph = TPGraph.getInstance(); + Graph graph = tpGraph.getGraph(); + + Vertex v = graph.getVertex(id); + if (v == null) return badRequest("Consensus id "+ id +" is not found."); + ClaimModel consensusRoot = new ClaimModel(v); + + + + + + return ok(); @@ -90,6 +103,7 @@ + private static String[] toStringArray(JsonNode jsonNode) { int length = jsonNode.size(); if (length == 0) return null; diff -r e246e0dac9c8 -r 7112b826a53a app/models/ClaimModel.java --- a/app/models/ClaimModel.java Wed Oct 03 04:44:45 2012 +0900 +++ b/app/models/ClaimModel.java Wed Oct 03 12:53:37 2012 +0900 @@ -16,6 +16,17 @@ super(vertex); } + public ObjectNode getClaimPropertyFromGraph() { + + ObjectNode t = Json.newObject(); + + + + + + return null; + } + public void setClaimProperties(JsonNode toulmin, String type) { String title = toulmin.findPath(NodeModel.TITLE).getTextValue(); diff -r e246e0dac9c8 -r 7112b826a53a test/RequestTest.java --- a/test/RequestTest.java Wed Oct 03 04:44:45 2012 +0900 +++ b/test/RequestTest.java Wed Oct 03 12:53:37 2012 +0900 @@ -1,25 +1,24 @@ -import java.lang.reflect.Array; -import java.util.ArrayList; import java.util.Iterator; import javax.ws.rs.core.MediaType; import models.NodeModel; -import org.json.JSONException; -import org.json.JSONObject; +import org.codehaus.jackson.JsonNode; +import org.codehaus.jackson.node.ArrayNode; +import org.codehaus.jackson.node.ObjectNode; + +import play.libs.Json; import com.sun.jersey.api.client.Client; -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; public class RequestTest { final static String SERVER_ROOT_URI = "http://localhost:9000"; - public static void main(String[] args) throws JSONException { + public static void main(String[] args) { String user1 = "akifumi"; String user2 = "takaaki"; String user3 = "yosiaki"; @@ -32,19 +31,16 @@ createClaim(user1, users1); String[] users2 = {user2}; createClaim(user1, users2); - - getUser(user1); - getUserInfo(user1,"consensus/"); - - + JsonNode user1Claim = getUserInfo(user1,"consensus/"); String[] users3 = {user1}; - createMention(user2, users3, NodeModel.L_QUESTION, "5"); - createMention(user3, users3, NodeModel.L_REFUTATION, "5"); + for (int i=0; i