Examples of ConfirmationCallback


Examples of javax.security.auth.callback.ConfirmationCallback

    public final void testConfirmationCallback_06() {
        String[] opt = {"CONTINUE", "ABORT"};
        String[] opt1 = {"START", ""};
        String[] opt2 = {"START", null};
        try {
            cc = new ConfirmationCallback(ConfirmationCallback.INFORMATION, opt, 1);
        } catch(IllegalArgumentException e){}
        try {
            cc = new ConfirmationCallback(ConfirmationCallback.INFORMATION, opt1, 1);
           fail("1. Option type should not be null and empty ");
        } catch(IllegalArgumentException e){}
        try {
            cc = new ConfirmationCallback(ConfirmationCallback.INFORMATION, opt2, 1);
          fail("2. Option type should not be null and empty ");
      } catch(IllegalArgumentException e){}
      try {
          cc = new ConfirmationCallback(ConfirmationCallback.INFORMATION, opt, 3);
          fail("Default Option does not lie within the array boundaries of options ");
        } catch(IllegalArgumentException e){
        }
    }
View Full Code Here

Examples of javax.security.auth.callback.ConfirmationCallback

    /**
     * Expected IAE, if prompt is null or an empty, else ok.
     */
     public final void testConfirmationCallback_07() {
        try {
            cc = new ConfirmationCallback("prompt", ConfirmationCallback.INFORMATION, ot[0], dopt[0]);
        } catch(IllegalArgumentException e){}
        try {
            cc = new ConfirmationCallback("", ConfirmationCallback.INFORMATION, ot[0], dopt[0]);
            fail("2. Prompt should not be null and empty ");
        } catch(IllegalArgumentException e){}
        try {
            cc = new ConfirmationCallback(null, ConfirmationCallback.INFORMATION, ot[0], dopt[0]);
            fail("2. Prompt should not be null and empty ");
        } catch(IllegalArgumentException e){}
    }
View Full Code Here

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

Examples of javax.security.auth.callback.ConfirmationCallback

     */
    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

Examples of javax.security.auth.callback.ConfirmationCallback

    /**
     * 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

Examples of javax.security.auth.callback.ConfirmationCallback

     * 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

Examples of javax.security.auth.callback.ConfirmationCallback

    /*
     * 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

Examples of javax.security.auth.callback.ConfirmationCallback

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

Examples of javax.security.auth.callback.ConfirmationCallback

    /**
     * @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

Examples of javax.security.auth.callback.ConfirmationCallback

     * 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
TOP
Copyright © 2018 www.massapi.com. 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.