Package org.osgi.service.cm

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


    public void testChangeGlobalConfig() throws Exception {
        // Set log level to debug for Root logger
        Configuration config = ca.getConfiguration(PID, null);
        Dictionary<String, Object> p = new Hashtable<String, Object>();
        p.put(LOG_LEVEL, "DEBUG");
        config.update(p);

        delay();

        assertTrue(LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME).isDebugEnabled());
View Full Code Here


        // Reset back to Info
        config = ca.getConfiguration(PID, null);
        p = new Hashtable<String, Object>();
        p.put(LOG_LEVEL, "INFO");
        config.update(p);

        delay();

        assertTrue(LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME).isInfoEnabled());
        assertFalse(LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME).isDebugEnabled());
View Full Code Here

        // Set log level to debug for Root logger
        Configuration config = ca.getConfiguration(PID, null);
        Dictionary<String, Object> p = new Hashtable<String, Object>();
        p.put(LOG_PACKAGING_DATA, Boolean.FALSE);
        p.put(LOG_LEVEL, "INFO");
        config.update(p);

        delay();

        assertFalse(((LoggerContext)LoggerFactory.getILoggerFactory()).isPackagingDataEnabled());
    }
View Full Code Here

    public void testExternalConfig() throws Exception {
        Configuration config = ca.getConfiguration(PID, null);
        Dictionary<String, Object> p = new Hashtable<String, Object>();
        p.put(LOG_LEVEL, "DEBUG");
        p.put(LOGBACK_FILE,absolutePath("test1-external-config.xml"));
        config.update(p);

        delay();

        ch.qos.logback.classic.Logger rootLogger = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
        assertNotNull(rootLogger.getAppender("FILE"));
View Full Code Here

                if (configuration == null) {
                    configuration = configurationAdmin.createFactoryConfiguration(configFactory);
                }

                properties = filterBeforeSave(properties);
                configuration.update(toDictionary(properties));
            }

            for (String resourceName : deletedResources) {
                String configName = getConfigName(resourceName);
                Configuration configuration = getConfiguration(configName);
View Full Code Here

               initDefaultConfig(defaultConfig);
            }

            // create the factory and set the properties
            Configuration config = ca.createFactoryConfiguration(this.getClientRepositoryFactoryPID());
            config.update(defaultConfig);

            log.debug("verifyConfiguration: Created configuration {} for {}",
                config.getPid(), config.getFactoryPid());

        } catch (Throwable t) {
View Full Code Here

        p.put("defaultReadOnly","false");
        p.put("datasource.svc.properties",new String[]{
                "initSQL=SELECT 1",
        });
        p.put("maxActive",70);
        config.update(p);

        Filter filter = context.createFilter("(&(objectclass=javax.sql.DataSource)(datasource.name=test))");
        ServiceTracker<DataSource, DataSource> st =
                new ServiceTracker<DataSource, DataSource>(context, filter, null);
        st.open();
View Full Code Here

        assertNull(getProperty(ds, "poolProperties.defaultAutoCommit"));

        config = ca.listConfigurations("(datasource.name=test)")[0];
        Dictionary dic = config.getProperties();
        dic.put("defaultReadOnly", Boolean.TRUE);
        config.update(dic);

        TimeUnit.MILLISECONDS.sleep(100);
        assertEquals("true", getProperty(ds, "poolProperties.defaultReadOnly"));
    }
View Full Code Here

        Dictionary<String,Object> dict = new Hashtable<String, Object>();
        dict.put("headers",new String[]{"mdc-test-header"});
        dict.put("parameters",new String[]{"mdc-test-param"});
        dict.put("cookies",new String[]{"mdc-test-cookie"});
        cfg.update(dict);
    }
}
View Full Code Here

            }
        }
        if (cfg.getBundleLocation() != null) {
            cfg.setBundleLocation(null);
        }
        cfg.update(props);
    }

    protected String[] parsePid(String pid) {
        int n = pid.indexOf('-');
        if (n > 0) {
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.