User: juhalindfors
  Date: 02/02/05 04:57:57

  Added:       src/main/test/implementation/loading
                        LoaderRepositoryTEST.java LoadingSUITE.java
  Log:
  test for demonstrating class conflict between two mlets
  
  Revision  Changes    Path
  1.1                  
jmx/src/main/test/implementation/loading/LoaderRepositoryTEST.java
  
  Index: LoaderRepositoryTEST.java
  ===================================================================
  /*
   * JBoss, the OpenSource J2EE webOS
   *
   * Distributable under LGPL license.
   * See terms of license at gnu.org.
   */
  
  package test.implementation.loading;
  
  import junit.framework.TestCase;
  import junit.framework.AssertionFailedError;
  
  import javax.management.MBeanServer;
  import javax.management.MBeanServerFactory;
  import javax.management.ObjectName;
  import javax.management.Attribute;
  import javax.management.ServiceNotFoundException;
  import javax.management.MBeanException;
  import javax.management.ReflectionException;
  import javax.management.RuntimeErrorException;
  import javax.management.RuntimeMBeanException;
  
  import javax.management.loading.MLet;
  import javax.management.loading.MLetMBean;
  
  import org.jboss.mx.util.AgentID;
  
  public class LoaderRepositoryTEST extends TestCase
  {
     public LoaderRepositoryTEST(String s)
     {
        super(s);
     }
  
     public void testClassConflictBetweenMLets()
     {
        // NOTE:
        // the urls used here are relative to the location of the build.xml
   
        try
        {
           MBeanServer server = MBeanServerFactory.createMBeanServer();
           MLet mlet1 = new MLet();
           MLet mlet2 = new MLet();
           ObjectName m1Name = new ObjectName(":name=mlet1");
           ObjectName m2Name = new ObjectName(":name=mlet2");
           
           server.registerMBean(mlet1, m1Name);
           server.registerMBean(mlet2, m2Name);
           
           server.invoke(m1Name, "getMBeansFromURL",
           new Object[] { 
"file:./src/main/test/implementation/loading/support/mlet/CCTest1.mlet" },
           new String[] { String.class.getName() }
           );
           
           server.invoke(m2Name, "getMBeansFromURL",
           new Object[] { 
"file:./src/main/test/implementation/loading/support/mlet/CCTest2.mlet" },
           new String[] { String.class.getName() }
           );
           
           server.invoke(new ObjectName(":name=Start"), "startOp", 
           new Object[] { AgentID.get(server) },
           new String[] { String.class.getName() }
           );
        }
        catch (AssertionFailedError e)
        {
           // defensive: in case assertXXX() or fail() are added later
           throw e;
        }
        catch (MBeanException e)
        {
           Exception ee = e.getTargetException();
           
           if (ee instanceof ReflectionException)
           {
              ((ReflectionException)ee).getTargetException().printStackTrace();
           }
        }
        catch (Throwable t)
        {
           fail("Unexpected error: " + t.toString());
        }
     }
    
  }
  
  
  
  1.1                  jmx/src/main/test/implementation/loading/LoadingSUITE.java
  
  Index: LoadingSUITE.java
  ===================================================================
  /*
   * JBoss, the OpenSource J2EE webOS
   *
   * Distributable under LGPL license.
   * See terms of license at gnu.org.
   */
  
  package test.implementation.loading;
  
  import junit.framework.Test;
  import junit.framework.TestSuite;
  
  public class LoadingSUITE extends TestSuite
  {
     public static void main(String[] args)
     {
        junit.textui.TestRunner.run(suite());
     }
  
     public static Test suite()
     {
        TestSuite suite = new TestSuite("JBossMX Loader Tests");
  
        suite.addTest(new TestSuite(LoaderRepositoryTEST.class));
        
        return suite;
     }
  
  }
  
  
  

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

Reply via email to