RemotePoliciesConfiguration configuration =
marinerConfig.getRemotePolicies();
Iterator i = configuration.getQuotaIterator();
Map quotaMap = new HashMap();
while (i.hasNext()) {
RemotePolicyQuotaConfiguration quota =
(RemotePolicyQuotaConfiguration) i.next();
quotaMap.put(quota.getUrl(), quota);
}
// NOTE: this fails in IBM JDK 1.4.1 with IllegalAccessException
// the *second* time it is run. It looks like a VM bug to me.
// ReflectionManager accessMgr = new ReflectionManager(
// Volantis.class.getDeclaredMethod(
// "getRemotePolicyCacheAttributes", new Class[] {String.class})
// );
// Map quotaMap = (Map)accessMgr.useAsAccessible(new ReflectionExecutor() {
// public Object execute(AccessibleObject object) throws Exception {
// return ((Method)object).invoke(volantis,
// new Object[] {quotaElement});
// }
// });
Assert.assertNotNull("quota map", quotaMap);
Iterator itr = quotaList.iterator();
while (itr.hasNext()) {
ConfigValueRemoteQuota quota = (ConfigValueRemoteQuota) itr.next();
RemotePolicyQuotaConfiguration config =
(RemotePolicyQuotaConfiguration) quotaMap.get(quota.url);
Assert.assertEquals("Percentage for URL " + quota.url,
quota.percentage, config.getPercentage());
}
// Not checking for extra, unused stuff here, probably should...
}