List of usage examples for java.lang System setProperty
public static String setProperty(String key, String value)
From source file:com.redhat.victims.util.VictimsConfig.java
/** * Set configuration options for victims-lib * * @link https://github.com/victims/victims-lib-java#configuration-options *//*from w w w .ja v a 2 s. c o m*/ public static void configureVictimsOptions() { Map<String, String> config = VictimsConfig.getProperties(); for (String key : config.keySet()) { //only set from properties if no JVM option if (StringUtils.isBlank(System.getProperty(key)) && StringUtils.isNotBlank(config.get(key))) { System.setProperty(key, config.get(key)); } } }
From source file:org.brekka.stillingar.example.PollingReloadTest.java
@BeforeClass public static void setOverrideProperty() { // Simulate JDK < 7 System.setProperty("stillingar.reload-watcher.disabled", "true"); writeConfig("Reload check"); }
From source file:org.apache.camel.example.camel.transport.CamelTransportClientServerTest.java
@BeforeClass public static void startUpServer() throws Exception { if (!"true".equalsIgnoreCase(System.getProperty("skipStartingCamelContext"))) { port = AvailablePortFinder.getNextAvailable(); System.setProperty("port", String.valueOf(port)); context = new ClassPathXmlApplicationContext( new String[] { "/META-INF/spring/CamelTransportSpringConfig.xml" }); } else {/*from w w w . java 2 s .c om*/ System.out.println( "Skipping starting CamelContext as system property skipStartingCamelContext is set to be true."); } }
From source file:Main.java
/** * Used to optimize performance by avoiding expensive file access every time * a DocumentBuilderFactory is constructed as a result of constructing a * Xalan document factory./*from w w w . ja v a 2 s. com*/ */ private static void speedUpDcoumentBuilderFactory() { if (System.getProperty(DOCUMENT_BUILDER_FACTORY_PROP_NAME) == null) { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); if (DOCUMENT_BUILDER_FACTORY_IMPL_CLASS_NAME.equals(factory.getClass().getName())) { // This would avoid the file system to be accessed every time // the internal DocumentBuilderFactory is instantiated. System.setProperty(DOCUMENT_BUILDER_FACTORY_PROP_NAME, DOCUMENT_BUILDER_FACTORY_IMPL_CLASS_NAME); } } }
From source file:org.apache.hadoop.gateway.jetty.SslSocketTest.java
@BeforeClass public static void setupSuite() { System.setProperty("javax.net.ssl.keyStore", "target/test-classes/server-keystore.jks"); System.setProperty("javax.net.ssl.keyStorePassword", "horton"); System.setProperty("javax.net.ssl.trustStore", "target/test-classes/server-keystore.jks"); System.setProperty("javax.net.ssl.trustStorePassword", "horton"); System.setProperty("java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol"); System.setProperty("javax.net.debug", "ssl"); }
From source file:org.apache.cxf.fediz.integrationtests.BadWReqTest.java
@BeforeClass public static void init() { System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.SimpleLog"); System.setProperty("org.apache.commons.logging.simplelog.showdatetime", "true"); System.setProperty("org.apache.commons.logging.simplelog.log.httpclient.wire", "info"); System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.commons.httpclient", "info"); System.setProperty("org.apache.commons.logging.simplelog.log.org.springframework.webflow", "info"); System.setProperty("org.apache.commons.logging.simplelog.log.org.springframework.security.web", "info"); System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.cxf.fediz", "info"); System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.cxf", "info"); idpHttpsPort = System.getProperty("idp.https.port"); Assert.assertNotNull("Property 'idp.https.port' null", idpHttpsPort); rpHttpsPort = System.getProperty("rp.https.port"); Assert.assertNotNull("Property 'rp.https.port' null", rpHttpsPort); initIdp();/* w ww. ja v a2 s . c om*/ initRp(); }
From source file:Main.java
/** * Used to optimize performance by avoiding expensive file access every time * a DTMManager is constructed as a result of constructing a Xalan xpath * context!//from w ww . j a va2 s . co m */ private static void speedUpDTMManager() { // https://github.com/aws/aws-sdk-java/issues/238 // http://stackoverflow.com/questions/6340802/java-xpath-apache-jaxp-implementation-performance String className = System.getProperty(DTM_MANAGER_DEFAULT_PROP_NAME); if (className == null) { DTMManager dtmManager = new XPathContext().getDTMManager(); if (dtmManager instanceof DTMManagerDefault) { // This would avoid the file system to be accessed every time // the internal XPathContext is instantiated. System.setProperty(DTM_MANAGER_DEFAULT_PROP_NAME, DTMManagerDefault.class.getName()); } } }
From source file:net.rptools.tokentool.AppSetup.java
public static void install(String versionString) { System.setProperty("appHome", getAppHome("logs").getAbsolutePath()); log = LogManager.getLogger(AppSetup.class); File overlayVer = new File(getAppHome().getAbsolutePath() + "/version.txt"); Collection<File> existingOverLays = FileUtils.listFiles(AppConstants.OVERLAY_DIR, ImageUtil.SUPPORTED_FILE_FILTER, TrueFileFilter.INSTANCE); log.info("Overlays installed: " + existingOverLays.size()); // Only install overlays once or if version.text is missing or version is newer // Overlays are stored in a version packaged structure so we can later install only newer overlays if wanted String installedVersion = "0"; try {/* ww w.j a v a 2 s . co m*/ if (overlayVer.exists()) { installedVersion = FileUtils.readFileToString(overlayVer, Charset.defaultCharset()); } else { FileUtils.writeStringToFile(overlayVer, versionString, Charset.defaultCharset()); } } catch (IOException ioe) { log.error(ioe); } if (existingOverLays.isEmpty() || isNewerVersion(TokenTool.getVersion(), installedVersion)) { try { installDefaultOverlays(); } catch (IOException e) { log.error(e); } // Update version file to new version try { FileUtils.writeStringToFile(overlayVer, versionString, Charset.defaultCharset()); } catch (IOException e) { log.error(e); } } }
From source file:org.chimi.s4s.metainfo.mysql.MysqlMetaInfoDaoTest.java
@BeforeClass public static void init() { System.setProperty("metainfo.db", "mysql"); }
From source file:name.martingeisse.esdk.simulation.lwjgl.NativeLibraryHelper.java
/** * Extracts LWJGL libraries to a folder and * @throws Exception on errors/*w w w .j av a2 s . c o m*/ */ public static void prepareNativeLibraries() throws Exception { // Unfortunately, Java is also too stupid to create a temp directory... tempFolder = File.createTempFile("miner-launcher-", ""); deleteRecursively(tempFolder); tempFolder.mkdir(); logger.debug("temp: " + tempFolder.getAbsolutePath()); // detect which set of native libraries to load, then extract the files resourcePath = OperatingSystemSelector.getHostOs().getNativeLibraryPath(); logger.debug("native library path: " + resourcePath); for (String fileName : OperatingSystemSelector.getHostOs().getNativeLibraryFileNames()) { extractFile(fileName); } // make Java use our libraries System.setProperty("java.library.path", tempFolder.getAbsolutePath()); final Field fieldSysPath = ClassLoader.class.getDeclaredField("sys_paths"); fieldSysPath.setAccessible(true); fieldSysPath.set(null, null); }