author | xyin |
Wed, 25 Jul 2018 11:03:07 +0800 | |
changeset 51192 | 499b873761d8 |
permissions | -rw-r--r-- |
51192
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
1 |
/* |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
2 |
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
4 |
* |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
8 |
* |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
13 |
* accompanied this code). |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
14 |
* |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
18 |
* |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
21 |
* questions. |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
22 |
*/ |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
23 |
|
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
24 |
/** |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
25 |
* The test base class for JNDI related tests. |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
26 |
* |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
27 |
* run() will be the entry to launch whole tests, base test sequence is |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
28 |
* initRes(), initTest(), setupTest() and launch(). |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
29 |
* |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
30 |
* launch() will call real test logic runTest() which required to be implemented |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
31 |
* in test class. |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
32 |
* |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
33 |
* exception handling logic should be placed in handleException(). |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
34 |
* |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
35 |
* cleanup related should be placed in cleanupTest which been called in finally |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
36 |
* block. |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
37 |
*/ |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
38 |
public abstract class TestBase { |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
39 |
|
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
40 |
/** |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
41 |
* The entry to the test. |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
42 |
* |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
43 |
* @param args given input arguments |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
44 |
* @throws Exception if any exception |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
45 |
*/ |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
46 |
public void run(String[] args) throws Exception { |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
47 |
initRes(); |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
48 |
initTest(args); |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
49 |
setupTest(); |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
50 |
launch(); |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
51 |
} |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
52 |
|
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
53 |
/** |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
54 |
* Initial local resources, such as socket. |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
55 |
* |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
56 |
* @throws Exception if any exception |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
57 |
*/ |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
58 |
public void initRes() throws Exception { |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
59 |
} |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
60 |
|
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
61 |
/** |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
62 |
* Initial test with given arguments. |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
63 |
* |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
64 |
* @param args given arguments |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
65 |
*/ |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
66 |
public void initTest(String[] args) { |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
67 |
} |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
68 |
|
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
69 |
/** |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
70 |
* Setup test. |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
71 |
*/ |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
72 |
public void setupTest() { |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
73 |
} |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
74 |
|
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
75 |
/** |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
76 |
* Launch test. |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
77 |
* |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
78 |
* @throws Exception if any exception |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
79 |
*/ |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
80 |
public void launch() throws Exception { |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
81 |
try { |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
82 |
runTest(); |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
83 |
} catch (Exception e) { |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
84 |
if (!handleException(e)) { |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
85 |
throw e; |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
86 |
} |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
87 |
} finally { |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
88 |
cleanupTest(); |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
89 |
} |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
90 |
} |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
91 |
|
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
92 |
/** |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
93 |
* The real test logic to run, this required to be implemented in test class. |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
94 |
* |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
95 |
* @throws Exception if any exception |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
96 |
*/ |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
97 |
public abstract void runTest() throws Exception; |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
98 |
|
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
99 |
/** |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
100 |
* Handle test exception. |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
101 |
* |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
102 |
* @param e exception which been thrown during test runTest() |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
103 |
* @return <tt>true</tt> if given exception is expected |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
104 |
*/ |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
105 |
public boolean handleException(Exception e) { |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
106 |
return false; |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
107 |
} |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
108 |
|
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
109 |
/** |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
110 |
* Cleanup test. |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
111 |
*/ |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
112 |
public abstract void cleanupTest(); |
499b873761d8
8198882: Add 10 JNDI tests to com/sun/jndi/dns/AttributeTests/
xyin
parents:
diff
changeset
|
113 |
} |