Tabnine Logo
System.setProperties
Code IndexAdd Tabnine to your IDE (free)

How to use
setProperties
method
in
java.lang.System

Best Java code snippets using java.lang.System.setProperties (Showing top 20 results out of 1,467)

origin: wildfly/wildfly

  public Void run() {
    System.setProperties(properties);
    return null;
  }
}
origin: apache/geode

private static void removeJavaProperties(final Properties javaProps) {
 if (javaProps != null) {
  Properties props = System.getProperties();
  for (Iterator iter = javaProps.keySet().iterator(); iter.hasNext();) {
   props.remove(iter.next());
  }
  System.setProperties(props);
 }
}
origin: stackoverflow.com

 Properties p = new Properties(System.getProperties());
p.put("com.mchange.v2.log.MLog", "com.mchange.v2.log.FallbackMLog");
p.put("com.mchange.v2.log.FallbackMLog.DEFAULT_CUTOFF_LEVEL", "OFF"); // Off or any other level
System.setProperties(p);
origin: apache/geode

@Override
public void close() {
 // Clear the extra stuff from System properties
 Properties properties = System.getProperties();
 properties.remove(SECURITY_SYSTEM_PREFIX + SECURITY_PEER_AUTH_INIT);
 properties.remove(SECURITY_SYSTEM_PREFIX + SECURITY_PEER_AUTHENTICATOR);
 Iterator iter = security.keySet().iterator();
 while (iter.hasNext()) {
  properties.remove(SECURITY_SYSTEM_PREFIX + iter.next());
 }
 System.setProperties(properties);
}
origin: spockframework/spock

 @Override
 public void intercept(IMethodInvocation invocation) throws Throwable {
  Properties original = new Properties();
  original.putAll(System.getProperties());

  try {
   invocation.proceed();
  } finally {
   System.setProperties(original);
  }
 }
}
origin: Netflix/conductor

  public static void teardown() {
    System.setProperties(null);
  }
}
origin: spotbugs/spotbugs

public static void makeSystemPropertiesWriteOnce() {
  Properties properties = System.getProperties();
  if (properties instanceof WriteOnceProperties) {
    return;
  }
  System.setProperties(new WriteOnceProperties(properties));
}
origin: jphp-group/jphp

@Signature
public static void setProperties(Properties properties) {
  System.setProperties(properties);
}
origin: groovy/groovy-core

public void tearDown() {
  System.setProperties(savedProperties);
}
origin: oracle/helidon

@Override
public void beforeTestExecution(ExtensionContext ec) throws Exception {
  getStore(ec).put(SYSPROPS_KEY, System.getProperties());
  Properties copy = new Properties();
  copy.putAll(System.getProperties());
  System.setProperties(copy);
}
origin: springside/springside4

/**
 * Properties 本质上是一个HashTable,每次读写都会加锁,所以不支持频繁的System.getProperty(name)来检查系统内容变化 因此扩展了一个ListenableProperties,
 * 在其所关心的属性变化时进行通知.
 * 
 * @see ListenableProperties
 */
public static synchronized void registerSystemPropertiesListener(PropertiesListener listener) {
  Properties currentProperties = System.getProperties();
  // 将System的properties实现替换为ListenableProperties
  if (!(currentProperties instanceof ListenableProperties)) {
    ListenableProperties newProperties = new ListenableProperties(currentProperties);
    System.setProperties(newProperties);
    currentProperties = newProperties;
  }
  ((ListenableProperties) currentProperties).register(listener);
}
origin: apache/ignite

/**
 * Constructor.
 *
 * @param name Name.
 * @param val Value.
 */
public SystemProperty(String name, String val) {
  this.name = name;
  Properties props = System.getProperties();
  originalValue = (String)props.put(name, val);
  System.setProperties(props);
}
origin: apache/ignite

  /** {@inheritDoc} */
  @Override public void close() {
    Properties props = System.getProperties();
    if (originalValue != null)
      props.put(name, originalValue);
    else
      props.remove(name);
    System.setProperties(props);
  }
}
origin: groovy/groovy-core

public void setUp() {
  savedProperties = System.getProperties();
  System.setProperties(new Properties(savedProperties));
}
origin: org.apache.commons/commons-lang3

/**
 * Tests that a lookup object for system properties can deal with a full
 * replacement of the system properties object. This test is related to
 * LANG-1055.
 */
@Test
public void testSystemPropertiesLookupReplacedProperties() {
  final Properties oldProperties = System.getProperties();
  final String osName = "os.name";
  final String newOsName = oldProperties.getProperty(osName) + "_changed";
  final StrLookup<String> sysLookup = StrLookup.systemPropertiesLookup();
  final Properties newProps = new Properties();
  newProps.setProperty(osName, newOsName);
  System.setProperties(newProps);
  try {
    assertEquals("Changed properties not detected", newOsName, sysLookup.lookup(osName));
  } finally {
    System.setProperties(oldProperties);
  }
}
origin: pentaho/pentaho-kettle

