mx4j/src/test/test/javax/management DynamicMBeanFunctionalityTest.java,1.8,1.9
Simone Bordet <[email protected]> Sat, 30 Oct 2004 17:09:41 +0000
| Newsgroups | gmane.comp.java.mx4j.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/mx4j/mx4j/src/test/test/javax/management
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15136/src/test/test/javax/management
Modified Files:
DynamicMBeanFunctionalityTest.java
Log Message:
Fixed broken test as a result of a bug fix
Index: DynamicMBeanFunctionalityTest.java
===================================================================
RCS file: /cvsroot/mx4j/mx4j/src/test/test/javax/management/DynamicMBeanFunctionalityTest.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** DynamicMBeanFunctionalityTest.java 4 Sep 2004 15:44:42 -0000 1.8
--- DynamicMBeanFunctionalityTest.java 30 Oct 2004 17:09:38 -0000 1.9
***************
*** 17,23 ****
import javax.management.ObjectName;
import javax.management.RuntimeMBeanException;
- import javax.management.RuntimeOperationsException;
! import junit.framework.TestCase;
import test.javax.management.support.MBeanDynamic;
--- 17,22 ----
import javax.management.ObjectName;
import javax.management.RuntimeMBeanException;
! import test.MX4JTestCase;
import test.javax.management.support.MBeanDynamic;
***************
*** 26,30 ****
* @version $Revision$
*/
! public class DynamicMBeanFunctionalityTest extends TestCase
{
private MBeanServer m_server;
--- 25,29 ----
* @version $Revision$
*/
! public class DynamicMBeanFunctionalityTest extends MX4JTestCase
{
private MBeanServer m_server;
***************
*** 54,69 ****
AttributeList list = null;
! System.out.print("Retrieving attributes of a dynamic mbean: no attributes requested... ");
! try
! {
! list = m_server.getAttributes(m_name, new String[0]);
! fail("No attributes requested");
! }
! catch (RuntimeOperationsException x)
! {
! }
! System.out.println("OK");
- System.out.print("Retrieving attributes of a dynamic mbean: non-existing attribute requested... ");
list = m_server.getAttributes(m_name, new String[]{"doesNotExist"});
if (list.size() != 0)
--- 53,59 ----
AttributeList list = null;
! list = m_server.getAttributes(m_name, new String[0]);
! assertEquals(list.size(), 0);
list = m_server.getAttributes(m_name, new String[]{"doesNotExist"});
if (list.size() != 0)
***************
*** 71,79 ****
fail("Attribute does not exist");
}
- System.out.println("OK");
String attributeName = "DynamicAttribute1";
- System.out.print("Retrieving attributes of a dynamic mbean: existing attribute requested... ");
list = m_server.getAttributes(m_name, new String[]{attributeName});
if (list.size() != 1 && ((Attribute)list.get(0)).getName().equals(attributeName))
--- 61,67 ----
***************
*** 81,85 ****
fail("Attribute exists");
}
- System.out.println("OK");
}
--- 69,72 ----
***************
*** 88,104 ****
String attributeName = "DynamicAttribute1";
- System.out.print("Retrieving attribute value: ");
Object valueBefore = m_server.getAttribute(m_name, attributeName);
- System.out.println(valueBefore);
- System.out.print("Setting attribute value... ");
Object newValue = "newValue";
Attribute attribute = new Attribute(attributeName, newValue);
m_server.setAttribute(m_name, attribute);
- System.out.println("OK");
- System.out.print("Retrieving attribute value: ");
Object valueAfter = m_server.getAttribute(m_name, attributeName);
- System.out.println(valueAfter);
if (valueAfter.equals(valueBefore) || !valueAfter.equals(newValue))
{
--- 75,85 ----
***************
*** 114,118 ****
Object value2Before = m_server.getAttribute(m_name, attributeName2);
AttributeList changeThese = new AttributeList();
- System.out.print("Setting attributes with empty AttributeList... ");
AttributeList list = m_server.setAttributes(m_name, changeThese);
if (list.size() != 0)
--- 95,98 ----
***************
*** 124,131 ****
fail("Attribute was not changed");
}
- System.out.println("OK");
Attribute attr = new Attribute(attributeName2, "Value2");
changeThese.add(attr);
- System.out.print("Setting attributes with one-element-AttributeList... ");
list = m_server.setAttributes(m_name, changeThese);
if (list.size() != 1)
--- 104,109 ----
***************
*** 143,147 ****
fail("Attribute was not changed");
}
- System.out.println("OK");
}
--- 121,124 ----
***************
*** 151,155 ****
Object value1 = m_server.getAttribute(m_name, attributeName1);
- System.out.print("Testing operation invocation... ");
Boolean result = (Boolean)m_server.invoke(m_name, "dynamicOperation", new Object[]{"dummy"}, new String[]{"java.lang.String"});
if (result.booleanValue())
--- 128,131 ----
***************
*** 162,177 ****
fail("Operation does not work");
}
- System.out.println("OK");
- }
-
- public void testPublicInterface() throws Exception
- {
- // Tests whether a MBean is acceptable as long as the public interface is public
- // Checks compliance with p34 of JMX 1.2 specification
- /*ObjectName m_name = new ObjectName(":type=dynamic,class=protected");
- m_server.createMBean("test.javax.management.support.PrivateMBeanDynamic", m_name);
-
- assertTrue(m_server.isRegistered(m_name));
- m_server.unregisterMBean(m_name);*/
}
--- 138,141 ----
***************
*** 188,192 ****
catch (NotCompliantMBeanException x)
{
- // success
}
}
--- 152,155 ----
***************
*** 206,210 ****
catch (RuntimeMBeanException x)
{
- // success
}
}
--- 169,172 ----
***************
*** 221,225 ****
catch (JMRuntimeException x)
{
- assertTrue(true); // success
}
}
--- 183,186 ----
-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click