Package javax.security.auth.callback

Examples of javax.security.auth.callback.ConfirmationCallback


     * Expected IAE, if optionType is YES_NO_CANCEL_OPTION and defaultOption is not YES/NO/CANCEL,
     * else ok.    
     */
    public final void testConfirmationCallback_04() throws IllegalArgumentException {
        try {
            cc = new ConfirmationCallback(ConfirmationCallback.INFORMATION, ot[1], dopt[0]);
        } catch(IllegalArgumentException e){}
        try {
            cc = new ConfirmationCallback(ConfirmationCallback.INFORMATION, ot[1], dopt[1]);
        } catch(IllegalArgumentException e){}
        try {
            cc = new ConfirmationCallback(ConfirmationCallback.INFORMATION, ot[1], dopt[2]);
        } catch(IllegalArgumentException e){}
        try {
            cc = new ConfirmationCallback(ConfirmationCallback.INFORMATION, ot[1], dopt[3]);
            fail("1. If option type is YES_NO_CANCEL_OPTION then default option should be YES/NO/CANCEL");
        } catch(IllegalArgumentException e){}

    }
View Full Code Here


     * Expected IAE, if optionType is OK_CANCEL_OPTION and defaultOption is not CANCEL/OK
     * else ok.    
     */
    public final void testConfirmationCallback_05() throws IllegalArgumentException {
        try {
            cc = new ConfirmationCallback(ConfirmationCallback.INFORMATION, ot[2], dopt[0]);
            fail("1. If option type is OK_CANCEL_OPTION then default option should be CANCEL/OK");
        } catch(IllegalArgumentException e){}
        try {
            cc = new ConfirmationCallback(ConfirmationCallback.INFORMATION, ot[2], dopt[1]);
            fail("2. If option type is OK_CANCEL_OPTION then default option should be CANCEL/OK");
        } catch(IllegalArgumentException e){}
        try {
            cc = new ConfirmationCallback(ConfirmationCallback.INFORMATION, ot[2], dopt[2]);
        } catch(IllegalArgumentException e){}
        try {
            cc = new ConfirmationCallback(ConfirmationCallback.INFORMATION, ot[2], dopt[3]);
        } catch(IllegalArgumentException e){}
    }
View Full Code Here

    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

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

     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

      // Setup default callback handlers.
      Callback[] callbacks = new Callback[]
      {
              new NameCallback("Username: "), /* 0 */
              new PasswordCallback("Password: ", false), /* 1 */
              new ConfirmationCallback(ConfirmationCallback.INFORMATION,
                      ConfirmationCallback.YES_NO_OPTION, ConfirmationCallback.NO),

              /* 2 */
              new TextInputCallback("Domain: "), /* 3 */
              new ConfigurationCallback(), /* 4 */
 
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.