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

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


  public void test_eval() throws IOException {
   
    ScriptProcess p = datastore.newProcess(TEST_USER, "eval.js", false, "", "owner", TransportType.Dummy);
   
    ScriptAction r = p.call();
   
    assertTrue("Listened correctly", r instanceof Listen);

    p.save();

    r.visit(new ScriptusFacade(datastore, c, m, conf), p);
  }
View Full Code Here


   
    ScriptProcess p = datastore.newProcess(TEST_USER, "breakSec.js", false, "", "owner", TransportType.Dummy);
   
    p.save();
   
    ScriptAction r = p.call();
   
    assertTrue("Failed correctly", r instanceof ErrorTermination);
   
    System.out.println(((ErrorTermination)r).getError());
   
    r.visit(new ScriptusFacade(datastore, c, m, conf), p);
  }
View Full Code Here

   
    ScriptProcess p = datastore.newProcess(TEST_USER, "breakSec2.js", false, "", "owner", TransportType.Dummy);

    p.save();

    ScriptAction r = p.call();
   
    assertTrue("Failed correctly", r instanceof ErrorTermination);
   
    System.out.println(((ErrorTermination)r).getError());
   
    r.visit(new ScriptusFacade(datastore, c, m, conf), p);
  }
View Full Code Here

   
    ScriptProcess p = datastore.newProcess(TEST_USER, "breakSec3.js", false, "", "owner", TransportType.Dummy);
   
        p.save();
       
    ScriptAction r = p.call();
   
    assertTrue("Failed correctly", r instanceof ErrorTermination);
   
    System.out.println(((ErrorTermination)r).getError());
   
    r.visit(new ScriptusFacade(datastore, c, m, conf), p);
  }
View Full Code Here

   
    ScriptProcess p = datastore.newProcess(TEST_USER, "breakSec4.js", false, "", "owner", TransportType.Dummy);
   
        p.save();
       
    ScriptAction r = p.call();
   
    assertEquals("Failed correctly", ErrorTermination.class, r.getClass());
   
    System.out.println(((ErrorTermination)r).getError());
   
    r.visit(new ScriptusFacade(datastore, c, m, conf), p);
  }
View Full Code Here

    ScriptProcess p = datastore.newProcess(TEST_USER, "breakSec5.js", false, "", "owner", TransportType.Dummy);
   
        p.save();
       
       
    ScriptAction r = p.call();
   
    assertEquals("Failed correctly", ErrorTermination.class, r.getClass());
           
    System.out.println(((ErrorTermination)r).getError());
   
    r.visit(new ScriptusFacade(datastore, c, m, conf), p);
  }
View Full Code Here

    public void test_ask() throws IOException {

        ScriptProcess p = datastore.newProcess(TEST_USER, "ask.js", false, "", "owner", TransportType.Twitter);

        ScriptAction r = p.call();

        assertTrue("Asked correctly", r instanceof Ask);
        assertTrue("Asked correctly foo", ((Ask) r).getWho().equals("ianso"));

        p.save();

        final ThreadLocal<String> tweetId = new ThreadLocal<String>();

        ScriptusFacade f = new ScriptusFacade(datastore, c, m, config) {

            @Override
            public void registerMessageCorrelation(MessageCorrelation cid) {
                tweetId.set(cid.getMessageId());
                super.registerMessageCorrelation(cid);
            }

        };

        r.visit(f, p); // sould say

        Set<MessageCorrelation> ccc = datastore.getMessageCorrelations(tweetId.get(), "ianso", TEST_USER, TransportType.Twitter);

        assertEquals("1 correlation", 1, ccc.size());
View Full Code Here

    public void test_listen() throws IOException {

        ScriptProcess p = datastore.newProcess(TEST_USER, "listen.js", false, "", "owner", TransportType.Twitter);

        ScriptAction r = p.call();

        assertTrue("listened correctly", r instanceof Listen);
        assertTrue("listened correctly to no-one", ((Listen) r).getWho() == null);

        p.save();

//        final ThreadLocal<String> tweetId = new ThreadLocal<String>();

        ScriptusFacade f = new ScriptusFacade(datastore, c, m, config) {

            @Override
            public void registerMessageCorrelation(MessageCorrelation cid) {
//                tweetId.set(cid.getMessageId());
                super.registerMessageCorrelation(cid);
            }

        };

        r.visit(f, p); // sould say

        Set<MessageCorrelation> ccc = datastore.getMessageCorrelations(null, "ianso", TEST_USER, TransportType.Twitter);

        assertEquals("1 correlation", 1, ccc.size());
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();
View Full Code Here

    datastore.createSamples();
   
  }

  public void test_lifecycle() throws IOException {
    ScriptProcess newp = datastore.newProcess("test", "addTwoNumbers.js", true, "", "", TransportType.Dummy);
    newp.setArgs("foo bar");
   
    newp.save();
   
    ScriptProcess saved = datastore.getProcess(newp.getPid());
   
    assertEquals("pid same", newp.getPid(), saved.getPid());
   
    assertEquals("args same", newp.getArgs(), saved.getArgs());

        assertTrue("count processes", datastore.countRunningProcesses("test") >= 1);

  }
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.