Methods Summary |
---|
public static void | main(java.lang.String[] args)
junit.textui.TestRunner.run(suite());
|
protected void | setUp()
mrh = MonitoringRegistrationHelper.getInstance();
|
public static junit.framework.Test | suite()
TestSuite suite = new TestSuite(MonitoringRegistrationHelperTest.class);
return suite;
|
protected void | tearDown()
|
public void | testCreation()
assertNotNull(mrh);
|
public void | testRegisterStats()
Stats stats = new S1ASJVMStatsImplMock();
try{
boolean done = mrh.registerStats(stats, "JVMStats");
assertTrue(done);
}catch(Exception e){
e.getLocalizedMessage();
}
|
public void | testRegisteredMBean()
Stats stats = new S1ASJVMStatsImplMock();
try{
boolean done = mrh.registerStats(stats, "JVMStats");
assertTrue(done);
MBeanServer server = (MBeanServer) (MBeanServerFactory.findMBeanServer(null)).get(0);
assertNotNull(server);
ObjectName obj = new ObjectName("defaultDomain:name=JVMStats,type=statsMonitor");
MBeanInfo mInfo = (MBeanInfo)server.getMBeanInfo(obj);
assertNotNull(mInfo);
MBeanAttributeInfo[] attrInfo = mInfo.getAttributes();
assertNotNull(attrInfo);
for(int i=0; i<attrInfo.length;i++){
String attr = attrInfo[i].getName();
System.out.println("getting attribute:"+attr);
Object n = server.getAttribute(obj,attr);
try{
assertEquals(Long.class, n.getClass());
}
catch(Error ex){
ex.getLocalizedMessage();
assertEquals(String.class, n.getClass());
}
catch(Exception e){
assertNull(n);
}
}
}
catch(Exception ex){
ex.printStackTrace();
assertEquals(NullPointerException.class, ex.getClass());
}
|
public void | testUnregisterStats()
Stats stats = new S1ASJVMStatsImplMock();
try{
boolean done = mrh.registerStats(stats, "JVMStats");
assertTrue(done);
done = mrh.unregisterStats("JVMStats");
assertTrue(done);
}catch(Exception e){
e.getLocalizedMessage();
}
|