User: juhalindfors
  Date: 02/03/17 02:17:47

  Modified:    src/main/test/compliance/loading MLetTEST.java
  Log:
  
  
  Revision  Changes    Path
  1.6       +27 -38    jmx/src/main/test/compliance/loading/MLetTEST.java
  
  Index: MLetTEST.java
  ===================================================================
  RCS file: /cvsroot/jboss/jmx/src/main/test/compliance/loading/MLetTEST.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- MLetTEST.java     14 Mar 2002 18:14:45 -0000      1.5
  +++ MLetTEST.java     17 Mar 2002 10:17:47 -0000      1.6
  @@ -249,54 +249,43 @@
         }
      }         
      
  -   public void testArchiveListInMLet()
  +   public void testArchiveListInMLet() throws Exception
      {
         // NOTE:
         // the urls used here are relative to the location of the build.xml
         
         final String MLET_URL = 
"file:./output/etc/test/compliance/loading/ArchiveList.mlet";
  +   
  +      MBeanServer server = MBeanServerFactory.createMBeanServer();
  +      MLet mlet = new MLet();
  +      ObjectName name = new ObjectName("test:name=mlet");
  +      server.registerMBean(mlet, name);
         
  -      try 
  -      {
  -         MBeanServer server = MBeanServerFactory.createMBeanServer();
  -         MLet mlet = new MLet();
  -         ObjectName name = new ObjectName("test:name=mlet");
  -         server.registerMBean(mlet, name);
  -         
  -         server.invoke(name, "getMBeansFromURL",
  -         new Object[] { MLET_URL },
  -         new String[] { String.class.getName() }
  -         );
  -         
  -         Class c = null;
  -         
  -         try
  -         {
  -            c  = mlet.loadClass("test.compliance.loading.support.AClass");
  -         }
  -         catch (ClassNotFoundException e)
  -         {
  -            URL[] urls = mlet.getURLs();
  -            fail("FAILS IN RI: SUN JMX RI builds a malformed URL from an MLet text 
file URL '" +
  -                 MLET_URL + "' resulting into MLET codebase URL '" + urls[0] + "' 
and therefore fails " +
  -                 "to load the required classes from the Java archive.");            
  -         }
  -         
  -         Object o = c.newInstance();
  -         
  -         server.setAttribute(new ObjectName("test:name=AnotherTrivial"), new 
Attribute("Something", o));
  -         o = server.getAttribute(new ObjectName("test:name=AnotherTrivial"), 
"Something");
  -         
  -         assertTrue(o.getClass().isAssignableFrom(c));
  -      }
  -      catch (AssertionFailedError e)
  +      server.invoke(name, "getMBeansFromURL",
  +      new Object[] { MLET_URL },
  +      new String[] { String.class.getName() }
  +      );
  +      
  +      Class c = null;
  +      
  +      try
         {
  -         throw e;
  +         c  = mlet.loadClass("test.compliance.loading.support.AClass");
         }
  -      catch (Throwable t)
  +      catch (ClassNotFoundException e)
         {
  -         fail("Unexpected error: " + t.toString());
  +         URL[] urls = mlet.getURLs();
  +         fail("FAILS IN RI: SUN JMX RI builds a malformed URL from an MLet text 
file URL '" +
  +              MLET_URL + "' resulting into MLET codebase URL '" + urls[0] + "' and 
therefore fails " +
  +              "to load the required classes from the Java archive.");            
         }
  +      
  +      Object o = c.newInstance();
  +      
  +      server.setAttribute(new ObjectName("test:name=AnotherTrivial"), new 
Attribute("Something", o));
  +      o = server.getAttribute(new ObjectName("test:name=AnotherTrivial"), 
"Something");
  +      
  +      assertTrue(o.getClass().isAssignableFrom(c));
      }
      
      public void testUnexpectedEndOfFile()
  
  
  

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

Reply via email to