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.pros.jsontransform.plugin.constraint.ConstraintTaxPercentRangeTest.java

@Test
public void testPlugin() throws IOException, ObjectTransformerException {
    jsonSource = JunitTools.readFile(pathToJson + "/" + fileNamePrefix + "Source.json");
    jsonTransform = JunitTools.readFile(pathToJson + "/" + fileNamePrefix + "Map.json");
    jsonTarget = JunitTools.readFile(pathToJson + "/" + fileNamePrefix + "Target.json");

    Properties properties = new Properties();
    properties.setProperty("plugin.folder", pathToPlugins);
    ObjectTransformer transformer = new ObjectTransformer(properties, mapper);
    String result = transformer.transform(jsonSource, jsonTransform);

    System.out.println(result);//  w  w w.j  a  v  a  2  s . co m

    assertTrue(mapper.readTree(result).equals(mapper.readTree(jsonTarget)));
}

From source file:com.enonic.cms.business.MockSitePropertiesService.java

public void setProperty(SiteKey siteKey, String key, String value) {
    Properties props = getSiteProperties(siteKey).getProperties();
    props.setProperty(key, value);
}

From source file:com.fengduo.bee.commons.velocity.VelocityViewPaser.java

@PostConstruct
public void init() {

    // @SuppressWarnings("unused")
    // ViewResolver viewResolver = (ViewResolver)
    // SpringContextAware.getBean(DispatcherServlet.VIEW_RESOLVER_BEAN_NAME);

    Properties pro = new Properties();
    pro.setProperty("resource.loader", "file");
    pro.setProperty("file.resource.loader.path", DEFAULT_RELOAD_PATH);
    pro.setProperty("input.encoding", "utf-8");
    pro.setProperty("output.encoding", "utf-8");
    velocityEngine = new VelocityEngine(pro);
}

From source file:fr.xebia.springframework.security.core.userdetails.memory.ExtendedInMemoryDaoImplTest.java

@Test
public void testSetUserProperties() {
    final String USER1 = "bob";
    final String PROP1 = "bobpassword,ROLE,USER_ROLE,enabled,@(192.168.1.*;127.0.0.1)";

    ExtendedInMemoryDaoImpl dao = new ExtendedInMemoryDaoImpl();
    Properties properties = new Properties();
    properties.setProperty(USER1, PROP1);
    dao.setUserProperties(properties);//  ww  w . ja v  a2 s  .  c o m
    assertEquals("Unexpected number of users", 1, dao.getUserMap().getUserCount());
    assertNotNull("Unable to find user name", dao.getUserMap().getUser(USER1));
    assertTrue("Bad activated parameter", dao.getUserMap().getUser(USER1).isEnabled());
}

From source file:pl.softech.eav.example.JpaConfig.java

@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory(JpaVendorAdapter jpaVendorAdapter,
        DataSource ds, @Value("${hibernate.show_sql}") String showSql,
        @Value("${hibernate.format_sql}") String formatSql,
        @Value("${hibernate.cache.use_second_level_cache}") String useSecondLevelCache) {
    LocalContainerEntityManagerFactoryBean lemfb = new LocalContainerEntityManagerFactoryBean();
    lemfb.setDataSource(ds);//from  w  w  w . ja va 2  s  .c o m
    lemfb.setJpaVendorAdapter(jpaVendorAdapter);
    lemfb.setPackagesToScan("pl.softech.eav.domain");
    Properties jpaProperties = new Properties();
    jpaProperties.setProperty("hibernate.cache.region.factory_class",
            "org.hibernate.cache.ehcache.EhCacheRegionFactory");
    jpaProperties.setProperty("hibernate.cache.use_second_level_cache", useSecondLevelCache);
    jpaProperties.setProperty("hibernate.show_sql", showSql);
    jpaProperties.setProperty("hibernate.format_sql", formatSql);
    /* See https://hibernate.atlassian.net/browse/HHH-8796 */
    jpaProperties.setProperty("hibernate.schema_update.unique_constraint_strategy", "RECREATE_QUIETLY");
    lemfb.setJpaProperties(jpaProperties);
    return lemfb;
}

From source file:com.aerolinea.config.WebConfig.java

