Example usage for java.lang System clearProperty

List of usage examples for java.lang System clearProperty

Introduction

In this page you can find the example usage for java.lang System clearProperty.

Prototype

public static String clearProperty(String key) 

Source Link

Document

Removes the system property indicated by the specified key.

Usage

From source file:org.apache.kylin.job.BaseTestDistributedScheduler.java

@AfterClass
public static void after() throws Exception {
    jobLock1.purgeLocks("");

    if (scheduler1 != null) {
        scheduler1.shutdown();//  www.j  a  v  a  2s  . c  o  m
        scheduler1 = null;
    }
    if (scheduler2 != null) {
        scheduler2.shutdown();
        scheduler2 = null;
    }
    if (zkClient != null) {
        zkClient.close();
        zkClient = null;
    }

    FileUtils.deleteDirectory(localMetaDir);
    System.clearProperty("kylin.job.lock");
    System.clearProperty("kylin.metadata.url");
    staticCleanupTestMetadata();
}

From source file:org.apache.coheigea.bigdata.hdfs.HDFSKerberosTest.java

@org.junit.AfterClass
public static void cleanup() throws Exception {
    FileUtil.fullyDelete(baseDir);//from  w w  w .j  av a2  s . c o  m
    hdfsCluster.shutdown();
    if (kerbyServer != null) {
        kerbyServer.stop();
    }
    System.clearProperty("java.security.krb5.conf");
}

From source file:com.thoughtworks.go.plugin.infra.DefaultPluginManagerIntegrationTest.java

@After
public void tearDown() throws Exception {
    System.clearProperty(PLUGIN_DESC_PROPERTY_SET_BY_TEST_PLUGIN_1);
    FileUtils.deleteQuietly(PLUGIN_DIR);
    FileUtils.deleteQuietly(BUNDLE_DIR);
    pluginManager.stopInfrastructure();/*w w  w.ja  va2s  .  co  m*/
    FileUtils.deleteQuietly(PLUGIN_DIR);
    FileUtils.deleteQuietly(BUNDLE_DIR);
}

From source file:org.kie.workbench.common.forms.data.modeller.service.impl.AbstractModelFinderTest.java

@AfterClass
public static void tearDown() {
    if (weldContainer != null) {
        weldContainer.shutdown();/*from   www  .ja va  2  s  .co  m*/
    }

    FileUtils.deleteQuietly(repoFile);

    System.clearProperty(JGitFileSystemProviderConfiguration.GIT_DAEMON_ENABLED);
    System.clearProperty(JGitFileSystemProviderConfiguration.GIT_SSH_ENABLED);
    System.clearProperty("org.uberfire.sys.repo.monitor.disabled");
    System.clearProperty(ArtifactRepositoryService.ORG_GUVNOR_M2REPO_DIR_PROPERTY);
}

From source file:org.codice.ddf.commands.solr.BackupCommandTest.java

@After
public void tearDown() {
    consoleOutput.resetSystemOut();// ww w. j av a  2  s  .co m

    System.clearProperty(SOLR_CLIENT_PROP);
    System.clearProperty(ZOOKEEPER_HOSTS_PROP);

    if (cipherSuites != null) {
        System.setProperty("https.cipherSuites", cipherSuites);
    } else {
        System.clearProperty("https.cipherSuites");
    }
    if (protocols != null) {
        System.setProperty("https.protocols", protocols);
    } else {
        System.clearProperty("https.protocols");
    }
}

From source file:org.apache.hupa.server.guice.ServerModulTest.java

@Test
public void testLoadDemoProperties() throws Exception {
    File tmp = File.createTempFile("foo", ".properties");
    tmp.deleteOnExit();//  w  ww.j  ava2 s .  com
    Properties p = MockConstants.mockProperties;
    Collection<String> lines = new ArrayList<String>();
    for (Entry<Object, Object> e : p.entrySet()) {
        lines.add(e.getKey() + " = " + e.getValue());
    }
    FileUtils.writeLines(tmp, lines);

    System.setProperty(GuiceListener.SYS_PROP_CONFIG_FILE, tmp.getAbsolutePath());
    p = new GuiceListener().loadProperties();
    Assert.assertNotNull(p);
    Assert.assertEquals(MockConstants.mockSettings.getInboxFolderName(), p.get("DefaultInboxFolder"));
    Assert.assertEquals(MockConstants.mockSettings.getTrashFolderName(), p.get("DefaultTrashFolder"));
    Assert.assertEquals(MockConstants.mockSettings.getSentFolderName(), p.get("DefaultSentFolder"));
    System.clearProperty(GuiceListener.SYS_PROP_CONFIG_FILE);
}

From source file:org.apache.solr.cloud.ClusterStateUpdateTest.java

