List of usage examples for java.lang System clearProperty
public static String clearProperty(String key)
From source file:org.kie.server.services.impl.AbstractKieServerImplTest.java
@Test public void testManagementDisabledConfigured() { System.setProperty(KieServerConstants.KIE_SERVER_MGMT_API_DISABLED, "true"); try {/*from w w w. ja va2 s. c om*/ kieServer.destroy(); kieServer = new KieServerImpl(new KieServerStateFileRepository(REPOSITORY_DIR)); kieServer.init(); ServiceResponse<?> forbidden = kieServer.checkAccessability(); assertForbiddenResponse(forbidden); } finally { System.clearProperty(KieServerConstants.KIE_SERVER_MGMT_API_DISABLED); } }
From source file:org.apache.maven.wagon.providers.webdav.WebDavWagonTest.java
public void testWagonContinuesOnPutFailureIfPropertySet() throws Exception { setupRepositories();//from w ww .j a v a 2 s . co m setupWagonTestingFixtures(); File testFile = getTempFile(); String continueOnFailureProperty = WebDavWagon.CONTINUE_ON_FAILURE_PROPERTY; System.setProperty(continueOnFailureProperty, "true"); WebDavWagon wagon = new TimeoutSimulatingWagon(); wagon.connect(testRepository, getAuthInfo()); try { String filename = TimeoutSimulatingWagon.TIMEOUT_TRIGGER + ".txt"; wagon.put(testFile, filename); } finally { wagon.disconnect(); System.clearProperty(continueOnFailureProperty); tearDownWagonTestingFixtures(); } }
From source file:org.kuali.coeus.propdev.impl.s2s.connect.S2SConnectorServiceBase.java
/** * /*from ww w. j a v a2s . c om*/ * This method is to get Soap Port * * @return ApplicantIntegrationPortType Soap port used for applicant integration. * @throws S2sCommunicationException */ protected ApplicantWebServicesPortType configureApplicantIntegrationSoapPort(String alias, boolean mulitCampusEnabled) throws S2sCommunicationException { System.clearProperty("java.protocol.handler.pkgs"); JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); factory.setAddress(getS2SSoapHost()); factory.setServiceClass(ApplicantWebServicesPortType.class); // enabling mtom from V2 onwards // works for grants.gov but not for research.gov, get a mime related error. //Couldn't find MIME boundary: --uuid //disable for research.gov. This is not a big deal because submissions with attachments // go to grants.gov anyways and not to research.gov if (!StringUtils.equalsIgnoreCase(serviceHost, Constants.RESEARCH_GOV_SERVICE_HOST)) { Map<String, Object> properties = new HashMap<>(); properties.put("mtom-enabled", Boolean.TRUE); factory.setProperties(properties); } ApplicantWebServicesPortType applicantWebService = (ApplicantWebServicesPortType) factory.create(); Client client = ClientProxy.getClient(applicantWebService); HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy(); httpClientPolicy.setConnectionTimeout(0); httpClientPolicy.setReceiveTimeout(0); httpClientPolicy.setAllowChunking(false); HTTPConduit conduit = (HTTPConduit) client.getConduit(); conduit.setClient(httpClientPolicy); TLSClientParameters tlsConfig = new TLSClientParameters(); setPossibleCypherSuites(tlsConfig); configureKeyStoreAndTrustStore(tlsConfig, alias, mulitCampusEnabled); conduit.setTlsClientParameters(tlsConfig); return applicantWebService; }
From source file:org.dashbuilder.dataprovider.backend.elasticsearch.ElasticSearchDataSetTestBase.java
@AfterClass public static void stopELServer() throws Exception { if (!runServer) return;/* w ww.j a v a 2 s . c o m*/ // Clear the system properties that have been set for running the EL server. System.clearProperty(EL_PROPERTY_ELASTICSEARCH); System.clearProperty(EL_PROPERTY_FOREGROUND); System.clearProperty(EL_PROPERTY_HOME); // Stop the EL server. Bootstrap.close(new String[] {}); // Delete the working home folder for elasticsearch. elHomeFolder.delete(); }
From source file:org.apache.accumulo.minicluster.MiniAccumuloCluster.java
/** * @param config//from w ww. j ava 2 s. c om * initial configuration */ public MiniAccumuloCluster(MiniAccumuloConfig config) throws IOException { this.config = config.initialize(); config.getConfDir().mkdirs(); config.getAccumuloDir().mkdirs(); config.getZooKeeperDir().mkdirs(); config.getLogDir().mkdirs(); config.getWalogDir().mkdirs(); config.getLibDir().mkdirs(); if (config.useMiniDFS()) { File nn = new File(config.getAccumuloDir(), "nn"); nn.mkdirs(); File dn = new File(config.getAccumuloDir(), "dn"); dn.mkdirs(); File dfs = new File(config.getAccumuloDir(), "dfs"); dfs.mkdirs(); Configuration conf = new Configuration(); conf.set(DFSConfigKeys.DFS_NAMENODE_NAME_DIR_KEY, nn.getAbsolutePath()); conf.set(DFSConfigKeys.DFS_DATANODE_DATA_DIR_KEY, dn.getAbsolutePath()); conf.set(DFSConfigKeys.DFS_REPLICATION_KEY, "1"); conf.set("dfs.support.append", "true"); conf.set("dfs.datanode.synconclose", "true"); conf.set("dfs.datanode.data.dir.perm", MiniDFSUtil.computeDatanodeDirectoryPermission()); String oldTestBuildData = System.setProperty("test.build.data", dfs.getAbsolutePath()); miniDFS = new MiniDFSCluster(conf, 1, true, null); if (oldTestBuildData == null) System.clearProperty("test.build.data"); else System.setProperty("test.build.data", oldTestBuildData); miniDFS.waitClusterUp(); InetSocketAddress dfsAddress = miniDFS.getNameNode().getNameNodeAddress(); dfsUri = "hdfs://" + dfsAddress.getHostName() + ":" + dfsAddress.getPort(); File coreFile = new File(config.getConfDir(), "core-site.xml"); writeConfig(coreFile, Collections.singletonMap("fs.default.name", dfsUri).entrySet()); File hdfsFile = new File(config.getConfDir(), "hdfs-site.xml"); writeConfig(hdfsFile, conf); Map<String, String> siteConfig = config.getSiteConfig(); siteConfig.put(Property.INSTANCE_DFS_URI.getKey(), dfsUri); siteConfig.put(Property.INSTANCE_DFS_DIR.getKey(), "/accumulo"); config.setSiteConfig(siteConfig); } else { dfsUri = "file://"; } File siteFile = new File(config.getConfDir(), "accumulo-site.xml"); writeConfig(siteFile, config.getSiteConfig().entrySet()); FileWriter fileWriter = new FileWriter(siteFile); fileWriter.append("<configuration>\n"); for (Entry<String, String> entry : config.getSiteConfig().entrySet()) fileWriter.append("<property><name>" + entry.getKey() + "</name><value>" + entry.getValue() + "</value></property>\n"); fileWriter.append("</configuration>\n"); fileWriter.close(); zooCfgFile = new File(config.getConfDir(), "zoo.cfg"); fileWriter = new FileWriter(zooCfgFile); // zookeeper uses Properties to read its config, so use that to write in order to properly escape things like Windows paths Properties zooCfg = new Properties(); zooCfg.setProperty("tickTime", "2000"); zooCfg.setProperty("initLimit", "10"); zooCfg.setProperty("syncLimit", "5"); zooCfg.setProperty("clientPort", config.getZooKeeperPort() + ""); zooCfg.setProperty("maxClientCnxns", "1000"); zooCfg.setProperty("dataDir", config.getZooKeeperDir().getAbsolutePath()); zooCfg.store(fileWriter, null); fileWriter.close(); File nativeMap = new File(config.getLibDir().getAbsolutePath() + "/native/map"); nativeMap.mkdirs(); File testRoot = new File( new File(new File(System.getProperty("user.dir")).getParent() + "/server/src/main/c++/nativeMap") .getAbsolutePath()); if (testRoot.exists()) { for (String file : testRoot.list()) { File src = new File(testRoot, file); if (src.isFile() && file.startsWith("libNativeMap")) FileUtils.copyFile(src, new File(nativeMap, file)); } } }
From source file:com.seleniumtests.it.reporter.TestSeleniumTestsReporter2.java
/** * Check resources referenced in header are get from CDN and resources files are not copied to ouput folder * @throws Exception/*from w w w .j a va 2 s . co m*/ */ @Test(groups = { "it" }) public void testReportWithResourcesFromCDN() throws Exception { try { System.setProperty("optimizeReports", "true"); executeSubTest(1, new String[] { "com.seleniumtests.it.stubclasses.StubTestClass" }, ParallelMode.METHODS, new String[] { "testAndSubActions", "testInError", "testWithException" }); } finally { System.clearProperty("optimizeReports"); } // check content of summary report file String mainReportContent = readSummaryFile(); Assert.assertTrue( mainReportContent.contains("<link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com")); Assert.assertFalse(Paths.get(SeleniumTestsContextManager.getGlobalContext().getOutputDirectory(), "resources", "templates", "AdminLTE.min.css").toFile().exists()); Assert.assertFalse(Paths.get(SeleniumTestsContextManager.getGlobalContext().getOutputDirectory(), "resources", "templates", "bootstrap.min.css").toFile().exists()); Assert.assertFalse(Paths.get(SeleniumTestsContextManager.getGlobalContext().getOutputDirectory(), "resources", "templates", "fonts").toFile().exists()); }
From source file:org.apache.solr.SolrTestCaseJ4.java
@AfterClass public static void teardownTestCases() throws Exception { try {/* w ww. j a v a 2 s . co m*/ deleteCore(); resetExceptionIgnores(); if (suiteFailureMarker.wasSuccessful()) { // if the tests passed, make sure everything was closed / released if (!RandomizedContext.current().getTargetClass() .isAnnotationPresent(SuppressObjectReleaseTracker.class)) { endTrackingSearchers(120, false); String orr = ObjectReleaseTracker.clearObjectTrackerAndCheckEmpty(30); assertNull(orr, orr); } else { endTrackingSearchers(15, false); String orr = ObjectReleaseTracker.checkEmpty(); if (orr != null) { log.warn( "Some resources were not closed, shutdown, or released. This has been ignored due to the SuppressObjectReleaseTracker annotation, trying to close them now."); ObjectReleaseTracker.tryClose(); } } } resetFactory(); coreName = DEFAULT_TEST_CORENAME; } finally { ObjectReleaseTracker.clear(); TestInjection.reset(); initCoreDataDir = null; System.clearProperty("zookeeper.forceSync"); System.clearProperty("jetty.testMode"); System.clearProperty("tests.shardhandler.randomSeed"); System.clearProperty("enable.update.log"); System.clearProperty("useCompoundFile"); System.clearProperty("urlScheme"); System.clearProperty("solr.peerSync.useRangeVersions"); HttpClientUtil.resetHttpClientBuilder(); // clean up static sslConfig = null; testSolrHome = null; } IpTables.unblockAllPorts(); LogLevel.Configurer.restoreLogLevels(savedClassLogLevels); savedClassLogLevels.clear(); }
From source file:io.apiman.test.common.util.TestPlanRunner.java
/** * Binds any variables found in the response JSON to system properties * so they can be used in later rest tests. * @param actualJson/*from w w w .ja v a 2 s . c om*/ * @param restTest */ private void bindVariables(JsonNode actualJson, RestTest restTest) { for (String headerName : restTest.getExpectedResponseHeaders().keySet()) { if (headerName.startsWith("X-RestTest-BindTo-")) { //$NON-NLS-1$ String bindExpression = restTest.getExpectedResponseHeaders().get(headerName); String bindVarName = headerName.substring("X-RestTest-BindTo-".length()); //$NON-NLS-1$ String bindValue = evaluate(bindExpression, actualJson); log("-- Binding value in response --"); //$NON-NLS-1$ log("\tExpression: " + bindExpression); //$NON-NLS-1$ log("\t To Var: " + bindVarName); //$NON-NLS-1$ log("\t New Value: " + bindValue); //$NON-NLS-1$ if (bindValue == null) { System.clearProperty(bindVarName); } else { System.setProperty(bindVarName, bindValue); } } } }
From source file:org.apache.solr.util.SSLTestConfig.java
/** * @deprecated this method has very little practical use, in most cases you'll want to use * {@link SSLContext#setDefault} with {@link #buildClientSSLContext} instead. */// w ww . j a v a 2 s. co m @Deprecated public static void clearSSLSystemProperties() { System.clearProperty("javax.net.ssl.keyStore"); System.clearProperty("javax.net.ssl.keyStorePassword"); System.clearProperty("javax.net.ssl.trustStore"); System.clearProperty("javax.net.ssl.trustStorePassword"); }
From source file:org.docx4j.XmlUtils.java
private static void instantiateTransformerFactory() { // docx4j requires real Xalan // See further docs/JAXP_TransformerFactory_XSLT_notes.txt String originalSystemProperty = System.getProperty("javax.xml.transform.TransformerFactory"); try {//from w ww . j a v a 2s . com System.setProperty("javax.xml.transform.TransformerFactory", TRANSFORMER_FACTORY_PROCESSOR_XALAN); // TRANSFORMER_FACTORY_SAXON); transformerFactory = javax.xml.transform.TransformerFactory.newInstance(); // We've got our factory now, so set it back again! if (originalSystemProperty == null) { System.clearProperty("javax.xml.transform.TransformerFactory"); } else { System.setProperty("javax.xml.transform.TransformerFactory", originalSystemProperty); } } catch (javax.xml.transform.TransformerFactoryConfigurationError e) { // Provider org.apache.xalan.processor.TransformerFactoryImpl not found log.warn("Xalan jar missing from classpath; xslt not supported"); // so try using whatever TransformerFactory is available if (originalSystemProperty == null) { System.clearProperty("javax.xml.transform.TransformerFactory"); } else { System.setProperty("javax.xml.transform.TransformerFactory", originalSystemProperty); } transformerFactory = javax.xml.transform.TransformerFactory.newInstance(); } LoggingErrorListener errorListener = new LoggingErrorListener(false); transformerFactory.setErrorListener(errorListener); }