jdk/test/sun/security/krb5/auto/BadKdc1.java
changeset 43840 499bdc13c435
parent 43839 b002a92940ff
parent 43838 d696d6394a37
child 43842 ce5b78554c67
equal deleted inserted replaced
43839:b002a92940ff 43840:499bdc13c435
     1 /*
       
     2  * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
       
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       
     4  *
       
     5  * This code is free software; you can redistribute it and/or modify it
       
     6  * under the terms of the GNU General Public License version 2 only, as
       
     7  * published by the Free Software Foundation.
       
     8  *
       
     9  * This code is distributed in the hope that it will be useful, but WITHOUT
       
    10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
       
    11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
       
    12  * version 2 for more details (a copy is included in the LICENSE file that
       
    13  * accompanied this code).
       
    14  *
       
    15  * You should have received a copy of the GNU General Public License version
       
    16  * 2 along with this work; if not, write to the Free Software Foundation,
       
    17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
       
    18  *
       
    19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
       
    20  * or visit www.oracle.com if you need additional information or have any
       
    21  * questions.
       
    22  */
       
    23 
       
    24 /*
       
    25  * @test
       
    26  * @bug 6843127
       
    27  * @run main/othervm/timeout=300 BadKdc1
       
    28  * @summary krb5 should not try to access unavailable kdc too often
       
    29  */
       
    30 
       
    31 import java.security.Security;
       
    32 
       
    33 public class BadKdc1 {
       
    34 
       
    35    public static void main(String[] args)
       
    36            throws Exception {
       
    37 
       
    38        // 5 sec is default timeout for tryLess
       
    39        if (BadKdc.getRatio() > 2.5) {
       
    40            Security.setProperty("krb5.kdc.bad.policy",
       
    41                    "tryLess:1," + BadKdc.toReal(2000));
       
    42        } else {
       
    43            Security.setProperty("krb5.kdc.bad.policy", "tryLess");
       
    44        }
       
    45 
       
    46        BadKdc.go(
       
    47                "121212222222(32){1,3}1222(32){1,3}", // 1 2
       
    48                // The above line means try kdc1 for 2 seconds then kdc1
       
    49                // for 2 seconds... finally kdc3 for 2 seconds.
       
    50                "1222(32){1,3}1222(32){1,3}",    // 1 2
       
    51                // refresh
       
    52                "121212222222(32){1,3}1222(32){1,3}",  // 1 2
       
    53                // k3 off k2 on
       
    54                "(122212(22){1,3}|1222323232-)", // 1
       
    55                // k1 on
       
    56                "(12(12){1,3}|122212|122232-)"  // empty
       
    57        );
       
    58    }
       
    59 }