@Override public ComponentItem getComponentByLabel(@Nonnull String label) { for (ComponentItem component : componentList.getItems()) if (component.getLabel().equals(label)) return component; return null; }
@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); }
@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")); }
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()); }
@Override public Future<BaseEvent> apply(ComponentItem component) { EventFuture<BaseEvent> busyEventFuture = EventFuture.forKey(component, ComponentItem.BUSY); return component.isBusy() ? busyEventFuture : Futures.<BaseEvent>immediateFuture(null); }
@Override public void cancelComponents() { for (ComponentItem component : getComponents()) if (component.isBusy()) component.triggerAction(ComponentItem.CANCEL_ACTION); }
private double getRate(ComponentItem cItem) { return Double.parseDouble(cItem.getProperty("rate").getStringValue()); }