Package clojure.tools.nrepl.Connection

Examples of clojure.tools.nrepl.Connection.Response


    }
  }

  @SuppressWarnings("unchecked")
    private Map<String, List<String>> getRemoteNsTree (SafeConnection repl) throws Exception {
      Response res = repl.send(10000, "op", "eval", "code", "(ccw.debug.serverrepl/namespaces-info)");
        List<Object> values = res.values();
        if (values.isEmpty()) {
          return null;
        } else {
          return (Map<String, List<String>>)values.get(0);
        }
View Full Code Here


    }

    public Set<String> getAvailableOperations () throws IllegalStateException {
        if (describeInfo == null) {
          try {
              Response r = safeToolConnection.send(10000, "op", "describe");
              // working around the fact that nREPL < 0.2.0-beta9 does *not* send a
              // :done status when an operation is unknown!
              // TODO remove this and just check r.statuses() after we can assume usage
              // of later versions of nREPL
              Object status = ((Map<String, String>)r.seq().first()).get(Keyword.intern("status"));
              if (clojure.lang.Util.equals(status, "unknown-op") || (status instanceof Collection &&
                      ((Collection)status).contains("error"))) {
                  CCWPlugin.logError("Invalid response to \"describe\" request");
                  describeInfo = new HashMap();
              } else {
                  describeInfo = r.combinedResponse();
              }
          } catch (Exception e) {
            CCWPlugin.logError("Error while trying to obtain nrepl available operations", e);
            describeInfo = new HashMap();
          }
View Full Code Here

          @Override public <T> T withConnection(Connection c) {
              for (String maybeLibName: clojureLibs) {
//                System.out.println("compiling:'" + maybeLibName + "'");
                String compileLibCommand = CompileLibAction.compileLibCommand(maybeLibName);
//                System.out.println("Sending command: '" + compileLibCommand + "'");
              Response res = c.send("op", "eval", "code", compileLibCommand);
//              System.out.println("compilation response: '" + res + "'");
              if (res.values().isEmpty()) {
//                System.out.println(("oops, weird error when compiling '" + maybeLibName + "'"));
              } else {
                  Object result = res.values().get(0);
//                  System.out.println("ClojureVisitor: " + result);
                          if (result instanceof Map) {
                            Map resultMap = (Map) result;
                              Collection<Map> response = (Collection<Map>)resultMap.get("response");
                              if (response != null) {
View Full Code Here

    public void run() {
        try {
            String lib = editor.findDeclaringNamespace();
            REPLView replView = editor.getCorrespondingREPL();
            SafeConnection replConnection = replView.getSafeToolingConnection();
            Response compilationResult = replConnection.send(15000, "op", "eval", "code", CompileLibAction.compileLibCommand(lib));
            refreshCompilationResults();
            if (new Long(0).equals(((Map)compilationResult.values().get(0)).get("response-type"))) {
                runTests(lib, replConnection);
            } else {
                editor.setStatusLineErrorMessage(ClojureEditorMessages.Compilation_failed);
                setReplBackgroundColor(colorRegistry.get(FAILED_TESTS_COLOR_KEY));
            }
View Full Code Here

            CCWPlugin.logError("Failed running tests against editor " + editor.getPartName(), e);
        }
    }

    private void runTests(String lib, SafeConnection repl) throws Exception {
        Response results = repl.send(15000, "op", "eval", "code", runTestsCommand(lib));
        if (((String)results.combinedResponse().get(Keyword.intern("out"))).contains(":fail 0, :error 0")) {
            editor.setStatusLineErrorMessage(ClojureEditorMessages.Tests_passed);
            setReplBackgroundColor(colorRegistry.get(PASSED_TESTS_COLOR_KEY));
        } else {
            editor.setStatusLineErrorMessage(ClojureEditorMessages.Tests_failed);
            setReplBackgroundColor(colorRegistry.get(FAILED_TESTS_COLOR_KEY));
View Full Code Here

TOP

Related Classes of clojure.tools.nrepl.Connection.Response

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.