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:dpfmanager.shell.core.DPFManagerProperties.java

public static void setPropertiesValue(String key, String value) {
    Properties properties = getPropertiesConfig();
    properties.setProperty(key, value);
    setPropertiesConfig(properties);// w  w w.  ja  va 2  s .co m
}

From source file:com.sap.prd.mobile.ios.mios.FatBinaryTest.java

@BeforeClass
public static void __setup() throws Exception {
    final String testName = "fatLibPreparation";

    final Properties pomReplacements = new Properties();
    pomReplacements.setProperty(PROP_NAME_DEPLOY_REPO_DIR, masterRemoteRepoDir.getAbsolutePath());
    pomReplacements.setProperty(PROP_NAME_DYNAMIC_VERSION, dynamicVersion);

    if (masterRemoteRepoDir.exists())
        com.sap.prd.mobile.ios.mios.FileUtils.deleteDirectory(masterRemoteRepoDir);

    test(testName, new File(getTestRootDirectory(), "straight-forward/MyLibrary"), "deploy", THE_EMPTY_LIST,
            THE_EMPTY_MAP, pomReplacements, new NullProjectModifier());
}

From source file:com.adaptris.util.datastore.TestSimpleDataStore.java

private static Properties createProperties() throws IOException {
    Properties sp = new Properties();
    File dataFile = File.createTempFile("junitsds", ".dat");
    File lockFile = File.createTempFile("junitsds", ".lock");
    dataFile.delete();/*from   w w  w  .  ja  va2 s.  c om*/
    lockFile.delete();
    sp.setProperty(SimpleDataStore.FILE_PROPERTY, dataFile.getCanonicalPath());
    sp.setProperty(SimpleDataStore.LOCK_PROPERTY, lockFile.getCanonicalPath());
    sp.setProperty(SimpleDataStore.MAXLOCK_PROPERTY, "10");
    return sp;
}

From source file:co.runrightfast.core.utils.ConfigUtils.java

static Properties toProperties(final Config config) {
    checkNotNull(config);/* www .  j  av a 2s .  c  o m*/
    final Properties props = new Properties();
    config.entrySet()
            .forEach(entry -> props.setProperty(entry.getKey(), entry.getValue().unwrapped().toString()));
    return props;
}

From source file:com.krawler.portal.util.SystemEnv.java

public static void setProperties(Properties props) {
    Properties envProps = getProperties();

    Enumeration<String> enu = (Enumeration<String>) envProps.propertyNames();

    while (enu.hasMoreElements()) {
        String key = enu.nextElement();

        props.setProperty("env." + key, (String) envProps.get(key));
    }//from ww w.  ja v a2  s.c  om
}

From source file:com.srotya.tau.api.dao.TestRuleGroupManager.java

@BeforeClass
public static void beforeClass() throws Exception {
    Properties config = new Properties(System.getProperties());
    File db = new File(TARGET_RULES_DB);
    if (db.exists()) {
        FileUtils.deleteDirectory(db);//w w  w .j a  va  2  s . c  om
    }
    config.setProperty("javax.persistence.jdbc.url", CONNECTION_STRING);
    try {
        emf = Persistence.createEntityManagerFactory("tau", config);
    } catch (Exception e) {
        e.printStackTrace();
        throw e;
    }
}

From source file:ca.ualberta.physics.cssdp.util.IntegrationTestScaffolding.java

@BeforeClass
public static void setupDb() {

    ApplicationProperties.dropOverrides();

    // initialize default properties
    Common.properties();// www. ja  v  a2s  .co m

    // override the database connection url to point to an in-memory
    // database
    Properties overrides = new Properties();
    overrides.put("common.logback.configuration", "src/test/resources/logback-test.xml");
    overrides.setProperty("common.hibernate.connection.url",
            "jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;MODE=PostgreSQL;TRACE_LEVEL_FILE=0;DB_CLOSE_ON_EXIT=FALSE");
    ApplicationProperties.overrideDefaults(overrides);

    String url = Common.properties().getString("hibernate.connection.url");
    String driver = Common.properties().getString("hibernate.connection.driver_class");
    String user = Common.properties().getString("hibernate.connection.username");
    String password = Common.properties().getString("hibernate.connection.password");
    String scriptsDir = "../database/migrations";

    Migrator migrator = new Migrator(url, driver, user, password, scriptsDir);
    migrator.initDb();
    migrator.migrateUpAll();

}

