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:com.rackspacecloud.blueflood.inputs.handlers.HttpAnnotationsEndToEndTest.java

@AfterClass
public static void tearDownClass() throws Exception {
    Configuration.getInstance().setProperty(CoreConfig.EVENTS_MODULES.name(), "");
    System.clearProperty(CoreConfig.EVENTS_MODULES.name());
    if (esSetup != null) {
        esSetup.terminate();//  w  ww .  j a  v  a 2s  .  co m
    }

    if (vendor != null) {
        vendor.shutdown();
    }

    if (httpIngestionService != null) {
        httpIngestionService.shutdownService();
    }

    if (httpQueryService != null) {
        httpQueryService.stopService();
    }
}

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

@Test
public void test() throws Exception {
    handle.clear();//from  www  .  j  a  v a 2  s.c o  m
    handle.put("timestamp", SKIPVAL);

    try {
        CloudJettyRunner initialLeaderJetty = shardToLeaderJetty.get("shard1");
        List<CloudJettyRunner> otherJetties = getOtherAvailableJetties(initialLeaderJetty);

        log.info("Leader node_name: {},  url: {}", initialLeaderJetty.coreNodeName, initialLeaderJetty.url);
        for (CloudJettyRunner cloudJettyRunner : otherJetties) {
            log.info("Nonleader node_name: {},  url: {}", cloudJettyRunner.coreNodeName, cloudJettyRunner.url);
        }

        CloudJettyRunner secondNode = otherJetties.get(0);
        CloudJettyRunner freshNode = otherJetties.get(1);

        // shutdown a node to simulate fresh start
        otherJetties.remove(freshNode);
        forceNodeFailures(singletonList(freshNode));

        del("*:*");
        waitForThingsToLevelOut(30);

        checkShardConsistency(false, true);

        // index a few docs and commit
        for (int i = 0; i < 100; i++) {
            indexDoc(id, docId, i1, 50, tlong, 50, t1, "document number " + docId++);
        }
        commit();
        waitForThingsToLevelOut(30);

        checkShardConsistency(false, true);

        // bring down the other node and index a few docs; so the leader and other node segments diverge
        forceNodeFailures(singletonList(secondNode));
        for (int i = 0; i < 10; i++) {
            indexDoc(id, docId, i1, 50, tlong, 50, t1, "document number " + docId++);
            if (i % 2 == 0) {
                commit();
            }
        }
        commit();
        restartNodes(singletonList(secondNode));

        // start the freshNode 
        restartNodes(singletonList(freshNode));

        String replicationProperties = (String) freshNode.jetty.getSolrHome() + "/cores/"
                + DEFAULT_TEST_COLLECTION_NAME + "/data/replication.properties";
        String md5 = DigestUtils.md5Hex(Files.readAllBytes(Paths.get(replicationProperties)));

        // shutdown the original leader
        log.info("Now shutting down initial leader");
        forceNodeFailures(singletonList(initialLeaderJetty));
        waitForNewLeader(cloudClient, "shard1", (Replica) initialLeaderJetty.client.info,
                new TimeOut(15, SECONDS));
        waitTillNodesActive();
        log.info("Updating mappings from zk");
        updateMappingsFromZk(jettys, clients, true);
        assertEquals("Node went into replication", md5,
                DigestUtils.md5Hex(Files.readAllBytes(Paths.get(replicationProperties))));

        success = true;
    } finally {
        System.clearProperty("solr.disableFingerprint");
    }
}

From source file:co.cask.common.security.server.ExternalAuthenticationServerTestBase.java

@AfterClass
public static void afterClass() throws Exception {
    ldapServer.shutDown(true);//from  w  ww.j ava 2s  .  co  m
    server.stopAndWait();
    // Clear any security properties for zookeeper.
    System.clearProperty(Constants.External.Zookeeper.ENV_AUTH_PROVIDER_1);
}

From source file:com.redhat.example.rules.runtimestats.DefaultRuleSimulator.java

private void warmup(CommandsFactory commandsFactory, StatsType statsType, int warmupSeconds) {
    if (warmupSeconds <= 0) {
        return;//from   ww  w  . ja v  a2  s.c o  m
    }

    System.out.println(
            "START Warming Up. stats: " + statsType.toString() + " for " + warmupSeconds + " seconds.");

    String jittingThreshold = System.getProperty(ConstraintJittingThresholdOption.PROPERTY_NAME);
    System.setProperty(ConstraintJittingThresholdOption.PROPERTY_NAME, "1");
    long endWarmupTime = System.currentTimeMillis() + warmupSeconds * 1000;
    while (System.currentTimeMillis() < endWarmupTime) {
        ruleCompare.compareExecutionForWarmup(getBaseRules(), getWorkingRules(), commandsFactory, statsType,
                endWarmupTime);
    }
    if (jittingThreshold == null) {
        System.clearProperty(ConstraintJittingThresholdOption.PROPERTY_NAME);
    } else {
        System.setProperty(ConstraintJittingThresholdOption.PROPERTY_NAME, jittingThreshold);
    }

    System.out.println(
            "END   Warming Up. stats: " + statsType.toString() + " for " + warmupSeconds + " seconds.");
}

From source file:org.apache.solr.BaseDistributedSearchTestCase.java

/**
 * Clears the "hostContext" system property
 * @see #initHostContext/*from  w w  w . ja  v  a 2 s.  co  m*/
 */
@AfterClass
public static void clearHostContext() throws Exception {
    System.clearProperty("hostContext");
}