@Override protected void after() {
 cleanUp();
 System.setProperties( originalProperties );
 Locale.setDefault( originalLocale );
 Locale.setDefault( Locale.Category.FORMAT, originalFormatLocale );
 LanguageChoice.getInstance().setDefaultLocale( originalLocale );
 TimeZone.setDefault( originalTimezone );
 FileUtils.deleteQuietly( tmpKettleHome.toFile() );
}
origin: gocd/gocd

@After
public void cleanUp() {
  System.setProperties(original);
  files.cleanUp();
}
origin: AsyncHttpClient/async-http-client

@Test(enabled = false)
public void testIgnoreProxyPropertiesByDefault() throws IOException, TimeoutException, InterruptedException {
 // FIXME not threadsafe!
 Properties originalProps = new Properties();
 originalProps.putAll(System.getProperties());
 System.setProperty(ProxyUtils.PROXY_HOST, "localhost");
 System.setProperty(ProxyUtils.PROXY_PORT, String.valueOf(port1));
 System.setProperty(ProxyUtils.PROXY_NONPROXYHOSTS, "localhost");
 AsyncHttpClientConfigHelper.reloadProperties();
 try (AsyncHttpClient client = asyncHttpClient()) {
  String target = "http://localhost:1234/";
  Future<Response> f = client.prepareGet(target).execute();
  try {
   f.get(3, TimeUnit.SECONDS);
   fail("should not be able to connect");
  } catch (ExecutionException e) {
   // ok, no proxy used
  }
 } finally {
  System.setProperties(originalProps);
 }
}
origin: AsyncHttpClient/async-http-client

@Test(enabled = false)
public void testWildcardNonProxyHosts() throws IOException, TimeoutException, InterruptedException {
 // FIXME not threadsafe!
 Properties originalProps = new Properties();
 originalProps.putAll(System.getProperties());
 System.setProperty(ProxyUtils.PROXY_HOST, "127.0.0.1");
 System.setProperty(ProxyUtils.PROXY_PORT, String.valueOf(port1));
 System.setProperty(ProxyUtils.PROXY_NONPROXYHOSTS, "127.*");
 AsyncHttpClientConfigHelper.reloadProperties();
 try (AsyncHttpClient client = asyncHttpClient(config().setUseProxyProperties(true))) {
  String nonProxifiedTarget = "http://127.0.0.1:1234/";
  Future<Response> f = client.prepareGet(nonProxifiedTarget).execute();
  try {
   f.get(3, TimeUnit.SECONDS);
   fail("should not be able to connect");
  } catch (ExecutionException e) {
   // ok, no proxy used
  }
 } finally {
  System.setProperties(originalProps);
 }
}
origin: gocd/gocd

@After
public void after() {
  System.setProperties(original);
  new SystemEnvironment().reset(SystemEnvironment.ENABLE_CONFIG_MERGE_FEATURE);
}
java.langSystemsetProperties

Javadoc

Sets all system properties. This does not take a copy; the passed-in object is used directly. Passing null causes the VM to reinitialize the properties to how they were when the VM was started.

Popular methods of System

  • currentTimeMillis
    Returns the current time in milliseconds. Note that while the unit of time of the return value is a
  • getProperty
    Returns the value of a particular system property. The defaultValue will be returned if no such prop
  • arraycopy
  • exit
  • setProperty
    Sets the value of a particular system property.
  • nanoTime
    Returns the current timestamp of the most precise timer available on the local system, in nanosecond
  • getenv
    Returns the value of the environment variable with the given name, or null if no such variable exist
  • getProperties
    Returns the system properties. Note that this is not a copy, so that changes made to the returned Pr
  • identityHashCode
    Returns an integer hash code for the parameter. The hash code returned is the same one that would be
  • getSecurityManager
    Gets the system security interface.
  • gc
    Indicates to the VM that it would be a good time to run the garbage collector. Note that this is a h
  • lineSeparator
    Returns the system's line separator. On Android, this is "\n". The value comes from the value of the
  • gc,
  • lineSeparator,
  • clearProperty,
  • setOut,
  • setErr,
  • console,
  • loadLibrary,
  • load,
  • setSecurityManager,
  • mapLibraryName

Popular in Java

  • Finding current android device location
  • addToBackStack (FragmentTransaction)
  • getSystemService (Context)
  • setContentView (Activity)
  • URLConnection (java.net)
    A connection to a URL for reading or writing. For HTTP connections, see HttpURLConnection for docume
  • Date (java.util)
    A specific moment in time, with millisecond precision. Values typically come from System#currentTime
  • Hashtable (java.util)
    A plug-in replacement for JDK1.5 java.util.Hashtable. This version is based on org.cliffc.high_scale
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • Random (java.util)
    This class provides methods that return pseudo-random values.It is dangerous to seed Random with the
  • JPanel (javax.swing)
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now