0N/A/*
2362N/A * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
0N/A * published by the Free Software Foundation.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/A/**
0N/A *
0N/A *
0N/A * This isn't the test case: ResourceCheckTest.sh is.
0N/A * Refer to ResourceCheckTest.sh when running this test.
0N/A *
0N/A * @bug 5008856 5023573 5024917 5062569
0N/A * @summary 'missing resource key' error for key = "Operating system"
0N/A */
0N/A
0N/Aimport java.awt.event.KeyEvent;
0N/A
0N/Aimport sun.tools.jconsole.Resources;
0N/A
0N/Apublic class ResourceCheckTest {
0N/A
0N/A public static void main(String[] args){
0N/A Object [][] testData = {
0N/A {"<", "", "", "", ""},
0N/A {"<<", "", "", "", ""},
0N/A {">", "", "", "", ""},
0N/A {" 1 day", "", "", "", ""},
0N/A {" 1 hour", "", "", "", ""},
0N/A {" 1 min", "", "", "", ""},
0N/A {" 1 month", "", "", "", ""},
0N/A {" 1 year", "", "", "", ""},
0N/A {" 2 hours", "", "", "", ""},
0N/A {" 3 hours", "", "", "", ""},
0N/A {" 3 months", "", "", "", ""},
0N/A {" 5 min", "", "", "", ""},
0N/A {" 6 hours", "", "", "", ""},
0N/A {" 6 months", "", "", "", ""},
0N/A {" 7 days", "", "", "", ""},
0N/A {"10 min", "", "", "", ""},
0N/A {"12 hours", "", "", "", ""},
0N/A {"30 min", "", "", "", ""},
0N/A {"ACTION", "", "", "", ""},
0N/A {"ACTION_INFO", "", "", "", ""},
0N/A {"All", "", "", "", ""},
0N/A {"Architecture", "", "", "", ""},
0N/A {"Attribute", "", "", "", ""},
0N/A {"Attribute value", "", "", "", ""},
0N/A {"Attribute values", "", "", "", ""},
0N/A {"Attributes", "", "", "", ""},
0N/A {"Blank", "", "", "", ""},
0N/A {"BlockedCount WaitedCount", "BlockedCount", "WaitedCount", "", ""},
0N/A {"Boot class path", "", "", "", ""},
0N/A {"BorderedComponent.moreOrLessButton.toolTip", "", "", "", ""},
0N/A {"Close", "", "", "", ""},
0N/A {"CPU Usage", "", "", "", ""},
0N/A {"CPUUsageFormat","PhonyPercentage", "", "", ""},
0N/A {"Cancel", "", "", "", ""},
0N/A {"Cascade", "", "", "", ""},
0N/A {"Cascade.mnemonic", "", "", "", ""},
0N/A {"Chart:", "", "", "", ""},
0N/A {"Chart:.mnemonic", "", "", "", ""},
0N/A {"ClassTab.infoLabelFormat", "LoadedCount", "UnloadedCount", "TotalCount", ""},
0N/A {"ClassTab.loadedClassesPlotter.accessibleName", "", "", "", ""},
0N/A {"Class path", "", "", "", ""},
0N/A {"Classes", "", "", "", ""},
0N/A {"ClassName", "", "", "", ""},
0N/A {"Column.Name", "", "", "", ""},
0N/A {"Column.PID", "", "", "", ""},
0N/A {"Committed", "", "", "", ""},
0N/A {"Committed memory", "", "", "", ""},
0N/A {"Committed virtual memory", "", "", "", ""},
0N/A {"Compiler", "", "", "", ""},
0N/A {"Connect...", "", "", "", ""},
0N/A {"Connect", "", "", "", ""},
0N/A {"Connect.mnemonic", "", "", "", ""},
0N/A {"ConnectDialog.connectButton.toolTip", "", "", "", ""},
0N/A {"ConnectDialog.accessibleDescription", "", "", "", ""},
0N/A {"ConnectDialog.masthead.accessibleName", "", "", "", ""},
0N/A {"ConnectDialog.masthead.title", "", "", "", ""},
0N/A {"ConnectDialog.statusBar.accessibleName", "", "", "", ""},
0N/A {"ConnectDialog.title", "", "", "", ""},
0N/A {"Connected. Click to disconnect.", "", "", "", ""},
0N/A {"connectingTo1", "PhonyConnectionName", "", "", ""},
0N/A {"connectingTo2", "PhonyConnectionName", "", "", ""},
0N/A {"connectionFailed1", "", "", "", ""},
0N/A {"connectionFailed2", "PhonyConnectionName", "", "", ""},
0N/A {"connectionLost1", "", "", "", ""},
0N/A {"connectionLost2", "PhonyConnectionName", "", "", ""},
0N/A {"Connection failed", "", "", "", ""},
0N/A {"Connection", "", "", "", ""},
0N/A {"Connection.mnemonic", "", "", "", ""},
0N/A {"Connection name", "", "", "", ""},
0N/A {"ConnectionName (disconnected)", "Phony", "Phony", "", ""},
0N/A {"Constructor", "", "", "", ""},
0N/A {"Create", "Phony", "Phony", "", ""},
0N/A {"Current classes loaded", "", "", "", ""},
0N/A {"Current heap size", "", "", "", ""},
0N/A {"Current value", "PhonyValue", "", "", ""},
0N/A {"Daemon threads", "", "", "", ""},
0N/A {"deadlockAllTab", "", "", "", ""},
0N/A {"deadlockTab", "", "", "", ""},
0N/A {"deadlockTabN", "PhonyInt", "", "", ""},
0N/A {"Description", "", "", "", ""},
0N/A {"Descriptor", "", "", "", ""},
0N/A {"Details", "", "", "", ""},
0N/A {"Detect Deadlock", "", "", "", ""},
0N/A {"Detect Deadlock.mnemonic", "", "", "", ""},
0N/A {"Detect Deadlock.toolTip", "", "", "", ""},
0N/A {"Dimension is not supported:", "", "", "", ""},
0N/A {"Discard chart", "", "", "", ""},
0N/A {"Disconnected. Click to connect.", "", "", "", ""},
0N/A {"Double click to expand/collapse", "", "", "", ""},
0N/A {"Double click to visualize", "", "", "", ""},
0N/A {"DurationDaysHoursMinutes", 0, 13, 54, ""},
0N/A {"DurationDaysHoursMinutes", 1, 13, 54, ""},
0N/A {"DurationDaysHoursMinutes", 2, 13, 54, ""},
0N/A {"DurationDaysHoursMinutes", 1024, 13, 45, ""},
0N/A {"DurationHoursMinutes", 0, 13, "", ""},
0N/A {"DurationHoursMinutes", 1, 0, "", ""},
0N/A {"DurationHoursMinutes", 1, 1, "", ""},
0N/A {"DurationHoursMinutes", 2, 42, "", ""},
0N/A {"DurationMinutes", 0, "", "", ""},
0N/A {"DurationMinutes", 1, "", "", ""},
0N/A {"DurationMinutes", 2, "", "", ""},
0N/A {"DurationSeconds", 0, "", "", ""},
0N/A {"DurationSeconds", 1, "", "", ""},
0N/A {"DurationSeconds", 2, "", "", ""},
0N/A {"Empty array", "", "", "", ""},
0N/A {"Error", "", "", "", ""},
0N/A {"Error: MBeans already exist", "", "", "", ""},
0N/A {"Error: MBeans do not exist", "", "", "", ""},
0N/A {"Event", "", "", "", ""},
0N/A {"Exit", "", "", "", ""},
0N/A {"Exit.mnemonic", "", "", "", ""},
0N/A {"expand", "", "", "", ""},
0N/A {"Fail to load plugin", "", "", "", ""},
0N/A {"FileChooser.fileExists.cancelOption", "", "", "", ""},
0N/A {"FileChooser.fileExists.message", "PhonyFileName", "", "", ""},
0N/A {"FileChooser.fileExists.okOption", "", "", "", ""},
0N/A {"FileChooser.fileExists.title", "", "", "", ""},
0N/A {"FileChooser.savedFile", "PhonyFilePath", "PhonyFileSize", "", ""},
0N/A {"FileChooser.saveFailed.message", "PhonyFilePath", "PhonyMessage", "", ""},
0N/A {"FileChooser.saveFailed.title", "", "", "", ""},
0N/A {"Free physical memory", "", "", "", ""},
0N/A {"Free swap space", "", "", "", ""},
0N/A {"Garbage collector", "", "", "", ""},
0N/A {"GC time", "", "", "", ""},
0N/A {"GC time details", 54, "Phony", 11, ""},
0N/A {"GcInfo", "Phony", -1, 768, ""},
0N/A {"GcInfo", "Phony", 0, 768, ""},
0N/A {"GcInfo", "Phony", 1, 768, ""},
0N/A {"Heap", "", "", "", ""},
0N/A {"Heap Memory Usage", "", "", "", ""},
0N/A {"Help.AboutDialog.accessibleDescription", "", "", "", ""},
0N/A {"Help.AboutDialog.jConsoleVersion", "DummyVersion", "", "", ""},
0N/A {"Help.AboutDialog.javaVersion", "DummyVersion", "", "", ""},
0N/A {"Help.AboutDialog.masthead.accessibleName", "", "", "", ""},
0N/A {"Help.AboutDialog.masthead.title", "", "", "", ""},
0N/A {"Help.AboutDialog.title", "", "", "", ""},
0N/A {"Help.AboutDialog.userGuideLink", "DummyMessage", "", "", ""},
0N/A {"Help.AboutDialog.userGuideLink.mnemonic", "", "", "", ""},
0N/A {"Help.AboutDialog.userGuideLink.url", "DummyURL", "", "", ""},
0N/A {"HelpMenu.About.title", "", "", "", ""},
0N/A {"HelpMenu.About.title.mnemonic", "", "", "", ""},
0N/A {"HelpMenu.UserGuide.title", "", "", "", ""},
0N/A {"HelpMenu.UserGuide.title.mnemonic", "", "", "", ""},
0N/A {"HelpMenu.title", "", "", "", ""},
0N/A {"HelpMenu.title.mnemonic", "", "", "", ""},
0N/A {"Hotspot MBeans...", "", "", "", ""},
0N/A {"Hotspot MBeans....mnemonic", "", "", "", ""},
0N/A {"Hotspot MBeans.dialog.accessibleDescription", "", "", "", ""},
0N/A {"Impact", "", "", "", ""},
0N/A {"Info", "", "", "", ""},
0N/A {"INFO", "", "", "", ""},
0N/A {"Invalid plugin path", "", "", "", ""},
0N/A {"Invalid URL", "", "", "", ""},
0N/A {"Is", "", "", "", ""},
0N/A {"Java Monitoring & Management Console", "", "", "", ""},
0N/A {"Java Virtual Machine", "", "", "", ""},
0N/A {"JConsole: ", "", "", "", ""},
0N/A {"JConsole.accessibleDescription", "", "", "", ""},
0N/A {"JConsole version", "PhonyVersion", "", "", ""},
0N/A {"JIT compiler", "", "", "", ""},
0N/A {"Library path", "", "", "", ""},
0N/A {"Live Threads", "", "", "", ""},
0N/A {"Loaded", "", "", "", ""},
0N/A {"Local Process:", "", "", "", ""},
0N/A {"Local Process:.mnemonic", "", "", "", ""},
0N/A {"Manage Hotspot MBeans in: ", "", "", "", ""},
0N/A {"Management Not Enabled", "", "", "", ""},
0N/A {"Management Will Be Enabled", "", "", "", ""},
0N/A {"Masthead.font", "", "", "", ""},
0N/A {"Max", "", "", "", ""},
0N/A {"Max", "", "", "", ""},
0N/A {"Maximum heap size", "", "", "", ""},
0N/A {"MBeanAttributeInfo", "", "", "", ""},
0N/A {"MBeanInfo", "", "", "", ""},
0N/A {"MBeanNotificationInfo", "", "", "", ""},
0N/A {"MBeanOperationInfo", "", "", "", ""},
0N/A {"MBeans", "", "", "", ""},
0N/A {"MBeansTab.clearNotificationsButton", "", "", "", ""},
0N/A {"MBeansTab.clearNotificationsButton.mnemonic", "", "", "", ""},
0N/A {"MBeansTab.clearNotificationsButton.toolTip", "", "", "", ""},
0N/A {"MBeansTab.compositeNavigationMultiple", 0, 0, "", ""},
0N/A {"MBeansTab.compositeNavigationSingle", "", "", "", ""},
0N/A {"MBeansTab.refreshAttributesButton", "", "", "", ""},
0N/A {"MBeansTab.refreshAttributesButton.mnemonic", "", "", "", ""},
0N/A {"MBeansTab.refreshAttributesButton.toolTip", "", "", "", ""},
0N/A {"MBeansTab.subscribeNotificationsButton", "", "", "", ""},
0N/A {"MBeansTab.subscribeNotificationsButton.mnemonic", "", "", "", ""},
0N/A {"MBeansTab.subscribeNotificationsButton.toolTip", "", "", "", ""},
0N/A {"MBeansTab.tabularNavigationMultiple", 0, 0, "", ""},
0N/A {"MBeansTab.tabularNavigationSingle", "", "", "", ""},
0N/A {"MBeansTab.unsubscribeNotificationsButton", "", "", "", ""},
0N/A {"MBeansTab.unsubscribeNotificationsButton.mnemonic", "", "", "", ""},
0N/A {"MBeansTab.unsubscribeNotificationsButton.toolTip", "", "", "", ""},
0N/A {"Memory", "", "", "", ""},
0N/A {"MemoryPoolLabel", "PhonyMemoryPool", "", "", ""},
0N/A {"MemoryTab.heapPlotter.accessibleName", "", "", "", ""},
0N/A {"MemoryTab.infoLabelFormat", "UsedCount", "CommittedCount", "MaxCount", ""},
0N/A {"MemoryTab.nonHeapPlotter.accessibleName", "", "", "", ""},
0N/A {"MemoryTab.poolChart.aboveThreshold", "Threshold", "", "", ""},
0N/A {"MemoryTab.poolChart.accessibleName", "", "", "", ""},
0N/A {"MemoryTab.poolChart.belowThreshold", "Threshold", "", "", ""},
0N/A {"MemoryTab.poolPlotter.accessibleName", "PhonyMemoryPool", "", "", ""},
0N/A {"Message", "", "", "", ""},
0N/A {"Method successfully invoked", "", "", "", ""},
0N/A {"Monitor locked", "", "", "", ""},
0N/A {"Minimize All", "", "", "", ""},
0N/A {"Minimize All.mnemonic", "", "", "", ""},
0N/A {"Name", "", "", "", ""},
0N/A {"Name and Build", "PhonyName", "PhonyBuild", "", ""},
0N/A {"Name Build and Mode", "PhonyName", "PhonyBuild", "PhonyMode", ""},
0N/A {"Name State", "PhonyName", "PhonyState", "", ""},
0N/A {"Name State LockName", "PhonyName", "PhonyState", "PhonyLock", ""},
0N/A {"Name State LockName LockOwner", "PhonyName", "PhonyState", "PhonyLock", "PhonyOwner"},
0N/A {"New Connection...", "", "", "", ""},
0N/A {"New Connection....mnemonic", "", "", "", ""},
0N/A {"No deadlock detected", "", "", "", ""},
0N/A {"Non-Heap", "", "", "", ""},
0N/A {"Non-Heap Memory Usage", "", "", "", ""},
0N/A {"Notification", "", "", "", ""},
0N/A {"Notification buffer", "", "", "", ""},
0N/A {"Notifications", "", "", "", ""},
0N/A {"NotifTypes", "", "", "", ""},
0N/A {"Number of Loaded Classes", "", "", "", ""},
0N/A {"Number of processors", "", "", "", ""},
0N/A {"Number of Threads", "", "", "", ""},
0N/A {"ObjectName", "", "", "", ""},
0N/A {"Operating System", "", "", "", ""},
0N/A {"Operation", "", "", "", ""},
0N/A {"Operation invocation", "", "", "", ""},
0N/A {"Operation return value", "", "", "", ""},
0N/A {"Operations", "", "", "", ""},
0N/A {"Overview", "", "", "", ""},
0N/A {"OverviewPanel.plotter.accessibleName", "PhonyPlotter", "", "", ""},
0N/A {"Parameter", "", "", "", ""},
0N/A {"Password: ", "", "", "", ""},
0N/A {"Password: .mnemonic", "", "", "", ""},
0N/A {"Password.accessibleName", "", "", "", ""},
0N/A {"Peak", "", "", "", ""},
0N/A {"Perform GC", "", "", "", ""},
0N/A {"Perform GC.mnemonic", "", "", "", ""},
0N/A {"Perform GC.toolTip", "", "", "", ""},
0N/A {"Plotter.accessibleName", "", "", "", ""},
0N/A {"Plotter.accessibleName.keyAndValue", "Key", "Value", "", ""},
0N/A {"Plotter.accessibleName.noData", "", "", "", ""},
0N/A {"Plotter.saveAsMenuItem", "", "", "", ""},
0N/A {"Plotter.saveAsMenuItem.mnemonic", "", "", "", ""},
0N/A {"Plotter.timeRangeMenu", "", "", "", ""},
0N/A {"Plotter.timeRangeMenu.mnemonic", "", "", "", ""},
0N/A {"plot", "", "", "", ""},
0N/A {"Problem adding listener", "", "", "", ""},
0N/A {"Problem displaying MBean", "", "", "", ""},
0N/A {"Problem invoking", "", "", "", ""},
0N/A {"Problem removing listener", "", "", "", ""},
0N/A {"Problem setting attribute", "", "", "", ""},
0N/A {"Process CPU time", "", "", "", ""},
0N/A {"Readable", "", "", "", ""},
0N/A {"Reconnect", "", "", "", ""},
0N/A {"Remote Process:", "", "", "", ""},
0N/A {"Remote Process:.mnemonic", "", "", "", ""},
0N/A {"Remote Process.textField.accessibleName", "", "", "", ""},
0N/A {"remoteTF.usage", "", "", "", ""},
0N/A {"Restore All", "", "", "", ""},
0N/A {"Restore All.mnemonic", "", "", "", ""},
0N/A {"ReturnType", "", "", "", ""},
0N/A {"SeqNum", "", "", "", ""},
0N/A {"Size Bytes", 512, "", "", ""},
0N/A {"Size Gb", 512, "", "", ""},
0N/A {"Size Kb", 512, "", "", ""},
0N/A {"Size Mb", 512, "", "", ""},
0N/A {"Source", "", "", "", ""},
0N/A {"Stack trace", "", "", "", ""},
0N/A {"SummaryTab.headerDateTimeFormat", "", "", "", ""},
0N/A {"SummaryTab.pendingFinalization.label", "", "", "", ""},
0N/A {"SummaryTab.pendingFinalization.value", "ObjectCount", "", "", ""},
0N/A {"SummaryTab.tabName", "", "", "", ""},
0N/A {"SummaryTab.vmVersion", "VMName", "VMVersion", "", ""},
0N/A {"ThreadTab.infoLabelFormat", "LiveCount", "PeakCount", "TotalCount", ""},
0N/A {"ThreadTab.threadInfo.accessibleName", "", "", "", ""},
0N/A {"ThreadTab.threadPlotter.accessibleName", "", "", "", ""},
0N/A {"Threads", "", "", "", ""},
0N/A {"Threshold", "", "", "", ""},
0N/A {"Tile", "", "", "", ""},
0N/A {"Tile.mnemonic", "", "", "", ""},
0N/A {"Time", "", "", "", ""},
0N/A {"Time Range:", "", "", "", ""},
0N/A {"Time Range:.mnemonic", "", "", "", ""},
0N/A {"TimeStamp", "", "", "", ""},
0N/A {"Total classes loaded", "", "", "", ""},
0N/A {"Total classes unloaded", "", "", "", ""},
0N/A {"Total compile time", "", "", "", ""},
0N/A {"Total Loaded", "", "", "", ""},
0N/A {"Total physical memory", "", "", "", ""},
0N/A {"Total swap space", "", "", "", ""},
0N/A {"Total threads started", "", "", "", ""},
0N/A {"Type", "", "", "", ""},
0N/A {"Unavailable", "", "", "", ""},
0N/A {"UNKNOWN", "", "", "", ""},
0N/A {"Unregister", "", "", "", ""},
0N/A {"Uptime", "", "", "", ""},
0N/A {"Usage Threshold", "", "", "", ""},
0N/A {"Used", "", "", "", ""},
0N/A {"Username: ", "", "", "", ""},
0N/A {"Username: .mnemonic", "", "", "", ""},
0N/A {"Username.accessibleName", "", "", "", ""},
0N/A {"UserData", "", "", "", ""},
0N/A {"Value", "", "", "", ""},
0N/A {"Vendor", "", "", "", ""},
0N/A {"Verbose Output", "", "", "", ""},
0N/A {"Verbose Output.toolTip", "", "", "", ""},
0N/A {"visualize", "", "", "", ""},
0N/A {"VM", "", "", "", ""},
0N/A {"VMInternalFrame.accessibleDescription", "", "", "", ""},
0N/A {"VM arguments", "", "", "", ""},
0N/A {"Virtual Machine", "", "", "", ""},
0N/A {"Window", "", "", "", ""},
0N/A {"Window.mnemonic", "", "", "", ""},
0N/A {"Writable", "", "", "", ""},
0N/A {"zz usage text", "PhonyName", "", "", ""},
0N/A };
0N/A //boolean verbose = false;
0N/A boolean verbose = true;
0N/A
0N/A long badLookups = 0;
0N/A System.out.println("Start...");
0N/A for (int ii = 0; ii < testData.length; ii++) {
0N/A String key = (String)testData[ii][0];
0N/A
0N/A if (key.endsWith(".mnemonic")) {
0N/A String baseKey = key.substring(0, key.length() - ".mnemonic".length());
0N/A int mnemonic = Resources.getMnemonicInt(baseKey);
0N/A if (mnemonic == 0) {
0N/A badLookups++;
0N/A System.out.println("****lookup failed for key = " + key);
0N/A } else {
0N/A if (verbose) {
0N/A System.out.println(" mnemonic: " + KeyEvent.getKeyText(mnemonic));
0N/A }
0N/A }
0N/A continue;
0N/A }
0N/A
0N/A String ss = Resources.getText(key,
0N/A testData[ii][1],
0N/A testData[ii][2],
0N/A testData[ii][3],
0N/A testData[ii][4]);
0N/A if (ss.startsWith("missing resource key")) {
0N/A badLookups++;
0N/A System.out.println("****lookup failed for key = " + key);
0N/A } else {
0N/A if (verbose) {
0N/A System.out.println(" " + ss);
0N/A }
0N/A }
0N/A }
0N/A if (badLookups > 0) {
0N/A throw new Error ("Resource lookup failed " + badLookups +
0N/A " time(s); Test failed");
0N/A }
0N/A System.out.println("...Finished.");
0N/A }
0N/A}