From 754fda16e642d645134f6af8558d3f96d4cfca5c Mon Sep 17 00:00:00 2001 From: Raymond Weng Date: Fri, 28 Oct 2022 00:41:10 -0400 Subject: [PATCH] getRequests: fix query error --- src/main/java/ca/utoronto/utm/mcs/Neo4jDAO.java | 8 ++++---- src/test/java/ca/utoronto/utm/mcs/AppTest.java | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/ca/utoronto/utm/mcs/Neo4jDAO.java b/src/main/java/ca/utoronto/utm/mcs/Neo4jDAO.java index 311c728..6db31ce 100644 --- a/src/main/java/ca/utoronto/utm/mcs/Neo4jDAO.java +++ b/src/main/java/ca/utoronto/utm/mcs/Neo4jDAO.java @@ -114,7 +114,7 @@ public String getActor(String id) throws JSONException { public String getMovie(String movieId) throws JSONException { JSONObject response = new JSONObject(); String query; - query = "MATCH (m:movie { id: \"%s\"}) RETURN m.name"; + query = "MATCH (m:movie { id: \"%s\"}) RETURN m.Name"; query = String.format(query, movieId); Result result = this.session.run(query); @@ -124,7 +124,7 @@ public String getMovie(String movieId) throws JSONException { } List resultValues = result.list(); response.put("movieId", movieId); - response.put("name", resultValues.get(0).get("m.name").asString()); + response.put("name", resultValues.get(0).get("m.Name").asString()); query = "MATCH (a:actor)-[r:ACTED_IN]->(m:movie { id: \"%s\"}) RETURN a.id"; query = String.format(query, movieId); @@ -139,7 +139,7 @@ public String hasRelationship(String actorId, String movieId) throws JSONExcepti JSONObject response = new JSONObject(); String query; - query = "MATCH (m:movie { id: \"%s\"}) RETURN m.name"; + query = "MATCH (m:movie { id: \"%s\"}) RETURN m.Name"; query = String.format(query, movieId); Result result = this.session.run(query); if(!result.hasNext()){ @@ -147,7 +147,7 @@ public String hasRelationship(String actorId, String movieId) throws JSONExcepti return "404"; } - query = "MATCH (a:actor { id: \"%s\"}) RETURN a.name"; + query = "MATCH (a:actor { id: \"%s\"}) RETURN a.Name"; query = String.format(query, actorId); result = this.session.run(query); if(!result.hasNext()){ diff --git a/src/test/java/ca/utoronto/utm/mcs/AppTest.java b/src/test/java/ca/utoronto/utm/mcs/AppTest.java index 3ada8ea..7b27915 100644 --- a/src/test/java/ca/utoronto/utm/mcs/AppTest.java +++ b/src/test/java/ca/utoronto/utm/mcs/AppTest.java @@ -151,7 +151,7 @@ public void getMoviePass() throws JSONException, IOException, InterruptedExcepti public void getMovieFail() throws JSONException, IOException, InterruptedException { JSONObject setupReq = new JSONObject() .put("name", "TestMovie") - .put("actorId", "12345678901"); + .put("movieId", "12345678901"); sendRequest("/api/v1/addMovie", "PUT", setupReq.toString()); JSONObject confirmReq = new JSONObject()