List of usage examples for java.lang System setProperty
public static String setProperty(String key, String value)
From source file:com.pivotal.gemfire.tools.pulse.testbed.driver.TomcatHelper.java
public static Tomcat startTomcat(String bindAddress, int port, String context, String path) throws Exception { Tomcat tomcat = new Tomcat(); // Set up logging - first we're going to remove all existing handlers. Don't do this before Tomcat is // instantiated otherwise there isn't anything to remove. /*/* w w w . j a v a2 s . c o m*/ Logger globalLogger = Logger.getLogger(""); for (Handler handler : globalLogger.getHandlers()) { globalLogger.removeHandler(handler); } // Now let's add our handler Handler gfHandler = new GemFireHandler((LogWriterImpl) log); Logger logger = Logger.getLogger(""); logger.addHandler(gfHandler); */ // Set up for commons-logging which is used by Spring. // This forces JCL to use the JDK logger otherwise it defaults to trying to use Log4J. if (System.getProperty("org.apache.commons.logging.Log") == null) { System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.Jdk14Logger"); } if (bindAddress != null && bindAddress.length() > 0) { Connector c = tomcat.getConnector(); IntrospectionUtils.setProperty(c, "address", bindAddress); } tomcat.setPort(port); // Working (scratch) dir String scratch = System.getProperty("java.io.tmpdir") + System.getProperty("file.separator") + "Pulse_" + ((bindAddress == null || bindAddress.length() == 0) ? "0.0.0.0" : bindAddress) + "_" + port + "_" + String.format("%x", path.hashCode()); tomcat.setBaseDir(scratch); StandardHost stdHost = (StandardHost) tomcat.getHost(); //stdHost.setUnpackWARs(false); //tomcat.addContext(context, path); tomcat.addWebapp(stdHost, context, path); stdHost.setDeployOnStartup(true); tomcat.start(); return tomcat; }
From source file:com.pivotal.gemfire.tools.pulse.tests.TomcatHelper.java
public static Tomcat startTomcat(String bindAddress, int port, String context, String path) throws Exception { Tomcat tomcat = new Tomcat(); // Set up logging - first we're going to remove all existing handlers. Don't do this before Tomcat is // instantiated otherwise there isn't anything to remove. /*// w w w. j a va2s. c o m Logger globalLogger = Logger.getLogger(""); for (Handler handler : globalLogger.getHandlers()) { globalLogger.removeHandler(handler); } // Now let's add our handler Handler gfHandler = new GemFireHandler((LogWriterImpl) log); Logger logger = Logger.getLogger(""); logger.addHandler(gfHandler); */ // Set up for commons-logging which is used by Spring. // This forces JCL to use the JDK logger otherwise it defaults to trying to // use Log4J. if (System.getProperty("org.apache.commons.logging.Log") == null) { System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.Jdk14Logger"); } if (bindAddress != null && bindAddress.length() > 0) { Connector c = tomcat.getConnector(); IntrospectionUtils.setProperty(c, "address", bindAddress); } tomcat.setPort(port); // Working (scratch) dir String scratch = System.getProperty("java.io.tmpdir") + System.getProperty("file.separator") + "Pulse_" + ((bindAddress == null || bindAddress.length() == 0) ? "0.0.0.0" : bindAddress) + "_" + port + "_" + String.format("%x", path.hashCode()); tomcat.setBaseDir(scratch); StandardHost stdHost = (StandardHost) tomcat.getHost(); // stdHost.setUnpackWARs(false); // tomcat.addContext(context, path); tomcat.addWebapp(stdHost, context, path); stdHost.setDeployOnStartup(true); tomcat.start(); return tomcat; }
From source file:org.brekka.stillingar.example.NestedServiceTest.java
@AfterClass public static void unSetProperty() { System.setProperty("stillingar.reload-watcher.disabled", "false"); }
From source file:org.bonitasoft.web.designer.config.DesignerConfigTest.java
@BeforeClass public static void init() throws IOException { //We can't use Spring to load the property file because we are before the context initialization prop.load(DesignerConfigTest.class.getClassLoader().getResourceAsStream("application.properties")); //We want to personnalize the workspace directory System.setProperty("repository.pages", prop.getProperty("builddirectory") + "/test-classes/workspace/pages"); System.setProperty("repository.widgets", prop.getProperty("builddirectory") + "/test-classes/workspace/widgets"); }
From source file:coyote.commons.network.http.SSLServerSocketFactoryTest.java
/** * @throws java.lang.Exception//from ww w .jav a 2 s .c o m */ @BeforeClass public static void setUpBeforeClass() throws Exception { // setup the keystore System.setProperty("javax.net.ssl.trustStore", new File("src/test/resources/keystore.jks").getAbsolutePath()); // make sure our port is available, or pick the next available port = NetUtil.getNextAvailablePort(port); // start the server on the port testServer = new TestingServer(port); // set the secure server socket factory using the keystore testServer.makeSecure(HTTPD.makeSSLSocketFactory("/keystore.jks", "password".toCharArray()), null); // which way is better? //testServer.setServerSocketFactory( new SecureServerSocketFactory( HTTPD.makeSSLSocketFactory( "/keystore.jks", "password".toCharArray() ), null ) ); // start the server testServer.start(); // try to start the server, waiting only 2 seconds before giving up try { final long start = System.currentTimeMillis(); Thread.sleep(100L); while (!testServer.wasStarted()) { Thread.sleep(100L); if ((System.currentTimeMillis() - start) > 2000) { testServer.stop(); fail("could not start server"); } } } catch (final InterruptedException e) { } }
From source file:net.sf.ehcache.store.ApacheLruMemoryStoreTest.java
/** * setup test/*from w ww . j av a 2 s.co m*/ */ protected void setUp() throws Exception { System.setProperty("net.sf.ehcache.useLRUMap", "true"); super.setUp(); }
From source file:com.mtt.myapp.infra.config.ConfigTest.java
@Before public void before() { System.setProperty("unit-test", ""); config = new MockConfig(); }
From source file:com.sifcoapp.report.util.ReportConfigUtil.java
/** * PRIVATE METHODS//from www .j ava 2 s . c o m */ private static void setCompileTempDir(ServletContext context, String uri) { System.setProperty("jasper.reports.compile.temp", context.getRealPath(uri)); }
From source file:br.gov.jfrj.siga.base.ConexaoHTTP.java
public static String get(String URL, HashMap<String, String> header, Integer timeout, String payload) throws AplicacaoException { try {//from w w w .j a v a2 s . co m HttpURLConnection conn = (HttpURLConnection) new URL(URL).openConnection(); if (timeout != null) { conn.setConnectTimeout(timeout); conn.setReadTimeout(timeout); } //conn.setInstanceFollowRedirects(true); if (header != null) { for (String s : header.keySet()) { conn.setRequestProperty(s, header.get(s)); } } System.setProperty("http.keepAlive", "false"); if (payload != null) { byte ab[] = payload.getBytes("UTF-8"); conn.setRequestMethod("POST"); // Send post request conn.setDoOutput(true); OutputStream os = conn.getOutputStream(); os.write(ab); os.flush(); os.close(); } //StringWriter writer = new StringWriter(); //IOUtils.copy(conn.getInputStream(), writer, "UTF-8"); //return writer.toString(); return IOUtils.toString(conn.getInputStream(), "UTF-8"); } catch (IOException ioe) { throw new AplicacaoException("No foi possvel abrir conexo", 1, ioe); } }
From source file:org.apache.coheigea.cxf.fediz.tomcat.sso.FederationTest.java
@BeforeClass public static void init() throws Exception { 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"); // idpHttpsPort = "12345"; Assert.assertNotNull("Property 'idp.https.port' null", idpHttpsPort); rpHttpsPort = System.getProperty("rp.https.port"); Assert.assertNotNull("Property 'rp.https.port' null", rpHttpsPort); idpServer = startServer(true, idpHttpsPort); rpServer = startServer(false, rpHttpsPort); }