Package net.ex337.scriptus.model

Examples of net.ex337.scriptus.model.MessageCorrelation


public class Testcase_BootSpring extends BaseTestCase {

 
  public void test_doNothing() throws IOException {
    ScriptusDatastore datastore = (ScriptusDatastore) appContext.getBean("datastore");
  }
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

        em.persist(d);
    }

    private MessageCorrelation toMessageCorrelation(MessageCorrelationDAO dao) {
        MessageCorrelation r = new MessageCorrelation();
        r.setPid(UUID.fromString(dao.pid));
        r.setFrom(dao.from);
        r.setMessageId(dao.messageId);
        r.setTimestamp(dao.timestamp);
        r.setTransport(TransportType.valueOf(dao.transport));
        r.setUserId(dao.userId);
        return r;

    }
View Full Code Here

    scriptus.scheduleTask(new Wake(process.getPid(), nonce, timeout.getTimeInMillis()));

    String messageId = scriptus.send(process.getUserId(), process.getTransport(), getWho(), getMsg());
   
        scriptus.registerMessageCorrelation(new MessageCorrelation(process.getPid(), getWho(), messageId, System.currentTimeMillis(), process.getTransport(), process.getUserId()));
   
  }
View Full Code Here

    scriptus.updateProcessState(process.getPid(), this);

    scriptus.scheduleTask(new Wake(process.getPid(), nonce, timeout.getTimeInMillis()));
   
    //who and messageId can both be null
        scriptus.registerMessageCorrelation(new MessageCorrelation(process.getPid(), getWho(), getMessageId(), System.currentTimeMillis(), process.getTransport(), process.getUserId()));

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

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.