test/jdk/com/sun/jndi/dns/EnvTests/EnvTestBase.java
author xyin
Wed, 08 Aug 2018 10:21:23 +0800
changeset 51331 7939b3c4e408
permissions -rw-r--r--
8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/ Reviewed-by: vtewari, rriggs
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
51331
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
     1
/*
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
     2
 * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
     4
 *
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
     7
 * published by the Free Software Foundation.
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
     8
 *
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    13
 * accompanied this code).
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    14
 *
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    18
 *
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    21
 * questions.
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    22
 */
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    23
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    24
import javax.naming.Context;
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    25
import javax.naming.NamingException;
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    26
import javax.naming.directory.Attributes;
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    27
import java.util.Hashtable;
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    28
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    29
/**
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    30
 * Abstract test base for most of Env Tests, this class extends DNSTestBase.
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    31
 *
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    32
 * @see DNSTestBase
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    33
 * @see TestBase
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    34
 */
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    35
abstract class EnvTestBase extends DNSTestBase {
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    36
    private static final String[] MANDATORY_ATTRIBUTES = { "A", "MX", "HINFO",
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    37
            "TXT", "29" };
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    38
    private static final String[] OPTIONAL_ATTRIBUTES = {};
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    39
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    40
    private String key;
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    41
    private String fqdnUrl;
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    42
    private String foreignFqdnUrl;
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    43
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    44
    public EnvTestBase() {
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    45
        // set default test data
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    46
        setKey("host1");
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    47
    }
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    48
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    49
    /**
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    50
     * Setup test before real test run, it overrides the method of TestBase.
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    51
     */
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    52
    @Override public void setupTest() {
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    53
        super.setupTest();
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    54
        String fqdn = DNSTestUtils.buildFqdn(key, env(), true);
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    55
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    56
        String foreignLeaf = (String) env().get("FOREIGN_LEAF");
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    57
        String foreignFqdn = DNSTestUtils.buildFqdn(foreignLeaf, env(), false);
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    58
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    59
        fqdnUrl = DNSTestUtils.getRootUrl(env()) + "/" + fqdn;
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    60
        foreignFqdnUrl = DNSTestUtils.getRootUrl(env()) + "/" + foreignFqdn;
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    61
    }
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    62
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    63
    /**
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    64
     * Overload method of addToEnvAndVerifyOldValIsNull, use context() as
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    65
     * context.
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    66
     *
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    67
     * @param propName given property name
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    68
     * @param propVal  given property value
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    69
     * @throws NamingException if a naming exception is encountered
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    70
     */
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    71
    public void addToEnvAndVerifyOldValIsNull(String propName, Object propVal)
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    72
            throws NamingException {
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    73
        addToEnvAndVerifyOldValIsNull(context(), propName, propVal);
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    74
    }
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    75
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    76
    /**
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    77
     * Add given property name/value to the environment of given context and
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    78
     * verify the previous old property value is null which means the property
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    79
     * was not in the environment before.
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    80
     *
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    81
     * @param context  given context
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    82
     * @param propName given property name
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    83
     * @param propVal  given property value
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    84
     * @throws NamingException if a naming exception is encountered
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    85
     */
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    86
    public void addToEnvAndVerifyOldValIsNull(Context context, String propName,
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    87
            Object propVal) throws NamingException {
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    88
        Object oldValue = context.addToEnvironment(propName, propVal);
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    89
        DNSTestUtils.debug("Old Value for " + propName + " : " + oldValue);
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    90
        if (oldValue != null) {
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    91
            throw new RuntimeException(
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    92
                    "Failed: old value expected to be null for " + propName
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    93
                            + " but actual is : " + oldValue);
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    94
        }
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    95
    }
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    96
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    97
    /**
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    98
     * Verify the value of specified property in given environment matched with
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
    99
     * given expected value. If property not exist and given expected value is
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
   100
     * null, we think verify passed. RuntimeException will be thrown if verify
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
   101
     * failed.
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
   102
     *
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
   103
     * @param env         given environment
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
   104
     * @param propName    given property name to verify
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
   105
     * @param expectedVal expected property value
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
   106
     */
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
   107
    public void verifyEnvProperty(Hashtable<?, ?> env, String propName,
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
   108
            Object expectedVal) {
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
   109
        boolean equals = true;
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
   110
        Object actualVal = env.get(propName);
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
   111
        if (actualVal != null && expectedVal != null) {
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
   112
            if (!expectedVal.equals(actualVal)) {
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
   113
                equals = false;
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
   114
            }
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
   115
        } else {
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
   116
            if (actualVal != null || expectedVal != null) {
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
   117
                equals = false;
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
   118
            }
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
   119
        }
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
   120
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
   121
        if (!equals) {
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
   122
            throw new RuntimeException(
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
   123
                    "Failed: value not match for " + propName + " expected: "
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
   124
                            + expectedVal + " actual: " + actualVal);
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
   125
        }
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
   126
    }
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
   127
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
   128
    /**
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
   129
     * Retrieve attributes by given name and attributes ids and verify
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
   130
     * attributes contains the mandatory attributes and the right
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
   131
     * objectclass attribute, will throw RuntimeException if verify failed.
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
   132
     *
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
   133
     * @param name    given name
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
   134
     * @param attrIds given attribute ids
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
   135
     * @throws NamingException if a naming exception is encountered
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
   136
     */
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
   137
    public void retrieveAndVerifyData(String name, String[] attrIds)
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
   138
            throws NamingException {
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
   139
        Attributes retAttrs = context().getAttributes(name, attrIds);
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
   140
        DNSTestUtils.verifySchema(retAttrs, MANDATORY_ATTRIBUTES,
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
   141
                OPTIONAL_ATTRIBUTES);
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
   142
    }
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
   143
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
   144
    public String getKey() {
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
   145
        return key;
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
   146
    }
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
   147
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
   148
    public void setKey(String key) {
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
   149
        this.key = key;
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
   150
    }
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
   151
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
   152
    public String getFqdnUrl() {
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
   153
        return fqdnUrl;
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
   154
    }
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
   155
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
   156
    public String getForeignFqdnUrl() {
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
   157
        return foreignFqdnUrl;
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
   158
    }
7939b3c4e408 8208279: Add 8 JNDI tests to com/sun/jndi/dns/EnvTests/
xyin
parents:
diff changeset
   159
}