From source file:org.apache.sentry.tests.e2e.solr.AbstractSolrSentryTestBase.java

@AfterClass
public static void teardownClass() throws Exception {
    HdfsTestUtil.teardownClass(dfsCluster);
    System.clearProperty("solr.hdfs.home");
    System.clearProperty("solr.authorization.sentry.site");
    dfsCluster = null;//  w  w  w . j  a  v a  2  s.  c o  m
    extraRequestFilters = null;
    miniSolrCloudCluster.shutdown();
}

From source file:com.google.gdt.eclipse.designer.core.util.UtilsTest.java

/**
 * Test for {@link Utils#hasGPE()}./*from  ww  w .  ja  v  a2 s.  co m*/
 */
public void test_hasGPE_falseInTesting() throws Exception {
    System.setProperty("wbp.noGPE", "true");
    try {
        assertFalse(Utils.hasGPE());
    } finally {
        System.clearProperty("wbp.noGPE");
    }
}

From source file:com.seleniumtests.it.driver.TestWebUiDriver.java

/**
 * Check that HAR capture file is present 
 * Check it contains one page per TestStep
 * /*ww  w.  j  av a2s.  c om*/
 * @throws Exception
 */
@Test(groups = { "it" })
public void testHarCaptureExists() throws Exception {

    try {
        System.setProperty(SeleniumTestsContext.CAPTURE_NETWORK, "true");

        executeSubTest(1, new String[] { "com.seleniumtests.it.stubclasses.StubTestClassForDriverTest" },
                ParallelMode.METHODS, new String[] { "testDriver" });

        Assert.assertTrue(Paths.get(SeleniumTestsContextManager.getGlobalContext().getOutputDirectory(),
                "testDriver", "networkCapture.har").toFile().exists());

        JSONObject json = new JSONObject(FileUtils
                .readFileToString(Paths.get(SeleniumTestsContextManager.getGlobalContext().getOutputDirectory(),
                        "testDriver", "networkCapture.har").toFile()));
        JSONArray pages = json.getJSONObject("log").getJSONArray("pages");

        // 7 steps in HTML 
        // 'getPageUrl' step should be called before driver is created but creating PictureElement starts driver
        Assert.assertTrue(pages.length() >= 6, "content is: " + json.toString());
        List<String> pageNames = new ArrayList<>();
        for (Object page : pages.toList()) {
            pageNames.add(((Map<String, Object>) page).get("id").toString().trim());
        }
        Assert.assertTrue(pageNames.contains("testDriver"));
        Assert.assertTrue(pageNames.contains("_writeSomething"));
        Assert.assertTrue(pageNames.contains("_reset"));
        Assert.assertTrue(pageNames.contains("_sendKeysComposite"));
        Assert.assertTrue(pageNames.contains("_clickPicture"));

    } finally {
        System.clearProperty(SeleniumTestsContext.CAPTURE_NETWORK);
    }
}

From source file:com.yahoo.athenz.common.server.db.DataSourceFactoryTest.java

@Test
public void testPoolConfigInvalidValues() {

    System.setProperty(DataSourceFactory.ATHENZ_PROP_DBPOOL_MAX_TOTAL, "a");
    System.setProperty(DataSourceFactory.ATHENZ_PROP_DBPOOL_MAX_IDLE, "b");
    System.setProperty(DataSourceFactory.ATHENZ_PROP_DBPOOL_MIN_IDLE, "c");
    System.setProperty(DataSourceFactory.ATHENZ_PROP_DBPOOL_MAX_WAIT, "d");
    System.setProperty(DataSourceFactory.ATHENZ_PROP_DBPOOL_EVICT_IDLE_TIMEOUT, "e");
    System.setProperty(DataSourceFactory.ATHENZ_PROP_DBPOOL_EVICT_IDLE_INTERVAL, "f");

    GenericObjectPoolConfig config = DataSourceFactory.setupPoolConfig();
    assertNotNull(config);//from w  ww.  j  a  va  2  s  .  c o  m

    assertEquals(config.getMaxTotal(), GenericObjectPoolConfig.DEFAULT_MAX_TOTAL);
    assertEquals(config.getMaxIdle(), GenericObjectPoolConfig.DEFAULT_MAX_IDLE);
    assertEquals(config.getMinIdle(), GenericObjectPoolConfig.DEFAULT_MIN_IDLE);
    assertEquals(config.getMaxWaitMillis(), GenericObjectPoolConfig.DEFAULT_MAX_WAIT_MILLIS);
    assertEquals(config.getMinEvictableIdleTimeMillis(),
            BaseObjectPoolConfig.DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS);
    assertEquals(config.getTimeBetweenEvictionRunsMillis(),
            BaseObjectPoolConfig.DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS);
    assertTrue(config.getTestWhileIdle());
    assertTrue(config.getTestOnBorrow());

    System.clearProperty(DataSourceFactory.ATHENZ_PROP_DBPOOL_MAX_TOTAL);
    System.clearProperty(DataSourceFactory.ATHENZ_PROP_DBPOOL_MAX_IDLE);
    System.clearProperty(DataSourceFactory.ATHENZ_PROP_DBPOOL_MIN_IDLE);
    System.clearProperty(DataSourceFactory.ATHENZ_PROP_DBPOOL_MAX_WAIT);
    System.clearProperty(DataSourceFactory.ATHENZ_PROP_DBPOOL_EVICT_IDLE_TIMEOUT);
    System.clearProperty(DataSourceFactory.ATHENZ_PROP_DBPOOL_EVICT_IDLE_INTERVAL);
}