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


Java AbstractConfiguration.setProperty方法代碼示例

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


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

示例1: testSunnyDayNoClientAuth

import org.apache.commons.configuration.AbstractConfiguration; //導入方法依賴的package包/類
@Test
public void testSunnyDayNoClientAuth() throws Exception{

	AbstractConfiguration cm = ConfigurationManager.getConfigInstance();

	String name = "GetPostSecureTest" + ".testSunnyDayNoClientAuth";

	String configPrefix = name + "." + "ribbon";

	cm.setProperty(configPrefix + "." + CommonClientConfigKey.IsSecure, "true");
	cm.setProperty(configPrefix + "." + CommonClientConfigKey.SecurePort, Integer.toString(PORT2));
	cm.setProperty(configPrefix + "." + CommonClientConfigKey.IsHostnameValidationRequired, "false");
	cm.setProperty(configPrefix + "." + CommonClientConfigKey.TrustStore, FILE_TS2.getAbsolutePath());
	cm.setProperty(configPrefix + "." + CommonClientConfigKey.TrustStorePassword, PASSWORD);

	RestClient rc = (RestClient) ClientFactory.getNamedClient(name);

	testServer2.accept();

	URI getUri = new URI(SERVICE_URI2 + "test/");
       HttpRequest request = HttpRequest.newBuilder().uri(getUri).queryParams("name", "test").build();
	HttpResponse response = rc.execute(request);
	assertEquals(200, response.getStatus());
}
 
開發者ID:Netflix,項目名稱:ribbon,代碼行數:25,代碼來源:SecureGetTest.java

示例2: configure

import org.apache.commons.configuration.AbstractConfiguration; //導入方法依賴的package包/類
private void configure(String namespace, String appName){
    URI serviceUri = server.getServiceURI();
    AbstractConfiguration configInstance = ConfigurationManager.getConfigInstance();
    configInstance.setProperty(namespace + ".serviceUrl.default", serviceUri.toString());
    configInstance.setProperty(namespace + ".port", serviceUri.getPort());
    configInstance.setProperty(namespace + ".name", appName);
}
 
開發者ID:hazelcast,項目名稱:hazelcast-eureka,代碼行數:8,代碼來源:HazelcastClientTestCase.java

示例3: registerClusters

import org.apache.commons.configuration.AbstractConfiguration; //導入方法依賴的package包/類
public static void registerClusters(Collection<String> clusterNames,
                                    String instanceUrlSuffix) {
    final AbstractConfiguration configurationManager = ConfigurationManager.getConfigInstance();
    configurationManager.setProperty(InstanceDiscovery.TURBINE_AGGREGATOR_CLUSTER_CONFIG,
            Joiner.on(',').join(clusterNames));
    configurationManager.setProperty("turbine.instanceUrlSuffix", instanceUrlSuffix);
    final ClusterMonitorFactory<?> clusterMonitorFactory = PluginsFactory.getClusterMonitorFactory();
    if (clusterMonitorFactory != null) {
        try {
            clusterMonitorFactory.initClusterMonitors();
        } catch (Exception err) {
            LOGGER.error("Trouble initializing cluster monitors", err);
        }
    }
}
 
開發者ID:yammer,項目名稱:breakerbox,代碼行數:16,代碼來源:TurbineInstanceDiscovery.java

示例4: testSunnyDay

import org.apache.commons.configuration.AbstractConfiguration; //導入方法依賴的package包/類
@Test
public void testSunnyDay() throws Exception {

	AbstractConfiguration cm = ConfigurationManager.getConfigInstance();

	String name = "GetPostSecureTest" + ".testSunnyDay";

	String configPrefix = name + "." + "ribbon";

	cm.setProperty(configPrefix + "." + CommonClientConfigKey.IsSecure, "true");
	cm.setProperty(configPrefix + "." + CommonClientConfigKey.SecurePort, Integer.toString(PORT1));
	cm.setProperty(configPrefix + "." + CommonClientConfigKey.IsHostnameValidationRequired, "false");
	cm.setProperty(configPrefix + "." + CommonClientConfigKey.IsClientAuthRequired, "true");
	cm.setProperty(configPrefix + "." + CommonClientConfigKey.KeyStore, FILE_KS1.getAbsolutePath());
	cm.setProperty(configPrefix + "." + CommonClientConfigKey.KeyStorePassword, PASSWORD);
	cm.setProperty(configPrefix + "." + CommonClientConfigKey.TrustStore, FILE_TS1.getAbsolutePath());
	cm.setProperty(configPrefix + "." + CommonClientConfigKey.TrustStorePassword, PASSWORD);

	RestClient rc = (RestClient) ClientFactory.getNamedClient(name);

	testServer1.accept();

	URI getUri = new URI(SERVICE_URI1 + "test/");
       HttpRequest request = HttpRequest.newBuilder().uri(getUri).queryParams("name", "test").build();
	HttpResponse response = rc.execute(request);
	assertEquals(200, response.getStatus());
}
 
