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:magicware.scm.redmine.tools.RedmineClientTestCase.java

@BeforeClass
public static void setUpBeforeClass() throws Exception {
    System.setProperty(Constants.CONFIG_FILE,
            RedmineClientTestCase.class.getClassLoader().getResource("data/config.json").getFile());

    config = ConfigFacade.getConfig();/*from www .  jav  a2 s  . co  m*/
    redmineClient = new RedmineClient(config.getRedmineHost(), config.getRedminePort(),
            config.getRedmineContext());
}

From source file:com.redhat.lightblue.config.ldap.LdapDataSourceConfigurationTest.java

@BeforeClass
public static void beforeClass() {
    System.setProperty("ldap.host", "localhost");
    System.setProperty("ldap.port", String.valueOf(LdapServerExternalResource.DEFAULT_PORT));
}

From source file:org.talend.components.api.component.runtime.JarRuntimeInfoTest.java

@BeforeClass
public static void setupMavenUrlHandler() {
    try {//from  w w  w .  j  a  va2  s. co m
        new URL("mvn:foo/bar");
    } catch (MalformedURLException e) {
        // handles mvn local repository
        String mvnLocalRepo = System.getProperty("maven.repo.local");
        if (mvnLocalRepo != null) {
            System.setProperty("org.ops4j.pax.url.mvn.localRepository", mvnLocalRepo);
        }
        URL.setURLStreamHandlerFactory(new URLStreamHandlerFactory() {

            @Override
            public URLStreamHandler createURLStreamHandler(String protocol) {
                if (ServiceConstants.PROTOCOL.equals(protocol)) {
                    return new Handler();
                } else {
                    return null;
                }
            }
        });
    }
}

From source file:com.serphacker.serposcope.scraper.http.ScrapClientIT.java

@BeforeClass
public static void before() {
    System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.SimpleLog");
    System.setProperty("org.apache.commons.logging.simplelog.showdatetime", "false");
    System.setProperty("org.apache.commons.logging.simplelog.defaultlog", "fatal");
}

From source file:com.github.born2snipe.maven.plugin.idea.sandbox.IdeaCacheLocatorTest.java

@AfterClass
public static void reset() {
    System.setProperty("os.name", ORIGINAL_OS_NAME);
    System.setProperty("user.home", ORIGINAL_USER_HOME);
}

From source file:com.comcast.cats.domain.configuration.CatsHomeTest.java

public static void setCatsHome(String catsHome) {
    System.setProperty("cats.home", catsHome);
}

From source file:com.ms.commons.nisa.impl.ConfigServiceImplTest.java

public void testInit() {
    System.setProperty(ConfigServiceImpl.KEY_NISA_PROPERTIES, "/Users/zxc/abc.properties");
    System.setProperty(ConfigServiceImpl.KEY_START_MINA_CLIENT, "false");
    ConfigServiceImpl cs = new ConfigServiceImpl();
    try {//w w  w .java  2s.  c o m
        cs.init();
    } catch (NisaException ee) {
        return;
    }
    fail();
}

From source file:com.liferay.arquillian.maven.importer.LiferayPluginTestCase.java

protected static void setupPortalMinimal() {
    System.setProperty("liferay.version", LIFERAY_VERSION);

    System.setProperty("liferay.auto.deploy.dir", PORTAL_AUTO_DEPLOY_DIR);

    System.setProperty("liferay.app.server.deploy.dir", PORTAL_SERVER_DEPLOY_DIR);

    System.setProperty("liferay.app.server.lib.global.dir", PORTAL_SERVER_LIB_GLOBAL_DIR);

    System.setProperty("liferay.app.server.portal.dir", SERVER_PORTAL_DIR);

    try {/*  w  w w  .  j  a  v  a 2 s.  c  o  m*/
        ArchiverManager archiverManager = plexusContainer.lookup(ArchiverManager.class);

        assertNotNull(archiverManager);

        FileUtils.forceMkdir(new File(PORTAL_AUTO_DEPLOY_DIR));
        FileUtils.forceMkdir(new File(PORTAL_SERVER_DEPLOY_DIR));
        FileUtils.forceMkdir(new File(PORTAL_SERVER_LIB_GLOBAL_DIR));
        FileUtils.forceMkdir(new File(SERVER_PORTAL_DIR));

        final MavenResolverSystem mavenResolverSystem = Maven.configureResolver()
                .fromClassloaderResource("settings.xml");

        File[] dependencies = mavenResolverSystem.loadPomFromClassLoaderResource("liferay-setup.xml")
                .importRuntimeAndTestDependencies().resolve().withoutTransitivity().asFile();

        File warFile = null;

        for (File file : dependencies) {
            String fileName = file.getName();
            String fileExtension = FilenameUtils.getExtension(fileName);

            if (fileExtension.equalsIgnoreCase("jar")) {
                FileUtils.copyFile(file, new File(PORTAL_SERVER_LIB_GLOBAL_DIR, file.getName()));
            } else if (fileExtension.equalsIgnoreCase("war") && fileName.contains("portal-web")) {

                warFile = file;
            }
        }

        assertNotNull(warFile);

        // extract portal war

        UnArchiver unArchiver = archiverManager.getUnArchiver(warFile);
        unArchiver.setDestDirectory(new File(SERVER_PORTAL_DIR));
        unArchiver.setSourceFile(warFile);
        unArchiver.setOverwrite(false);
        unArchiver.extract();
        setup = true;
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}

From source file:Main.java

/**
 * Used to optimize performance by avoiding expensive file access every time
 * a DocumentBuilderFactory is constructed as a result of constructing a
 * Xalan document factory.//www  . j av a2  s .co  m
 */
private static void speedUpDcoumentBuilderFactory() {
    String className = System.getProperty(DOCUMENT_BUILDER_FACTORY_PROP_NAME);
    if (className == null) {
        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        if (factory instanceof DocumentBuilderFactoryImpl) {
            // This would avoid the file system to be accessed every time
            // the internal DocumentBuilderFactory is instantiated.
            System.setProperty(DOCUMENT_BUILDER_FACTORY_PROP_NAME, DocumentBuilderFactoryImpl.class.getName());
        }
    }
}

From source file:com.google.cloud.hadoop.util.LogUtilTest.java

/**
 * Performs initialization once before tests are run.
 *///from w  w  w  .  j a v  a 2  s  .  c  o m
@BeforeClass
public static void beforeAllTests() {
    // Configure Log4j to send all log output to a StringWriter
    // so that we can inspect logged content.
    System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.Log4JLogger");
    log = new LogUtil(LogUtilTest.class);
    sw = new StringWriter();
    WriterAppender logAppender = new WriterAppender(new SimpleLayout(), sw);
    Logger rootLogger = Logger.getRootLogger();
    rootLogger.addAppender(logAppender);
    rootLogger.setLevel(Level.DEBUG);
}