Methods Summary |
---|
private void | createListeners()
final int nj = 2;
jvml = new MonitoringLevelListener[nj];
jvml[0] = new JvmListener();
jvml[1] = new JvmListener();
final int ne = 3;
ejbl = new MonitoringLevelListener[ne];
ejbl[0] = new EjbListener();
ejbl[1] = new EjbListener();
ejbl[2] = new EjbListener();
|
public static void | main(java.lang.String[] args)
junit.textui.TestRunner.run(suite());
//junit.swingui.TestRunner.run(suite());
|
private void | nyi()
fail("Not yet implemented");
|
protected void | setUp()
|
public static junit.framework.Test | suite()
TestSuite suite = new TestSuite(ValueListMapTest.class);
return suite;
|
protected void | tearDown()
|
public void | testAddOneListenerForTwoTypes()
final Map m = new ValueListMap();
m.put(MonitoredObjectType.JVM, jvml[0]);
m.put(MonitoredObjectType.EJB, jvml[0]);
//now there should be two keys created
assertEquals(m.keySet().size(), 2);
//removed Collection should also contain 2 elements.
final Collection removed = (Collection) m.remove(jvml[0]); //It is a collection
assertEquals(removed.size(), 2);
final Iterator it = removed.iterator();
while (it.hasNext()) {
assertSame(jvml[0], it.next());
}
|
public void | testCreateMap()
final Map m = new ValueListMap();
|
public void | testInvalidPut()
try {
final Map m = new ValueListMap(); //value with listener class.
final String key = "key1";
final String val = "Invalid Value"; //attempt to put a value with String class.
m.put(key, val);
fail ("Should have thrown IllegalArgumentException - Failed Test");
}
catch(IllegalArgumentException e) {}
|
public void | testJvmListenerAdd()
final Map m = new ValueListMap();
m.put(MonitoredObjectType.JVM, jvml[0]);
m.put(MonitoredObjectType.JVM, jvml[1]);
final Map n = (Map) m.get(MonitoredObjectType.JVM); //I know it is a map
assertEquals(n.keySet().size(), 2);
|
public void | testJvmListenerAddRemove()
final Map m = new ValueListMap();
m.put(MonitoredObjectType.JVM, jvml[0]);
m.put(MonitoredObjectType.JVM, jvml[1]);
m.remove(jvml[1]);
final Map n = (Map) m.get(MonitoredObjectType.JVM); //I know it is a map
assertEquals(n.keySet().size(), 1);
|
public void | testRemoveJvmType()
final Map m = new ValueListMap();
m.put(MonitoredObjectType.JVM, jvml[0]);
m.put(MonitoredObjectType.JVM, jvml[1]);
final Collection removed = (Collection)m.remove(MonitoredObjectType.JVM);
assertEquals(m.get(MonitoredObjectType.JVM), null);
assertEquals(removed.size(), 2);
final Iterator it = removed.iterator();
while (it.hasNext()) {
final Object n = it.next();
assertTrue(n == jvml[0] || n == jvml[1]); //order is not known
}
|