開發者ID:Netflix,項目名稱:ribbon,代碼行數:28,代碼來源:SecureGetTest.java

示例5: testFailsWithHostNameValidationOn

import org.apache.commons.configuration.AbstractConfiguration; //導入方法依賴的package包/類
@Test
public void testFailsWithHostNameValidationOn() throws Exception {

	AbstractConfiguration cm = ConfigurationManager.getConfigInstance();

	String name = "GetPostSecureTest" + ".testFailsWithHostNameValidationOn";

	String configPrefix = name + "." + "ribbon";

	cm.setProperty(configPrefix + "." + CommonClientConfigKey.IsSecure, "true");
	cm.setProperty(configPrefix + "." + CommonClientConfigKey.SecurePort, Integer.toString(PORT1));
	cm.setProperty(configPrefix + "." + CommonClientConfigKey.IsHostnameValidationRequired, "true"); // <--
	cm.setProperty(configPrefix + "." + CommonClientConfigKey.IsClientAuthRequired, "true");
	cm.setProperty(configPrefix + "." + CommonClientConfigKey.KeyStore, FILE_KS1.getAbsolutePath());
	cm.setProperty(configPrefix + "." + CommonClientConfigKey.KeyStorePassword, PASSWORD);
	cm.setProperty(configPrefix + "." + CommonClientConfigKey.TrustStore, FILE_TS1.getAbsolutePath());
	cm.setProperty(configPrefix + "." + CommonClientConfigKey.TrustStorePassword, PASSWORD);

	RestClient rc = (RestClient) ClientFactory.getNamedClient(name);

	testServer1.accept();

	URI getUri = new URI(SERVICE_URI1 + "test/");
	MultivaluedMapImpl params = new MultivaluedMapImpl();
	params.add("name", "test");
       HttpRequest request = HttpRequest.newBuilder().uri(getUri).queryParams("name", "test").build();

	try{
		rc.execute(request);

		fail("expecting ssl hostname validation error");
	}catch(ClientHandlerException che){
		assertTrue(che.getMessage().indexOf("hostname in certificate didn't match") > -1);
	}
}
 
開發者ID:Netflix,項目名稱:ribbon,代碼行數:36,代碼來源:SecureGetTest.java

示例6: testClientRejectsWrongServer

import org.apache.commons.configuration.AbstractConfiguration; //導入方法依賴的package包/類
@Test
public void testClientRejectsWrongServer() throws Exception{

	AbstractConfiguration cm = ConfigurationManager.getConfigInstance();

	String name = "GetPostSecureTest" + ".testClientRejectsWrongServer";

	String configPrefix = name + "." + "ribbon";

	cm.setProperty(configPrefix + "." + CommonClientConfigKey.IsSecure, "true");
	cm.setProperty(configPrefix + "." + CommonClientConfigKey.SecurePort, Integer.toString(PORT2));
	cm.setProperty(configPrefix + "." + CommonClientConfigKey.IsHostnameValidationRequired, "false");
	cm.setProperty(configPrefix + "." + CommonClientConfigKey.TrustStore, FILE_TS1.getAbsolutePath()); // <--
	cm.setProperty(configPrefix + "." + CommonClientConfigKey.TrustStorePassword, PASSWORD);

	RestClient rc = (RestClient) ClientFactory.getNamedClient(name);

	testServer2.accept();

	URI getUri = new URI(SERVICE_URI2 + "test/");
	HttpRequest request = HttpRequest.newBuilder().uri(getUri).queryParams("name", "test").build();
	try{
		rc.execute(request);

		fail("expecting ssl hostname validation error");

	}catch(ClientHandlerException che){
		assertTrue(che.getMessage().indexOf("peer not authenticated") > -1);
	}
}
 
