/**
* Verify that returned value of invoked method never retrieves value from
* cache if currencyTimeLimit is not defended in descriptor of
* ModelMBeanOperationInfo.
* <p>
* Instructions are the same as in testNegative.
*/
public Result testNotPresent() throws Exception {
Method method = class1.getDeclaredMethod("simpleMethod", null);
ModelMBeanOperationInfo operationInfo1 = new ModelMBeanOperationInfo(
"description", method);
ModelMBeanInfoSupport beanInfoSupport = new ModelMBeanInfoSupport(
class1.getName(), "description", null, null,
new ModelMBeanOperationInfo[] { operationInfo1 }, null);
RequiredModelMBean requiredModelMBean = new RequiredModelMBean(
beanInfoSupport);
requiredModelMBean.setManagedResource(this, "ObjectReference");
ObjectName objectName = new ObjectName("domain", "name", "simple name");
MBeanServer server = MBeanServerFactory.createMBeanServer();
server.registerMBean(requiredModelMBean, objectName);
Object value = server.invoke(objectName, method.getName(), null, null);
assertEquals(value, returnedObject);
assertTrue(isInvokedMethod());
ModelMBeanOperationInfo operationInfo2 = (ModelMBeanOperationInfo)server
.getMBeanInfo(objectName).getOperations()[0];
assertTrue(operationInfo1 == operationInfo2);
value = server.invoke(objectName, method.getName(), null, null);
assertEquals(value, returnedObject);
assertTrue(isInvokedMethod());
return result();
}
InvocationTest.java 文件源码
java
阅读 28
收藏 0
点赞 0
评论 0
项目:freeVM
作者:
评论列表
文章目录