Package net.ex337.scriptus

Examples of net.ex337.scriptus.ScriptusFacade


    assertTrue("Broken", r instanceof ErrorTermination);
  }

  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


//    ((DummyTransport)m).defaultResponse = "response";
//  }

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

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

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

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

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

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

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

    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

 
  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

    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

TOP

Related Classes of net.ex337.scriptus.ScriptusFacade

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.