Package net.ex337.scriptus.datastore.impl.jpa.dao

Examples of net.ex337.scriptus.datastore.impl.jpa.dao.LogMessageDAO


  }

  public void test_scheduleTask() throws IOException {
   
    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;
   
    for(ScheduledScriptAction t : actions){
      if(t.equals(w)) {
View Full Code Here


public class Testcase_BootSpring extends BaseTestCase {

 
  public void test_doNothing() throws IOException {
    ScriptusDatastore datastore = (ScriptusDatastore) appContext.getBean("datastore");
  }
View Full Code Here

    @Override
    @Transactional(readOnly = false)
    public void saveLogMessage(UUID pid, String userId, String message) {
       
        LogMessageDAO i = new LogMessageDAO();
        i.message = message;
        i.created = System.currentTimeMillis();
        i.pid = pid.toString();
        i.id = new LogMessageDAOId();
        i.id.id = UUID.randomUUID().toString();
View Full Code Here

    @Transactional(readOnly = false)
    public void deleteLogMessage(String logId, String openid) {
       
        LogMessageDAOId i = new LogMessageDAOId(logId, openid);
       
        LogMessageDAO d = em.find(LogMessageDAO.class, i);
       
        //FIXME use delete query
       
        if(d != null){
            em.remove(d);
View Full Code Here

       
        String uid = UUID.randomUUID().toString();
        String msg = UUID.randomUUID().toString();
        String parent = UUID.randomUUID().toString();
       
        PersonalTransportMessageDAO m = new PersonalTransportMessageDAO();
        m.userId = uid;
        m.parent = parent;
        m.message = msg;
        m.from="from";
       
View Full Code Here

//      System.out.println(ss.exec(cx, globalScope));
     
//      System.out.println(cx.evaluateString(globalScope, "scriptus.foo();", "<test>", 1, null));
     
    } catch (Exception e) {
      throw new ScriptusRuntimeException(e);
    } finally {
      Context.exit();
    }
   
  }
View Full Code Here

   
    String c = "tweet:"+Math.abs(r.nextInt());
        String f = "from:"+Math.abs(r.nextInt());
        String u = "user:"+Math.abs(r.nextInt());
   
    MessageCorrelation m = new MessageCorrelation(UUID.randomUUID(), f, c, System.currentTimeMillis(), TransportType.Dummy, u);
   
    datastore.registerMessageCorrelation(m);

    Set<MessageCorrelation> cc = datastore.getMessageCorrelations(c, f, u, TransportType.Dummy);
   
    assertTrue("correct pid returned", cc.contains(m));
   
    datastore.unregisterMessageCorrelation(m);
   
    assertTrue("nothing left", ! datastore.getMessageCorrelations(c, f, u, TransportType.Dummy).contains(m));

    //listen({to:"user", messageId:"foo"})
        MessageCorrelation both      = new MessageCorrelation(UUID.randomUUID(), f,    c,    System.currentTimeMillis(), TransportType.Dummy, u);
        //listen({to:"user"})
        MessageCorrelation byuser    = new MessageCorrelation(UUID.randomUUID(), f,    null, System.currentTimeMillis(), TransportType.Dummy, u);
        //listen({messageId:"foo"})
        MessageCorrelation messageId = new MessageCorrelation(UUID.randomUUID(), null, c,    System.currentTimeMillis(), TransportType.Dummy, u);
        //listen()
        MessageCorrelation byNull    = new MessageCorrelation(UUID.randomUUID(), null, null, System.currentTimeMillis(), TransportType.Dummy, u);

        MessageCorrelation byNullOtheruser    = new MessageCorrelation(UUID.randomUUID(), null, null, System.currentTimeMillis(), TransportType.Dummy, u+r.nextInt());

        datastore.registerMessageCorrelation(both);
        datastore.registerMessageCorrelation(byuser);
        datastore.registerMessageCorrelation(messageId);
        datastore.registerMessageCorrelation(byNull);
View Full Code Here

     
        String tt = UUID.randomUUID().toString();
        String u1 = UUID.randomUUID().toString();
        String u2 = UUID.randomUUID().toString();
     
      MessageCorrelation d1 = new MessageCorrelation(
              UUID.randomUUID(),
              "from1", "mid1", System.currentTimeMillis(), TransportType.Dummy, u1);

      datastore.registerMessageCorrelation(d1);

        MessageCorrelation d2 = new MessageCorrelation(
                UUID.randomUUID(),
                "from2", "mid2", System.currentTimeMillis(), TransportType.Dummy, u2);

        datastore.registerMessageCorrelation(d2);
       
        MessageCorrelation d3 = new MessageCorrelation(
                UUID.randomUUID(),
                "from3", "mid3", System.currentTimeMillis(), TransportType.Dummy, u2);

        datastore.registerMessageCorrelation(d3);
       
View Full Code Here

     
      List<ProcessListItem> i = datastore.getProcessesForUser(uid);
     
      assertEquals("good size", 1, i.size());
     
      ProcessListItem l = i.get(0);
     
      assertEquals("good pid", p.getPid(), l.getPid());
      assertEquals("uid", uid, l.getUid());
  }
View Full Code Here

  public void test_sleepBadDate() throws IOException {
   
    ScriptProcess p = datastore.newProcess(TEST_USER, "sleepBadDate.js", false, "", "owner", TransportType.Dummy);
   
    ScriptAction r = p.call();
   
    assertTrue("Forked correctly", r instanceof ErrorTermination);

  }
View Full Code Here

TOP

Related Classes of net.ex337.scriptus.datastore.impl.jpa.dao.LogMessageDAO

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.