當前位置: 首頁>>代碼示例>>Java>>正文


Java CompositeConfiguration.setProperty方法代碼示例

本文整理匯總了Java中org.apache.commons.configuration.CompositeConfiguration.setProperty方法的典型用法代碼示例。如果您正苦於以下問題:Java CompositeConfiguration.setProperty方法的具體用法?Java CompositeConfiguration.setProperty怎麽用?Java CompositeConfiguration.setProperty使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.commons.configuration.CompositeConfiguration的用法示例。


在下文中一共展示了CompositeConfiguration.setProperty方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: propagatesRenderingException

import org.apache.commons.configuration.CompositeConfiguration; //導入方法依賴的package包/類
@Test(expected = RenderingException.class)
public void propagatesRenderingException() throws Exception {
    IndexRenderer renderer = new IndexRenderer();

    CompositeConfiguration compositeConfiguration = new MockCompositeConfiguration().withDefaultBoolean(true);
    compositeConfiguration.setProperty(PAGINATE_INDEX, false);
    ContentStore contentStore = mock(ContentStore.class);
    Renderer mockRenderer = mock(Renderer.class);

    doThrow(new Exception()).when(mockRenderer).renderIndex(anyString());

    int renderResponse = renderer.render(mockRenderer, contentStore,
            new File("fake"), new File("fake"), compositeConfiguration);

    verify(mockRenderer, never()).renderIndex("random string");
}
 
開發者ID:ghaseminya,項目名稱:jbake-rtl-jalaali,代碼行數:17,代碼來源:IndexRendererTest.java

示例2: load

import org.apache.commons.configuration.CompositeConfiguration; //導入方法依賴的package包/類
public static CompositeConfiguration load(File source, boolean isRunServer) throws ConfigurationException {
      CompositeConfiguration config = new CompositeConfiguration();
      config.setListDelimiter(',');
      File customConfigFile = new File(source, LEGACY_CONFIG_FILE);
      if (customConfigFile.exists()) {
      	LEGACY_CONFIG_FILE_EXISTS = true;
          config.addConfiguration(new PropertiesConfiguration(customConfigFile));
      }
      customConfigFile = new File(source, CONFIG_FILE);
      if (customConfigFile.exists()) {
          config.addConfiguration(new PropertiesConfiguration(customConfigFile));
      }
      config.addConfiguration(new PropertiesConfiguration(DEFAULT_CONFIG_FILE));
      config.addConfiguration(new SystemConfiguration());
      if (isRunServer) {
	String port = config.getString(Keys.SERVER_PORT);
	config.setProperty(Keys.SITE_HOST, "http://localhost:"+port);
}
      return config;
  }
 
開發者ID:jbake-org,項目名稱:jbake,代碼行數:21,代碼來源:ConfigUtil.java

示例3: readFilterIntoProperties

import org.apache.commons.configuration.CompositeConfiguration; //導入方法依賴的package包/類
/**
 * Filter io contain the properties we wish to substitute in templates.
 *
 * Uses Apache Commons Configuration to load filters.
 */
private Properties readFilterIntoProperties(final FileInfo filter) throws ConfigurationException, IOException {
    final CompositeConfiguration composite = new CompositeConfiguration();
    final List<File> files = filter.getFiles();
    for (final File file : files) {
        final PropertiesConfiguration config = new PropertiesConfiguration(file);
        config.setEncoding(configGeneratorParameters.getEncoding());
        composite.addConfiguration(config);
    }
    if (StringUtils.isNotBlank(configGeneratorParameters.getFilterSourcePropertyName())) {
        composite.setProperty(configGeneratorParameters.getFilterSourcePropertyName(), filter.getAllSources());
    }
    return ConfigurationConverter.getProperties(composite);
}
 
開發者ID:sofdes,項目名稱:config-generation-maven-plugin,代碼行數:19,代碼來源:ConfigGeneratorImpl.java

示例4: shouldGenerateTagsHome

