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


Java Properties.put方法代碼示例

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


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

示例1: shutdownDerby

import java.util.Properties; //導入方法依賴的package包/類
protected final void shutdownDerby() throws Exception {
    assertTrue(isDerby());

    String url = dbUrl + ";shutdown=true";
    url = url.replace(";create=true", "");

    Properties p = new Properties();
    p.put("username", username);
    p.put("password", password);

    // This forces the shutdown
    try {
        getJDBCDriver().getDriver().connect(url, p);
    } catch (SQLException ex) {
        // Exception is expected
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:18,代碼來源:DBTestBase.java

示例2: getAttributesInNamespace

import java.util.Properties; //導入方法依賴的package包/類
/**
 * Returns all attributes in a specific namespace as a Properties object.
 *
 * @param namespace the namespace URI of the attributes, which may be null.
 *
 * @return the non-null set.
 */
public Properties getAttributesInNamespace(String namespace) {
    Properties result = new Properties();
    Enumeration enum2 = this.attributes.elements();
    while (enum2.hasMoreElements()) {
        XMLAttribute attr = (XMLAttribute) enum2.nextElement();
        if (namespace == null) {
            if (attr.getNamespace() == null) {
                result.put(attr.getName(), attr.getValue());
            }
        } else {
            if (namespace.equals(attr.getNamespace())) {
                result.put(attr.getName(), attr.getValue());
            }
        }
    }
    return result;
}
 
開發者ID:the-im,項目名稱:enhanced-vnc-thumbnail-viewer,代碼行數:25,代碼來源:XMLElement.java

示例3: testGetProceduresUsingInfoSchema

import java.util.Properties; //導入方法依賴的package包/類
/**
 * Tests the implementation of Information Schema for description
 * of stored procedures available in a catalog.
 */
public void testGetProceduresUsingInfoSchema() throws Exception {
    if (versionMeetsMinimum(5, 0, 7)) {
        createProcedure("sp1", "()\n BEGIN\nSELECT 1;end\n");
        Properties props = new Properties();
        props.put("useInformationSchema", "true");
        Connection conn1 = null;
        try {
            conn1 = getConnectionWithProps(props);
            DatabaseMetaData metaData = conn1.getMetaData();
            this.rs = metaData.getProcedures(null, null, "sp1");
            this.rs.next();
            assertEquals("sp1", this.rs.getString("PROCEDURE_NAME"));
            assertEquals("1", this.rs.getString("PROCEDURE_TYPE"));
        } finally {
            if (conn1 != null) {
                conn1.close();
            }
        }
    }
}
 
開發者ID:Jugendhackt,項目名稱:OpenVertretung,代碼行數:25,代碼來源:MetadataTest.java

示例4: main

import java.util.Properties; //導入方法依賴的package包/類
public static void main(String[] args) throws InterruptedException {

        Properties props = new Properties();
        props.put(BOOTSTRAP_SERVERS_CONFIG, "localhost:9092");
        props.put(ACKS_CONFIG, "all");
        props.put(RETRIES_CONFIG, 0);
        props.put(BATCH_SIZE_CONFIG, 32000);
        props.put(LINGER_MS_CONFIG, 100);
        props.put(BUFFER_MEMORY_CONFIG, 33554432);
        props.put(KEY_SERIALIZER_CLASS_CONFIG, "org.apache.kafka.common.serialization.LongSerializer");
        props.put(VALUE_SERIALIZER_CLASS_CONFIG, "org.apache.kafka.common.serialization.LongSerializer");

        Producer<Long, Long> producer = new KafkaProducer<>(props);

        long t1 = System.currentTimeMillis();

        long i = 0;
        for(; i < 1000000; i++) {

            producer.send(new ProducerRecord<>("produktion", i, i));
        }
        producer.send(new ProducerRecord<Long,Long>("produktion", (long) -1, (long)-1));
        System.out.println("fertig " + i  + " Nachrichten in " + (System.currentTimeMillis() - t1 + " ms"));

        producer.close();
    }
 
開發者ID:predic8,項目名稱:apache-kafka-demos,代碼行數:27,代碼來源:PerformanceProducer.java

示例5: main

import java.util.Properties; //導入方法依賴的package包/類
public static void main(String[] args) throws InterruptedException {

        Properties props = new Properties();
        props.put(BOOTSTRAP_SERVERS_CONFIG, "localhost:9092");
        props.put(GROUP_ID_CONFIG, "a");
        props.put(ENABLE_AUTO_COMMIT_CONFIG, "true");
        props.put(AUTO_COMMIT_INTERVAL_MS_CONFIG, "1000");
        props.put(SESSION_TIMEOUT_MS_CONFIG, "30000");
        props.put(KEY_DESERIALIZER_CLASS_CONFIG, "org.apache.kafka.common.serialization.StringDeserializer");
        props.put(VALUE_DESERIALIZER_CLASS_CONFIG, "org.apache.kafka.common.serialization.StringDeserializer");

        KafkaConsumer<String, String> consumer = new KafkaConsumer<>(props);

        consumer.subscribe(Arrays.asList("produktion"), new OffsetBeginningRebalanceListener(consumer, "produktion"));

        while(true) {

            ConsumerRecords<String, String> records = consumer.poll(1000);
            if (records.count() == 0)
                continue;

            System.out.println(" Count: " + records.count());

            for (ConsumerRecord<String, String> record : records)
                System.out.printf("offset= %d, key= %s, value= %s\n", record.offset(), record.key(), record.value());

        }
    }
 
開發者ID:predic8,項目名稱:apache-kafka-demos,代碼行數:29,代碼來源:OffsetConsumer.java

示例6: mergeSettings_OnlyPlatformProps

import java.util.Properties; //導入方法依賴的package包/類
@Test
public void mergeSettings_OnlyPlatformProps() throws Exception {
    Properties platformSettings = new Properties();
    platformSettings.put("setting2", "value2");
    Set<POLdapSetting> result = umsBean.mergeSettings(props,
            new Properties());
    assertTrue(result.isEmpty());
}
 
開發者ID:servicecatalog,項目名稱:oscm,代碼行數:9,代碼來源:UserManagementServiceBeanIT.java

示例7: start

import java.util.Properties; //導入方法依賴的package包/類
@Override public void start(Stage primaryStage) throws Exception {
    Properties licensee = new Properties();
    licensee.put("Organization", "Jalian Systems Pvt. Ltd");
    licensee.put("License Type", "Trial");
    licensee.put("Expires", "18/10/2018");

    VersionInfo versionInfo = new VersionInfo("4.1.2.0", "Marathon GUI Testing Tool (Java/Swing) (Opensource version)",
            "� Jalian Systems Private Ltd. and Other contributors",
            "Visit our website: http://www.marathontesting.com for details",
            "Marathon uses other OSS projects. See Credits for more information.");
    MarathonSplashScreen screen = new MarathonSplashScreen(versionInfo);
    screen.show(null);
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:14,代碼來源:MarathonSplashScreen.java

示例8: setDatabaseConnection

import java.util.Properties; //導入方法依賴的package包/類
/**
 * Set database connection properties for the specified database listed in the configuration file (descriptor xml)
 *
 * @param databaseIndex - the number(index) of database element in the configuration file (descriptor xml)
 * @param dbHost database host
 * @param dbName database name
 * @param dbPort database port
 * @param userName user name
 * @param userPassword user password
 * @throws AgentException
 */
@PublicAtsApi
public void setDatabaseConnection( int databaseIndex, String dbHost, String dbName, int dbPort,
                                   String userName, String userPassword ) throws AgentException {

    Properties dbProperties = new Properties();
    dbProperties.put(EnvironmentConfigurator.DB_CONFIGURATION_INDEX, databaseIndex);
    if (!StringUtils.isNullOrEmpty(dbHost)) {
        dbProperties.put(EnvironmentConfigurator.DB_HOST, dbHost);
    }
    if (dbPort > 0) {
        dbProperties.put(EnvironmentConfigurator.DB_PORT, dbPort);
    }
    if (!StringUtils.isNullOrEmpty(dbName)) {
        dbProperties.put(EnvironmentConfigurator.DB_NAME, dbName);
    }
    if (!StringUtils.isNullOrEmpty(userName)) {
        dbProperties.put(EnvironmentConfigurator.DB_USER_NAME, userName);
    }
    if (!StringUtils.isNullOrEmpty(userPassword)) {
        dbProperties.put(EnvironmentConfigurator.DB_USER_PASSWORD, userPassword);
    }

    List<Properties> dbPropertiesList = new ArrayList<Properties>();
    dbPropertiesList.add(dbProperties);

    EnvironmentConfigurator envronmentConfigurator = new EnvironmentConfigurator(component,
                                                                                 dbPropertiesList);
    pushConfiguration(envronmentConfigurator);
}
 
開發者ID:Axway,項目名稱:ats-framework,代碼行數:41,代碼來源:EnvironmentCleanupClient.java

示例9: jpaProperties

import java.util.Properties; //導入方法依賴的package包/類
private Properties jpaProperties() {
    Properties extraProperties = new Properties();
    extraProperties.put(ENV_HIBERNATE_FORMAT_SQL, env.getProperty(ENV_HIBERNATE_FORMAT_SQL));
    extraProperties.put(ENV_HIBERNATE_SHOW_SQL, env.getProperty(ENV_HIBERNATE_SHOW_SQL));
    extraProperties.put(ENV_HIBERNATE_HBM2DDL_AUTO, env.getProperty(ENV_HIBERNATE_HBM2DDL_AUTO));
    if (log.isDebugEnabled()) {
        log.debug(" hibernate.dialect @" + env.getProperty(ENV_HIBERNATE_DIALECT));
    }
    if (env.getProperty(ENV_HIBERNATE_DIALECT) != null) {
        extraProperties.put(ENV_HIBERNATE_DIALECT, env.getProperty(ENV_HIBERNATE_DIALECT));
    }
    return extraProperties;
}
 
開發者ID:lordking,項目名稱:spring-rest-sample,代碼行數:14,代碼來源:JpaConfig.java

示例10: testStartTwoLocatorsWithMultiKeystoreSSL

import java.util.Properties; //導入方法依賴的package包/類
@Test
public void testStartTwoLocatorsWithMultiKeystoreSSL() throws Exception {
  disconnectAllFromDS();
  Host host = Host.getHost(0);
  VM loc1 = host.getVM(1);
  VM loc2 = host.getVM(2);

  int ports[] = AvailablePortHelper.getRandomAvailableTCPPorts(2);
  final int port1 = ports[0];
  this.port1 = port1;
  final int port2 = ports[1];
  this.port2 = port2; // for cleanup in tearDown2
  DistributedTestUtils.deleteLocatorStateFile(port1);
  DistributedTestUtils.deleteLocatorStateFile(port2);
  final String host0 = NetworkUtils.getServerHostName(host);
  final String locators = host0 + "[" + port1 + "]," + host0 + "[" + port2 + "]";
  final Properties properties = new Properties();
  properties.put(MCAST_PORT, "0");
  properties.put(LOCATORS, locators);
  properties.put(ENABLE_NETWORK_PARTITION_DETECTION, "false");
  properties.put(DISABLE_AUTO_RECONNECT, "true");
  properties.put(MEMBER_TIMEOUT, "2000");
  properties.put(LOG_LEVEL, LogWriterUtils.getDUnitLogLevel());
  properties.put(ENABLE_CLUSTER_CONFIGURATION, "false");
  properties.put(SSL_CIPHERS, "any");
  properties.put(SSL_PROTOCOLS, "any");
  properties.put(SSL_KEYSTORE, getMultiKeyKeystore());
  properties.put(SSL_KEYSTORE_PASSWORD, "password");
  properties.put(SSL_KEYSTORE_TYPE, "JKS");
  properties.put(SSL_TRUSTSTORE, getMultiKeyTruststore());
  properties.put(SSL_TRUSTSTORE_PASSWORD, "password");
  properties.put(SSL_LOCATOR_ALIAS, "locatorkey");
  properties.put(SSL_ENABLED_COMPONENTS, SecurableCommunicationChannel.LOCATOR.getConstant());

  startVerifyAndStopLocator(loc1, loc2, port1, port2, properties);
}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:37,代碼來源:LocatorDUnitTest.java

示例11: startLocator

import java.util.Properties; //導入方法依賴的package包/類
protected void startLocator(int port) {
  File logFile = new File("");
  try {
    Properties locProps = new Properties();
    locProps.setProperty(MCAST_PORT, "0");
    locProps.setProperty(MEMBER_TIMEOUT, "1000");
    locProps.put(ENABLE_CLUSTER_CONFIGURATION, "false");

    addDSProps(locProps);
    Locator.startLocatorAndDS(port, logFile, locProps);
  } catch (IOException ex) {
    org.apache.geode.test.dunit.Assert.fail("While starting locator on port " + port, ex);
  }
}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:15,代碼來源:LocatorDUnitTest.java

示例12: testRegionFactoryProperties

import java.util.Properties; //導入方法依賴的package包/類
/**
 * Test method for 'org.apache.geode.cache.RegionFactory.RegionFactory(Properties)'
 */
@Test
public void testRegionFactoryProperties() throws Exception {
  final Properties gemfireProperties = createGemFireProperties();
  gemfireProperties.put(MCAST_TTL, "64");
  RegionFactory factory = new RegionFactory(gemfireProperties);
  r1 = factory.create(this.r1Name);
  assertBasicRegionFunctionality(r1, r1Name);
  assertEquals(gemfireProperties.get(MCAST_TTL),
      r1.getCache().getDistributedSystem().getProperties().get(MCAST_TTL));
}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:14,代碼來源:RegionFactoryJUnitTest.java

示例13: createTemporaryPropertiesFile

import java.util.Properties; //導入方法依賴的package包/類
private File createTemporaryPropertiesFile(long whEtlExecId, Properties etlJobProperties) {
  final File tempDir = Files.createTempDir();
  tempDir.deleteOnExit();
  final String tempDirPath = tempDir.getAbsolutePath();

  etlJobProperties.put(Constant.WH_APP_FOLDER_KEY, tempDirPath);

  return new File(tempDirPath + "/exec", whEtlExecId + ".properties");
}
 
開發者ID:thomas-young-2013,項目名稱:wherehowsX,代碼行數:10,代碼來源:ConfigUtilTest.java

示例14: determineSequenceName

import java.util.Properties; //導入方法依賴的package包/類
@Override
protected QualifiedName determineSequenceName(final Properties params, final Dialect dialect, final JdbcEnvironment jdbcEnv) {
	// Make sure sequence are lower case and corresponds to table name
	params.put(SEQUENCE_PARAM, StringHelper.unquote(params.getProperty("identity_tables"))
			+ ConfigurationHelper.getString(CONFIG_SEQUENCE_PER_ENTITY_SUFFIX, params, DEF_SEQUENCE_SUFFIX));
	return super.determineSequenceName(params, dialect, jdbcEnv);
}
 
開發者ID:ligoj,項目名稱:bootstrap,代碼行數:8,代碼來源:SequenceIdentifierGeneratorStrategyProvider.java

示例15: getRunTimeProperties

import java.util.Properties; //導入方法依賴的package包/類
private Properties getRunTimeProperties(List<Property> list) {
	Properties properties = new Properties();
	for (Property property : list) {
		properties.put(property.getName(), property.getValue());
	}
	return properties;
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:8,代碼來源:InputFileMixedSchemeEntityGenerator.java


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