Package org.osgi.service.cm

Examples of org.osgi.service.cm.Configuration.update()


        final Bundle cfgAdminBundle = configAdminTracker.getServiceReference().getBundle();
        cfgAdminBundle.stop();
        try
        {
            config.update();
            TestCase.fail( "Expected IllegalStateException for config.update" );
        }
        catch ( IllegalStateException ise )
        {
            // expected
View Full Code Here


        final Bundle cfgAdminBundle = configAdminTracker.getServiceReference().getBundle();
        cfgAdminBundle.stop();
        try
        {
            config.update( new Hashtable<String, Object>()
            {
                {
                    put( "sample", "sample" );
                }
            } );
View Full Code Here

        final String pid = "test_configuration_change_counter";
        final Configuration config = configure( pid, null, false );

        TestCase.assertEquals("Expect first version to be 1", 1, config.getChangeCount());

        config.update(new Hashtable(){{put("x", "x");}});
        TestCase.assertEquals("Expect second version to be 2", 2, config.getChangeCount());

        // delete
        config.delete();
    }
View Full Code Here

            final Configuration c2 = getConfigurationAdmin().getConfiguration( pid, null );
            TestCase.assertEquals( "getConfiguration must retrieve required PID", pid, c2.getPid() );
            TestCase.assertEquals( "getConfiguration must retrieve new factory configuration from persistence", factoryPid, c2.getFactoryPid() );
            TestCase.assertNull( "Configuration must not have properties", c2.getProperties() );

            c2.update( theConfig );
            delay();

            TestCase.assertEquals( 1, tester.numManagedServiceFactoryUpdatedCalls );
            TestCase.assertEquals( theConfig.get( PROP_NAME ), tester.configs.get( cf.getPid() ).get( PROP_NAME ) );
View Full Code Here

        Dictionary props = cimpl.getProperties();
        assertNull( "Configuration is fresh", props );

        props = new Hashtable();
        props.put( SCALAR, STRING_VALUE );
        cimpl.update( props );

        Dictionary newProps = cimpl.getProperties();
        assertNotNull( "Configuration is not fresh", newProps );
        assertEquals( "Expect 2 elements", 2, newProps.size() );
        assertEquals( "Service.pid must match", TEST_PID, newProps.get( Constants.SERVICE_PID ) );
View Full Code Here

        Dictionary props = cimpl.getProperties();
        assertNull( "Configuration is fresh", props );

        props = new Hashtable();
        props.put( ARRAY, ARRAY_VALUE );
        cimpl.update( props );

        Dictionary newProps = cimpl.getProperties();
        assertNotNull( "Configuration is not fresh", newProps );
        assertEquals( "Expect 2 elements", 2, newProps.size() );
        assertEquals( "Service.pid must match", TEST_PID, newProps.get( Constants.SERVICE_PID ) );
View Full Code Here

        Dictionary props = cimpl.getProperties();
        assertNull( "Configuration is fresh", props );

        props = new Hashtable();
        props.put( COLLECTION, COLLECTION_VALUE );
        cimpl.update( props );

        Dictionary newProps = cimpl.getProperties();
        assertNotNull( "Configuration is not fresh", newProps );
        assertEquals( "Expect 2 elements", 2, newProps.size() );
        assertEquals( "Service.pid must match", TEST_PID, newProps.get( Constants.SERVICE_PID ) );
View Full Code Here

        // ==> configuration supplied to the service ms2
        TestCase.assertNotNull( testerB1.configs.get( pid ) );
        TestCase.assertEquals( 1, testerB1.numManagedServiceFactoryUpdatedCalls );

        // 6. Update configuration now
        config.update();
        delay();

        // ==> configuration supplied to the service ms2
        TestCase.assertNotNull( testerB1.configs.get( pid ) );
        TestCase.assertEquals( 2, testerB1.numManagedServiceFactoryUpdatedCalls );
View Full Code Here

        // create config2; ensure dynamic binding
        Configuration bundleConfig2 = bundleCa.getConfiguration( pid2 );
        TestCase.assertNull(bundleConfig2.getProperties());
        TestCase.assertEquals( bundle.getLocation(), bundleConfig2.getBundleLocation() );
        bundleConfig2.update( new Hashtable<String, String>()
        {
            {
                put( "key", "value" );
            }
        } );
View Full Code Here

        // create config2; ensure dynamic binding
        Configuration bundleConfig2 = bundleCa.createFactoryConfiguration( factoryPid2 );
        pid2 = bundleConfig2.getPid();
        TestCase.assertNull(bundleConfig2.getProperties());
        TestCase.assertEquals( bundle.getLocation(), bundleConfig2.getBundleLocation() );
        bundleConfig2.update( new Hashtable<String, String>()
        {
            {
                put( "key", "value" );
            }
        } );
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.