import org.apache.commons.configuration.CompositeConfiguration; //導入方法依賴的package包/類
@Test
public void shouldGenerateTagsHome() throws Exception {
    TagsRenderer renderer = new TagsRenderer();
   
    CompositeConfiguration compositeConfiguration = new MockCompositeConfiguration().withDefaultBoolean(true);
    compositeConfiguration.setProperty(Keys.TAG_PATH, "tags");
    compositeConfiguration.setProperty(Keys.OUTPUT_EXTENSION, ".html");
    compositeConfiguration.setProperty(Keys.RENDER_ENCODING, "UTF-8");
    
    ContentStore contentStore = mock(ContentStore.class);
    
    File destination = folder.newFolder();
    
    //Let it create the files in temporary folder
    Renderer rendere = new Renderer(contentStore, destination, new File("."), compositeConfiguration);
  
    Set<String> tags = new HashSet<String>(Arrays.asList("tag1", "tags2"));
    when(contentStore.getAllTags()).thenReturn(tags);
    
    int renderResponse = renderer.render(rendere, contentStore,
            new File("fake"), new File("fake"), compositeConfiguration);
    
    assertThat(renderResponse).isEqualTo(3);
    
    //Verify that index.html is created as tags home.
    assertThat(new File(destination, "tags/index.html").exists()).isEqualTo(true);
}
 
開發者ID:jbake-org,項目名稱:jbake,代碼行數:28,代碼來源:TagsRendererTest.java

示例5: loadBaseConfig

import org.apache.commons.configuration.CompositeConfiguration; //導入方法依賴的package包/類
private void loadBaseConfig() {
    loadedConfig = new CompositeConfiguration();
    loadedConfig.setProperty("name", "name");
    loadedConfig.setProperty("owner", "owner");
    loadedConfig.setProperty("token", "changeMe");
}
 
開發者ID:rgamed,項目名稱:jsoup-demo,代碼行數:7,代碼來源:ConfigHolder.java

示例6: startup

import org.apache.commons.configuration.CompositeConfiguration; //導入方法依賴的package包/類
public synchronized void startup() throws Exception
{
    LOG.info("Starting up cluster...");

    config = new CompositeConfiguration();
    if (System.getProperty("whirr.config") != null)
    {
        config.addConfiguration(
            new PropertiesConfiguration(System.getProperty("whirr.config")));
    }
    config.addConfiguration(new PropertiesConfiguration("whirr-default.properties"));

    clusterSpec = new ClusterSpec(config);
    if (clusterSpec.getPrivateKey() == null)
    {
        Map<String, String> pair = KeyPair.generate();
        clusterSpec.setPublicKey(pair.get("public"));
        clusterSpec.setPrivateKey(pair.get("private"));
    }

    // if a local tarball is available deploy it to the blobstore where it will be available to cassandra
    if (System.getProperty("whirr.cassandra_tarball") != null)
    {
        Pair<BlobMetadata,URI> blob = BlobUtils.storeBlob(config, clusterSpec, System.getProperty("whirr.cassandra_tarball"));
        tarball = blob.left;
        config.setProperty(CassandraClusterActionHandler.BIN_TARBALL, blob.right.toURL().toString());
        // TODO: parse the CassandraVersion property file instead
        config.setProperty(CassandraClusterActionHandler.MAJOR_VERSION, "0.8");
    }

    service = new ServiceFactory().create(clusterSpec.getServiceName());
    cluster = service.launchCluster(clusterSpec);
    computeService = ComputeServiceContextBuilder.build(clusterSpec).getComputeService();
    hosts = new ArrayList<InetAddress>();
    for (Instance instance : cluster.getInstances())
    {
        hosts.add(instance.getPublicAddress());
    }

    ShutdownHook shutdownHook = new ShutdownHook(this);
    Runtime.getRuntime().addShutdownHook(shutdownHook);

    waitForClusterInitialization();

    running = true;
}
 
開發者ID:devdattakulkarni,項目名稱:Cassandra-KVPM,代碼行數:47,代碼來源:CassandraServiceController.java


注:本文中的org.apache.commons.configuration.CompositeConfiguration.setProperty方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。