Package org.jbehave.core.threaded

Examples of org.jbehave.core.threaded.QueuedMiniHashMap


    public static final long DEFAULT_WINDOW_TIMEOUT = 30000;
    private QueuedMiniMap miniMap;
    private AWTEventListener windowWatcher = new WindowWatcher();
   
    public WindowGrabber() {
      this(new QueuedMiniHashMap());
    }
View Full Code Here


public class QueuedMiniHashMapBehaviour extends UsingMiniMock {
   
  private PseudoClock clock = new PseudoClock();
 
    public void shouldReturnExistingObjectMatchingKey() throws TimeoutException {
        QueuedMiniHashMap queuedMiniMap = new QueuedMiniHashMap(new ClockedTimeouterFactory(clock));
       
        queuedMiniMap.put("F", "Frodo");
        ensureThat(queuedMiniMap.get("F", 100), eq("Frodo"));
    }
View Full Code Here

        queuedMiniMap.put("F", "Frodo");
        ensureThat(queuedMiniMap.get("F", 100), eq("Frodo"));
    }
   
    public void shouldReturnObjectMatchingKeyWhenAddedLater() {
        final QueuedMiniHashMap queuedMiniMap = new QueuedMiniHashMap(new ClockedTimeouterFactory(clock));
        final ObjectHolder objectHolder = new ObjectHolder();
       
    Thread threadForGetToRun = new Thread(new Runnable() {
      public void run() {
        try {
          objectHolder.object = queuedMiniMap.get("F", 100);
        } catch (TimeoutException e) { }
        synchronized(QueuedMiniHashMapBehaviour.this) {
          QueuedMiniHashMapBehaviour.this.notifyAll();
        }
      }
    });
   
    threadForGetToRun.start();
   
    // Add an item to the map. Wait until all objects verified
    // before ending the test.
    synchronized (this) {
      // Wait for a short while, just to be sure that the getThread is running and
      // waiting on the item (otherwise this test passes anyway, bizarrely)
      try {
          wait(200);
      } catch (InterruptedException e) {};
       
      queuedMiniMap.put("F", "Frodo");
      try {
        while (threadForGetToRun.isAlive()) { wait(200); }
      } catch (InterruptedException e) {}
    }
    ensureThat(objectHolder.object, eq("Frodo"));
View Full Code Here

    ensureThat(objectHolder.object, eq("Frodo"));
    }
   
    public void shouldTimeoutIfTooLate() {
        final ObjectHolder objectHolder = new ObjectHolder();
        final QueuedMiniHashMap queuedMiniMap =
          new QueuedMiniHashMap(new ClockedTimeouterFactory(clock));
       
    Thread threadForGetToRun = new Thread(new Runnable() {
      public void run() {
        try  {
          queuedMiniMap.get("F", 100);
        } catch (TimeoutException e) {
          objectHolder.object = e;
        }
        synchronized(QueuedMiniHashMapBehaviour.this) {
          QueuedMiniHashMapBehaviour.this.notifyAll();
View Full Code Here

TOP

Related Classes of org.jbehave.core.threaded.QueuedMiniHashMap

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.