Package org.rioproject.impl.config

Examples of org.rioproject.impl.config.DynamicConfiguration


        }

        // config
        final int collectionSizes[] = new int[]{1, 1000, 5000};
        for (int collectionSize : collectionSizes) {
            DynamicConfiguration config = new DynamicConfiguration();
            config.setEntry("org.rioproject.watch", "collectionSize",
                            collectionSize);
            Watch watch = construct2("watch", config);
            checkInstance(watch, collectionSize, false);
            Utils.close(watch.getWatchDataSource());
        }
View Full Code Here


        }

        // watchDataSource
        final int collectionSizes[] = new int[]{1, 1000, 5000};
        for (int collectionSize : collectionSizes) {
            DynamicConfiguration config = new DynamicConfiguration();
            config.setEntry("org.rioproject.watch", "collectionSize",
                            collectionSize);
            //WatchDataSource wds = new WatchDataSourceImpl("", null,
            //                                              config).export();
            WatchDataSource wds = new WatchDataSourceImpl();
            wds.setConfiguration(config);
View Full Code Here

        systemCapabilities = new SystemCapabilities();
    }

    @Test
    public void testGetMeasurableCapabilities() throws Exception {
        MeasurableCapability[] mCaps = systemCapabilities.getMeasurableCapabilities(new DynamicConfiguration());
        Assert.assertEquals("Expected 4", 4, mCaps.length);

        org.rioproject.impl.system.measurable.memory.Memory memory =
            getCapability(org.rioproject.impl.system.measurable.memory.Memory.class, mCaps);
        Assert.assertNotNull(memory);
View Full Code Here

    }

    @Test
    public void testGetPlatformCapabilities() throws Exception {
        PlatformCapability[] pCaps = systemCapabilities.getPlatformCapabilities(new DynamicConfiguration());
        Assert.assertTrue("Expected at least 7", pCaps.length>=7);

        ProcessorArchitecture processorArchitecture = getCapability(ProcessorArchitecture.class, pCaps);
        Assert.assertNotNull(processorArchitecture);
        log(processorArchitecture);
View Full Code Here

                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);
View Full Code Here

            impl.close();
        }

        {   // Non-default initial size
            DynamicConfiguration config = new DynamicConfiguration();
            config.setEntry("org.rioproject.watch", "collectionSize",
                            DCS + 15);
            WatchDataSourceImpl impl = new WatchDataSourceImpl();
            impl.setID("watch");
            impl.setConfiguration(config);
            impl.initialize();
View Full Code Here

                LoggingWatchDataReplicator wdr;
                if(wdrClass.equals(RemoteWDR.class.getName()))
                    wdr = new RemoteWDR();
                else
                    wdr = new LoggingWatchDataReplicator();
                DynamicConfiguration config = new DynamicConfiguration();
                config.setEntry("org.rioproject.watch", "collectionSize", collectionSize);

                WatchDataSourceImpl impl = new WatchDataSourceImpl();
                impl.setID("watch");
                impl.setConfiguration(config);
                if(wdrClass.equals(RemoteWDR.class.getName()))
View Full Code Here

     */
    @Test public void testGetWatchDataReplicator() throws Exception {
        WatchDataReplicator wdr1 = new LoggingWatchDataReplicator();
        WatchDataSourceImpl impl = new WatchDataSourceImpl();
        impl.setID("watch");
        impl.setConfiguration(new DynamicConfiguration());
        impl.addWatchDataReplicator(wdr1);
        Assert.assertSame(wdr1, impl.getWatchDataReplicators()[0]);

        WatchDataReplicator wdr2 = new LoggingWatchDataReplicator();
        impl.addWatchDataReplicator(wdr2);
View Full Code Here

     * @throws Exception if the test fails
     */
    @Test public void testAddWatchDataReplicator() throws Exception {
        WatchDataSourceImpl impl = new WatchDataSourceImpl();
        impl.setID("watch");
        impl.setConfiguration(new DynamicConfiguration());

        WatchDataReplicator wdr1 = new LoggingWatchDataReplicator();
        impl.addWatchDataReplicator(wdr1);
        Assert.assertSame(wdr1, impl.getWatchDataReplicators()[0]);

View Full Code Here

        }
        return found;
    }

    private void startLookup(String... groups) throws Exception {
        DynamicConfiguration configuration = new DynamicConfiguration();
        configuration.setEntry("com.sun.jini.reggie", "initialMemberGroups", String[].class, groups);
        registrar = new Reggie(configuration, null);
        listener = new DL();
        discoveryManagement = new LookupDiscoveryManager(new String[]{"foo"}, null, listener);
        deploymentVerifier = new DeploymentVerifier(EmptyConfiguration.INSTANCE, discoveryManagement);
    }
View Full Code Here

TOP

Related Classes of org.rioproject.impl.config.DynamicConfiguration

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.