@Override
public void setUp() throws Exception {
    super.setUp();
    createTempDir();/*from   w  w w.  j  a va 2 s  .  com*/
    System.setProperty("zkClientTimeout", "3000");

    zkDir = dataDir.getAbsolutePath() + File.separator + "zookeeper/server1/data";
    zkServer = new ZkTestServer(zkDir);
    zkServer.run();
    System.setProperty("zkHost", zkServer.getZkAddress());
    AbstractZkTestCase.buildZooKeeper(zkServer.getZkHost(), zkServer.getZkAddress(), "solrconfig.xml",
            "schema.xml");

    log.info("####SETUP_START " + getTestName());
    dataDir1 = new File(dataDir + File.separator + "data1");
    dataDir1.mkdirs();

    dataDir2 = new File(dataDir + File.separator + "data2");
    dataDir2.mkdirs();

    dataDir3 = new File(dataDir + File.separator + "data3");
    dataDir3.mkdirs();

    dataDir4 = new File(dataDir + File.separator + "data4");
    dataDir4.mkdirs();

    // set some system properties for use by tests
    System.setProperty("solr.test.sys.prop1", "propone");
    System.setProperty("solr.test.sys.prop2", "proptwo");

    System.setProperty("solr.solr.home", TEST_HOME());
    System.setProperty("hostPort", "1661");
    System.setProperty("solr.data.dir", ClusterStateUpdateTest.this.dataDir1.getAbsolutePath());
    container1 = new CoreContainer(solrHomeDirectory.getAbsolutePath());
    container1.load();
    System.clearProperty("hostPort");

    System.setProperty("hostPort", "1662");
    System.setProperty("solr.data.dir", ClusterStateUpdateTest.this.dataDir2.getAbsolutePath());
    container2 = new CoreContainer(solrHomeDirectory.getAbsolutePath());
    container2.load();
    System.clearProperty("hostPort");

    System.setProperty("hostPort", "1663");
    System.setProperty("solr.data.dir", ClusterStateUpdateTest.this.dataDir3.getAbsolutePath());
    container3 = new CoreContainer(solrHomeDirectory.getAbsolutePath());
    container3.load();
    System.clearProperty("hostPort");
    System.clearProperty("solr.solr.home");

    log.info("####SETUP_END " + getTestName());

}

From source file:org.apache.hadoop.mapred.TestTaskLog.java

/**
 * test without TASK_LOG_DIR/*  w  w  w .  j  a  v  a 2  s .  c om*/
 * 
 * @throws IOException
 */
@Test(timeout = 50000)
public void testTaskLogWithoutTaskLogDir() throws IOException {
    // TaskLog tasklog= new TaskLog();
    System.clearProperty(YarnConfiguration.YARN_APP_CONTAINER_LOG_DIR);

    // test TaskLog

    assertEquals(TaskLog.getMRv2LogDir(), null);
    TaskAttemptID taid = mock(TaskAttemptID.class);
    JobID jid = new JobID("job", 1);

    when(taid.getJobID()).thenReturn(jid);
    when(taid.toString()).thenReturn("JobId");

    File f = TaskLog.getTaskLogFile(taid, true, LogName.STDOUT);
    assertTrue(f.getAbsolutePath().endsWith("stdout"));

}

From source file:org.guvnor.ala.build.maven.executor.MavenDependencyConfigExecutorTest.java

@Test
public void testMavenDependencyAPI() throws Exception {
    final String groupId = "org.guvnor.ala";
    final String artifactId = "maven-ala-artifact-test";
    final String version = "1";

    final String oldSettingsXmlPath = System.getProperty(CUSTOM_SETTINGS_PROPERTY);
    try {/*  www  .  j  a  va2  s.  c  o  m*/
        final Path settingsXmlPath = generateSettingsXml();
        System.setProperty(CUSTOM_SETTINGS_PROPERTY, settingsXmlPath.toString());
        MavenSettings.reinitSettings();

        installArtifactLocally(groupId, artifactId, version);

        final BuildRegistry buildRegistry = new InMemoryBuildRegistry();

        final Stage<Input, BinaryConfig> sourceConfig = config("Maven Artifact",
                (s) -> new MavenDependencyConfigImpl());

        final Pipeline pipe = PipelineFactory.startFrom(sourceConfig).buildAs("my pipe");

        final PipelineExecutor executor = new PipelineExecutor(
                singletonList(new MavenDependencyConfigExecutor(buildRegistry)));

        executor.execute(new Input() {
            {
                put("artifact", groupId + ":" + artifactId + ":pom:" + version);
            }
        }, pipe, System.out::println);

        final List<Binary> allBinaries = buildRegistry.getAllBinaries();
        assertNotNull(allBinaries);
        assertEquals(1, allBinaries.size());
        assertTrue(allBinaries.get(0) instanceof MavenBinary);
        final MavenBinary binary = (MavenBinary) allBinaries.get(0);
        assertEquals("Maven", binary.getType());
        assertEquals(artifactId, binary.getName());
        assertEquals(groupId, binary.getGroupId());
        assertEquals(artifactId, binary.getArtifactId());
        assertEquals(version, binary.getVersion());
        assertEquals(m2Folder + "/org/guvnor/ala/maven-ala-artifact-test/1/maven-ala-artifact-test-1.pom",
                binary.getPath().toString());
    } finally {
        if (oldSettingsXmlPath == null) {
            System.clearProperty(CUSTOM_SETTINGS_PROPERTY);
        } else {
            System.setProperty(CUSTOM_SETTINGS_PROPERTY, oldSettingsXmlPath);
        }
        MavenSettings.reinitSettings();
    }
}

From source file:org.apache.atlas.web.service.SecureEmbeddedServerTestBase.java

@Test
public void testNoConfiguredCredentialProvider() throws Exception {
    String originalConf = null;/*w w  w. j a  v a2  s  .c om*/
    try {
        originalConf = System.getProperty("atlas.conf");
        System.clearProperty("atlas.conf");
        ApplicationProperties.forceReload();
        secureEmbeddedServer = new SecureEmbeddedServer(securePort, TestUtils.getWarPath());
        secureEmbeddedServer.server.start();

        Assert.fail("Should have thrown an exception");
    } catch (IOException e) {
        Assert.assertEquals(e.getMessage(),
                "No credential provider path configured for storage of certificate store passwords");
    } finally {
        if (secureEmbeddedServer != null) {
            secureEmbeddedServer.server.stop();
        }

        if (originalConf == null) {
            System.clearProperty("atlas.conf");
        } else {
            System.setProperty("atlas.conf", originalConf);
        }
    }
}