List of usage examples for java.lang System clearProperty
public static String clearProperty(String key)
From source file:com.talis.storage.s3.S3StoreTest.java
@Test public void inputDataLargerThanChunkSize() throws Exception { try {//from www . ja v a 2 s .co m System.setProperty(S3Store.CHUNK_SIZE_PROPERTY, "10"); System.setProperty(S3Store.READ_BUFFER_SIZE_PROPERTY, "1"); S3Store s3store = (S3Store) getStore(); s3store.write(itemURI, new SubmittedItem(MediaType.TEXT_PLAIN_TYPE, new ByteArrayInputStream(data))); S3Object[] chunks = chunkHandler.listChunks(s3store.mapUriToNativeKey(itemURI)); assertEquals(6, chunks.length); ByteArrayOutputStream buffer = new ByteArrayOutputStream(); for (S3Object chunk : chunks) { IOUtils.copy(chunk.getDataInputStream(), buffer); } assertTrue(Arrays.equals(data, buffer.toByteArray())); } finally { System.clearProperty(S3Store.CHUNK_SIZE_PROPERTY); System.clearProperty(S3Store.READ_BUFFER_SIZE_PROPERTY); } }
From source file:org.jtalks.poulpe.web.listener.LoggerInitializationListener.java
/** * Initializing logger. For an idea how configuration file looks like, see class javadocs. * * @param event standard listener servlet event * @see <a href="http://wiki.apache.org/logging-log4j/Log4jXmlFormat">Log4j XML configuration apache tutorial</a> *///w ww .j a v a 2s. com @Override public void contextInitialized(ServletContextEvent event) { servletContext = event.getServletContext(); FileInfo fileInfo = log4jConfigLocation(); // Skip standard Log4j auto configuration on first call String previousLog4jInitOverrideValue = System.setProperty(LOG4J_INIT_OVERRIDE_PROPERTY, "true"); if (!loadLog4jConfigurationFromExternalFile(fileInfo)) { loadEmbeddedLog4jConfiguration(); } // Return previous auto configuration property. It's shared between all applications in Tomcat if (previousLog4jInitOverrideValue == null) { System.clearProperty(LOG4J_INIT_OVERRIDE_PROPERTY); } else { System.setProperty(LOG4J_INIT_OVERRIDE_PROPERTY, previousLog4jInitOverrideValue); } }
From source file:com.kylinolap.job.engine.GenericJobEngineTest.java
@AfterClass public static void afterClass() throws Exception { FileUtils.deleteDirectory(new File(tempTestMetadataUrl)); System.clearProperty(KylinConfig.KYLIN_CONF); // print metrics System.out//from w w w . j av a 2 s. co m .println("Job step duration seconds 80 percentile: " + jobManager.getPercentileJobStepDuration(80)); System.out.println("Max job step duration seconds: " + jobManager.getMaxJobStepDuration()); System.out.println("Min job step duration seconds: " + jobManager.getMinJobStepDuration()); System.out.println("# job steps executed: " + jobManager.getNumberOfJobStepsExecuted()); System.out.println("Engine ID: " + jobManager.getPrimaryEngineID()); jobManager.stopJobEngine(); }
From source file:org.apache.solr.cloud.TestMiniSolrCloudClusterKerberos.java
@Override public void tearDown() throws Exception { System.clearProperty("java.security.auth.login.config"); System.clearProperty("cookie.domain"); System.clearProperty("kerberos.principal"); System.clearProperty("kerberos.keytab"); System.clearProperty("authenticationPlugin"); kerberosTestServices.stop();//from w w w. j a v a 2 s . com super.tearDown(); }
From source file:com.gargoylesoftware.htmlunit.gae.GAETestRunner.java
@Override protected void runChild(final FrameworkMethod method, final RunNotifier notifier) { try {//from w ww .ja v a2s . c o m // See http://code.google.com/appengine/docs/java/runtime.html#The_Environment System.setProperty("com.google.appengine.runtime.environment", "Production"); super.runChild(method, notifier); } finally { System.clearProperty("com.google.appengine.runtime.environment"); } }
From source file:com.xebialabs.overcast.OvercastPropertiesTest.java
@Test public void testWorkDirHasPrecedenceOverClasspath() { System.setProperty("user.home", new File("src/test/resources/dir-without-conf").getAbsolutePath()); System.clearProperty("precedenceTestValue"); OvercastProperties.reloadOvercastProperties(); assertThat(OvercastProperties.getOvercastProperty("precedenceTestValue"), is("valueFromWork")); }
From source file:org.codice.alliance.nsili.mockserver.server.MockNsili.java
private ORB getOrbForServer(int port) throws InvalidName, AdapterInactive, WrongPolicy, ServantNotActive, IOException { System.setProperty("org.omg.CORBA.ORBInitialPort", String.valueOf(port)); final ORB orb = ORB.init(new String[0], null); System.clearProperty("org.omg.CORBA.ORBInitialPort"); POA rootPOA = POAHelper.narrow(orb.resolve_initial_references("RootPOA")); rootPOA.the_POAManager().activate(); org.omg.CORBA.Object objref = rootPOA.servant_to_reference(new LibraryImpl(rootPOA)); //set ior.txt for http web server iorString = orb.object_to_string(objref); //set ior.txt for ftp web server File ftpIorFile = new File(ftpHomeDirectoryPath + "/data/ior.txt"); File ftpDataDirectory = new File(ftpHomeDirectoryPath + "/data"); ftpDataDirectory.mkdirs();//ww w . j a v a2s . co m ftpIorFile.createNewFile(); PrintWriter printWriter = new PrintWriter(new FileWriter(ftpIorFile.getPath())); printWriter.print(orb.object_to_string(objref)); if (printWriter.checkError()) { System.out.println("ERROR: Unable to write ior string to ftp server temporary file"); } printWriter.close(); return orb; }
From source file:org.apache.solr.cloud.TestAuthenticationFramework.java
@After public void tearDown() throws Exception { System.clearProperty("authenticationPlugin"); super.tearDown(); }
From source file:org.apache.atlas.web.filters.AtlasAuthenticationKerberosFilterTest.java
@Test(enabled = false) public void testKerberosBasedLogin() throws Exception { String originalConf = System.getProperty("atlas.conf"); setupKDCAndPrincipals();//from w w w . jav a 2 s. c o m TestEmbeddedServer server = null; try { // setup the atlas-application.properties file String confDirectory = generateKerberosTestProperties(); System.setProperty("atlas.conf", confDirectory); // need to create the web application programmatically in order to control the injection of the test // application properties server = new TestEmbeddedServer(23000, "webapp/target/apache-atlas"); startEmbeddedServer(server.getServer()); final URLConnectionFactory connectionFactory = URLConnectionFactory.DEFAULT_SYSTEM_CONNECTION_FACTORY; // attempt to hit server and get rejected URL url = new URL("http://localhost:23000/"); HttpURLConnection connection = (HttpURLConnection) connectionFactory.openConnection(url, false); connection.setRequestMethod("GET"); connection.connect(); assertEquals(connection.getResponseCode(), 401); // need to populate the ticket cache with a local user, so logging in... Subject subject = loginTestUser(); Subject.doAs(subject, new PrivilegedExceptionAction<Object>() { @Override public Object run() throws Exception { // attempt to hit server and get rejected URL url = new URL("http://localhost:23000/"); HttpURLConnection connection = (HttpURLConnection) connectionFactory.openConnection(url, true); connection.setRequestMethod("GET"); connection.connect(); assertEquals(connection.getResponseCode(), 200); assertEquals(RequestContext.get().getUser(), TESTUSER); return null; } }); } finally { server.getServer().stop(); kdc.stop(); if (originalConf != null) { System.setProperty("atlas.conf", originalConf); } else { System.clearProperty("atlas.conf"); } } }
From source file:org.fcrepo.integration.http.api.ExternalContentPathValidatorIT.java
@Before public void init() throws Exception { // Because of the dirtied context, need to wait for fedora to restart before testing int triesRemaining = 50; while (true) { final HttpGet get = new HttpGet(serverAddress); try (final CloseableHttpResponse response = execute(get)) { assertEquals(SC_OK, getStatus(response)); break; } catch (final NoHttpResponseException | ConnectException e) { if (triesRemaining-- > 0) { LOGGER.debug("Waiting for fedora to become available"); Thread.sleep(50); } else { throw new Exception("Fedora instance did not become available in allowed time"); }/*from w w w . j a v a 2s. com*/ } } // Now that fedora has started, clear the property so it won't impact other tests System.clearProperty("fcrepo.external.content.allowed"); }