mx4j/src/test/test/javax/management MBeanComplianceTest.java,1.5,1.6

[email protected]
Newsgroups gmane.comp.java.mx4j.cvs
Message-ID <[email protected]>
Update of /cvsroot/mx4j/mx4j/src/test/test/javax/management
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29151/test/test/javax/management

Modified Files:
	MBeanComplianceTest.java 
Log Message:
Fixed the test case based on the new API for MBeanMetaData and MBeanIntrospector

Index: MBeanComplianceTest.java
===================================================================
RCS file: /cvsroot/mx4j/mx4j/src/test/test/javax/management/MBeanComplianceTest.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** MBeanComplianceTest.java	24 Feb 2004 15:13:24 -0000	1.5
--- MBeanComplianceTest.java	25 Feb 2004 16:44:18 -0000	1.6
***************
*** 10,14 ****
  
  import java.lang.reflect.Constructor;
- import java.lang.reflect.Field;
  import java.lang.reflect.Method;
  import java.util.ArrayList;
--- 10,13 ----
***************
*** 17,20 ****
--- 16,20 ----
  
  import mx4j.MX4JSystemKeys;
+ import mx4j.server.MBeanIntrospector;
  import mx4j.server.MBeanMetaData;
  import test.MX4JTestCase;
***************
*** 27,31 ****
  public class MBeanComplianceTest extends MX4JTestCase
  {
!    private Object m_introspector;
  
     public MBeanComplianceTest(String s)
--- 27,31 ----
  public class MBeanComplianceTest extends MX4JTestCase
  {
!    private MBeanIntrospector introspector;
  
     public MBeanComplianceTest(String s)
***************
*** 38,51 ****
        String property = MX4JSystemKeys.MX4J_STRICT_MBEAN_INTERFACE;
        System.setProperty(property, "no");
! 
!       Class cls = getClass().getClassLoader().loadClass("mx4j.server.MBeanIntrospector");
!       Constructor ctor = cls.getDeclaredConstructor(new Class[0]);
!       ctor.setAccessible(true);
!       m_introspector = ctor.newInstance(new Object[0]);
     }
  
     protected void tearDown() throws Exception
     {
!       m_introspector = null;
     }
  
--- 38,47 ----
        String property = MX4JSystemKeys.MX4J_STRICT_MBEAN_INTERFACE;
        System.setProperty(property, "no");
!       introspector = new MBeanIntrospector();
     }
  
     protected void tearDown() throws Exception
     {
!       introspector = null;
     }
  
***************
*** 61,67 ****
     {
        Object metadata = createMBeanMetaData(mbean);
!       Method method = m_introspector.getClass().getDeclaredMethod("testCompliance", new Class[]{metadata.getClass()});
        method.setAccessible(true);
!       Boolean value = (Boolean)method.invoke(m_introspector, new Object[]{metadata});
        return value.booleanValue();
     }
--- 57,63 ----
     {
        Object metadata = createMBeanMetaData(mbean);
!       Method method = introspector.getClass().getDeclaredMethod("testCompliance", new Class[]{MBeanMetaData.class});
        method.setAccessible(true);
!       Boolean value = (Boolean)method.invoke(introspector, new Object[]{metadata});
        return value.booleanValue();
     }
***************
*** 70,76 ****
     {
        MBeanMetaData metadata = createMBeanMetaData(mbean);
!       Method method = m_introspector.getClass().getDeclaredMethod("testCompliance", new Class[]{metadata.getClass()});
        method.setAccessible(true);
!       Boolean value = (Boolean)method.invoke(m_introspector, new Object[]{metadata});
        return value.booleanValue() && metadata.isMBeanStandard() && !metadata.isMBeanDynamic() && metadata.getMBeanInterface() != null;
     }
--- 66,72 ----
     {
        MBeanMetaData metadata = createMBeanMetaData(mbean);
!       Method method = introspector.getClass().getDeclaredMethod("testCompliance", new Class[]{MBeanMetaData.class});
        method.setAccessible(true);
!       Boolean value = (Boolean)method.invoke(introspector, new Object[]{metadata});
        return value.booleanValue() && metadata.isMBeanStandard() && !metadata.isMBeanDynamic() && metadata.getMBeanInterface() != null;
     }
***************
*** 79,85 ****
     {
        MBeanMetaData metadata = createMBeanMetaData(mbean);
!       Method method = m_introspector.getClass().getDeclaredMethod("testCompliance", new Class[]{metadata.getClass()});
        method.setAccessible(true);
!       Boolean value = (Boolean)method.invoke(m_introspector, new Object[]{metadata});
        return value.booleanValue() && !metadata.isMBeanStandard() && metadata.isMBeanDynamic();
     }
--- 75,81 ----
     {
        MBeanMetaData metadata = createMBeanMetaData(mbean);
!       Method method = introspector.getClass().getDeclaredMethod("testCompliance", new Class[]{MBeanMetaData.class});
        method.setAccessible(true);
!       Boolean value = (Boolean)method.invoke(introspector, new Object[]{metadata});
        return value.booleanValue() && !metadata.isMBeanStandard() && metadata.isMBeanDynamic();
     }
***************
*** 87,97 ****
     private Class getStandardManagementInterface(Object mbean) throws Exception
     {
!       Object metadata = createMBeanMetaData(mbean);
!       Method method = m_introspector.getClass().getDeclaredMethod("introspect", new Class[]{metadata.getClass()});
!       method.setAccessible(true);
!       method.invoke(m_introspector, new Object[]{metadata});
!       Field field = metadata.getClass().getDeclaredField("management");
!       field.setAccessible(true);
!       return (Class)field.get(metadata);
     }
  
--- 83,89 ----
     private Class getStandardManagementInterface(Object mbean) throws Exception
     {
!       MBeanMetaData metadata = createMBeanMetaData(mbean);
!       introspector.introspect(metadata);
!       return metadata.getMBeanInterface();
     }
  



-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.