User: juhalindfors
Date: 02/03/14 10:09:10
Modified: src/main/test/implementation/loading
LoaderRepositoryTEST.java
Log:
fixed the test that shows class conflict between two different mlets
Revision Changes Path
1.2 +32 -16
jmx/src/main/test/implementation/loading/LoaderRepositoryTEST.java
Index: LoaderRepositoryTEST.java
===================================================================
RCS file:
/cvsroot/jboss/jmx/src/main/test/implementation/loading/LoaderRepositoryTEST.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- LoaderRepositoryTEST.java 5 Feb 2002 12:57:57 -0000 1.1
+++ LoaderRepositoryTEST.java 14 Mar 2002 18:09:09 -0000 1.2
@@ -22,6 +22,7 @@
import javax.management.loading.MLet;
import javax.management.loading.MLetMBean;
+import javax.management.loading.DefaultLoaderRepository;
import org.jboss.mx.util.AgentID;
@@ -32,11 +33,33 @@
super(s);
}
- public void testClassConflictBetweenMLets()
+ public void testClassConflictBetweenMLets() throws Exception
{
// NOTE:
// the urls used here are relative to the location of the build.xml
+ // make sure the classes are loaded from mlet, not system cl
+ String[] classes = { "test.implementation.loading.support.Start",
+ "test.implementation.loading.support.StartMBean",
+ "test.implementation.loading.support.Target",
+ "test.implementation.loading.support.TargetMBean",
+ "test.implementation.loading.support.AClass"
+ };
+
+ for (int i = 0; i < classes.length; ++i)
+ {
+ try
+ {
+ DefaultLoaderRepository.loadClass(classes[i]);
+
+ fail("class " + classes[i] + " was already found in CL repository.");
+ }
+ catch (ClassNotFoundException e)
+ {
+ // expected
+ }
+ }
+
try
{
MBeanServer server = MBeanServerFactory.createMBeanServer();
@@ -49,12 +72,12 @@
server.registerMBean(mlet2, m2Name);
server.invoke(m1Name, "getMBeansFromURL",
- new Object[] {
"file:./src/main/test/implementation/loading/support/mlet/CCTest1.mlet" },
+ new Object[] {
"file:./output/etc/test/implementation/loading/CCTest1.mlet" },
new String[] { String.class.getName() }
);
server.invoke(m2Name, "getMBeansFromURL",
- new Object[] {
"file:./src/main/test/implementation/loading/support/mlet/CCTest2.mlet" },
+ new Object[] {
"file:./output/etc/test/implementation/loading/CCTest2.mlet" },
new String[] { String.class.getName() }
);
@@ -62,24 +85,17 @@
new Object[] { AgentID.get(server) },
new String[] { String.class.getName() }
);
- }
- catch (AssertionFailedError e)
- {
- // defensive: in case assertXXX() or fail() are added later
- throw e;
+
+ fail("Expected to fail due to two different mlet loaders having a class
mismatch.");
}
catch (MBeanException e)
{
- Exception ee = e.getTargetException();
-
- if (ee instanceof ReflectionException)
+ if (e.getTargetException() instanceof ReflectionException)
{
- ((ReflectionException)ee).getTargetException().printStackTrace();
+ // expected, argument type mismatch error since the arg of type AClass
is
+ // loaded by diff mlet loader than the target MBean with AClass in its
sign.
}
- }
- catch (Throwable t)
- {
- fail("Unexpected error: " + t.toString());
+ else throw e;
}
}
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development