Example usage for java.util Properties setProperty

List of usage examples for java.util Properties setProperty

Introduction

In this page you can find the example usage for java.util Properties setProperty.

Prototype

public synchronized Object setProperty(String key, String value) 

Source Link

Document

Calls the Hashtable method put .

Usage

From source file:com.cami.spring.PersistenceJPAConfig.java

Properties additionalProperties() {
    final Properties properties = new Properties();
    properties.setProperty("hibernate.hbm2ddl.auto", "update");
    // properties.setProperty("hibernate.hbm2ddl.auto", "create-drop");
    properties.setProperty("hibernate.dialect", "org.hibernate.dialect.MySQL5Dialect");
    return properties;
}

From source file:com.thoughtworks.go.domain.ArtifactMd5ChecksumsTest.java

@Test
public void shouldReturnTrueIfTheChecksumFileContainsAGivenPath() throws IOException {
    Properties properties = new Properties();
    properties.setProperty("first/path", "md5");
    ArtifactMd5Checksums artifactMd5Checksums = new ArtifactMd5Checksums(properties);
    assertThat(artifactMd5Checksums.md5For("first/path"), is("md5"));
}

From source file:com.thoughtworks.go.domain.ArtifactMd5ChecksumsTest.java

@Test
public void shouldReturnNullIfTheChecksumFileDoesNotContainsAGivenPath() throws IOException {
    Properties properties = new Properties();
    properties.setProperty("first/path", "md5");
    ArtifactMd5Checksums artifactMd5Checksums = new ArtifactMd5Checksums(properties);
    assertThat(artifactMd5Checksums.md5For("foo"), is(nullValue()));
}

From source file:com.orangeandbronze.jblubble.sample.BlobstoreSampleAppConfig.java

@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
    entityManagerFactoryBean.setDataSource(dataSource());
    entityManagerFactoryBean.setPackagesToScan("com.orangeandbronze.jblubble.sample");
    entityManagerFactoryBean.setJpaVendorAdapter(new HibernateJpaVendorAdapter());
    Properties jpaProperties = new Properties();
    jpaProperties.setProperty("javax.persistence.schema-generation.database.action", "none");
    jpaProperties.setProperty("hibernate.dialect", "org.hibernate.dialect.HSQLDialect");
    entityManagerFactoryBean.setJpaProperties(jpaProperties);
    return entityManagerFactoryBean;
}

From source file:pl.edu.uksw.j2eecourse.configuration.LibraryConfig.java

Properties additionalProperties() {
    Properties properties = new Properties();
    properties.setProperty("hibernate.hbm2ddl.auto", "create-drop");
    properties.setProperty("hibernate.dialect", "org.hibernate.dialect.HSQLDialect");
    properties.setProperty("hibernate.show_sql", "true");
    return properties;
}

From source file:ragna.wl1036.web.support.infra.ComponentConfig.java

@Bean
public JndiTemplate jndiTemplate() {
    Properties jndiProps = new Properties();

    jndiProps.setProperty("java.naming.factory.initial", env.getProperty("jms.jndi.factory.initial"));
    jndiProps.setProperty("java.naming.provider.url", env.getProperty("jms.provider.url"));
    jndiProps.setProperty("java.naming.security.principal", env.getProperty("jms.user"));
    jndiProps.setProperty("java.naming.security.credentials", env.getProperty("jms.pwd"));

    JndiTemplate jndiTemplate = new JndiTemplate(jndiProps);

    return jndiTemplate;
}

From source file:uk.ac.ebi.ep.data.dataconfig.DataConfig.java

@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
    //em.setPersistenceXmlLocation("classpath*:META-INF/persistence.xml");

    em.setDataSource(dataSource);// w w  w .  j a va 2s  .  co m
    em.setPackagesToScan("uk.ac.ebi.ep.data.domain");

    Properties properties = new Properties();
    properties.setProperty("hibernate.cache.provider_class", "org.hibernate.cache.NoCacheProvider");
    properties.setProperty("hibernate.connection.driver_class", "oracle.jdbc.OracleDriver");

    HibernateJpaVendorAdapter vendor = new HibernateJpaVendorAdapter();
    vendor.setShowSql(false);
    vendor.setDatabase(Database.ORACLE);
    em.setJpaProperties(properties);
    em.setJpaVendorAdapter(vendor);

    return em;
}

From source file:edu.umd.cs.eclipse.courseProjectManager.TurninProjectAction.java

public static void addPropertiesNotAlreadyDefined(Properties dst, Properties src) {
    for (Map.Entry<?, ?> entry : src.entrySet()) {
        if (!dst.containsKey(entry.getKey()))
            dst.setProperty((String) entry.getKey(), (String) entry.getValue());
    }/*from w  w  w .j a  v  a 2s  .  com*/
}

From source file:edu.sjsu.cmpe275.project.configuration.MailConfig.java

private Properties getMailProperties() {
    Properties properties = new Properties();
    properties.setProperty("mail.transport.protocol", "smtp");
    properties.setProperty("mail.smtp.auth", "true");
    properties.setProperty("mail.smtp.starttls.enable", "true");
    properties.setProperty("mail.smtp.starttls.required", "true");
    properties.setProperty("mail.smtp.EnableSSL.enable", "true");
    properties.setProperty("mail.debug", "false");
    return properties;
}

From source file:com.metamx.emitter.core.HttpEmitterConfigTest.java

@Test
public void testSettingEverything() {
    final Properties props = new Properties();
    props.setProperty("com.metamx.emitter.flushMillis", "1");
    props.setProperty("com.metamx.emitter.flushCount", "2");
    props.setProperty("com.metamx.emitter.http.url", "http://example.com/");
    props.setProperty("com.metamx.emitter.http.basicAuthentication", "a:b");
    props.setProperty("com.metamx.emitter.http.batchingStrategy", "newlines");
    props.setProperty("com.metamx.emitter.http.maxBatchSize", "4");
    props.setProperty("com.metamx.emitter.http.maxBufferSize", "8");

    final ObjectMapper objectMapper = new ObjectMapper();
    final HttpEmitterConfig config = objectMapper.convertValue(Emitters.makeHttpMap(props),
            HttpEmitterConfig.class);

    Assert.assertEquals(1, config.getFlushMillis());
    Assert.assertEquals(2, config.getFlushCount());
    Assert.assertEquals("http://example.com/", config.getRecipientBaseUrl());
    Assert.assertEquals("a:b", config.getBasicAuthentication());
    Assert.assertEquals(BatchingStrategy.NEWLINES, config.getBatchingStrategy());
    Assert.assertEquals(4, config.getMaxBatchSize());
    Assert.assertEquals(8, config.getMaxBufferSize());
}