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 *
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.
22 */
23
24 /*
25 * @test
26 * @bug 4982289
27 * @summary Test MemoryUsage.from() method to return a valid MemoryUsage
28 * or throw exception if the input CompositeData is invalid.
29 * @author Mandy Chung
30 *
31 * @modules java.management
32 * @build MemoryUsageCompositeData
33 * @run main MemoryUsageCompositeData
34 */
35
36 import javax.management.openmbean.*;
37 import java.lang.management.MemoryUsage;
38
39 public class MemoryUsageCompositeData {
40 public static void main(String[] argv) throws Exception {
41 createGoodCompositeData();
42 badTypeCompositeData();
43 badNameCompositeData();
44 System.out.println("Test passed");
45 }
46
47 public static void createGoodCompositeData() throws Exception {
48 final int K = 1024;
49 // these values are synchronized with the item names
50 final Object[] values = {
51 new Long(5 * K), // committed
|
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 *
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.
22 */
23
24 /*
25 * @test
26 * @bug 4982289
27 * @summary Test MemoryUsage.from() method to return a valid MemoryUsage
28 * or throw exception if the input CompositeData is invalid.
29 * @author Mandy Chung
30 *
31 * @build MemoryUsageCompositeData
32 * @run main MemoryUsageCompositeData
33 */
34
35 import javax.management.openmbean.*;
36 import java.lang.management.MemoryUsage;
37
38 public class MemoryUsageCompositeData {
39 public static void main(String[] argv) throws Exception {
40 createGoodCompositeData();
41 badTypeCompositeData();
42 badNameCompositeData();
43 System.out.println("Test passed");
44 }
45
46 public static void createGoodCompositeData() throws Exception {
47 final int K = 1024;
48 // these values are synchronized with the item names
49 final Object[] values = {
50 new Long(5 * K), // committed
|