ids, wdrs, collectionSizes});
for (Object[] combination : combinations) {
String id = (String) combination[0];
WatchDataReplicator wdr = (WatchDataReplicator) combination[1];
int collectionSize = (Integer) combination[2];
DynamicConfiguration config = new DynamicConfiguration();
if (collectionSize != 666) {
config.setEntry("org.rioproject.watch",
"collectionSize",
collectionSize);
}
WatchDataSourceImpl impl = new WatchDataSourceImpl(id, config);
boolean added = impl.addWatchDataReplicator(wdr);
if(wdr!=null)
Assert.assertTrue("Expected to add "+wdr.getClass().getName(),
added);
else
Assert.assertFalse("Expected to not add a null WatchDataReplicator",
added);
Assert.assertSame(id, impl.getID());
if (wdr == null) {
Assert.assertNotNull(impl.getWatchDataReplicators());
Assert.assertTrue(impl.getWatchDataReplicators().length==0);
} else {
Assert.assertSame(wdr, impl.getWatchDataReplicators()[0]);
}
if (collectionSize == 666 || collectionSize < 1
|| collectionSize > MCS) {
Assert.assertEquals(DCS, impl.getMaxSize());
} else {
Assert.assertEquals(collectionSize, impl.getMaxSize());
}
Assert.assertNull(impl.getProxy());
assertAddCalculableWorks(impl,
Math.min(Math.max(collectionSize, 0), 10),
true);
impl.close();
}
try {
new WatchDataSourceImpl(null, new DynamicConfiguration());
Assert.fail("IllegalArgumentException expected but not thrown");
} catch (IllegalArgumentException e) {
}
try {
new WatchDataSourceImpl("watch", null);