示例#1
0
  @Override
  public ComponentItem getComponentByLabel(@Nonnull String label) {
    for (ComponentItem component : componentList.getItems())
      if (component.getLabel().equals(label)) return component;

    return null;
  }
示例#2
0
  @Override
  public void appendToSummary(MutableSummary mutableSummary) {
    MutableChapterImpl chap = (MutableChapterImpl) mutableSummary.addChapter(sceneItem.getLabel());
    chap.addSection(new TestCaseDataSummarySection(sceneItem, mutableSummary));
    chap.addSection(new TestCaseExecutionDataSection(sceneItem, mutableSummary));
    chap.addSection(new TestCaseExecutionMetricsSection(sceneItem));
    chap.addSection(new TestCaseExecutionNotablesSection(sceneItem));
    chap.addSection(new TestCaseDataSection(sceneItem));
    chap.setDescription(sceneItem.getDescription());

    for (ComponentItem component : sceneItem.getComponents()) component.generateSummary(chap);
  }
示例#3
0
  @Test
  public void shouldHaveCorrectTerminals() {
    assertThat(component.getTerminals().size(), is(2));

    InputTerminal incoming =
        (InputTerminal) component.getTerminalByName(OnOffCategory.STATE_TERMINAL);
    assertThat(incoming.getLabel(), is("Component activation"));

    OutputTerminal scheduler =
        (OutputTerminal) component.getTerminalByName(SchedulerCategory.OUTGOING_TERMINAL);
    assertThat(scheduler.getLabel(), is("Scheduling Terminal"));
  }
示例#4
0
 private void waitForComponentsToComplete() {
   for (Future<BaseEvent> future : Iterables.transform(getComponents(), busyComponentFuture)) {
     try {
       future.get(1, TimeUnit.MINUTES);
     } catch (InterruptedException | ExecutionException | TimeoutException e) {
       log.error("Failed waiting for a Component to complete", e);
     }
   }
   for (ComponentItem component : getComponents()) {
     component.setBusy(false);
   }
   log.debug("All components completed in canvas {}", getLabel());
 }
示例#5
0
 @Override
 public Future<BaseEvent> apply(ComponentItem component) {
   EventFuture<BaseEvent> busyEventFuture =
       EventFuture.forKey(component, ComponentItem.BUSY);
   return component.isBusy() ? busyEventFuture : Futures.<BaseEvent>immediateFuture(null);
 }
示例#6
0
 @Override
 public void cancelComponents() {
   for (ComponentItem component : getComponents())
     if (component.isBusy()) component.triggerAction(ComponentItem.CANCEL_ACTION);
 }
示例#7
0
 private double getRate(ComponentItem cItem) {
   return Double.parseDouble(cItem.getProperty("rate").getStringValue());
 }