Package net.ex337.scriptus.model.api

Examples of net.ex337.scriptus.model.api.ScriptusAPI


 
  public void testProcessListItem() {
     
      String uid = UUID.randomUUID().toString();
     
      ScriptProcess p = datastore.newProcess(uid, "addTwoNumbers.js", false, "aarfgs", uid, TransportType.Dummy);
      p.setSource("");
      datastore.writeProcess(p);
     
      List<ProcessListItem> i = datastore.getProcessesForUser(uid);
     
      assertEquals("good size", 1, i.size());
     
      ProcessListItem l = i.get(0);
     
      assertEquals("good pid", p.getPid(), l.getPid());
      assertEquals("uid", uid, l.getUid());
  }
View Full Code Here


 
 
    public void test_return() throws IOException {
       
        ScriptProcess p = datastore.newProcess(TEST_USER, "return.js", false, "", "owner", TransportType.Dummy);
       
        p.save();
       
        ScriptAction r = p.call();
       
        assertTrue("Correct result", r instanceof NormalTermination);
       
        NormalTermination n = (NormalTermination) r;
View Full Code Here

       
    }

    public void test_returnArgs() throws IOException {
       
        ScriptProcess p = datastore.newProcess(TEST_USER, "returnArgs.js", false, "aaarghs", "owner", TransportType.Dummy);
       
        p.save();
       
        p = datastore.getProcess(p.getPid());
       
        ScriptAction r = p.call();
       
        assertTrue("Correct result", r instanceof NormalTermination);
       
        NormalTermination n = (NormalTermination) r;
View Full Code Here

       
    }

  public void test_log() throws IOException {
   
    ScriptProcess p = datastore.newProcess(TEST_USER, "log.js", false, "", "owner", TransportType.Dummy);
   
    p.save();
   
    ScriptAction r = p.call();
   
    assertTrue("Correct result", r instanceof NormalTermination);
   
    NormalTermination n = (NormalTermination) r;
View Full Code Here

   *
   * @throws IOException
   */
  public void test_prototypes() throws IOException {
   
    ScriptProcess p = datastore.newProcess(TEST_USER, "prototypes.js", false, "", "owner", TransportType.Dummy);
   
    ScriptAction r = p.call();
   
    assertTrue("Correct result", r instanceof Say);
   
    p.save();

    r.visit(new ScriptusFacade(datastore, c, m, conf) {

        @Override
      public void execute(UUID pid) {
        ScriptProcess pp = datastore.getProcess(pid);
        ScriptAction rr = pp.call();
                assertEquals("final result", NormalTermination.class, rr.getClass());
                assertEquals("final result value OK", "foo", ((NormalTermination)rr).getResult());
      }
     
    }, p);
View Full Code Here

  }

  public void test_syntaxError() throws IOException {
   
    ScriptProcess p = datastore.newProcess(TEST_USER, "syntaxError.js", false, "", "owner", TransportType.Dummy);
   
    ScriptAction r = p.call();

    assertTrue("Error termination", r instanceof ErrorTermination);
   
  }
View Full Code Here

   
  }

  public void test_throwException() throws IOException {
   
    ScriptProcess p = datastore.newProcess(TEST_USER, "throw.js", false, "", "owner", TransportType.Dummy);
   
    ScriptAction r = p.call();

    assertTrue("Error termination", r instanceof ErrorTermination);
   
  }
View Full Code Here

  }
 
 
  public void test_fiddleWithAPI() throws IOException {
   
    ScriptProcess p = datastore.newProcess(TEST_USER, "fiddle.js", false, "", "owner", TransportType.Dummy);
   
    ScriptAction r = p.call();
   
    assertTrue("Didn't fork correctly", ! (r instanceof Fork));
  }
View Full Code Here

    assertTrue("Didn't fork correctly", ! (r instanceof Fork));
  }

  public void test_fiddleWithAPI2() throws IOException {
   
    ScriptProcess p = datastore.newProcess(TEST_USER, "fiddle2.js", false, "", "owner", TransportType.Dummy);
   
    ScriptAction r = p.call();
   
    assertTrue("error condition", r instanceof ErrorTermination);
   
  }
View Full Code Here

  }

 
  public void test_fork() throws IOException {
   
    ScriptProcess p = datastore.newProcess(TEST_USER, "fork.js", false, "", "owner", TransportType.Dummy);
   
    ScriptAction r = p.call();
   
    assertTrue("Forked correctly", r instanceof Fork);
   
    r.visit(new ScriptusFacade(datastore, c, m, conf), p);
View Full Code Here

TOP

Related Classes of net.ex337.scriptus.model.api.ScriptusAPI

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.