Package javax.security.auth.callback

Examples of javax.security.auth.callback.ConfirmationCallback


     public final void testConfirmationCallback_08() {
        String[] opt = {"CONTINUE", "ABORT"};
        String[] opt1 = {"START", ""};
        String[] opt2 = {"START", null};
        try {
            cc = new ConfirmationCallback("prompt", ConfirmationCallback.INFORMATION, opt, 1);
        } catch(IllegalArgumentException e){}
        try {
            cc = new ConfirmationCallback("prompt", ConfirmationCallback.INFORMATION, opt1, 1);
           fail("1. Option type should not be null and empty ");
        } catch(IllegalArgumentException e){}
        try {
            cc = new ConfirmationCallback("prompt", ConfirmationCallback.INFORMATION, opt2, 1);
          fail("2. Option type should not be null and empty ");
        } catch(IllegalArgumentException e){}
        try {
            cc = new ConfirmationCallback("", ConfirmationCallback.INFORMATION, opt, 1);
            fail("3. Prompt should not be null and empty ");
        } catch(IllegalArgumentException e){}
        try {
            cc = new ConfirmationCallback(null, ConfirmationCallback.INFORMATION, opt, 1);
            fail("4. Prompt should not be null and empty ");
        } catch(IllegalArgumentException e){
        }

    }
View Full Code Here


     */
    public final void testConfirmationCallback_09() throws IllegalArgumentException {
        String[] opt = {"CONTINUE", "ABORT"};
        String[] s;

            cc = new ConfirmationCallback("prompt", mt[0], opt, 1);
            assertEquals(1, cc.getDefaultOption());
            assertEquals(ConfirmationCallback.INFORMATION, cc.getMessageType());
            assertEquals(opt,cc.getOptions());
            s = cc.getOptions();
            for (int i = 0; i < opt.length; i++){
View Full Code Here

    /**
     * test of methods getOptions(), set/getSelectedIndex when options is null
     */
    public final void testConfirmationCallback_10() throws IllegalArgumentException {
       
            cc = new ConfirmationCallback("prompt", mt[0], ot[0], dopt[0]);
            assertNull(cc.getOptions());
            cc.setSelectedIndex(1);
            assertEquals(1, cc.getSelectedIndex());
    }
View Full Code Here

     * if optionType was specified in ctor, then selection represented as YES, NO, OK or CANCEL
     * i.e. defaultOption, thus expected IAE if selection does not lie within the array
     * boundaries of options.
     */
    public final void testSetSelection() throws IllegalArgumentException {
        cc = new ConfirmationCallback("prompt", mt[0], ot[0], dopt[0]);
        try {
           cc.setSelectedIndex(3);
           assertEquals(3, cc.getSelectedIndex());
           fail("There is not enough an information about setSelection in java doc");
        }catch (IllegalArgumentException e) {
View Full Code Here

    /*
     * Regression test for bug in setSelectedIndex
     */
    public final void testSetSelectedIndex() throws Exception {
        cc = new ConfirmationCallback("prompt", mt[0], ot[0], dopt[0]);
        cc.setSelectedIndex(ConfirmationCallback.YES);
    }
View Full Code Here

public class ConfirmationCallbackTest extends SerializationTest implements
        SerializationTest.SerializableAssert {

    @Override
    protected Object[] getData() {
        return new Object[] { new ConfirmationCallback("prompt",
                ConfirmationCallback.INFORMATION,
                ConfirmationCallback.YES_NO_OPTION, 1) };
    }
View Full Code Here

    /**
     * @InheritDoc
     */
    public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
        ConfirmationCallback confirmation = null;

        for (Callback callback : callbacks) {
            if (callback instanceof TextOutputCallback) {
                handleOutputCallback((TextOutputCallback) callback);
            } else if (callback instanceof NameCallback) {
View Full Code Here

     * instance of NameCallback or PasswordCallback
     */
    public void handle(Callback[] callbacks)
        throws IOException, UnsupportedCallbackException
    {
        ConfirmationCallback confirmation = null;

        for (int i = 0; i < callbacks.length; i++) {
            if (callbacks[i] instanceof TextOutputCallback) {
                TextOutputCallback tc = (TextOutputCallback) callbacks[i];

View Full Code Here

                        pc.setPassword(password.getPassword());
                    }
                });

            } else if (callbacks[i] instanceof ConfirmationCallback) {
                ConfirmationCallback cc = (ConfirmationCallback)callbacks[i];

                confirmation.setCallback(cc);
                if (cc.getPrompt() != null) {
                    messages.add(cc.getPrompt());
                }

            } else {
                throw new UnsupportedCallbackException(
                    callbacks[i], "Unrecognized Callback");
View Full Code Here

    /**
     * @InheritDoc
     */
    public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
        ConfirmationCallback confirmation = null;

        for (Callback callback : callbacks) {
            if (callback instanceof TextOutputCallback) {
                handleOutputCallback((TextOutputCallback) callback);
            } else if (callback instanceof NameCallback) {
View Full Code Here

TOP

Related Classes of javax.security.auth.callback.ConfirmationCallback

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.