Package net.ex337.scriptus.model.support

Examples of net.ex337.scriptus.model.support.ScriptusClassShutter


       
        ScriptAction r = p.call();
       
        assertTrue("Correct result", r instanceof NormalTermination);
       
        NormalTermination n = (NormalTermination) r;

        r.visit(new ScriptusFacade(datastore, c, m, conf), p); //sould say

        assertEquals("Correct result", "aaarghs", n.getResult());
       
    }
View Full Code Here


   
    ScriptAction r = p.call();
   
    assertTrue("Correct result", r instanceof NormalTermination);
   
    NormalTermination n = (NormalTermination) r;

    r.visit(new ScriptusFacade(datastore, c, m, conf), p); //sould say

    assertEquals("Correct result", "result", n.getResult());
   
  }
View Full Code Here

    ScriptusDatastore datastore = (ScriptusDatastore) appContext.getBean("datastore");
   
    Calendar then = Calendar.getInstance();
    then.add(Calendar.HOUR, 3);
   
    Wake w = new Wake(UUID.randomUUID(), 1234, then.getTimeInMillis());
   
    datastore.saveScheduledTask(w);
   
    List<ScheduledScriptAction> actions = datastore.getScheduledTasks(Calendar.getInstance());
   
    assertFalse("doesnt contain task in future", actions.contains(w));
   
    actions = datastore.getScheduledTasks(then);
   
    assertTrue("contains task in future",  actions.contains(w));
   
    boolean found = false;
   
    Wake neww = null;
   
    for(ScheduledScriptAction t : actions){
      if(t.equals(w)) {
        neww = (Wake) t;
        found = true;
        break;
      }
    }
   
    assertTrue("retrieved task", found);
   
    then.add(Calendar.HOUR, 1);
   
    actions = datastore.getScheduledTasks(then);
   
    assertTrue("list not empty",  ! actions.isEmpty());
   
    found = false;
   
    for(ScheduledScriptAction t : actions){
      if(t.equals(w)) {
        found = true;
        break;
      }
    }
   
    datastore.deleteScheduledTask(neww.getPid(), neww.getNonce());

    actions = datastore.getScheduledTasks(then);
   
    found = false;
   
View Full Code Here

        }

        LOG.debug("loading " + pid.toString().substring(30));

        Context cx = Context.enter();
        cx.setClassShutter(new ScriptusClassShutter());
        cx.setOptimizationLevel(-1); // must use interpreter mode

        try {

            ProcessDAO d;
View Full Code Here

        }

        LOG.debug("saving " + p.getPid().toString().substring(30));

        Context cx = Context.enter();
        cx.setClassShutter(new ScriptusClassShutter());
        cx.setOptimizationLevel(-1); // must use interpreter mode

        try {
            ProcessDAO d = null;
View Full Code Here

    this.isRoot = true;
    this.isAlive = true;
    this.version = 0;

    Context cx = Context.enter();
    cx.setClassShutter(new ScriptusClassShutter());
    cx.setOptimizationLevel(-1); // must use interpreter mode
   
    try {

      ScriptusAPI scriptusApi = new ScriptusAPI(config);
View Full Code Here

        LOG.debug("starting new script");

        Context cx = Context.enter();
        cx.putThreadLocal("process", this);
        cx.setClassShutter(new ScriptusClassShutter());

        globalScope.put("args", globalScope, Context.javaToJS(args, globalScope));
        globalScope.put("owner", globalScope, Context.javaToJS(owner, globalScope));

        try {
          // running for first time
          result = cx.callFunctionWithContinuations(compiled, globalScope, new Object[0]);
        } finally {
          Context.exit();

        }

      } else {

        LOG.debug("continuing existing script " + getPid().toString().substring(30));

        if (state instanceof ConvertsToScriptable) {
          state = ((ConvertsToScriptable) state).toScriptable();
        }

        Context cx = Context.enter();
        cx.setClassShutter(new ScriptusClassShutter());
        cx.putThreadLocal("process", this);
        try {
//            if(state != null) {
//                      System.out.println("state class="+state.getClass());
//            }
View Full Code Here

    }
 
   
  public void test_dummyTransport() throws IOException {
     
      DummyTransport dummy = (DummyTransport) appContext.getBean("dummyTransport");
     
        assertEquals("straight text replacement", "ACK", dummy.getResponse("SYN"));
        assertEquals("regexp replacement", "CAT", dummy.getResponse("DIG"));
        assertEquals("variable replacement", "I have 1024 dogs", dummy.getResponse("I have 1024 cats"));
     
  }
View Full Code Here

        assertEquals("1 correlation", 1, ccc.size());

        assertEquals("correct pid registered", ccc.iterator().next().getPid(), ccc.iterator().next().getPid());
        assertEquals("correct user registered", "ianso", ccc.iterator().next().getFrom());

        Tweet t = new Tweet(123, "reply", "ianso", Long.parseLong(StringUtils.remove(tweetId.get(), "tweet:")));

        clientMock.getMentions().add(t);
       
        //should find & process the reply
        twitter.checkMessages();
View Full Code Here

        assertEquals("1 correlation", 1, ccc.size());

        assertEquals("correct pid registered", ccc.iterator().next().getPid(), ccc.iterator().next().getPid());
        assertEquals("correct user registered", null, ccc.iterator().next().getFrom());

        Tweet t = new Tweet(123, "reply", "ianso");

        clientMock.getMentions().add(t);
       
        //should find & process the reply
        twitter.checkMessages();
View Full Code Here

TOP

Related Classes of net.ex337.scriptus.model.support.ScriptusClassShutter

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.