開發者ID:Netflix,項目名稱:ribbon,代碼行數:31,代碼來源:SecureGetTest.java

示例7: init

import org.apache.commons.configuration.AbstractConfiguration; //導入方法依賴的package包/類
@Before
public void init() {
  AbstractConfiguration cfg = ConfigurationManager.getConfigInstance();
  cfg.setProperty("spectator.nflx.enabled", "false");
}
 
開發者ID:Netflix,項目名稱:spectator,代碼行數:6,代碼來源:AutoPluginTest.java

示例8: addApplicationContext

import org.apache.commons.configuration.AbstractConfiguration; //導入方法依賴的package包/類
public static void addApplicationContext(ConfigurableApplicationContext context) {
	AbstractConfiguration config = ConfigurationManager.getConfigInstance();
	config.clearProperty(APPLICATION_CONTEXT);
	config.setProperty(APPLICATION_CONTEXT, context);
}
 
開發者ID:spring-cloud,項目名稱:spring-cloud-netflix,代碼行數:6,代碼來源:ArchaiusDelegatingProxyUtils.java

示例9: testGetKeystoreWithClientAuth

import org.apache.commons.configuration.AbstractConfiguration; //導入方法依賴的package包/類
@Test
public void testGetKeystoreWithClientAuth() throws Exception{

	// jks format
	byte[] dummyTruststore = Base64.decode(SecureGetTest.TEST_TS1);
	byte[] dummyKeystore = Base64.decode(SecureGetTest.TEST_KS1);

	File tempKeystore = File.createTempFile(this.getClass().getName(), ".keystore");
	File tempTruststore = File.createTempFile(this.getClass().getName(), ".truststore");

	FileOutputStream keystoreFileOut = new FileOutputStream(tempKeystore);
       try {
           keystoreFileOut.write(dummyKeystore);
       } finally {
           keystoreFileOut.close();
       }

	FileOutputStream truststoreFileOut = new FileOutputStream(tempTruststore);
       try {
           truststoreFileOut.write(dummyTruststore);
       } finally {
           truststoreFileOut.close();
       }

	AbstractConfiguration cm = ConfigurationManager.getConfigInstance();

	String name = this.getClass().getName() + ".test1";

	String configPrefix = name + "." + "ribbon";

	cm.setProperty(configPrefix + "." +  CommonClientConfigKey.IsSecure, "true");
	cm.setProperty(configPrefix + "." +  CommonClientConfigKey.IsClientAuthRequired, "true");
	cm.setProperty(configPrefix + "." +  CommonClientConfigKey.KeyStore, tempKeystore.getAbsolutePath());
	cm.setProperty(configPrefix + "." +  CommonClientConfigKey.KeyStorePassword, "changeit");
	cm.setProperty(configPrefix + "." +  CommonClientConfigKey.TrustStore, tempTruststore.getAbsolutePath());
	cm.setProperty(configPrefix + "." +  CommonClientConfigKey.TrustStorePassword, "changeit");

	RestClient client = (RestClient) ClientFactory.getNamedClient(name);

	KeyStore keyStore = client.getKeyStore();

	Certificate cert = keyStore.getCertificate("ribbon_key");

	assertNotNull(cert);

}
 
開發者ID:Netflix,項目名稱:ribbon,代碼行數:47,代碼來源:SecureRestClientKeystoreTest.java

示例10: testGetKeystoreWithNoClientAuth

