01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one
03: * or more contributor license agreements. See the NOTICE file
04: * distributed with this work for additional information
05: * regarding copyright ownership. The ASF licenses this file
06: * to you under the Apache License, Version 2.0 (the
07: * "License"); you may not use this file except in compliance
08: * with the License. You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing,
13: * software distributed under the License is distributed on an
14: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15: * KIND, either express or implied. See the License for the
16: * specific language governing permissions and limitations
17: * under the License.
18: *
19: */
20:
21: package org.apache.harmony.lang.management;
22:
23: import java.util.List;
24:
25: import javax.management.AttributeList;
26: import javax.management.ReflectionException;
27:
28: import org.apache.harmony.lang.management.DynamicMXBeanImpl;
29:
30: public abstract class MultiInstanceDynamicMXBeanImplTestBase extends
31: DynamicMXBeanImplTestBase {
32:
33: protected List<DynamicMXBeanImpl> mbList;
34:
35: public void testInvoke() throws Exception {
36: // Default for DynamicMXBeanImpl that has no operations to invoke...
37: for (DynamicMXBeanImpl mb : mbList) {
38: // No operations to invoke...
39: try {
40: Object retVal = mb.invoke("KissTheRoadOfRoratonga",
41: new Object[] { new Long(7446), new Long(54) },
42: new String[] { "java.lang.Long",
43: "java.lang.Long" });
44: fail("Should have thrown a ReflectionException.");
45: } catch (ReflectionException ignore) {
46: }
47: }// end for
48: }
49:
50: public void testGetAttributesBad() throws Exception {
51: for (DynamicMXBeanImpl mb : mbList) {
52: String[] badNames = { "Cork", "Galway" };
53: AttributeList attributes = mb.getAttributes(badNames);
54: assertNotNull(attributes);
55: // No attributes will have been returned.
56: assertTrue(attributes.size() == 0);
57:
58: }// end for
59: }
60: }
|