From source file:gdt.data.entity.BaseHandler.java

/**
   * Build the set of arguments needed to create an instance of BaseHandler 
   * and pack them in the special string parameter - locator. 
   *  // www.  ja  va 2s  .  com
   * @return The locator string.
   */
public static String getLocator() {
    Properties locator = new Properties();
    locator.setProperty(Locator.LOCATOR_TITLE, "Base handler");
    locator.setProperty(BaseHandler.HANDLER_CLASS, BaseHandler.class.getName());
    locator.setProperty(BaseHandler.HANDLER_SCOPE, BaseHandler.BASE_SCOPE);
    return Locator.toString(locator);
}

From source file:com.bc.fiduceo.TestUtil.java

private static void convertToProperties(Properties properties, BasicDataSource datasource) {
    properties.setProperty("driverClassName", datasource.getDriverClassName());
    properties.setProperty("url", datasource.getUrl());
    properties.setProperty("username", datasource.getUsername());
    properties.setProperty("password", datasource.getPassword());
}

From source file:eu.planets_project.tb.impl.services.mockups.workflow.WorkflowResult.java

/**
 * @param wfr//from   w ww . j  a v  a 2s . com
 * @param exp
 */
public static void recordWorkflowResultToExperiment(long eid, WorkflowResult wfr, String filename,
        BatchExecutionRecordImpl batch, Experiment exp) {
    DataHandler dh = new DataHandlerImpl();
    try {
        ExecutionRecordImpl rec = new ExecutionRecordImpl(batch);
        rec.setDigitalObjectReferenceCopy(filename);
        try {
            rec.setDigitalObjectSource(dh.get(filename).getName());
        } catch (FileNotFoundException e) {
            rec.setDigitalObjectSource(filename);
        }
        // Populate the exec record:
        rec.setStartDate(wfr.getStartDate());
        rec.setEndDate(wfr.getEndDate());
        rec.setReportLog(wfr.getReportLog());
        // And the stages.
        Set<ExecutionStageRecordImpl> stages = rec.getStages();

        if (wfr != null && wfr.getStages() != null) {
            // Examine the result:
            if (WorkflowResult.RESULT_DIGITAL_OBJECT.equals(wfr.getResultType())) {
                rec.setDigitalObjectResult((DigitalObject) wfr.getResult(), exp);

            } else if (WorkflowResult.RESULT_CREATEVIEW_RESULT.equals(wfr.getResultType())) {
                CreateViewResult cvr = (CreateViewResult) wfr.getResult();
                Properties vp = new Properties();
                vp.setProperty(ExecutionRecordImpl.RESULT_PROPERTY_CREATEVIEW_SESSION_ID,
                        cvr.getSessionIdentifier());
                vp.setProperty(ExecutionRecordImpl.RESULT_PROPERTY_CREATEVIEW_VIEW_URL,
                        cvr.getViewURL().toString());
                vp.setProperty(ExecutionRecordImpl.RESULT_PROPERTY_CREATEVIEW_ENDPOINT_URL,
                        wfr.getMainEndpoint().toString());
                rec.setPropertiesListResult(vp);

            } else {
                rec.setResultType(ExecutionRecordImpl.RESULT_MEASUREMENTS_ONLY);
            }

            // Now pull out the stages, which include the measurements etc:
            for (ExecutionStageRecordImpl stage : wfr.getStages()) {
                // FIXME Can this be done from the session's Service Registry instead, please!?
                if (stage.getEndpoint() != null) {
                    log.info("Recording info about endpoint: " + stage.getEndpoint());
                    stage.setServiceRecord(ServiceBrowser.createServiceRecordFromEndpoint(eid,
                            stage.getEndpoint(), Calendar.getInstance()));
                }
                // Re-reference this stage object from the Experiment:
                stages.add(stage);
            }
        }

        batch.getRuns().add(rec);
        log.info("Added records (" + batch.getRuns().size() + ") for " + rec.getDigitalObjectSource());
    } catch (Exception e) {
        log.error("Exception while parsing Execution Record.");
        e.printStackTrace();
    }

}