List of usage examples for java.lang System setProperties
public static void setProperties(Properties props)
From source file:org.apache.cxf.dosgi.singlebundle.AggregatedActivatorTest.java
@Override protected void tearDown() throws Exception { super.tearDown(); Properties props = new Properties(); props.putAll(savedProps);/*from w ww. ja v a2 s. c om*/ System.setProperties(props); AggregatedActivator.DEFAULT_HTTP_PORT = oldDefaultPort; }
From source file:com.asakusafw.bulkloader.testutil.UnitTestUtil.java
public static void tearDownEnv() throws Exception { Properties p = System.getProperties(); p.remove(Constants.ASAKUSA_HOME);//w w w .j a v a 2 s. c o m p.remove(Constants.THUNDER_GATE_HOME); ConfigurationLoader.setSysProp(p); System.setProperties(p); }
From source file:com.ibm.watson.app.common.codegen.languages.WatsonAppJaxRSServerCodegenTest.java
@After public void cleanup() { Properties props = System.getProperties(); props.remove(PACKAGE_PREFIX); System.setProperties(props); }
From source file:com.couchbase.shell.CouchbaseShell.java
public CouchbaseShell() { connected = false;/*from www. ja va2 s .co m*/ hasQuery = false; Properties systemProperties = System.getProperties(); systemProperties.put("net.spy.log.LoggerImpl", "net.spy.memcached.compat.log.Log4JLogger"); System.setProperties(systemProperties); }
From source file:ch.nydi.spring.config.SystemPropertiesFactoryBean.java
@Override protected Properties createProperties() throws IOException { final Properties originalProperties = super.createProperties(); final Properties propertiesReplaced = new Properties(); final PropertyVariableParser propertyParser = new PropertyVariableParser(); for (final Map.Entry<Object, Object> entry : originalProperties.entrySet()) { propertiesReplaced.put(entry.getKey(), propertyParser.replaceVariables((String) entry.getValue())); }/*from w w w .ja v a 2 s.c o m*/ if (propagateToSystemProperties) { final Properties systemProperties = System.getProperties(); systemProperties.putAll(propertiesReplaced); System.setProperties(systemProperties); } return propertiesReplaced; }
From source file:com.mindquarry.webapp.servlet.ConfigLoaderListener.java
/** * @see javax.servlet.ServletContextListener#contextInitialized(javax.servlet.ServletContextEvent) *//* w ww . j a v a 2s .co m*/ public void contextInitialized(ServletContextEvent ctxEvent) { try { // load props file File propFile = new File(System.getProperty(P_CONFIG_FILE, "mindquarry-webapplication.properties")); //$NON-NLS-1$ FileInputStream is = new FileInputStream(propFile); // load props Properties props = new Properties(); props.load(is); // add props to system props Properties sysProps = System.getProperties(); sysProps.putAll(props); System.setProperties(sysProps); } catch (Exception e) { log.error("An error occured while loading system properties.", e); System.exit(-1); } }
From source file:org.jboss.bqt.framework.TestConfigPropertyLoader.java
/** * Tests {@link org.jboss.bqt.core.util.PropertiesUtils} * @throws Exception //from w ww . j a va 2s .com */ @Test public void test1() throws Exception { // add this step of removing the property because the order of // running is not guaranteed, and if this doesn't run first, // this property is set by other tests Properties props = System.getProperties(); props.remove(ConfigPropertyNames.CONFIG_FILE); System.setProperties(props); System.setProperty("test", "value"); ConfigPropertyLoader _instance = ConfigPropertyLoader.getInstance(); Properties p = _instance.getProperties(); assertNotNull(p); assertTrue(!p.isEmpty()); assertEquals("value", p.getProperty("test")); //$NON-NLS-1$ //$NON-NLS-2$ _instance.setProperty("override", "ovalue"); assertEquals("ovalue", _instance.getProperty("override")); //$NON-NLS-1$ //$NON-NLS-2$ // confirm the loader actually loaded the default-config.properties file assertEquals("driver", p.getProperty(ConfigPropertyNames.CONNECTION_TYPE)); //$NON-NLS-1$ //$NON-NLS-2$ System.setProperty("username", ""); ConfigPropertyLoader.reset(); _instance = ConfigPropertyLoader.getInstance(); p = _instance.getProperties(); assertNull("should be null after reset", _instance.getProperties().getProperty("override")); assertEquals("failed to pickup system property", "value", p.getProperty("test")); //$NON-NLS-1$ //$NON-NLS-2$ // confirm the loader actually loaded the default-config.properties file assertEquals("failed to correctly pickup the User ", "", _instance.getProperty("conn.user")); //$NON-NLS-1$ //$NON-NLS-2$ }
From source file:org.settings4j.helper.spring.Settings4jPlaceholderConfigurerTest.java
@Before public void setUp() throws Exception { removeUnitTestNode(Preferences.userRoot()); removeUnitTestNode(Preferences.systemRoot()); Properties props = System.getProperties(); props.remove(SYSTEM_PROPERTY_TEST_1); props.remove(SYSTEM_PROPERTY_TEST_2); props.remove(SYSTEM_PROPERTY_TEST_3); System.setProperties(props); }
From source file:org.codice.ddf.catalog.transformer.zip.TestZipValidator.java
@AfterClass public static void tearDownAfterClass() { System.setProperties(properties); }
From source file:org.kjkoster.zapcat.test.ZabbixAgentProtocolTest.java
/** * Sleep a little, to give the agent time to die. Restore the system * properties and check that we have not settings screwing up our * experiments.//from w ww. jav a2s . c om * * @throws Exception * When the test failed. */ @After public void tearDown() throws Exception { Thread.sleep(100); System.setProperties(originalProperties); assertNull(originalProperties.getProperty(ZabbixAgent.PROTOCOL_PROPERTY)); assertNull(originalProperties.get(ZabbixAgent.PROTOCOL_PROPERTY)); assertNull(System.getProperty(ZabbixAgent.PROTOCOL_PROPERTY)); }