User: squirest
Date: 02/01/18 09:28:41
Added: src/main/test/compliance/notcompliant NCMBeanSUITE.java
NCMBeanTEST.java NoConstructor.java
NoConstructorMBean.java
Log:
added testcases for mbean inheritance
added testcases for some types of NotCompliant MBeans
Revision Changes Path
1.1 jmx/src/main/test/compliance/notcompliant/NCMBeanSUITE.java
Index: NCMBeanSUITE.java
===================================================================
/*
* JBoss, the OpenSource J2EE webOS
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package test.compliance.notcompliant;
import junit.framework.Test;
import junit.framework.TestSuite;
public class NCMBeanSUITE extends TestSuite
{
public static void main(String[] args)
{
junit.textui.TestRunner.run(suite());
}
public static Test suite()
{
TestSuite suite = new TestSuite("All Not Compliant MBean Tests");
suite.addTest(new TestSuite(NCMBeanTEST.class));
return suite;
}
}
1.1 jmx/src/main/test/compliance/notcompliant/NCMBeanTEST.java
Index: NCMBeanTEST.java
===================================================================
/*
* JBoss, the OpenSource J2EE webOS
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package test.compliance.notcompliant;
import junit.framework.TestCase;
import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
import javax.management.MBeanServerFactory;
import javax.management.MBeanServer;
import javax.management.NotCompliantMBeanException;
import javax.management.ObjectInstance;
import java.util.Hashtable;
import test.compliance.notcompliant.support.OverloadedAttribute1;
import test.compliance.notcompliant.support.OverloadedAttribute3;
import test.compliance.notcompliant.support.OverloadedAttribute2;
import test.compliance.notcompliant.support.DynamicAndStandard;
public class NCMBeanTEST extends TestCase
{
public NCMBeanTEST(String s)
{
super(s);
}
public void testOverloadedAttribute1()
{
registerAndTest(new OverloadedAttribute1());
}
public void testOverloadedAttribute2()
{
registerAndTest(new OverloadedAttribute2());
}
public void testOverloadedAttribute3()
{
registerAndTest(new OverloadedAttribute3());
}
public void testMixedDynamicStandard()
{
registerAndTest(new DynamicAndStandard());
}
public void testNoConstructor()
{
registerAndTest(new NoConstructor());
}
private void registerAndTest(Object mbean)
{
try
{
MBeanServer server = MBeanServerFactory.newMBeanServer();
server.registerMBean(mbean, new ObjectName("test:foo=bar"));
fail("expected a NotCompliantMBeanException for " +
mbean.getClass().getName());
}
catch (NotCompliantMBeanException e)
{
// this is what we want
}
catch (Exception e)
{
fail("unexpected exception when registering " + mbean.getClass().getName()
+ ": " + e.getMessage());
}
}
}
1.1 jmx/src/main/test/compliance/notcompliant/NoConstructor.java
Index: NoConstructor.java
===================================================================
/*
* JBoss, the OpenSource J2EE webOS
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package test.compliance.notcompliant;
public class NoConstructor
{
NoConstructor()
{
}
}
1.1
jmx/src/main/test/compliance/notcompliant/NoConstructorMBean.java
Index: NoConstructorMBean.java
===================================================================
/*
* JBoss, the OpenSource J2EE webOS
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package test.compliance.notcompliant;
public interface NoConstructorMBean
{
}
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development