List of usage examples for java.lang System clearProperty
public static String clearProperty(String key)
From source file:com.gemstone.gemfire.management.internal.cli.shell.GfshInitFileJUnitTest.java
@AfterClass public static void tearDownAfterClass() throws Exception { for (Handler handler : saveHandlers) { julLogger.addHandler(handler);//from w w w . j a v a 2s .c o m } if (saveLog4j2Config == null) { System.clearProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY); } else { System.setProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY, saveLog4j2Config); ((LoggerContext) LogManager.getContext(false)).reconfigure(); } if (saveUserDir == null) { System.clearProperty("user.dir"); } else { System.setProperty("user.dir", saveUserDir); } if (saveUserHome == null) { System.clearProperty("user.home"); } else { System.setProperty("user.home", saveUserHome); } }
From source file:org.onehippo.repository.journal.ExternalRepositorySyncRevisionServiceTest.java
@Test public void testSyncRevision() throws Exception { final File tmpdir = new File(System.getProperty("java.io.tmpdir")); final File storage = new File(tmpdir, "repository-" + UUID.randomUUID().toString()); String originalRepoConfig = System.getProperty("repo.config", null); HippoRepository repo = null;//from w ww .j a v a2 s . c om Exception ex = null; try { String repoPath = storage.getAbsolutePath(); System.setProperty("repo.config", "/journal/repository.xml"); repo = HippoRepositoryFactory.getHippoRepository(repoPath); Session session = repo.login(credentials); InternalHippoRepository internalHippoRepository = (InternalHippoRepository) RepositoryDecorator .unwrap(session.getRepository()); ExternalRepositorySyncRevisionService syncRevisionService = internalHippoRepository .getExternalRepositorySyncRevisionService(); ExternalRepositorySyncRevision syncRevision = syncRevisionService.getSyncRevision("test"); assertNotNull("With cluster DatabaseJournal syncRevision should not be null", syncRevision); assertEquals("SyncRevision.qualifiedId", ExternalRepositorySyncRevisionService.EXTERNAL_REPOSITORY_SYNC_ID_PREFIX + "test", syncRevision.getQualifiedId()); assertFalse("Initial syncRevision value should not exist", syncRevision.exists()); syncRevision.set(12345); assertTrue("syncRevision should be created", syncRevision.exists()); assertEquals("Stored revision", 12345, syncRevision.get()); ExternalRepositorySyncRevision localRevision = syncRevisionService.getSyncRevision("node"); assertNotNull("Local node revision should exist", localRevision.exists()); } catch (Exception e) { ex = e; } finally { if (originalRepoConfig != null) { System.setProperty("repo.config", originalRepoConfig); } else { System.clearProperty("repo.config"); } if (repo != null) { repo.close(); } FileUtils.deleteQuietly(storage); if (ex != null) { throw ex; } } }
From source file:org.kitesdk.data.oozie.TestKiteConfigurationService.java
@After public void removeDataPath() throws IOException { // restore configuration DefaultConfiguration.set(startingConf); if (serviceTempDir != null) { FileUtils.deleteDirectory(serviceTempDir); serviceTempDir = null;//from w ww . ja v a 2 s.co m } if (kiteConfigPath != null) { fs.delete(kiteConfigPath, true); kiteConfigPath = null; } if (Services.get() != null) { Services.get().destroy(); } if (startingOozieHome == null) { System.clearProperty("oozie.home.dir"); } else { System.setProperty("oozie.home.dir", startingOozieHome); startingOozieHome = null; } }
From source file:org.apache.solr.morphlines.solr.AbstractSolrMorphlineZkTestBase.java
@Override public void distribTearDown() throws Exception { super.distribTearDown(); System.clearProperty("host"); System.clearProperty("numShards"); }
From source file:org.apache.hadoop.hive.metastore.TestMetastoreVersion.java
/*** * Test config defaults/*from w w w . ja v a2 s . co m*/ */ public void testDefaults() { System.clearProperty(HiveConf.ConfVars.METASTORE_SCHEMA_VERIFICATION.toString()); hiveConf = new HiveConf(this.getClass()); assertFalse(hiveConf.getBoolVar(HiveConf.ConfVars.METASTORE_SCHEMA_VERIFICATION)); assertTrue(hiveConf.getBoolVar(HiveConf.ConfVars.METASTORE_AUTO_CREATE_ALL)); }
From source file:org.geoserver.wcs2_0.WCSNetCDFMosaicTest.java
@AfterClass public static void close() { System.clearProperty("org.geotools.referencing.forceXY"); System.clearProperty("user.timezone"); System.clearProperty(NetCDFCRSAuthorityFactory.SYSTEM_DEFAULT_USER_PROJ_FILE); }
From source file:org.apache.hupa.server.guice.ServerModulTest.java
@Test public void testLoadPropertiesWithEmptyFile() throws Exception { GuiceListener sconfig = new GuiceListener(); File tmp = File.createTempFile("foo", ".properties"); tmp.deleteOnExit();/*from www.jav a 2 s. c o m*/ try { ConfigurationProperties.loadProperties(tmp.toString()); } catch (IllegalArgumentException e) { // This must be thrown because of missing mandatory configuration properties } catch (Exception e) { Assert.fail( "IllegalArgumentException must be thrown because of missing mandatory configuration properties"); } System.setProperty(GuiceListener.SYS_PROP_CONFIG_FILE, tmp.toString()); try { sconfig.loadProperties(); } catch (IllegalArgumentException e) { // This must be thrown because of missing mandatory configuration properties } catch (Exception e) { Assert.fail( "IllegalArgumentException must be thrown because of missing mandatory configuration properties"); } System.clearProperty(GuiceListener.SYS_PROP_CONFIG_FILE); }
From source file:com.redpill_linpro.springframework.beans.factory.config.EtcdPlaceholderConfigurerTests.java
@After public void tearDown() { System.clearProperty(P1); getModifiableSystemEnvironment().remove(P1); }
From source file:com.evolveum.midpoint.init.TestConfigurationLoad.java
/** * MID-3349//from www . ja v a 2s . c o m */ @Test public void test020DirectoryAndExtractionTest() throws Exception { LOGGER.info("---------------- test020DirectoryAndExtractionTest -----------------"); File midpointHome = new File("target/midPointHome"); System.setProperty("midpoint.home", "target/midPointHome/"); StartupConfiguration sc = new StartupConfiguration(); assertNotNull(sc); sc.init(); assertNotNull(midpointHome); assertTrue(midpointHome.exists(), "existence"); assertTrue(midpointHome.isDirectory(), "type directory"); File configFile = new File(midpointHome, "config.xml"); assertTrue(configFile.exists(), "existence"); assertTrue(configFile.isFile(), "type file"); TestUtil.assertPrivateFilePermissions(configFile); ConfigurableProtectorFactory keystoreFactory = new ConfigurableProtectorFactory(); keystoreFactory.setConfiguration(sc); keystoreFactory.init(); File keystoreFile = new File(midpointHome, "keystore.jceks"); assertTrue(keystoreFile.exists(), "existence"); assertTrue(keystoreFile.isFile(), "type file"); TestUtil.assertPrivateFilePermissions(keystoreFile); //cleanup System.clearProperty("midpoint.home"); }
From source file:org.apache.usergrid.corepersistence.StaleIndexCleanupTest.java
@After public void after() { System.clearProperty(EVENTS_DISABLED); }