Package net.ex337.scriptus.model.api.functions

Examples of net.ex337.scriptus.model.api.functions.Get


  }
 
  public void test_forkNoPrefix() throws IOException {
   
    ScriptProcess p = datastore.newProcess(TEST_USER, "forkNoPrefix.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


  }
 
  public void test_exit() throws IOException {
   
    ScriptProcess p = datastore.newProcess(TEST_USER, "exit.js", false, "", "owner", TransportType.Dummy);
   
    ScriptAction r = p.call();
   
    assertTrue("Exited correctly", r instanceof NormalTermination);
    assertTrue("correct exit", ((NormalTermination)r).getResult().equals("result"));

  }
View Full Code Here

  }

  public void test_exec() throws IOException {
   
    final ScriptProcess p = datastore.newProcess(TEST_USER, "exec.js", false, "ags", "owner", TransportType.Dummy);
   
    ScriptAction r = p.call();
   
    p.save();
   
    assertTrue("Exec correctly", r instanceof Exec);
    assertEquals("Exec good program", "returnArg.js", ((Exec)r).getScript());
    assertEquals("Exec good args", "arg1 arg2", ((Exec)r).getArgs());
   
    r.visit(new ScriptusFacade(datastore, c, m, conf) {

      @Override
      public void execute(UUID pid) {

        ScriptProcess pp = datastore.getProcess(pid);
       
        assertEquals("good pid", p.getPid(), pid);
        assertEquals("good source", "returnArg.js", pp.getSourceName());
        assertEquals("good args", "arg1 arg2", pp.getArgs());
       
        ScriptAction aa = pp.call();
       
        assertEquals("good class result", NormalTermination.class, aa.getClass());
        assertEquals("goood result", "resultarg1 arg2", ((NormalTermination)aa).getResult());
      }
     
View Full Code Here

    }, p);
  }

  public void test_sleepHour() throws IOException {
   
    ScriptProcess p = datastore.newProcess(TEST_USER, "sleepHour.js", false, "", "owner", TransportType.Dummy);
   
    ScriptAction r = p.call();
   
    assertTrue("slept correctly", r instanceof Sleep);

  }
View Full Code Here

  }

  public void test_getHttp() throws IOException {
   
    ScriptProcess p = datastore.newProcess(TEST_USER, "getHttp.js", false, "", "owner", TransportType.Dummy);
   
    ScriptAction r = p.call();
   
    assertTrue("slept correctly", r instanceof Get);

    p.save();

    Get g = (Get) r;
   
    g.visit(new ScriptusFacade(datastore, c, m, conf), p);
   
    p = datastore.getProcess(p.getPid());
   
    assertTrue("got content", p.getState() instanceof String);
   
    String content = (String) p.getState();
   
    assertTrue("content ok", content.contains("User-agent: *"));
   
  }
 
View Full Code Here

  }


  public void test_evalGet() throws IOException {
   
    ScriptProcess p = datastore.newProcess(TEST_USER, "evalget.js", false, "", "owner", TransportType.Dummy);
   
    ScriptAction r = p.call();
   
    assertTrue("slept correctly", r instanceof Get);

    p.save();

    Get g = (Get) r;
   
    g.visit(new ScriptusFacade(datastore, c, m, conf), p);
   
    p = datastore.getProcess(p.getPid());
   
    assertTrue("got content", p.getState() instanceof String);
   
    r = p.call();
   
    assertTrue("said correctly", r instanceof Say);
   
    assertTrue("contains fn def", ((Say)r).getMsg().contains("return new Date().clearTime();"));
  }
View Full Code Here

  }


  public void test_evalGetBug() throws IOException {
   
    ScriptProcess p = datastore.newProcess(TEST_USER, "evalgetBUG.js", false, "", "owner", TransportType.Dummy);
   
    ScriptAction r = p.call();
   
    assertTrue("slept correctly", r instanceof Get);

    p.save();

    Get g = (Get) r;
   
    g.visit(new ScriptusFacade(datastore, c, m, conf), p);
   
    p = datastore.getProcess(p.getPid());
   
    assertTrue("got content", p.getState() instanceof String);
   
    r = p.call();
   
    assertTrue("said correctly", r instanceof Say);
   
    assertTrue("contains fn def", ((Say)r).getMsg().contains("return new Date().clearTime();"));
  }
View Full Code Here

  }

 
  public void test_getHttps() throws IOException {
   
    ScriptProcess p = datastore.newProcess(TEST_USER, "getHttps.js", false, "", "owner", TransportType.Dummy);
   
    ScriptAction r = p.call();
   
    assertTrue("slept correctly", r instanceof Get);

    p.save();

    Get g = (Get) r;
   
    g.visit(new ScriptusFacade(datastore, c, m, conf), p);
   
    p = datastore.getProcess(p.getPid());
   
    assertTrue("got content", p.getState() instanceof String);
   
    String content = (String) p.getState();
   
    assertTrue("content ok", content.contains("User-agent: *"));

  }
 
View Full Code Here

  }

  public void test_sleepDate() throws IOException {
   
    ScriptProcess p = datastore.newProcess(TEST_USER, "sleepDate.js", false, "", "owner", TransportType.Dummy);
   
    ScriptAction r = p.call();
   
    assertTrue("slept correctly", r instanceof Sleep);

  }
View Full Code Here

  }

  public void test_sleepDateObject() throws IOException {
   
    ScriptProcess p = datastore.newProcess(TEST_USER, "sleepDateObject.js", false, "", "owner", TransportType.Dummy);
   
    ScriptAction r = p.call();
   
    assertTrue("slept correctly", r instanceof Sleep);

  }
View Full Code Here

TOP

Related Classes of net.ex337.scriptus.model.api.functions.Get

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.