Exemplo n.º 1
0
  @Test
  public void shouldUpdateRunnerWithStatusDone() {
    when(runner.getStatus()).thenReturn(Runner.Status.DONE);
    when(css.blueColor()).thenReturn(TEXT);

    runnerWidget.update(runner);

    verify(css).greenColor();

    shouldUpdateItemWidgetParameter();
  }
Exemplo n.º 2
0
  @Test
  public void shouldUpdateRunnerWithStatusTimeOut() {
    when(runner.getStatus()).thenReturn(Runner.Status.TIMEOUT);
    when(css.blueColor()).thenReturn(TEXT);

    runnerWidget.update(runner);

    verify(css).whiteColor();

    shouldUpdateItemWidgetParameter();
  }
Exemplo n.º 3
0
  @Test
  public void shouldUpdateRunnerWithStatusStopped() {
    when(runner.getStatus()).thenReturn(Runner.Status.STOPPED);
    when(css.blueColor()).thenReturn(TEXT);

    runnerWidget.update(runner);

    verify(css).redColor();

    shouldUpdateItemWidgetParameter();
  }
Exemplo n.º 4
0
  @Test
  public void shouldUpdateRunnerWithStatusInProgress() {
    when(runner.getStatus()).thenReturn(IN_PROGRESS);
    when(css.blueColor()).thenReturn(TEXT);

    runnerWidget.update(runner);

    verify(css).blueColor();

    shouldUpdateItemWidgetParameter();
  }
Exemplo n.º 5
0
  @Test
  public void shouldUpdateRunnerWithStatusQueue() {
    when(runner.getStatus()).thenReturn(Runner.Status.IN_QUEUE);
    when(css.blueColor()).thenReturn(TEXT);

    runnerWidget.update(runner);

    verify(css).yellowColor();

    shouldUpdateItemWidgetParameter();
  }
Exemplo n.º 6
0
  @Test
  public void clickEventShouldBePerformedWhenRunnerStatusIsNotFailedOrStopped() throws Exception {
    when(runner.getStatus()).thenReturn(DONE);
    runnerWidget.update(runner);
    reset(itemWidget);

    verify(imagePanel).addDomHandler(clickCaptor.capture(), eq(ClickEvent.getType()));

    clickCaptor.getValue().onClick(clickEvent);

    verify(delegate, never()).removeRunnerWidget(runner);
  }
Exemplo n.º 7
0
  @Test
  public void onMouseOutEventShouldBePerformed() throws Exception {
    when(runner.getStatus()).thenReturn(IN_PROGRESS);
    runnerWidget.update(runner);
    reset(itemWidget);

    verify(imagePanel).addDomHandler(mouseOutCaptor.capture(), eq(MouseOutEvent.getType()));

    mouseOutCaptor.getValue().onMouseOut(mouseOutEvent);

    verify(itemWidget).setImage(any(SVGImage.class));
  }
Exemplo n.º 8
0
  @Test
  public void imageShouldNotBeSetWhenStatusIsNotFailedOrStopped() throws Exception {
    when(runner.getStatus()).thenReturn(DONE);

    runnerWidget.update(runner);
    reset(itemWidget);

    verify(imagePanel).addDomHandler(mouseOverCaptor.capture(), eq(MouseOverEvent.getType()));

    mouseOverCaptor.getValue().onMouseOver(mouseOverEvent);

    verify(itemWidget, never()).setImage(any(SVGImage.class));
  }
 private void changeURLDependingOnState(@NotNull Runner runner) {
   switch (runner.getStatus()) {
     case IN_PROGRESS:
       view.setApplicationURl(locale.uplAppWaitingForBoot());
       break;
     case IN_QUEUE:
       view.setApplicationURl(locale.uplAppWaitingForBoot());
       break;
     case STOPPED:
       view.setApplicationURl(locale.urlAppRunnerStopped());
       break;
     case FAILED:
       view.setApplicationURl(null);
       break;
     default:
       String url = runner.getApplicationURL();
       view.setApplicationURl(url == null ? locale.urlAppRunning() : url);
       setDebugPort(runner);
   }
 }
Exemplo n.º 10
0
  @Test
  public void clickEventShouldBePerformedWhenRunnerStatusIsStopped() throws Exception {
    when(runner.getStatus()).thenReturn(STOPPED);

    verifyClickEvent();
  }
Exemplo n.º 11
0
  @Test
  public void onMouseOverEventShouldBePerformedWhenRunnerStatusIsFailed() throws Exception {
    when(runner.getStatus()).thenReturn(FAILED);

    verifyMouseOverEvent();
  }