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

How to use
clearProperty
method
in
java.lang.System

Best Java code snippets using java.lang.System.clearProperty (Showing top 20 results out of 6,084)

origin: google/guava

@Override
protected void tearDown() throws Exception {
 classReloader.close();
 Thread.currentThread().setContextClassLoader(oldClassLoader);
 System.clearProperty("guava.concurrent.generate_cancellation_cause");
}
origin: spring-projects/spring-framework

@After
public void cleanup() {
  System.clearProperty(P1);
}
origin: spring-projects/spring-framework

@After
public void after() {
  if (enabled != null) {
    System.setProperty("ENABLED", enabled);
  }
  else {
    System.clearProperty("ENABLED");
  }
  if (context != null) {
    context.close();
  }
}
origin: spring-projects/spring-framework

@Test
public void suppressGetenvAccessThroughSystemProperty() {
  System.setProperty("spring.getenv.ignore", "true");
  assertTrue(environment.getSystemEnvironment().isEmpty());
  System.clearProperty("spring.getenv.ignore");
}
origin: spring-projects/spring-framework

@Test
public void withResolvablePlaceholder() {
  AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
  ctx.register(ConfigWithResolvablePlaceholder.class);
  System.setProperty("path.to.properties", "org/springframework/context/annotation");
  ctx.refresh();
  assertThat(ctx.getBean(TestBean.class).getName(), equalTo("p1TestBean"));
  System.clearProperty("path.to.properties");
}
origin: spring-projects/spring-framework

@Test
@SuppressWarnings("resource")
public void valueFieldsAreProcessedWhenStaticPlaceholderConfigurerIsIntegrated() {
  AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
  ctx.register(ConfigWithValueFieldAndStaticPlaceholderConfigurer.class);
  System.setProperty("test.name", "foo");
  ctx.refresh();
  System.clearProperty("test.name");
  TestBean testBean = ctx.getBean(TestBean.class);
  assertThat(testBean.getName(), equalTo("foo"));
}
origin: spring-projects/spring-framework

@Test
public void resolveSystemProperty() throws Exception {
  System.setProperty("systemProperty", "22");
  Object value = resolver.resolveArgument(paramSystemProperty, null, webRequest, null);
  System.clearProperty("systemProperty");
  assertEquals("22", value);
}
origin: spring-projects/spring-framework

@Test
public void withResolvablePlaceholderAndFactoryBean() {
  AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
  ctx.register(ConfigWithResolvablePlaceholderAndFactoryBean.class);
  System.setProperty("path.to.properties", "org/springframework/context/annotation");
  ctx.refresh();
  assertThat(ctx.getBean(TestBean.class).getName(), equalTo("p1TestBean"));
  System.clearProperty("path.to.properties");
}
origin: spring-projects/spring-framework

@Test
@SuppressWarnings("resource")
public void valueFieldsAreProcessedWhenPlaceholderConfigurerIsSegregated() {
  AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
  ctx.register(ConfigWithValueField.class);
  ctx.register(ConfigWithPlaceholderConfigurer.class);
  System.setProperty("test.name", "foo");
  ctx.refresh();
  System.clearProperty("test.name");
  TestBean testBean = ctx.getBean(TestBean.class);
  assertThat(testBean.getName(), equalTo("foo"));
}
origin: spring-projects/spring-framework

@Test
public void resolveSystemProperty() throws Exception {
  System.setProperty("systemProperty", "22");
  try {
    Mono<Object> mono = this.resolver.resolveArgument(
        this.paramSystemProperty,  new BindingContext(), this.exchange);
    Object value = mono.block();
    assertEquals(22, value);
  }
  finally {
    System.clearProperty("systemProperty");
  }
}
origin: spring-projects/spring-framework

@Test
public void resolveDefaultValueFromSystemProperty() throws Exception {
  System.setProperty("systemProperty", "bar");
  try {
    Object result = resolver.resolveArgument(paramSystemProperty, null, webRequest, null);
    assertTrue(result instanceof String);
    assertEquals("bar", result);
  }
  finally {
    System.clearProperty("systemProperty");
  }
}
origin: spring-projects/spring-framework

@Before
@After
public void clearProperties() {
  System.clearProperty(MAX_CONTEXT_CACHE_SIZE_PROPERTY_NAME);
  SpringProperties.setProperty(MAX_CONTEXT_CACHE_SIZE_PROPERTY_NAME, null);
}
origin: spring-projects/spring-framework

