Package net.ex337.scriptus.tests

Examples of net.ex337.scriptus.tests.JsTest


   
    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);
   
View Full Code Here


   
    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);
   
View Full Code Here

   
    ScriptAction r = p.call();
   
    assertTrue("slept correctly", r instanceof Sleep);

    Sleep s = (Sleep)r;
   
    Calendar target = Calendar.getInstance();
    target.add(Calendar.YEAR, 1);
    target.add(Calendar.MONTH, 2);
    target.add(Calendar.DATE, 3);
    target.add(Calendar.HOUR, 4);
   
    Calendar c = s.getUntil();
   
    assertEquals("good year", target.get(Calendar.YEAR), c.get(Calendar.YEAR));
    assertEquals("good month", target.get(Calendar.MONTH), c.get(Calendar.MONTH));
    assertEquals("good day", target.get(Calendar.DATE), c.get(Calendar.DATE));
    assertEquals("good hour", target.get(Calendar.HOUR), c.get(Calendar.HOUR));
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

       
        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

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

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.