Search in sources :

Example 6 with UserConsentNavigator

use of org.openecard.gui.UserConsentNavigator in project open-ecard by ecsec.

the class TCTokenHandler method killUserConsent.

public static void killUserConsent() {
    // kill any open dialog
    DynamicContext ctx = DynamicContext.getInstance(TR03112Keys.INSTANCE_KEY);
    Object navObj = ctx.get(TR03112Keys.OPEN_USER_CONSENT_NAVIGATOR);
    if (navObj instanceof UserConsentNavigator) {
        UserConsentNavigator nav = (UserConsentNavigator) navObj;
        nav.close();
    }
}
Also used : UserConsentNavigator(org.openecard.gui.UserConsentNavigator) DynamicContext(org.openecard.common.DynamicContext)

Example 7 with UserConsentNavigator

use of org.openecard.gui.UserConsentNavigator in project open-ecard by ecsec.

the class EacNavigatorFactoryTest method testGivenCorrectValuesThenCreateFromShouldBeCorrect.

@Test
public void testGivenCorrectValuesThenCreateFromShouldBeCorrect() {
    final List<Step> expectedSteps = createInitialSteps();
    new Expectations() {

        {
            ucd.getDialogType();
            result = "EAC";
            ucd.getSteps();
            result = expectedSteps;
        }
    };
    EacNavigatorFactory sut = new EacNavigatorFactory();
    final UserConsentNavigator result = sut.createFrom(ucd);
    assertNotNull(result);
    assertTrue(result.hasNext());
}
Also used : Expectations(mockit.Expectations) Step(org.openecard.gui.definition.Step) UserConsentNavigator(org.openecard.gui.UserConsentNavigator) Test(org.testng.annotations.Test)

Example 8 with UserConsentNavigator

use of org.openecard.gui.UserConsentNavigator 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 9 with UserConsentNavigator

use of org.openecard.gui.UserConsentNavigator 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 10 with UserConsentNavigator

use of org.openecard.gui.UserConsentNavigator 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)

Aggregations

UserConsentNavigator (org.openecard.gui.UserConsentNavigator)17 ExecutionEngine (org.openecard.gui.executor.ExecutionEngine)14 ResultStatus (org.openecard.gui.ResultStatus)6 Test (org.testng.annotations.Test)5 UserConsentDescription (org.openecard.gui.definition.UserConsentDescription)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 Expectations (mockit.Expectations)2 Result (oasis.names.tc.dss._1_0.core.schema.Result)2 DynamicContext (org.openecard.common.DynamicContext)2 CardResponseAPDU (org.openecard.common.apdu.common.CardResponseAPDU)2 Step (org.openecard.gui.definition.Step)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