/** * Compare this MBeanParameterInfo to another. * * @param o the object to compare to. * @return true if and only if <code>o</code> is an MBeanParameterInfo such that its {@link * #getName()}, {@link #getType()}, {@link #getDescriptor()}, and {@link #getDescription()} * values are equal (not necessarily identical) to those of this MBeanParameterInfo. */ public boolean equals(Object o) { if (o == this) return true; if (!(o instanceof MBeanParameterInfo)) return false; MBeanParameterInfo p = (MBeanParameterInfo) o; return (Objects.equals(p.getName(), getName()) && Objects.equals(p.getType(), getType()) && Objects.equals(p.getDescription(), getDescription()) && Objects.equals(p.getDescriptor(), getDescriptor())); }
/** * Tests correct MBean interface. * * @throws Exception Thrown if test fails. */ public void testCorrectMBeanInfo() throws Exception { StandardMBean mbean = new IgniteStandardMXBean(new GridMBeanImplementation(), GridMBeanInterface.class); MBeanInfo info = mbean.getMBeanInfo(); assert info.getDescription().equals("MBeanDescription.") == true; assert info.getOperations().length == 2; for (MBeanOperationInfo opInfo : info.getOperations()) { if (opInfo.getDescription().equals("MBeanOperation.")) assert opInfo.getSignature().length == 2; else { assert opInfo.getDescription().equals("MBeanSuperOperation.") == true; assert opInfo.getSignature().length == 1; } } for (MBeanParameterInfo paramInfo : info.getOperations()[0].getSignature()) { if (paramInfo.getName().equals("ignored")) assert paramInfo.getDescription().equals("MBeanOperationParameter1.") == true; else { assert paramInfo.getName().equals("someData") == true; assert paramInfo.getDescription().equals("MBeanOperationParameter2.") == true; } } assert info.getAttributes().length == 4 : "Expected 4 attributes but got " + info.getAttributes().length; for (MBeanAttributeInfo attrInfo : info.getAttributes()) { if (attrInfo.isWritable() == false) { assert (attrInfo.getDescription().equals("MBeanReadonlyGetter.") == true || attrInfo.getDescription().equals("MBeanROGetter.")); } else { assert (attrInfo.getDescription().equals("MBeanWritableGetter.") == true || attrInfo.getDescription().equals("MBeanWritableIsGetter.")); } } }