import org.apache.commons.configuration.AbstractConfiguration; //導入方法依賴的package包/類
@Test
public void testGetKeystoreWithNoClientAuth() throws Exception{

	// jks format
	byte[] dummyTruststore = Base64.decode(SecureGetTest.TEST_TS1);
	byte[] dummyKeystore = Base64.decode(SecureGetTest.TEST_KS1);

	File tempKeystore = File.createTempFile(this.getClass().getName(), ".keystore");
	File tempTruststore = File.createTempFile(this.getClass().getName(), ".truststore");

	FileOutputStream keystoreFileOut = new FileOutputStream(tempKeystore);
       try {
           keystoreFileOut.write(dummyKeystore);
       } finally {
           keystoreFileOut.close();
       }

	FileOutputStream truststoreFileOut = new FileOutputStream(tempTruststore);
       try {
           truststoreFileOut.write(dummyTruststore);
       } finally {
           truststoreFileOut.close();
       }

	AbstractConfiguration cm = ConfigurationManager.getConfigInstance();

	String name = this.getClass().getName() + ".test2";

	String configPrefix = name + "." + "ribbon";

	cm.setProperty(configPrefix + "." +  CommonClientConfigKey.IsSecure, "true");
	cm.setProperty(configPrefix + "." +  CommonClientConfigKey.KeyStore, tempKeystore.getAbsolutePath());
	cm.setProperty(configPrefix + "." +  CommonClientConfigKey.KeyStorePassword, "changeit");

	RestClient client = (RestClient) ClientFactory.getNamedClient(name);

	KeyStore keyStore = client.getKeyStore();

	Certificate cert = keyStore.getCertificate("ribbon_key");

	assertNotNull(cert);
}
 
開發者ID:Netflix,項目名稱:ribbon,代碼行數:43,代碼來源:SecureRestClientKeystoreTest.java

示例11: testPositiveAcceptAllSSLSocketFactory

import org.apache.commons.configuration.AbstractConfiguration; //導入方法依賴的package包/類
@Test
public void testPositiveAcceptAllSSLSocketFactory() throws Exception{

    // test connection succeeds connecting to a random SSL endpoint with allow all SSL factory

    AbstractConfiguration cm = ConfigurationManager.getConfigInstance();

    String name = "GetPostSecureTest" + ".testPositiveAcceptAllSSLSocketFactory";

    String configPrefix = name + "." + "ribbon";

    cm.setProperty(configPrefix + "." + CommonClientConfigKey.CustomSSLSocketFactoryClassName, "com.netflix.http4.ssl.AcceptAllSocketFactory");

    RestClient rc = (RestClient) ClientFactory.getNamedClient(name);

    TEST_SERVER.accept();

    URI getUri = new URI(TEST_SERVICE_URI + "test/");
    HttpRequest request = HttpRequest.newBuilder().uri(getUri).queryParams("name", "test").build();
    HttpResponse response = rc.execute(request);
    assertEquals(200, response.getStatus());
}
 
開發者ID:Netflix,項目名稱:ribbon,代碼行數:23,代碼來源:SecureAcceptAllGetTest.java

示例12: buildDBObject

import org.apache.commons.configuration.AbstractConfiguration; //導入方法依賴的package包/類
public void buildDBObject(UserProvisioningManager userProvisioningManager) throws Exception {
	AbstractConfiguration dataConfig = ConfigurationHelper.getConfiguration();
	Iterator entries = request.getParameterMap().entrySet().iterator();
	String prevExpiryVal = null;
	String [] currExpiryVal = null;
	while (entries.hasNext())
	{
		Entry thisEntry = (Entry) entries.next();
	  	Object key = thisEntry.getKey();
	  	String keyString = (String) thisEntry.getKey();
	  	if(keyString!=null && keyString.equalsIgnoreCase("PASSWORD_EXPIRY_DAYS"))
	  	{
	  	
	  		if(dataConfig.getProperty(keyString) != null)
	  		{
	  		
	  			prevExpiryVal = (String)dataConfig.getProperty(keyString);
	  			currExpiryVal =  (String[])thisEntry.getValue();
	  			
	  		}
	  	}
	  	
		if(dataConfig.getProperty((String) thisEntry.getKey()) != null)
		{
			dataConfig.setProperty( (String) thisEntry.getKey(), thisEntry.getValue() );
	   	}
	  	Object value = thisEntry.getValue();
		
	}
	if(prevExpiryVal!=null && currExpiryVal[0]!=null)
	{
		if(!prevExpiryVal.equalsIgnoreCase(currExpiryVal[0]))
		{
			List<User> list = userProvisioningManager.getUsers();
			if(list != null)
			{

				Iterator UserListIterator = list.iterator();
				while(UserListIterator.hasNext()){
					User user = (User) UserListIterator.next();
					if(user !=null ){
						// compare and update the expiry dates here
						int dateDiff = Integer.parseInt(currExpiryVal[0])-Integer.parseInt(prevExpiryVal);
						user.setPasswordExpiryDate(DateUtils.addDays(user.getPasswordExpiryDate(),dateDiff));
						userProvisioningManager.modifyUser(user);
					}

				}
			}
		}
	}
	
}
 
