public SessionId newSession(Capabilities desiredCapabilities) throws Exception {
    SessionId sessionId = new SessionId(UUID.randomUUID().toString());
    Session session = DefaultSession.createSession(factory, clock, sessionId, desiredCapabilities);

    sessionIdToDriver.put(sessionId, session);

    return sessionId;
  }
예제 #2
0
  @Test
  public void testNoCancel() {
    Description pd = getSellerProtocol();

    // Create Protocol Monitor
    ProtocolMonitor monitor = new DefaultProtocolMonitor();

    DefaultMonitorContext context = new DefaultMonitorContext();

    DefaultSession conv = new DefaultSession();
    monitor.initialize(context, pd, conv);

    DefaultMessage message = new DefaultMessage();
    message.getTypes().add(ORDER_MESSAGE_TYPE);

    if (monitor.messageReceived(context, pd, conv, null, message).isValid() == false) {
      fail("Order failed");
    }

    message = new DefaultMessage();
    message.getTypes().add(CONFIRMATION_MESSAGE_TYPE);

    if (monitor.messageSent(context, pd, conv, null, message).isValid() == false) {
      fail("Confirmation failed");
    }

    message = new DefaultMessage();
    message.getTypes().add(FINISH_MESSAGE_TYPE);

    if (monitor.messageReceived(context, pd, conv, null, message).isValid() == false) {
      fail("Finish message failed");
    }

    if (conv.isFinished() == false) {
      fail("Conversation should be finished");
    }
  }