Example usage for java.lang System setProperty

List of usage examples for java.lang System setProperty

Introduction

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

Prototype

public static String setProperty(String key, String value) 

Source Link

Document

Sets the system property indicated by the specified key.

Usage

From source file:ru.phsystems.irisx.voice.httpPOST.java

/**
 * Constructor will setup httpclient, post request method and useragent information as required
 *//* w w w  .j a  v a  2s  .  co m*/
public httpPOST() {
    httpclient = new DefaultHttpClient();
    System.setProperty("http.agent", "");
    httppost = new HttpPost(speechAPIURL);
    HttpProtocolParams.setUserAgent(httpclient.getParams(), User_Agent);
    httppost.setHeader(HeaderType, HeaderContent);
}

From source file:it.geosolutions.geostore.services.rest.auditing.AuditingTestsUtils.java

static void createDefaultConfiguration() {
    initDirectory(CONFIGURATION_DIRECTORY);
    System.setProperty(AuditingConfiguration.CONFIGURATION_PATH, CONFIGURATION_FILE_PATH.getAbsolutePath());
    String properties = propertiesToString(getDefaultProperties());
    createFile(CONFIGURATION_FILE_PATH, properties);
}

From source file:com.streamsets.datacollector.execution.runner.TestSlaveStandaloneRunner.java

@BeforeClass
public static void beforeClass() throws IOException {
    File testDir = new File("target", UUID.randomUUID().toString()).getAbsoluteFile();
    Assert.assertTrue(testDir.mkdirs());
    System.setProperty(RuntimeModule.SDC_PROPERTY_PREFIX + RuntimeInfo.DATA_DIR, testDir.getAbsolutePath());
    TestUtil.captureStagesForProductionRun();
}

From source file:org.apache.cxf.fediz.service.idp.service.jpa.ApplicationDAOJPATest.java

@BeforeClass
public static void init() {
    System.setProperty("spring.profiles.active", "jpa");
}

From source file:com.github.nbyl.xfdcontrol.service.Application.java

private static void installConfigLocation() throws FileNotFoundException {
    if (Strings.isNullOrEmpty(System.getProperty(SPRING_CONFIG_LOCATION))) {
        File configFile = new File(StandardSystemProperty.USER_HOME.value(), ".xfdcontrol.properties");
        LOGGER.debug("Loading configuration from file {}.", configFile.getAbsolutePath());

        if (!configFile.exists()) {
            throw new FileNotFoundException("Config file " + configFile.getPath() + " does not exist.");
        }//  ww  w  .ja va 2s .c  om

        System.setProperty(SPRING_CONFIG_LOCATION, configFile.getAbsolutePath());
    } else {
        LOGGER.debug("Configuration location already set.");
    }
}

From source file:net.javacrumbs.smock.http.client.connection.threadlocal.http.HttpThreadLocalMockWebServiceServer.java

public HttpThreadLocalMockWebServiceServer(WebServiceMessageFactory messageFactory,
        EndpointInterceptor[] interceptors) {
    super(messageFactory, interceptors);
    System.setProperty("java.protocol.handler.pkgs", "net.javacrumbs.smock.http.client.connection.threadlocal");
}

From source file:org.greencheek.utils.environment.propertyplaceholder.spring.TestEnvironmentalPropertySourcesPlaceholderConfigurerViaBuildersInXml.java

@Test
public void testPropertyResolved() {
    System.setProperty("ENVIRONMENT", "dev");
    System.setProperty("ENV", "dev");
    ctx = new ClassPathXmlApplicationContext(
            new String[] { "classpath:SpringPropertySourcesPlaceholderConfigurer-config.xml" });

    String value = (String) ctx.getBean("string");
    String valueSys = (String) ctx.getBean("string-sys");
    String valueEnv = (String) ctx.getBean("string-env");

    String valuePath = (String) ctx.getBean("string-path");

    assertEquals("devproperties", value);

    assertEquals("dev", valueSys);
    assertEquals(System.getenv("PATH"), valueEnv);

    assertEquals(System.getenv("PATH"), valuePath);
}

From source file:com.netflix.imfutility.itunes.chapters.ChaptersXmlProviderTest.java

@BeforeClass
public static void setupAll() throws IOException {
    // create both working directory and logs folder.
    FileUtils.deleteDirectory(TemplateParameterContextCreator.getWorkingDir());
    File workingDir = TemplateParameterContextCreator.getWorkingDir();
    if (!workingDir.mkdir()) {
        throw new RuntimeException("Could not create a working dir within tmp folder");
    }//from w  w  w .  j  a  v  a2  s. c o m
    //  set user.dir to working directory
    userDir = System.getProperty("user.dir");
    System.setProperty("user.dir", workingDir.getAbsolutePath());

    ChaptersUtils.createChapterFile(1);
    ChaptersUtils.createChapterFile(2);
}

From source file:org.fusesource.meshkeeper.MeshKeeperFactoryTest.java

@Override
protected void setUp() throws Exception {
    System.setProperty("meshkeeper.base",
            MavenTestSupport.getDataDirectory(MeshKeeperFactoryTest.class.getSimpleName()).getCanonicalPath());
    // This shows how to start an embedded server /w java
    controller = MeshKeeperFactory.createControlServer("zk:tcp://localhost:2101");
}

From source file:edu.wustl.xipHost.caGrid.QueryNBIATest.java

/**
 * @throws java.lang.Exception//from w  ww.j a va2  s .c  o  m
 */
@BeforeClass
public static void setUpBeforeClass() throws Exception {
    System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.NoOpLog");
}