Search in sources :

Example 6 with ExecutionEngine

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;
}
Also used : ExecutionEngine(org.openecard.gui.executor.ExecutionEngine) ResultStatus(org.openecard.gui.ResultStatus) UserConsentNavigator(org.openecard.gui.UserConsentNavigator)

Example 7 with ExecutionEngine

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();
    }
}
Also used : ConnectionHandleType(iso.std.iso_iec._24727.tech.schema.ConnectionHandleType) ExecutionEngine(org.openecard.gui.executor.ExecutionEngine) ResultStatus(org.openecard.gui.ResultStatus) UserConsentNavigator(org.openecard.gui.UserConsentNavigator)

Example 8 with ExecutionEngine

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();
}
Also used : ExecutionEngine(org.openecard.gui.executor.ExecutionEngine) UserConsentDescription(org.openecard.gui.definition.UserConsentDescription) Text(org.openecard.gui.definition.Text) Step(org.openecard.gui.definition.Step) UserConsent(org.openecard.gui.UserConsent) StepActionResult(org.openecard.gui.executor.StepActionResult) BackgroundTask(org.openecard.gui.executor.BackgroundTask) Test(org.testng.annotations.Test)

Example 9 with ExecutionEngine

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);
}
Also used : ExecutionEngine(org.openecard.gui.executor.ExecutionEngine) UserConsentNavigator(org.openecard.gui.UserConsentNavigator) Test(org.testng.annotations.Test)

Example 10 with ExecutionEngine

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);
    }
}
Also used : ExecutionEngine(org.openecard.gui.executor.ExecutionEngine) UserConsentNavigator(org.openecard.gui.UserConsentNavigator) Test(org.testng.annotations.Test) BeforeTest(org.testng.annotations.BeforeTest)

Aggregations

ExecutionEngine (org.openecard.gui.executor.ExecutionEngine)16 UserConsentNavigator (org.openecard.gui.UserConsentNavigator)14 ResultStatus (org.openecard.gui.ResultStatus)6 UserConsentDescription (org.openecard.gui.definition.UserConsentDescription)6 Test (org.testng.annotations.Test)4 ConnectionHandleType (iso.std.iso_iec._24727.tech.schema.ConnectionHandleType)3 InputAPDUInfoType (iso.std.iso_iec._24727.tech.schema.InputAPDUInfoType)2 Transmit (iso.std.iso_iec._24727.tech.schema.Transmit)2 TransmitResponse (iso.std.iso_iec._24727.tech.schema.TransmitResponse)2 Result (oasis.names.tc.dss._1_0.core.schema.Result)2 CardResponseAPDU (org.openecard.common.apdu.common.CardResponseAPDU)2 UserConsent (org.openecard.gui.UserConsent)2 AltVUMessagesType (iso.std.iso_iec._24727.tech.schema.AltVUMessagesType)1 DIDAuthenticate (iso.std.iso_iec._24727.tech.schema.DIDAuthenticate)1 DIDAuthenticateResponse (iso.std.iso_iec._24727.tech.schema.DIDAuthenticateResponse)1 DIDAuthenticationDataType (iso.std.iso_iec._24727.tech.schema.DIDAuthenticationDataType)1 InputUnitType (iso.std.iso_iec._24727.tech.schema.InputUnitType)1 PasswordAttributesType (iso.std.iso_iec._24727.tech.schema.PasswordAttributesType)1 PinInputType (iso.std.iso_iec._24727.tech.schema.PinInputType)1 VerifyUserResponse (iso.std.iso_iec._24727.tech.schema.VerifyUserResponse)1