User: juhalindfors
  Date: 02/02/20 22:47:23

  Added:       src/main/test/implementation/modelmbean ModelMBeanSUITE.java
                        XMBeanTEST.java
  Log:
  these fail for now til we get the invocation chain back in line
  
  Revision  Changes    Path
  1.1                  jmx/src/main/test/implementation/modelmbean/ModelMBeanSUITE.java
  
  Index: ModelMBeanSUITE.java
  ===================================================================
  /*
   * JBoss, the OpenSource J2EE webOS
   *
   * Distributable under LGPL license.
   * See terms of license at gnu.org.
   */
  
  package test.implementation.modelmbean;
  
  import junit.framework.Test;
  import junit.framework.TestSuite;
  
  public class ModelMBeanSUITE extends TestSuite
  {
     public static void main(String[] args)
     {
        junit.textui.TestRunner.run(suite());
     }
  
     public static Test suite()
     {
        TestSuite suite = new TestSuite("JBossMX Model MBean Tests");
  
        suite.addTest(new TestSuite(XMBeanTEST.class));
        
        return suite;
     }
  
  }
  
  
  
  1.1                  jmx/src/main/test/implementation/modelmbean/XMBeanTEST.java
  
  Index: XMBeanTEST.java
  ===================================================================
  /*
   * JBoss, the OpenSource J2EE webOS
   *
   * Distributable under LGPL license.
   * See terms of license at gnu.org.
   */
  
  package test.implementation.modelmbean;
  
  import java.net.URL;
  
  import junit.framework.TestCase;
  import junit.framework.AssertionFailedError;
  
  import javax.management.Attribute;
  import javax.management.MBeanServer;
  import javax.management.MBeanServerFactory;
  import javax.management.ObjectName;
  
  import org.jboss.mx.modelmbean.XMBean;
  
  import test.implementation.modelmbean.support.User;
  
  /**
   * Here are some basic XMBean tests, mainly to demonstrate the use of the
   * XMBean class and the MBean creation (this is the doc ;)
   *
   * @author  <a href="mailto:[EMAIL PROTECTED]";>Juha Lindfors</a>.
   * @version $Revision: 1.1 $
   */
  public class XMBeanTEST extends TestCase
  {
     public XMBeanTEST(String s)
     {
        super(s);
     }
  
     public void testCreateXMBean()
     {
        try 
        {
           MBeanServer server = MBeanServerFactory.createMBeanServer();
           XMBean mmb = new XMBean(new User(), 
"file:./src/main/test/implementation/modelmbean/support/xml/UserManagementInterface.xml");
  
           server.registerMBean(mmb, new ObjectName(":test=test"));     
           
           assertTrue(server.isRegistered(new ObjectName(":test=test")));
           
           server.setAttribute(new ObjectName(":test=test"), new Attribute("Name", 
"Juha"));
           
           assertTrue(server.getAttribute(new ObjectName(":test=test"), 
"Name").equals("Juha"));
        }
        catch (AssertionFailedError e)
        {
           // defensive: in case assertXXX() or fail() are later added
           throw e;
        }
        catch (Throwable t)
        {
           t.printStackTrace();
           fail("Unexpected error: " + t.toString());
        }
     }
     
  }
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to