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:camel.labs.iot.cloudlet.document.driver.mongodb.EmbeddedMongoDbTest.java

@BeforeClass
public static void beforeClass() {
    int mongodbPort = findAvailableTcpPort();
    System.setProperty("camel.labs.iot.cloudlet.document.driver.mongodb.embedded.port", mongodbPort + "");
    System.setProperty("camel.labs.iot.cloudlet.document.driver.mongodb.springbootconfig", TRUE.toString());
    System.setProperty("spring.data.mongodb.port", mongodbPort + "");

    System.setProperty("server.port", findAvailableTcpPort() + "");
    System.setProperty("camel.labs.iot.cloudlet.rest.port", findAvailableTcpPort() + "");
}

From source file:autohit.common.traps.CommonsLoggerTrap.java

/**
 * Log a message with debug log level.//from ww w  .j  a  v  a2 s  . c om
 * @param logger a logger in which to dump everything.
 */
public static void setTrap(AutohitLogInjectorWrapper logger) {
    System.setProperty("org.apache.commons.logging.Log", "autohit.common.traps.CommonsLoggerTrap");
    log = logger;
}

From source file:gov.nih.nci.cacis.transform.XSLTv2TransformerTest.java

@BeforeClass
public static void setupEnv() throws URISyntaxException {
    System.setProperty("cacis-pco.transformer.xml2rdf.xsl", "sampleXSLv2.xsl");
    final File smplxsl = new File(
            XSLTv2TransformerTest.class.getClassLoader().getResource("xsl2/sampleXSLv2.xsl").toURI());
    System.setProperty("cacis-pco.transformer.xsl.baseClassPath", smplxsl.getParent() + "/");
}

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

/**
 * @throws java.lang.Exception//from www.j  ava2s  .  c  o m
 */
@BeforeClass
public static void setUpBeforeClass() throws Exception {
    System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.NoOpLog");
    gridLoc = new GridLocation("http://imaging.nci.nih.gov/wsrf/services/cagrid/NCIACoreService", Type.DICOM,
            "NBIA-5.0", "NBIA Production Server at NCI");
    parser = new BasicDicomParser2();
    importDir = new File("./test-content/TmpXIP_Test");
    if (importDir.exists() == false) {
        boolean success = importDir.mkdir();
        if (!success) {
            fail("System could not create import directory.");
        }
    }
}

From source file:com.hp.autonomy.frontend.find.core.test.AbstractFindIT.java

@BeforeClass
public static void init() throws IOException {
    System.setProperty("hp.find.home", TEST_DIR);
    final File directory = new File(TEST_DIR);
    FileUtils.forceMkdir(directory);/*from   w ww  . j a v  a 2s .  c om*/
}

From source file:com.marklogic.client.test.DeleteSearchTest.java

@BeforeClass
public static void beforeClass() throws Exception {
    Common.connectAdmin();//from   w  w w. ja va 2 s.c  o  m
    System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.http.wire", "debug");
    writeDoc();
}

From source file:com.marklogic.client.functionaltest.TestRuntimeDBselection.java

@BeforeClass
public static void setUpBeforeClass() throws Exception {
    System.out.println("In setup");
    setupJavaRESTServer(dbName, fNames[0], restServerName, restPort, false);
    createUserRolesWithPrevilages("test-eval", "xdbc:eval", "xdbc:eval-in", "xdmp:eval-in", "any-uri",
            "xdbc:invoke");
    createRESTUser("eval-user", "x", "test-eval", "rest-admin", "rest-writer", "rest-reader");

    System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.http.wire", "debug");
}

From source file:com.vmware.bdd.usermgmt.TestSssdConfigurationGenerator.java

public static void setupSssdTemplates() throws IOException {
    String tmpDirPath = System.getProperty("java.io.tmpdir");

    if (StringUtils.isNotBlank(System.getProperty("serengeti.home.dir"))) {
        System.setProperty("serengeti.home.dir.bak", System.getProperty("serengeti.home.dir"));
    }//from  w w w  . jav  a 2  s. c o  m
    System.setProperty("serengeti.home.dir", tmpDirPath);

    File usermgmrConfDir = new File(
            System.getProperty("serengeti.home.dir") + File.separator + "conf" + File.separator + "usermgmt");
    usermgmrConfDir.mkdirs();
    usermgmrConfDir.deleteOnExit();

    File tmpFile = new File(usermgmrConfDir, SssdConfigurationGenerator.SSSD_CONF_TEMPLATES + "LDAP");
    tmpFile.createNewFile();
    tmpFile.deleteOnExit();
    FileCopyUtils.copy(readResource(SssdConfigurationGenerator.SSSD_CONF_TEMPLATES + "LDAP"),
            new FileWriter(tmpFile));

    tmpFile = new File(usermgmrConfDir, SssdConfigurationGenerator.SSSD_CONF_TEMPLATES + "AD_AS_LDAP");
    tmpFile.createNewFile();
    tmpFile.deleteOnExit();
    FileCopyUtils.copy(readResource(SssdConfigurationGenerator.SSSD_CONF_TEMPLATES + "AD_AS_LDAP"),
            new FileWriter(tmpFile));
}

