LemonGraph { public static JSONObject deleteGraph(String graphId) throws InvalidGraphException { JSONObject ret = new JSONObject(); try { openConnection(); ContentResponse res = client.newRequest(restUrl+"graph/"+graphId) .method(HttpMethod.DELETE) .agent("Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:17.0) Gecko/20100101 Firefox/17.0") .send(); int status = res.getStatus(); ret.put("status", status); ret.put("message", res.getContentAsString()); return ret; } catch (Exception e) { log.error("Caught exception in deleteGraph "+e.getMessage()); throw new InvalidGraphException(e.getMessage()); } } LemonGraph(); static void openConnection(); static boolean isConnected(); static void close(); static boolean isApiUp(); static JSONObject queryBasedOnPatterns(String jobId, HashMap<String, String> adapterPatterns, int startId); static JSONObject queryBasedOnPatterns(String jobId, HashMap<String, String> adapterPatterns, int startId, int stopId); static JSONObject queryBasedOnPatterns(String jobId, HashMap<String, String> adapterPatterns); static HashMap parseLemonGraphResult(JSONObject resultdata); static JSONObject resetGraph(String graphId); static JSONObject deleteGraph(String graphId); static String createGraph(JSONObject meta); static String createGraph(String graphId, JSONObject meta); static LemonGraphResponse postToGraph(String graphId, LemonGraphObject graph); static LemonGraphResponse postToGraph(LGPayload payload); static String getContent(String uri); static JSONObject getGraph(String jobId); static JSONObject getGraphCytoscape(String jobId); static JSONObject getGraphD3(String jobId); static JSONObject getGraphD3(String jobId, int start, int stop); static LemonGraphObject buildLemonGraphFromPayloadNodesandEdges(List<JSONObject> inNodes, List<JSONArray> inEdges); static void main(String[] args); final static int NOT_FOUND; static String restUrl; static HttpClient client; }
@Test public void testDelete() throws InvalidGraphException { LemonGraph.deleteGraph(""); }