List of usage examples for java.util Properties remove
@Override public synchronized Object remove(Object key)
From source file:net.big_oh.postoffice.PostOfficeServiceFactoryUnitTest.java
/** * Test method for//from ww w . j a va 2 s. com * {@link net.big_oh.postoffice.PostOfficeServiceFactory#getInstance(java.util.Properties)} * . */ @Test(expected = IllegalArgumentException.class) public void testGetInstanceProperties_Illegal_NoHost() { Properties props = PostOfficeServiceFactory.readDefaultPostOfficeProperties(); props.remove(PostOfficeServiceFactory.PROPERTY_KEY_HOST); PostOfficeServiceFactory.getInstance(props); }
From source file:net.big_oh.postoffice.PostOfficeServiceFactoryUnitTest.java
/** * Test method for// w w w . j a v a2 s . c o m * {@link net.big_oh.postoffice.PostOfficeServiceFactory#getInstance(java.util.Properties)} * . */ @Test(expected = IllegalArgumentException.class) public void testGetInstanceProperties_Illegal_NoFromAddress() { Properties props = PostOfficeServiceFactory.readDefaultPostOfficeProperties(); props.remove(PostOfficeServiceFactory.PROPERTY_KEY_FROM); PostOfficeServiceFactory.getInstance(props); }
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.galenframework.tests.runner.GalenConfigTest.java
private void deleteSystemProperty(String key) { Properties properties = System.getProperties(); if (properties.containsKey(key)) { properties.remove(key); }/*from ww w . j a v a2s . c o m*/ }
From source file:org.apache.carbondata.hive.server.HiveEmbeddedServer2.java
private HiveConf configure() throws Exception { log.info("Setting The Hive Conf Variables"); String scratchDir = SCRATCH_DIR; File scratchDirFile = new File(scratchDir); //TestUtils.delete(scratchDirFile); Configuration cfg = new Configuration(); HiveConf conf = new HiveConf(cfg, HiveConf.class); conf.addToRestrictList("columns.comments"); conf.set("hive.scratch.dir.permission", "777"); conf.setVar(ConfVars.SCRATCHDIRPERMISSION, "777"); scratchDirFile.mkdirs();/*from www .j a v a 2 s .c o m*/ // also set the permissions manually since Hive doesn't do it... scratchDirFile.setWritable(true, false); int random = new Random().nextInt(); conf.set("hive.metastore.warehouse.dir", scratchDir + "/warehouse" + random); conf.set("hive.metastore.metadb.dir", scratchDir + "/metastore_db" + random); conf.set("hive.exec.scratchdir", scratchDir); conf.set("fs.permissions.umask-mode", "022"); conf.set("javax.jdo.option.ConnectionURL", "jdbc:derby:;databaseName=" + scratchDir + "/metastore_db" + random + ";create=true"); conf.set("hive.metastore.local", "true"); conf.set("hive.aux.jars.path", ""); conf.set("hive.added.jars.path", ""); conf.set("hive.added.files.path", ""); conf.set("hive.added.archives.path", ""); conf.set("fs.default.name", "file:///"); // clear mapred.job.tracker - Hadoop defaults to 'local' if not defined. Hive however expects // this to be set to 'local' - if it's not, it does a remote execution (i.e. no child JVM) Field field = Configuration.class.getDeclaredField("properties"); field.setAccessible(true); Properties props = (Properties) field.get(conf); props.remove("mapred.job.tracker"); props.remove("mapreduce.framework.name"); props.setProperty("fs.default.name", "file:///"); // intercept SessionState to clean the threadlocal Field tss = SessionState.class.getDeclaredField("tss"); tss.setAccessible(true); return new HiveConf(conf); }
From source file:com.norconex.commons.lang.map.PropertiesTest.java
@Test public void testRemoveCaseInsensitive() throws Exception { Properties properties = new Properties(true); List<String> list = asList("a", "b", "c"); properties.put("key".toUpperCase(), list); assertEquals(list, properties.remove("key")); }
From source file:info.evanchik.eclipse.karaf.core.KarafCorePluginUtils.java
/** * Loads a configuration file relative to the specified base directory. This * method also processes any include directives that import other properties * files relative to the specified property file. * * @param base/* w w w . j a v a2s .co m*/ * the directory containing the file * @param filename * the relative path to the properties file * @param processIncludes * true if {@link #INCLUDES_PROPERTY} statements should be * followed; false otherwise. * @return the {@link Properties} object created from the contents of * configuration file * @throws CoreException * if there is a problem loading the file */ public static Properties loadProperties(final File base, final String filename, final boolean processIncludes) throws CoreException { final File f = new File(base, filename); try { final Properties p = new Properties(); p.load(new FileInputStream(f)); final String includes = p.getProperty(INCLUDES_PROPERTY); if (includes != null) { final StringTokenizer st = new StringTokenizer(includes, "\" ", true); if (st.countTokens() > 0) { String location; do { location = nextLocation(st); if (location != null) { final Properties includeProps = loadProperties(base, location); p.putAll(includeProps); } } while (location != null); } p.remove(INCLUDES_PROPERTY); } return p; } catch (final IOException e) { final String message = "Unable to load configuration file from configuration directory: " + f.getAbsolutePath(); throw new CoreException( new Status(IStatus.ERROR, KarafCorePluginActivator.PLUGIN_ID, IStatus.OK, message, e)); } }
From source file:org.sonar.batch.scan.DefaultProjectBootstrapper.java
@VisibleForTesting protected static void cleanAndCheckModuleProperties(ProjectDefinition project) { Properties properties = project.getProperties(); // We need to check the existence of source directories String[] sourceDirs = getListFromProperty(properties, PROPERTY_SOURCES); checkExistenceOfDirectories(project.getKey(), project.getBaseDir(), sourceDirs, PROPERTY_SOURCES); // And we need to resolve patterns that may have been used in "sonar.libraries" List<String> libPaths = Lists.newArrayList(); for (String pattern : getListFromProperty(properties, PROPERTY_LIBRARIES)) { for (File file : getLibraries(project.getBaseDir(), pattern)) { libPaths.add(file.getAbsolutePath()); }//from w w w . jav a 2s. c o m } properties.remove(PROPERTY_LIBRARIES); properties.put(PROPERTY_LIBRARIES, StringUtils.join(libPaths, ",")); }
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 w w w .java 2 s. c o m*/ }
From source file:org.sonar.runner.impl.BatchLauncherMain.java
private Properties loadProperties(String arg) throws IOException { Properties props = new Properties(); FileInputStream input = new FileInputStream(arg); try {//from www .ja va 2 s . c o m props.load(input); // just to be clean, do not forward properties that do not make sense in fork mode props.remove(InternalProperties.RUNNER_MASK_RULES); } finally { IOUtils.closeQuietly(input); } return props; }