Package com.volantis.mcs.runtime.configuration

Examples of com.volantis.mcs.runtime.configuration.RemotePolicyQuotaConfiguration


        if (quotaValues != null) {
            assertNotNull("quotas", quotas);
            assertTrue(quotas.hasNext());
            for (int i=0; i < quotaValues.length; i++) {
                RemotePolicyQuotaConfiguration quota =
                        (RemotePolicyQuotaConfiguration) quotas.next();
                RemotePolicyQuotaValue quotaValue = quotaValues[i];
                if (quotaValue != null) {
                    assertNotNull("quota", quota);
                    assertEquals(quotaValue.url, quota.getUrl());
                    assertEquals(quotaValue.percentage, quota.getPercentage());
                } else {
                    assertNull("quota", quota);
                }
            }
            assertTrue(!quotas.hasNext());
View Full Code Here


        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...
    }
View Full Code Here

                    policyType, maxCount);
        }

        Iterator i = remotePolicies.getQuotaIterator();
        while (i.hasNext()) {
            RemotePolicyQuotaConfiguration quota =
                    (RemotePolicyQuotaConfiguration) i.next();
            int percentage = quota.getPercentage().intValue();
            String url = quota.getUrl();
            int share = (remoteSize * percentage) / 100;

            builder.addDefaultRemotePathSpecificGroup(url, share);
        }

View Full Code Here

TOP

Related Classes of com.volantis.mcs.runtime.configuration.RemotePolicyQuotaConfiguration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.