開發者ID:NCIP,項目名稱:common-security-module,代碼行數:54,代碼來源:SystemConfigurationForm.java

示例13: registerCircuitForceReset

import org.apache.commons.configuration.AbstractConfiguration; //導入方法依賴的package包/類
public static void registerCircuitForceReset(TenacityPropertyKey key) {
    final AbstractConfiguration configInstance = ConfigurationManager.getConfigInstance();
    configInstance.setProperty(circuitBreakerForceOpen(key), false);
    configInstance.setProperty(circuitBreakerForceClosed(key), false);
}
 
開發者ID:yammer,項目名稱:tenacity,代碼行數:6,代碼來源:TenacityPropertyRegister.java

示例14: registerConfiguration

import org.apache.commons.configuration.AbstractConfiguration; //導入方法依賴的package包/類
private void registerConfiguration(TenacityPropertyKey key,
                                   TenacityConfiguration configuration,
                                   AbstractConfiguration configInstance) {
    configInstance.setProperty(
            executionIsolationThreadTimeoutInMilliseconds(key),
            configuration.getExecutionIsolationThreadTimeoutInMillis());

    configInstance.setProperty(
            circuitBreakerRequestVolumeThreshold(key),
            configuration.getCircuitBreaker().getRequestVolumeThreshold());

    configInstance.setProperty(
            circuitBreakerSleepWindowInMilliseconds(key),
            configuration.getCircuitBreaker().getSleepWindowInMillis());

    configInstance.setProperty(
            circuitBreakerErrorThresholdPercentage(key),
            configuration.getCircuitBreaker().getErrorThresholdPercentage());

    configInstance.setProperty(
            circuitBreakermetricsRollingStatsNumBuckets(key),
            configuration.getCircuitBreaker().getMetricsRollingStatisticalWindowBuckets());

    configInstance.setProperty(
            circuitBreakermetricsRollingStatsTimeInMilliseconds(key),
            configuration.getCircuitBreaker().getMetricsRollingStatisticalWindowInMilliseconds());

    configInstance.setProperty(
            threadpoolCoreSize(key),
            configuration.getThreadpool().getThreadPoolCoreSize());

    configInstance.setProperty(
            threadpoolKeepAliveTimeMinutes(key),
            configuration.getThreadpool().getKeepAliveTimeMinutes());

    configInstance.setProperty(
            threadpoolMaxQueueSize(key),
            configuration.getThreadpool().getMaxQueueSize());

    configInstance.setProperty(
            threadpoolQueueSizeRejectionThreshold(key),
            configuration.getThreadpool().getQueueSizeRejectionThreshold());

    configInstance.setProperty(
            threadpoolMetricsRollingStatsNumBuckets(key),
            configuration.getThreadpool().getMetricsRollingStatisticalWindowBuckets());

    configInstance.setProperty(
            threadpoolMetricsRollingStatsTimeInMilliseconds(key),
            configuration.getThreadpool().getMetricsRollingStatisticalWindowInMilliseconds());

    configInstance.setProperty(
            semaphoreMaxConcurrentRequests(key),
            configuration.getSemaphore().getMaxConcurrentRequests());

    configInstance.setProperty(
            semaphoreFallbackMaxConcurrentRequests(key),
            configuration.getSemaphore().getFallbackMaxConcurrentRequests());

    if (configuration.hasExecutionIsolationStrategy()) {
        configInstance.setProperty(
                executionIsolationStrategy(key),
                configuration.getExecutionIsolationStrategy());
    }
}
 
開發者ID:yammer,項目名稱:tenacity,代碼行數:66,代碼來源:TenacityPropertyRegister.java

示例15: setup

import org.apache.commons.configuration.AbstractConfiguration; //導入方法依賴的package包/類
private void setup() {
    resetStreams();
    Hystrix.reset();
    final AbstractConfiguration configuration = ConfigurationManager.getConfigInstance();
    configuration.setProperty("hystrix.command.default.metrics.healthSnapshot.intervalInMilliseconds", "100");
}
 
開發者ID:yammer,項目名稱:tenacity,代碼行數:7,代碼來源:TenacityTestRule.java


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