List of usage examples for java.util Properties setProperty
public synchronized Object setProperty(String key, String value)
From source file:com.asakusafw.bulkloader.testutil.UnitTestUtil.java
public static void setUpEnv() throws Exception { Properties p = System.getProperties(); p.setProperty(Constants.ASAKUSA_HOME, new File(".").getCanonicalPath()); p.setProperty(Constants.THUNDER_GATE_HOME, new File(PATH_DIST_TEST).getCanonicalPath()); ConfigurationLoader.setSysProp(p);//from www . j a va2 s . c o m System.setProperties(p); }
From source file:com.epam.dlab.automation.helper.PropertiesResolver.java
public static void overlapProperty(Properties props, String propertyName, boolean isOptional) { String argName = StringUtils.replaceChars(propertyName, '_', '.').toLowerCase(); String s = System.getProperty(argName, ""); if (!s.isEmpty()) { props.setProperty(propertyName, s); }/* w w w . j av a 2s . c om*/ if (!isOptional && props.getProperty(propertyName, "").isEmpty()) { throw new IllegalArgumentException( "Missed required argument -D" + argName + " or property " + propertyName); } }
From source file:eu.openanalytics.rsb.component.JobProcessor.java
private static void uploadPropertiesToR(final RServi rServi, final Map<String, Serializable> metas, final Set<String> filesUploadedToR) throws CoreException, IOException { final ByteArrayOutputStream baos = new ByteArrayOutputStream(); final Properties properties = new Properties(); for (final Entry<String, Serializable> meta : metas.entrySet()) { properties.setProperty(meta.getKey(), meta.getValue().toString()); }//from w w w . j a va 2 s . com properties.store(baos, null); final ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); rServi.uploadFile(bais, bais.available(), Constants.MULTIPLE_FILES_JOB_CONFIGURATION, 0, null); filesUploadedToR.add(Constants.MULTIPLE_FILES_JOB_CONFIGURATION); }
From source file:com.dtolabs.rundeck.core.cli.project.ProjectTool.java
static void parsePropertyArg(Properties props, String s) { if (isExtendedPropertyArg(s)) { final int ei = s.indexOf("="); String key = s.substring(2, ei); String val = s.substring(ei + 1); props.setProperty(key, val); }//from www. ja va 2 s. c o m }
From source file:com.knowbout.hibernate.HibernateUtil.java
/** * This will add properties to the hibernate configuration for each entry that has * a non null value and will remove properties for entries will a null value. It will also attempt * to close the old SessionFactory and create a new one based on the new properties. * All sessions must be closed before this method is called. * @param properties//from w w w . j a v a2 s . c o m */ public synchronized static void setProperties(HashMap<String, String> properties) { Properties currentProps = config.getProperties(); Set<Entry<String, String>> entries = properties.entrySet(); for (Entry<String, String> entry : entries) { if (entry.getValue() == null) { currentProps.remove(entry.getKey()); } else { currentProps.setProperty(entry.getKey(), entry.getValue()); } } if (sessionFactory != null) { sessionFactory.close(); sessionFactory = null; } }
From source file:com.wavemaker.common.util.SystemUtils.java
public static void writePropertiesFile(OutputStream os, Properties props, List<String> includePropertyNames, String comment) {/*from w ww . java 2 s . c o m*/ try { if (includePropertyNames != null) { Properties p = new Properties(); for (String key : CastUtils.<String>cast(props.keySet())) { if (includePropertyNames.contains(key)) { p.setProperty(key, props.getProperty(key)); } } props = p; } props.store(os, comment); } catch (IOException ex) { throw new RuntimeException(ex); } }
From source file:com.glaf.core.jdbc.connection.ConnectionProviderFactory.java
protected static Properties getConnectionProperties(Properties properties) { Iterator<?> iter = properties.keySet().iterator(); Properties result = new Properties(); while (iter.hasNext()) { String prop = (String) iter.next(); if (prop.startsWith(DBConfiguration.JDBC_DRIVER) && !SPECIAL_PROPERTIES.contains(prop)) { result.setProperty(prop.substring(DBConfiguration.JDBC_PREFIX.length() + 1), properties.getProperty(prop)); }/*w w w. j a va2 s. c o m*/ } String userName = properties.getProperty(DBConfiguration.JDBC_USER); if (userName != null) { result.setProperty("user", userName); } String pwd = properties.getProperty(DBConfiguration.JDBC_PASSWORD); if (pwd != null) { result.setProperty("password", pwd); } return result; }
From source file:com.mgmtp.jfunk.common.util.Configuration.java
private static void copyProperty(final Properties target, final Configuration source, final String key) { String value = source.get(key); if (!Strings.isNullOrEmpty(value)) { target.setProperty(key, value); }//w w w . j ava 2s. c om }
From source file:com.sap.prd.mobile.ios.mios.StraightForwardLibAndAppTest.java
@BeforeClass public static void __setup() throws Exception { dynamicVersion = "1.0." + String.valueOf(System.currentTimeMillis()); myLibArtifactFilePrefix = TestConstants.GROUP_ID_WITH_SLASH + "/MyLibrary/" + dynamicVersion + "/MyLibrary-" + dynamicVersion;/*from www . java 2 s.c o m*/ testName = StraightForwardLibAndAppTest.class.getName() + File.separator + Thread.currentThread().getStackTrace()[1].getMethodName(); remoteRepositoryDirectory = getRemoteRepositoryDirectory(StraightForwardLibAndAppTest.class.getName()); prepareRemoteRepository(remoteRepositoryDirectory); Properties pomReplacements = new Properties(); pomReplacements.setProperty(PROP_NAME_DEPLOY_REPO_DIR, remoteRepositoryDirectory.getAbsolutePath()); pomReplacements.setProperty(PROP_NAME_DYNAMIC_VERSION, dynamicVersion); Map<String, String> additionalSystemProperties = new HashMap<String, String>(); additionalSystemProperties.put("mios.ota-service.url", "http://apple-ota.wdf.sap.corp:8080/ota-service/HTML"); additionalSystemProperties.put("xcode.app.defaultConfigurations", "Release"); additionalSystemProperties.put("xcode.app.defaultSdks", "iphoneos"); additionalSystemProperties.put("archive.dir", "archive"); additionalSystemProperties.put("xcode.useSymbolicLinks", Boolean.TRUE.toString()); test(testName, new File(getTestRootDirectory(), "straight-forward/MyLibrary"), "deploy", THE_EMPTY_LIST, THE_EMPTY_MAP, pomReplacements, new NullProjectModifier()); appVerifier = test(testName, new File(getTestRootDirectory(), "straight-forward/MyApp"), "deploy", THE_EMPTY_LIST, additionalSystemProperties, pomReplacements, new NullProjectModifier()); myAppVersionRepoDir = TestConstants.GROUP_ID_WITH_SLASH + "/MyApp/" + dynamicVersion; myAppArtifactFilePrefix = myAppVersionRepoDir + "/MyApp-" + dynamicVersion; final File tmpFolder = new File(getTargetDirectory(), "tests/tmp"); tmpFolder.deleteOnExit(); extractedIpaFolder = new File(tmpFolder, "ipa"); extractFileWithShellScript( new File(remoteRepositoryDirectory, myAppArtifactFilePrefix + "-Release-iphoneos.ipa"), extractedIpaFolder); File appstoreUploadFile = new File(remoteRepositoryDirectory, myAppArtifactFilePrefix + "-Release-iphoneos-app.zip"); assertTrue(appstoreUploadFile.exists()); appstoreFolder = new File(tmpFolder, "appstoreFolder"); appstoreFolder.deleteOnExit(); extractFileWithShellScript(appstoreUploadFile, appstoreFolder); appTestBaseDir = new File(appVerifier.getBasedir()); archiveArtifactsDir = new File(appTestBaseDir, "archive/artifacts/com.sap.ondevice.production.ios.tests/MyApp"); }
From source file:com.bibisco.test.AllTests.java
public static SqlSessionFactory getBibiscoSqlSessionFactory() { SqlSessionFactory mSqlSessionFactory; try {// w w w . j ava2s.c om if (!mBlnEnvironmentInitialized) { init(); } Reader lReader = Resources.getResourceAsReader(RESOURCE_FILE_NAME); Properties lProperties = new Properties(); lProperties.setProperty("url", mStrBibiscoDBUrl); lProperties.setProperty("username", DB_USERNAME); lProperties.setProperty("password", DB_PASSWORD); mSqlSessionFactory = new SqlSessionFactoryBuilder().build(lReader, SQL_SESSION_ENVIRONMENT_JUNIT_TEST, lProperties); } catch (Exception e) { throw new IllegalStateException(e); } return mSqlSessionFactory; }