author | smarks |
Mon, 07 Jan 2013 18:09:07 -0800 | |
changeset 15005 | 796ffc400e9e |
parent 14778 | 5947768d173d |
permissions | -rw-r--r-- |
309
bda219d843f6
6627823: Missed whitespace normalization files: jdk/test/java/rmi
ohair
parents:
2
diff
changeset
|
1 |
/* |
15005
796ffc400e9e
7187882: TEST_BUG: java/rmi/activation/checkusage/CheckUsage.java fails intermittently
smarks
parents:
14778
diff
changeset
|
2 |
* Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. |
2 | 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 |
* |
|
5506 | 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. |
|
2 | 22 |
*/ |
23 |
||
24 |
/* @test |
|
25 |
* @bug 4151966 |
|
26 |
* @summary rmiregistry error message obsure; internationalize rmiregistry |
|
27 |
* @author Laird Dornin |
|
28 |
* |
|
29 |
* @library ../../testlibrary |
|
14778 | 30 |
* @build TestLibrary JavaVM |
2 | 31 |
* @run main/othervm CheckUsage |
32 |
*/ |
|
33 |
||
34 |
import java.io.ByteArrayOutputStream; |
|
35 |
||
36 |
/** |
|
37 |
* Make sure that the rmiregistry prints out a correct usage statement |
|
15005
796ffc400e9e
7187882: TEST_BUG: java/rmi/activation/checkusage/CheckUsage.java fails intermittently
smarks
parents:
14778
diff
changeset
|
38 |
* when run with an incorrect command line. |
2 | 39 |
*/ |
40 |
public class CheckUsage { |
|
41 |
public static void main(String[] args) { |
|
42 |
||
309
bda219d843f6
6627823: Missed whitespace normalization files: jdk/test/java/rmi
ohair
parents:
2
diff
changeset
|
43 |
try { |
bda219d843f6
6627823: Missed whitespace normalization files: jdk/test/java/rmi
ohair
parents:
2
diff
changeset
|
44 |
ByteArrayOutputStream berr = new ByteArrayOutputStream(); |
bda219d843f6
6627823: Missed whitespace normalization files: jdk/test/java/rmi
ohair
parents:
2
diff
changeset
|
45 |
|
bda219d843f6
6627823: Missed whitespace normalization files: jdk/test/java/rmi
ohair
parents:
2
diff
changeset
|
46 |
// run a VM to start the registry |
15005
796ffc400e9e
7187882: TEST_BUG: java/rmi/activation/checkusage/CheckUsage.java fails intermittently
smarks
parents:
14778
diff
changeset
|
47 |
JavaVM registryVM = new JavaVM("sun.rmi.registry.RegistryImpl", |
796ffc400e9e
7187882: TEST_BUG: java/rmi/activation/checkusage/CheckUsage.java fails intermittently
smarks
parents:
14778
diff
changeset
|
48 |
"", "foo", |
796ffc400e9e
7187882: TEST_BUG: java/rmi/activation/checkusage/CheckUsage.java fails intermittently
smarks
parents:
14778
diff
changeset
|
49 |
System.out, berr); |
309
bda219d843f6
6627823: Missed whitespace normalization files: jdk/test/java/rmi
ohair
parents:
2
diff
changeset
|
50 |
System.err.println("starting registry"); |
bda219d843f6
6627823: Missed whitespace normalization files: jdk/test/java/rmi
ohair
parents:
2
diff
changeset
|
51 |
System.err.println(" registry exited with status: " + |
15005
796ffc400e9e
7187882: TEST_BUG: java/rmi/activation/checkusage/CheckUsage.java fails intermittently
smarks
parents:
14778
diff
changeset
|
52 |
registryVM.execute()); |
309
bda219d843f6
6627823: Missed whitespace normalization files: jdk/test/java/rmi
ohair
parents:
2
diff
changeset
|
53 |
|
bda219d843f6
6627823: Missed whitespace normalization files: jdk/test/java/rmi
ohair
parents:
2
diff
changeset
|
54 |
String usage = new String(berr.toByteArray()); |
bda219d843f6
6627823: Missed whitespace normalization files: jdk/test/java/rmi
ohair
parents:
2
diff
changeset
|
55 |
|
bda219d843f6
6627823: Missed whitespace normalization files: jdk/test/java/rmi
ohair
parents:
2
diff
changeset
|
56 |
System.err.println("rmiregistry usage: " + usage); |
bda219d843f6
6627823: Missed whitespace normalization files: jdk/test/java/rmi
ohair
parents:
2
diff
changeset
|
57 |
|
bda219d843f6
6627823: Missed whitespace normalization files: jdk/test/java/rmi
ohair
parents:
2
diff
changeset
|
58 |
if (usage.indexOf("-J") < 0) { |
bda219d843f6
6627823: Missed whitespace normalization files: jdk/test/java/rmi
ohair
parents:
2
diff
changeset
|
59 |
TestLibrary.bomb("rmiregistry has incorrect usage statement"); |
bda219d843f6
6627823: Missed whitespace normalization files: jdk/test/java/rmi
ohair
parents:
2
diff
changeset
|
60 |
} else { |
bda219d843f6
6627823: Missed whitespace normalization files: jdk/test/java/rmi
ohair
parents:
2
diff
changeset
|
61 |
System.err.println("test passed"); |
bda219d843f6
6627823: Missed whitespace normalization files: jdk/test/java/rmi
ohair
parents:
2
diff
changeset
|
62 |
} |
bda219d843f6
6627823: Missed whitespace normalization files: jdk/test/java/rmi
ohair
parents:
2
diff
changeset
|
63 |
} catch (Exception e) { |
bda219d843f6
6627823: Missed whitespace normalization files: jdk/test/java/rmi
ohair
parents:
2
diff
changeset
|
64 |
TestLibrary.bomb(e); |
bda219d843f6
6627823: Missed whitespace normalization files: jdk/test/java/rmi
ohair
parents:
2
diff
changeset
|
65 |
} |
2 | 66 |
} |
67 |
} |