@Bean
public LocalSessionFactoryBean sessionFactory() {
    LocalSessionFactoryBean sfb = new LocalSessionFactoryBean();
    sfb.setDataSource(restDataSource());
    sfb.setPackagesToScan(new String[] { "com.aerolinea.entidad" });
    Properties props = new Properties();
    props.setProperty("hibernate.dialect", "org.hibernate.dialect.MySQLDialect");
    //        props.setProperty("driver_class", "");
    //        props.setProperty("url", "");
    //        props.setProperty("username", "root");
    //        props.setProperty("password", "admin");
    sfb.setHibernateProperties(props);/* w w w .  j  a v a2s .  c  o  m*/
    return sfb;
}

From source file:com.pros.jsontransform.plugin.sort.ArraySortByAvgAgeTest.java

@Test
public void testPlugin() throws IOException, ObjectTransformerException {
    jsonSource = JunitTools.readFile(pathToJson + "/" + fileNamePrefix + "Source.json");
    jsonTransform = JunitTools.readFile(pathToJson + "/" + fileNamePrefix + "Map.json");
    jsonTarget = JunitTools.readFile(pathToJson + "/" + fileNamePrefix + "Target.json");

    Properties properties = new Properties();
    properties.setProperty("plugin.folder", pathToPlugins);
    ObjectTransformer transformer = new ObjectTransformer(properties, mapper);
    //transformer.getLogger().setLevel(Level.DEBUG);
    String result = transformer.transform(jsonSource, jsonTransform);

    System.out.println(result);//from   w w  w .ja v a 2s  . c o m

    assertTrue(mapper.readTree(result).equals(mapper.readTree(jsonTarget)));
}

From source file:kr.co.bitnine.octopus.meta.jdo.JDOMetaStore.java

@Override
public void start(Properties conf, UpdateLoggerFactory updateLoggerFactory) throws MetaException {
    Properties props = new Properties();
    props.setProperty("javax.jdo.PersistenceManagerFactoryClass",
            "org.datanucleus.api.jdo.JDOPersistenceManagerFactory");
    props.setProperty("datanucleus.ConnectionDriverName",
            conf.getProperty("metastore.jdo.connection.drivername"));
    props.setProperty("datanucleus.ConnectionURL", conf.getProperty("metastore.jdo.connection.URL"));
    props.setProperty("datanucleus.ConnectionUserName", conf.getProperty("metastore.jdo.connection.username"));
    props.setProperty("datanucleus.ConnectionPassword", conf.getProperty("metastore.jdo.connection.password"));
    props.setProperty("datanucleus.connectionPoolingType", "DBCP");
    props.setProperty("datanucleus.schema.autoCreateAll", "true");

    if (conf.getProperty("metastore.jdo.connection.drivername").equals("org.sqlite.JDBC")) {
        // for sequences
        props.setProperty("datanucleus.valuegeneration.transactionAttribute", "UsePM");
        // connection pooling occurs NullPointerException
        props.setProperty("datanucleus.connectionPoolingType", "None");
        props.setProperty("datanucleus.connectionPoolingType.nontx", "None");
    }//w w  w.  j a v a  2s  .c om

    pmf = JDOHelper.getPersistenceManagerFactory(props);
    JDOMetaStore.ulf = updateLoggerFactory;
}

From source file:com.amazonaws.services.kinesis.producer.KinesisProducerConfigurationTest.java

@Test
public void unknownProperty() {
    Properties p = new Properties();
    p.setProperty("xcdfndetnedtne5tje45", "Sfbsfrne34534");
    KinesisProducerConfiguration.fromPropertiesFile(writeFile(p));
    // should not throw exception
}

From source file:com.apress.prospringintegration.messaging.qpid.jms.adapter.QpidConfiguration.java

@Bean
public JndiTemplate jndiTemplate() {
    JndiTemplate jndiTemplate = new JndiTemplate();
    Properties properties = new Properties();
    properties.setProperty("java.naming.factory.initial",
            "org.apache.qpid.jndi.PropertiesFileInitialContextFactory");
    jndiTemplate.setEnvironment(properties);

    return jndiTemplate;
}