@Test
public void trimValuesIsOffByDefault() {
  PropertyPlaceholderConfigurer ppc = new PropertyPlaceholderConfigurer();
  System.setProperty("my.name", " myValue  ");
  DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
  bf.registerBeanDefinition("testBean", rootBeanDefinition(TestBean.class)
      .addPropertyValue("name", "${my.name}")
      .getBeanDefinition());
  ppc.postProcessBeanFactory(bf);
  assertThat(bf.getBean(TestBean.class).getName(), equalTo(" myValue  "));
  System.clearProperty("my.name");
}
origin: spring-projects/spring-framework

  @Test
  public void fallbackToSystemProperties() {
    MockServletContext servletContext = new MockServletContext();
    System.setProperty("test.prop", "bar");
    try {
      String resolved = ServletContextPropertyUtils.resolvePlaceholders("${test.prop:foo}", servletContext);
      assertEquals("bar", resolved);
    }
    finally {
      System.clearProperty("test.prop");
    }
  }
}
origin: spring-projects/spring-framework

@Test
public void trimValuesIsApplied() {
  PropertyPlaceholderConfigurer ppc = new PropertyPlaceholderConfigurer();
  ppc.setTrimValues(true);
  System.setProperty("my.name", " myValue  ");
  DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
  bf.registerBeanDefinition("testBean", rootBeanDefinition(TestBean.class)
      .addPropertyValue("name", "${my.name}")
      .getBeanDefinition());
  ppc.postProcessBeanFactory(bf);
  assertThat(bf.getBean(TestBean.class).getName(), equalTo("myValue"));
  System.clearProperty("my.name");
}
origin: spring-projects/spring-framework

@Test
public void nullValueIsPreserved() {
  PropertyPlaceholderConfigurer ppc = new PropertyPlaceholderConfigurer();
  ppc.setNullValue("customNull");
  System.setProperty("my.name", "customNull");
  DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
  bf.registerBeanDefinition("testBean", rootBeanDefinition(TestBean.class)
      .addPropertyValue("name", "${my.name}")
      .getBeanDefinition());
  ppc.postProcessBeanFactory(bf);
  assertThat(bf.getBean(TestBean.class).getName(), nullValue());
  System.clearProperty("my.name");
}
origin: spring-projects/spring-framework

@Test
public void resolveDefaultValueSystemProperty() throws Exception {
  System.setProperty("systemProperty", "sysbar");
  try {
    Message<byte[]> message = MessageBuilder.withPayload(new byte[0]).build();
    Object result = resolver.resolveArgument(paramSystemPropertyDefaultValue, message);
    assertEquals("sysbar", result);
  }
  finally {
    System.clearProperty("systemProperty");
  }
}
origin: spring-projects/spring-framework

@Test
public void resolveNameFromSystemProperty() throws Exception {
  System.setProperty("systemProperty", "sysbar");
  try {
    Message<byte[]> message = MessageBuilder.withPayload(new byte[0]).setHeader("sysbar", "foo").build();
    Object result = resolver.resolveArgument(paramSystemPropertyName, message);
    assertEquals("foo", result);
  }
  finally {
    System.clearProperty("systemProperty");
  }
}
origin: spring-projects/spring-framework

@Test
public void resolveFromLocalProperties() {
  System.clearProperty(P1);
  registerWithGeneratedName(p1BeanDef, bf);
  ppc.postProcessBeanFactory(bf);
  TestBean bean = bf.getBean(TestBean.class);
  assertThat(bean.getName(), equalTo(P1_LOCAL_PROPS_VAL));
}
origin: spring-projects/spring-framework

@Test
public void setSystemSystemPropertiesMode_toOverride_andSetSearchSystemEnvironment_toFalse() {
  registerWithGeneratedName(p1BeanDef, bf);
  System.clearProperty(P1); // will now fall all the way back to system environment
  ppc.setSearchSystemEnvironment(false);
  ppc.setSystemPropertiesMode(PropertyPlaceholderConfigurer.SYSTEM_PROPERTIES_MODE_OVERRIDE);
  ppc.postProcessBeanFactory(bf);
  TestBean bean = bf.getBean(TestBean.class);
  assertThat(bean.getName(), equalTo(P1_LOCAL_PROPS_VAL)); // has to resort to local props
}
java.langSystemclearProperty

Javadoc

Removes a specific system property.

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,
  • 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 12 Jupyter Notebook extensions
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