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:org.osehra.vista.example.cxf.jaxrs.JAXRSClientServerTest.java

@BeforeClass
public static void setupPorts() {
    // System.setProperty("soapEndpointPort", String.valueOf(AvailablePortFinder.getNextAvailable()));
    System.setProperty("restEndpointPort", String.valueOf(AvailablePortFinder.getNextAvailable()));
}

From source file:de.oppermann.pomutils.VersionReplaceTest.java

@Override
protected void setUp() throws Exception {
    super.setUp();
    System.setProperty(org.slf4j.impl.SimpleLogger.DEFAULT_LOG_LEVEL_KEY, "DEBUG");

    File testTargetResourceFolder = new File("target/testresources/versionReplacer");
    FileUtils.deleteDirectory(testTargetResourceFolder);
    FileUtils.copyDirectory(new File("src/test/resources/versionReplacer"), testTargetResourceFolder);
}

From source file:lumbermill.internal.StringTemplateTest.java

@Before
public void prepare() {
    System.setProperty("field", "value");
}

From source file:com.agilegroups.aws.AmazonEC2ApplicationTests.java

@After
public void after() {
    if (this.profiles != null) {
        System.setProperty("spring.profiles.active", this.profiles);
    } else {/* ww w  .j a v  a 2  s. c  o  m*/
        System.clearProperty("spring.profiles.active");
    }
}

From source file:Main.java

/**
 * Used to optimize performance by avoiding expensive file access every time
 * a DTMManager is constructed as a result of constructing a Xalan xpath
 * context!//from   w  w w. jav  a 2s.  c o  m
 */
private static void speedUpDTMManager() throws Exception {
    // https://github.com/aws/aws-sdk-java/issues/238
    // http://stackoverflow.com/questions/6340802/java-xpath-apache-jaxp-implementation-performance
    if (System.getProperty(DTM_MANAGER_DEFAULT_PROP_NAME) == null) {
        Class<?> XPathContextClass = Class.forName(XPATH_CONTEXT_CLASS_NAME);
        Method getDTMManager = XPathContextClass.getMethod("getDTMManager");
        Object XPathContext = XPathContextClass.newInstance();
        Object dtmManager = getDTMManager.invoke(XPathContext);

        if (DTM_MANAGER_IMPL_CLASS_NAME.equals(dtmManager.getClass().getName())) {
            // This would avoid the file system to be accessed every time
            // the internal XPathContext is instantiated.
            System.setProperty(DTM_MANAGER_DEFAULT_PROP_NAME, DTM_MANAGER_IMPL_CLASS_NAME);
        }
    }
}

From source file:org.activiti.crystalball.examples.mortages.firstsimulation.TheFirstSimulationTest.java

@Before
public void before() {
    System.setProperty("_SIM_DB_PATH", System.getProperty("tempDir", "target") + "/" + SIM_DB);

    File db = new File(System.getProperty("tempDir", "target") + "/" + SIM_DB + ".h2.db");
    db.delete();/*  w w w  .  j  av  a 2s .c om*/
}

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

@Test
public void testPropertyResolved() {
    System.setProperty("ENVIRONMENT", "dev");
    System.setProperty("ENV", "dev");
    ctx = new ClassPathXmlApplicationContext(new String[] {
            "classpath:SpringPropertySourcesPlaceholderConfigurer-composite-config-withstringlocations.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");

    String valueOps = (String) ctx.getBean("string-ops");

    assertEquals("devproperties", value);

    assertEquals("dev", valueSys);
    assertEquals(System.getenv("PATH"), valueEnv);
    assertEquals(System.getenv("PATH"), valuePath);
    assertEquals("ops have overridden me", valueOps);

    PropertySource p = ((PropertySource) ctx.getBean("environmentalProperties"));

    assertEquals("${ENVIRONMENT}", p.getProperty("sys"));
    assertEquals("${PATH}", p.getProperty("env"));

}

From source file:org.apache.smscserver.test.spring.PropertyPlaceholderTest.java

public void test() throws Throwable {
    System.setProperty("port2", "3333");

    FileSystemXmlApplicationContext ctx = new FileSystemXmlApplicationContext(
            "src/test/resources/spring-config/config-property-placeholder.xml");

    DefaultSmscServer server = (DefaultSmscServer) ctx.getBean("server");

    Assert.assertEquals(2222, server.getServerContext().getListener("listener0").getPort());
    Assert.assertEquals(3333, server.getServerContext().getListener("listener1").getPort());
}

From source file:net.fenyo.mail4hotspot.service.Browser.java

public void setProxyPort(final String proxy_port) {
    System.setProperty("http.proxyPort", proxy_port);
}

From source file:io.mindmaps.migration.csv.CSVDataMigratorTest.java

@BeforeClass
public static void start() {
    Logger logger = (Logger) org.slf4j.LoggerFactory.getLogger(org.slf4j.Logger.ROOT_LOGGER_NAME);
    logger.setLevel(Level.INFO);/*  w  w  w.j  a  va2  s. co m*/

    System.setProperty(ConfigProperties.CONFIG_FILE_SYSTEM_PROPERTY, ConfigProperties.TEST_CONFIG_FILE);
    System.setProperty(ConfigProperties.CURRENT_DIR_SYSTEM_PROPERTY, System.getProperty("user.dir") + "/../");

    new TransactionController();
    new CommitLogController();
    new GraphFactoryController();

    schemaMigrator = new CSVSchemaMigrator();
    dataMigrator = new CSVDataMigrator();
}