Examples of Interpreter


Examples of org.infinispan.cli.interpreter.Interpreter

      interpreter.execute(sessionId, "remove 'b' 'c';");
      assert cache.containsKey("b");
   }

   public void testReplace() throws Exception {
      Interpreter interpreter = getInterpreter();
      String sessionId = interpreter.createSessionId(BasicCacheContainer.DEFAULT_CACHE_NAME);
      interpreter.execute(sessionId, "put 'a' 'a';");
      Object a = cache.get("a");
      assert a.equals("a");
      interpreter.execute(sessionId, "replace 'a' 'b';");
      a = cache.get("a");
      assert a.equals("b");
      interpreter.execute(sessionId, "replace 'a' 'b' 'c';");
      a = cache.get("a");
      assert a.equals("c");
      interpreter.execute(sessionId, "replace 'a' 'b' 'd';");
      a = cache.get("a");
      assert a.equals("c");
   }
View Full Code Here

Examples of org.infinispan.cli.interpreter.Interpreter

      a = cache.get("a");
      assert a.equals("c");
   }

   public void testCreateLocal() throws Exception {
      Interpreter interpreter = getInterpreter();
      String sessionId = interpreter.createSessionId(BasicCacheContainer.DEFAULT_CACHE_NAME);
      interpreter.execute(sessionId, "create newcache;");
      assert cacheManager.cacheExists("newcache");
      interpreter.execute(sessionId, "create anothercache like newcache;");
      assert cacheManager.cacheExists("anothercache");
   }
View Full Code Here

Examples of org.infinispan.cli.interpreter.Interpreter

      interpreter.execute(sessionId, "create anothercache like newcache;");
      assert cacheManager.cacheExists("anothercache");
   }

   public void testUpgrade() throws Exception {
      Interpreter interpreter = getInterpreter();
      String sessionId = interpreter.createSessionId(BasicCacheContainer.DEFAULT_CACHE_NAME);
      interpreter.execute(sessionId, "upgrade --dumpkeys;");
   }
View Full Code Here

Examples of org.infinispan.cli.interpreter.Interpreter

      String sessionId = interpreter.createSessionId(BasicCacheContainer.DEFAULT_CACHE_NAME);
      interpreter.execute(sessionId, "upgrade --dumpkeys;");
   }

   public void testInvalidSession() throws Exception {
      Interpreter interpreter = getInterpreter();
      String sessionId = "123";
      Map<String, String> response = interpreter.execute(sessionId, "put 'a' 'a';");
      assert response.containsKey(ResultKeys.ERROR.toString());
   }
View Full Code Here

Examples of org.infinispan.cli.interpreter.Interpreter

      assert response.containsKey(ResultKeys.ERROR.toString());
   }

   public void testCacheNotYetSelected() throws Exception {
      GlobalComponentRegistry gcr = TestingUtil.extractGlobalComponentRegistry(this.cacheManager);
      Interpreter interpreter = gcr.getComponent(Interpreter.class);
      String sessionId = interpreter.createSessionId(null);
      Map<String, String> response = interpreter.execute(sessionId, "cache;");
      assert response.containsKey(ResultKeys.ERROR.toString());
      String errorMsg = LogFactory.getLog(CacheStatement.class, Log.class).noCacheSelectedYet().getMessage();
      assert response.get(ResultKeys.ERROR.toString()).contains(errorMsg);
   }
View Full Code Here

Examples of org.mozilla.javascript.Interpreter

       
        ScriptOrFnNode tree = parser.parse(source, null, lineno);
        String encodedSource = parser.getEncodedSource();
        if (encodedSource.length() == 0) { return ""; }
       
        Interpreter compiler = new Interpreter();
        compiler.compile(compilerEnv, tree, encodedSource, false);
        UintMap properties = new UintMap(1);
        properties.put(Decompiler.INITIAL_INDENT_PROP, indent);
       
        TokenMapper tm = new TokenMapper(tree);
        Map replacedTokensLookup = collectReplacedTokens(encodedSource, escapeUnicode, tm);
View Full Code Here

Examples of org.terasology.logic.behavior.tree.Interpreter

        }
        save(tree);
    }

    private void addEntity(EntityRef entityRef, BehaviorComponent behaviorComponent) {
        Interpreter interpreter = entityInterpreters.get(entityRef);
        if (interpreter == null) {
            interpreter = new Interpreter(new Actor(entityRef));
            BehaviorTree tree = behaviorComponent.tree;
            entityInterpreters.put(entityRef, interpreter);
            if (tree != null) {
                interpreter.start(tree.getRoot());
            }
        }
    }
View Full Code Here

