CtorTests2.java revision 2362
9512fe850e98fdd448c638ca63fdd92a8a510255ahl/*
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9512fe850e98fdd448c638ca63fdd92a8a510255ahl *
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * This code is free software; you can redistribute it and/or modify it
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * under the terms of the GNU General Public License version 2 only, as
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * published by the Free Software Foundation.
9512fe850e98fdd448c638ca63fdd92a8a510255ahl *
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * This code is distributed in the hope that it will be useful, but WITHOUT
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * version 2 for more details (a copy is included in the LICENSE file that
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * accompanied this code).
9512fe850e98fdd448c638ca63fdd92a8a510255ahl *
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * You should have received a copy of the GNU General Public License version
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * 2 along with this work; if not, write to the Free Software Foundation,
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
9512fe850e98fdd448c638ca63fdd92a8a510255ahl *
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * or visit www.oracle.com if you need additional information or have any
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * questions.
9512fe850e98fdd448c638ca63fdd92a8a510255ahl */
9512fe850e98fdd448c638ca63fdd92a8a510255ahl
9512fe850e98fdd448c638ca63fdd92a8a510255ahl/*
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * @test
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * @bug 6329508
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * @summary GSSName created as GSSName.NT_ANONYMOUS return isAnonymous() == false
9512fe850e98fdd448c638ca63fdd92a8a510255ahl */
9512fe850e98fdd448c638ca63fdd92a8a510255ahl
9512fe850e98fdd448c638ca63fdd92a8a510255ahlimport org.ietf.jgss.Oid;
9512fe850e98fdd448c638ca63fdd92a8a510255ahlimport org.ietf.jgss.GSSException;
9512fe850e98fdd448c638ca63fdd92a8a510255ahlimport org.ietf.jgss.GSSManager;
9512fe850e98fdd448c638ca63fdd92a8a510255ahlimport org.ietf.jgss.GSSName;
9512fe850e98fdd448c638ca63fdd92a8a510255ahl
9512fe850e98fdd448c638ca63fdd92a8a510255ahlpublic class CtorTests2 {
9512fe850e98fdd448c638ca63fdd92a8a510255ahl
9512fe850e98fdd448c638ca63fdd92a8a510255ahl /* standalone interface */
9512fe850e98fdd448c638ca63fdd92a8a510255ahl public static void main(String[] argv) throws Exception {
9512fe850e98fdd448c638ca63fdd92a8a510255ahl try {
9512fe850e98fdd448c638ca63fdd92a8a510255ahl GSSManager manager = GSSManager.getInstance();
9512fe850e98fdd448c638ca63fdd92a8a510255ahl GSSName name = manager.createName("anonymous", GSSName.NT_ANONYMOUS);
9512fe850e98fdd448c638ca63fdd92a8a510255ahl boolean anonymous = name.isAnonymous();
9512fe850e98fdd448c638ca63fdd92a8a510255ahl if (anonymous == false) {
9512fe850e98fdd448c638ca63fdd92a8a510255ahl throw new RuntimeException("GSSName.isAnonymous() returns false for GSSName.NT_ANONYMOUS");
9512fe850e98fdd448c638ca63fdd92a8a510255ahl }
9512fe850e98fdd448c638ca63fdd92a8a510255ahl } catch (GSSException e) {
9512fe850e98fdd448c638ca63fdd92a8a510255ahl System.out.println("Not supported, ignored!");
9512fe850e98fdd448c638ca63fdd92a8a510255ahl }
9512fe850e98fdd448c638ca63fdd92a8a510255ahl }
9512fe850e98fdd448c638ca63fdd92a8a510255ahl
9512fe850e98fdd448c638ca63fdd92a8a510255ahl}
9512fe850e98fdd448c638ca63fdd92a8a510255ahl