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 javax.management.AttributeList;
24: import javax.management.ReflectionException;
25:
26: import org.apache.harmony.lang.management.DynamicMXBeanImpl;
27:
28: public abstract class SingleInstanceDynamicMXBeanImplTestBase extends
29: DynamicMXBeanImplTestBase {
30:
31: protected DynamicMXBeanImpl mb;
32:
33: public void testInvoke() throws Exception {
34: // Default for DynamicMXBeanImpl that has no operations to invoke...
35: try {
36: Object retVal = mb.invoke("KissTheBlarney", new Object[] {
37: new Long(7446), new Long(54) }, new String[] {
38: "java.lang.Long", "java.lang.Long" });
39: fail("Should have thrown a ReflectionException.");
40: } catch (ReflectionException ignore) {
41: }
42: }
43:
44: public void testGetAttributesBad() throws Exception {
45: // A failing scenario - pass in an attribute that is not part of
46: // the management interface.
47: String[] badNames = { "Cork", "Galway" };
48: AttributeList attributes = mb.getAttributes(badNames);
49: assertNotNull(attributes);
50: // No attributes will have been returned.
51: assertTrue(attributes.size() == 0);
52: }
53: }
|