Examples of org.uscxml.Interpreter

    System.load("/Users/sradomski/Documents/TK/Code/uscxml/build/cli/lib/libuscxmlNativeJava64.jnilib");

    // syntactic xml parse error -> throws
    try {
      String xml = "<invalid";
      Interpreter interpreter = Interpreter.fromXML(xml);
      throw new RuntimeException("");
    } catch (InterpreterException e) {
      System.err.println(e);
    }

    // semantic xml parse error -> throws
    try {
      String xml = "<invalid />";
      Interpreter interpreter = Interpreter.fromXML(xml);
      if (interpreter.getState() != InterpreterState.USCXML_INSTANTIATED) throw new RuntimeException("");
      interpreter.step();
      throw new RuntimeException("");
    } catch (InterpreterException e) {
      System.err.println(e);
    }

    // request unknown datamodel -> throws
    try {
      String xml =
      "<scxml datamodel=\"invalid\">" +
      "  <state id=\"start\">" +
      "    <transition target=\"done\" />" +
      " </state>" +
      " <final id=\"done\" />" +
      "</scxml>";
      Interpreter interpreter = Interpreter.fromXML(xml);
      if (interpreter.getState() != InterpreterState.USCXML_INSTANTIATEDthrow new RuntimeException("");
      interpreter.step();
      throw new RuntimeException("");
     
    } catch (InterpreterException e) {
      System.err.println(e);
    }

    try {
      // two microsteps
      String xml =
      "<scxml>" +
      "  <state id=\"start\">" +
      "    <transition target=\"s2\" />" +
      "   </state>" +
      "  <state id=\"s2\">" +
      "    <transition target=\"done\" />" +
      " </state>" +
      " <final id=\"done\" />" +
      "</scxml>";
     
      Interpreter interpreter = Interpreter.fromXML(xml);

      if (interpreter.getState() != InterpreterState.USCXML_INSTANTIATED) throw new RuntimeException("");
      if (interpreter.step() != InterpreterState.USCXML_MICROSTEPPED) throw new RuntimeException("");
      if (interpreter.step() != InterpreterState.USCXML_MICROSTEPPED) throw new RuntimeException("");
      if (interpreter.step() != InterpreterState.USCXML_FINISHED) throw new RuntimeException("");

    } catch (InterpreterException e) {
      System.err.println(e);
    }
 
    try {
      // single macrostep, multiple runs
      String xml =
      "<scxml>" +
      "  <state id=\"start\">" +
      "    <transition target=\"done\" />" +
      " </state>" +
      " <final id=\"done\" />" +
      "</scxml>";
     
      Interpreter interpreter = Interpreter.fromXML(xml);
      if (interpreter.getState() != InterpreterState.USCXML_INSTANTIATED) throw new RuntimeException("");
      if (interpreter.step() != InterpreterState.USCXML_MICROSTEPPED) throw new RuntimeException("");
      if (interpreter.step() != InterpreterState.USCXML_FINISHED) throw new RuntimeException("");
      interpreter.reset();

      if (interpreter.getState() != InterpreterState.USCXML_INSTANTIATED) throw new RuntimeException("");
      if (interpreter.step() != InterpreterState.USCXML_MICROSTEPPED) throw new RuntimeException("");
      if (interpreter.step() != InterpreterState.USCXML_FINISHED) throw new RuntimeException("");

    } catch (InterpreterException e) {
      System.err.println(e);
    }
   
    try {
      // macrostep in between
      String xml =
      "<scxml>" +
      "  <state id=\"start\">" +
      "    <onentry>" +
      "      <send event=\"continue\" delay=\"2s\"/>" +
      "    </onentry>" +
      "    <transition target=\"s2\" event=\"continue\" />" +
      " </state>" +
      "  <state id=\"s2\">" +
      "    <transition target=\"done\" />" +
      " </state>" +
      " <final id=\"done\" />" +
      "</scxml>";
     
      Interpreter interpreter = Interpreter.fromXML(xml);
      if (interpreter.getState() != InterpreterState.USCXML_INSTANTIATED) throw new RuntimeException("");
      if (interpreter.step() != InterpreterState.USCXML_IDLE) throw new RuntimeException("");
      if (interpreter.step(true) != InterpreterState.USCXML_MACROSTEPPED) throw new RuntimeException("");
      if (interpreter.step() != InterpreterState.USCXML_MICROSTEPPED) throw new RuntimeException("");
      if (interpreter.step() != InterpreterState.USCXML_FINISHED) throw new RuntimeException("");

    } catch (InterpreterException e) {
      System.err.println(e);
    }
  }
View Full Code Here

Examples of org.zkoss.web.servlet.dsp.Interpreter

      String ctype = Interpreter.getContentType(path);
      if (ctype == null)
        ctype = ";charset=UTF-8";
      else if (ctype.indexOf(';') < 0 && !ContentTypes.isBinary(ctype))
        ctype += ";charset=UTF-8";
      return new Interpreter()
        .parse(content, ctype, null, _webctx.getLocator());
    }
View Full Code Here

Examples of org.zkoss.zk.scripting.Interpreter

  private boolean setZScriptVariable(Component comp, String beanid, Object val) {
    //for all loaded interperter, assign val to beanid
    boolean found = false;
    for(final Iterator it = comp.getPage().getLoadedInterpreters().iterator();
    it.hasNext();) {
      final Interpreter ip = (Interpreter) it.next();
      if (ip instanceof HierachicalAware) {
        final HierachicalAware ha = (HierachicalAware)ip;
        if (ha.containsVariable(comp, beanid)) {
          ha.setVariable(comp, beanid, val);
          found = true;
        }
      } else if (ip.containsVariable(beanid)) {
        ip.setVariable(beanid, val);
        found = true;
      }
    }
    return found;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.