use of org.openecard.gui.executor.ExecutionEngine in project open-ecard by ecsec.
the class PinEntryDialog method show.
public ResultStatus show() throws CryptokiException {
UserConsentNavigator ucr = gui.obtainNavigator(createUserConsentDescription());
ExecutionEngine exec = new ExecutionEngine(ucr);
ResultStatus result = exec.process();
return result;
}
use of org.openecard.gui.executor.ExecutionEngine in project open-ecard by ecsec.
the class InsertCardDialog method show.
/**
* Shows this InsertCardDialog dialog.
*
* @return The ConnectionHandle of the inserted card or null if no card was inserted.
*/
public List<ConnectionHandleType> show() {
List<ConnectionHandleType> availableCards = checkAlreadyAvailable();
if (!availableCards.isEmpty()) {
return availableCards;
} else {
InsertCardStepAction insertCardAction = new InsertCardStepAction(STEP_ID, cardStates, cardNameAndType.values());
evDispatcher.add(insertCardAction, EventType.CARD_RECOGNIZED);
UserConsentNavigator ucr = gui.obtainNavigator(createInsertCardUserConsent(insertCardAction));
ExecutionEngine exec = new ExecutionEngine(ucr);
// run gui
ResultStatus status = exec.process();
if (status == ResultStatus.CANCEL) {
return null;
}
evDispatcher.del(insertCardAction);
return insertCardAction.getResponse();
}
}
use of org.openecard.gui.executor.ExecutionEngine in project open-ecard by ecsec.
the class BackgroundTaskTest method testWait.
@Test()
public void testWait() {
UserConsent uc = new SwingUserConsent(new SwingDialogWrapper());
UserConsentDescription ucd = new UserConsentDescription("Test background wait");
Step s = new Step("Wait Step");
s.getInputInfoUnits().add(new Text("Please wait for the background task to complete ..."));
s.setBackgroundTask(new BackgroundTask() {
@Override
public StepActionResult call() throws Exception {
// first wait
Thread.sleep(1000);
// then repeat ;-)
Step replacement = new Step("Replacement Step");
replacement.getInputInfoUnits().add(new Text("Super cool it works."));
replacement.setInstantReturn(true);
return new StepActionResult(StepActionResultStatus.REPEAT, replacement);
}
});
ucd.getSteps().add(s);
ExecutionEngine e = new ExecutionEngine(uc.obtainNavigator(ucd));
e.process();
}
use of org.openecard.gui.executor.ExecutionEngine in project open-ecard by ecsec.
the class InstantReturnTest method testInstantReturn.
// TODO: make Selenium test which really proves, that the GUI works correctly
/**
* Test if the GUI closes itself after executing an action with instantreturn set.
* There is no way to determine whether the GUI is displayed at all. This check must be part of a Selenium test.
*/
@Test(enabled = true)
public void testInstantReturn() {
// create wait action
WaitAction action = new WaitAction("step1", DIFF_TIME);
// create GUI
UserConsentNavigator nav = createNavigator(action);
ExecutionEngine exec = new ExecutionEngine(nav);
exec.process();
// eliminate most of the GUI overhead by retrieving start time from action
long startTime = action.getStartTime();
long stopTime = System.currentTimeMillis();
long act = stopTime - startTime;
long diff = act - DIFF_TIME;
String msg = "Display time of dialog differs " + diff + "ms from reference value (" + VARIANCE + "ms allowed).";
assertTrue(diff <= VARIANCE, msg);
}
use of org.openecard.gui.executor.ExecutionEngine in project open-ecard by ecsec.
the class RunGUI method runUC.
/**
* Uncomment the
* <code>@Ignore</code> line to run a demo gui so you can debug it.
*/
@Test
public void runUC() {
try {
SwingDialogWrapper dialog = new SwingDialogWrapper();
SwingUserConsent ucEngine = new SwingUserConsent(dialog);
UserConsentNavigator navigator = ucEngine.obtainNavigator(uc);
ExecutionEngine exec = new ExecutionEngine(navigator);
exec.process();
} catch (Throwable w) {
_logger.error(w.getMessage(), w);
}
}
Aggregations