From source file:edu.ku.brc.specify.config.init.secwiz.SpecifyDBSecurityWizardFrame.java

/**
 * @param args//from  w  ww.j  a  va 2 s .  c  o  m
 */
public static void main(String[] args) {
    // Set App Name, MUST be done very first thing!
    UIRegistry.setAppName("Specify"); //$NON-NLS-1$

    try {
        ResourceBundle.getBundle("resources", Locale.getDefault()); //$NON-NLS-1$

    } catch (MissingResourceException ex) {
        Locale.setDefault(Locale.ENGLISH);
        UIRegistry.setResourceLocale(Locale.ENGLISH);
    }

    try {
        if (!System.getProperty("os.name").equals("Mac OS X")) {
            UIManager.setLookAndFeel(new Plastic3DLookAndFeel());
            PlasticLookAndFeel.setPlasticTheme(new DesertBlue());
        }
    } catch (Exception e) {
        edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount();
        edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(SpecifyDBSecurityWizard.class, e);
        e.printStackTrace();
    }

    AppBase.processArgs(args);
    AppBase.setupTeeForStdErrStdOut(true, false);

    System.setProperty("appdatadir", "..");

    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            // Then set this
            IconManager.setApplicationClass(Specify.class);
            IconManager.loadIcons(XMLHelper.getConfigDir("icons_datamodel.xml")); //$NON-NLS-1$
            IconManager.loadIcons(XMLHelper.getConfigDir("icons_plugins.xml")); //$NON-NLS-1$
            IconManager.loadIcons(XMLHelper.getConfigDir("icons_disciplines.xml")); //$NON-NLS-1$

            // Load Local Prefs
            AppPreferences localPrefs = AppPreferences.getLocalPrefs();
            //try {
            //System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> "+(new File(UIRegistry.getAppDataDir()).getCanonicalPath())+"]");
            //} catch (IOException ex) {}

            localPrefs.setDirPath(UIRegistry.getAppDataDir());

            // Check to see if we should check for a new version
            String VERSION_CHECK = "version_check.auto";
            if (localPrefs.getBoolean(VERSION_CHECK, null) == null) {
                localPrefs.putBoolean(VERSION_CHECK, true);
            }

            String EXTRA_CHECK = "extra.check";
            if (localPrefs.getBoolean(EXTRA_CHECK, null) == null) {
                localPrefs.putBoolean(EXTRA_CHECK, true);
            }

            if (UIHelper.isLinux()) {
                Specify.checkForSpecifyAppsRunning();
            }

            if (UIRegistry.isEmbedded()) {
                checkForMySQLProcesses();
            }

            Specify.setUpSystemProperties();

            final SpecifyDBSecurityWizardFrame wizardFrame = new SpecifyDBSecurityWizardFrame();

            if (localPrefs.getBoolean(VERSION_CHECK, true) && localPrefs.getBoolean(EXTRA_CHECK, true)) {
                try {
                    com.install4j.api.launcher.SplashScreen.hide();
                    ApplicationLauncher.Callback callback = new ApplicationLauncher.Callback() {
                        public void exited(int exitValue) {
                            UIHelper.centerAndShow(wizardFrame);
                        }

                        public void prepareShutdown() {

                        }
                    };
                    ApplicationLauncher.launchApplication("100", null, true, callback);

                } catch (Exception ex) {
                    UIHelper.centerAndShow(wizardFrame);
                }
            } else {
                UIHelper.centerAndShow(wizardFrame);
            }
        }
    });
}

From source file:Main.java

/**
 * Prepares the theme. The theme can be overridden with the specified environment variable. The default is the
 * system look and feel.//from w ww.  j ava  2  s.  c  o  m
 *
 * @param overrideEnvVar
 *            The environment variable to check for override value. Specify null for don't use override variable
 * @throws Exception
 *             When setting the theme failed
 */

public static void prepareTheme(final String overrideEnvVar) throws Exception {
    final String sysThemeStr = overrideEnvVar == null ? null : System.getenv().get(overrideEnvVar);
    System.setProperty("apple.laf.useScreenMenuBar", "true");
    if (sysThemeStr == null || Boolean.parseBoolean(sysThemeStr)) {
        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    }
}