Package org.openqa.selenium.testworker

Examples of org.openqa.selenium.testworker.TrackableThread


        assertEquals(testCommand, queue.pollToGetContentUntilTimeout());
        assertNull(queue.peek());
    }

    public void testCanGetResultPostedByTheMainThreadFromAnotherThread() throws Throwable {
        final TrackableThread getter;

        /*
         * Note that you can't do listener first in the same thread
         */
        getter = new TrackableThread(new AsyncCommandGetter(), "launching getter");
        getter.start();
        assertTrue(queue.putContent(testCommand));
        assertEquals(testCommand, getter.getResult());
        assertNull(queue.peek());
    }
View Full Code Here


        assertEquals(testCommand, getter.getResult());
        assertNull(queue.peek());
    }

    public void testCanPutAndGetResultsFromDifferentThreads() throws Throwable {
        final TrackableThread firstGetter;
        final TrackableThread secondGetter;

        new TrackableThread(new AsyncCommandSender(testCommand), "launching sender").start();
        firstGetter = new TrackableThread(new AsyncCommandGetter(), "launching firstGetter");
        firstGetter.start();
        assertEquals(testCommand, firstGetter.getResult());

        assertTrue(queue.putContent(completeCommand));
        secondGetter = new TrackableThread(new AsyncCommandGetter(), "launching firstGetter");
        secondGetter.start();
        assertEquals(completeCommand, secondGetter.getResult());
    }
View Full Code Here

        assertEquals(completeCommand, secondGetter.getResult());
    }

    public void testPollReturnsPoisonOncePoisonedAndPoisonPollersIsCalled() throws Throwable {
        queue.setPoison(poisonString);       
        TrackableThread getter = new TrackableThread(new AsyncCommandGetter(), "launching getter");
        getter.start();
        assertTrue(queue.poisonPollers());
        assertEquals(poisonString, getter.getResult());
    }
View Full Code Here

                cq.doCommandWithoutWaitingForAResponse(testCommand, "", "");
                return null;
            }
        };
        String name = "launching runner";
        TrackableThread t = new TrackableThread(internalRunner, name);
        t.start();
        t.getResult();
        assertsForCommandState(cq.getNextCommand());
    }
View Full Code Here

        cq.handleCommandResultWithoutWaitingForACommand("OK");
        expectResult("OK");
    }

    public void testRealSimple() throws Throwable {
        TrackableThread commandRunner = launchCommandRunner("something", "arg1", "arg2");
        expectCommand("something", "arg1", "arg2");
        cq.handleCommandResultWithoutWaitingForACommand("OK");
        assertEquals("OK", commandRunner.getResult());
    }
View Full Code Here

        expectResult("OK");
    }

    public void testRealTwoRounds() throws Throwable {
        // do "something"
        TrackableThread commandRunner = launchCommandRunner("something", "arg1", "arg2");
        // browser receives "something"
        TrackableThread browserRequestRunner = launchBrowserResultRunner(null);
        expectCommand(browserRequestRunner, "something", "arg1", "arg2");
        // browser replies "OK"
        browserRequestRunner = launchBrowserResultRunner("OK");
        // commandRunner receives "OK"
        assertEquals("OK", commandRunner.getResult());
View Full Code Here

    /**
     * Fire off a command in the background, so we can wait for the result
     */
    private TrackableThread launchCommandRunner(String cmd, String arg1, String arg2) {
        TrackableThread t = new TrackableThread(new AsyncCommandRunner(cmd, arg1, arg2), cmd);
        t.start();
        return t;
    }
View Full Code Here

    private TrackableThread launchBrowserResultRunner(String browserResult) {
        String name = browserResult;
        if (name == null) {
            name = "NULL STARTING";
        }
        TrackableThread t = new TrackableThread(new AsyncBrowserResultRunner(browserResult), name);
        t.start();
        return t;
    }
View Full Code Here

                log.debug(Thread.currentThread().getName() + " got result: " + result);
                return result;
            }
        };
        String name = "launching getter";
        TrackableThread t = new TrackableThread(internalGetter, name);
        t.start();
        holder.poisonPollers();
        assertNull(t.getResult());
    }
View Full Code Here

          log.debug(Thread.currentThread().getName() + " got result: " + result);
          return result;
    }
  };
  String name = "launching getter";
    TrackableThread t = new TrackableThread(internalGetter, name);
    t.start();
    holder.poisonPollers();
    assertEquals(CommandResultHolder.CMD_NULL_RESULT_MSG,
           t.getResult());
  }
View Full Code Here

TOP

Related Classes of org.openqa.selenium.testworker.TrackableThread

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.