Package net.ex337.scriptus.tests

Examples of net.ex337.scriptus.tests.JsTest


    r.visit(new ScriptusFacade(datastore, c, m, conf), p);
  }

  public void test_breakSecurity5() throws IOException {
   
    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());
   
View Full Code Here


    protected void tearDown() throws Exception {
    }

    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) {
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) {
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);
   
    System.out.println(((Say)r).getMsg());
   
View Full Code Here

 
  public void testAccessTokens() {
     
      String uid = UUID.randomUUID().toString();

      TransportAccessToken t = new TransportAccessToken(uid, TransportType.Dummy, "accessToken"+uid, "accessSecret"+uid);
     
      datastore.saveTransportAccessToken(t);
     
      assertTrue("found new token", datastore.getInstalledTransports(uid).contains(TransportType.Dummy));
     
      datastore.deleteTransportAccessToken(uid, TransportType.Dummy);

      assertFalse("deleted new token", datastore.getInstalledTransports(uid).contains(TransportType.Dummy));

        datastore.saveTransportAccessToken(t);
       
        TransportAccessToken tt = datastore.getAccessToken(uid, TransportType.Dummy);
       
        assertEquals("access secret OK", t.getAccessSecret(), tt.getAccessSecret());
        assertEquals("access token OK", t.getAccessToken(), tt.getAccessToken());
       
  }
View Full Code Here

  public void testSay() throws TwitterException {
     
        String accessToken = "";
        String accessSecret = "";
       
        TransportAccessToken t = null;
        try{
            t = datastore.getAccessToken("userid", TransportType.Twitter);
        } catch(Exception e) {
            ;//do nothing
        }
       
        if(t == null) {
            datastore.saveTransportAccessToken(new TransportAccessToken("userid", TransportType.Twitter, accessToken, accessSecret));
        }
   
    i.send("userid", "robotoscriptu", "098765231");
   
    assertTrue(true);
View Full Code Here

        // ((DummyTransport)m).response = "response";
       
        twitter = (TwitterTransportImpl) appContext.getBean("twitterTransport");
       
        try{
            TransportAccessToken c = datastore.getAccessToken(TEST_USER, TransportType.Twitter);
        } catch(Exception e) {
            datastore.saveTransportAccessToken(new TransportAccessToken(TEST_USER, TransportType.Twitter, "token", "secret"));
        }
       

    }
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

   
    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

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.