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:UnitTest2.java

public static void main(String[] args) throws Exception {
    System.setProperty("org.slf4j.simpleLogger.showDateTime", "true");
    System.setProperty("org.slf4j.simpleLogger.showThreadName", "true");
    System.setProperty("org.slf4j.simpleLogger.levelInBrackets", "true");
    System.setProperty("org.slf4j.simpleLogger.dateTimeFormat", "yyyy-MM-dd HH:mm:ss:SSS Z");
    System.setProperty("org.slf4j.simpleLogger.defaultLogLevel", "debug");
    System.setProperty("org.slf4j.simpleLogger.showLogName", "true");
    //System.setProperty("org.slf4j.simplelogger.defaultlog", "debug");
    //System.setProperty(org.slf4j.impl.SimpleLogger.DEFAULT_LOG_LEVEL_KEY, "DEBUG");
    final Logger log = LoggerFactory.getLogger(UnitTest2.class);
    UnitTest2.log = log;/*  www .  j av a 2 s  .co m*/
    System.out.println("ScabiClient");

    String action = "dao = new Dao(@localhost@, @27017@, @MetaDB@);"
            + "dao.setTableName(@ComputeMetaDataTable@);"
            + "jsonQuery = @{ @@Status@@ : @@Available@@, @@ComputePort@@ : @@4568@@ }@;"
            + "jsonResult = dao.executeQuery(jsonQuery);" + "return jsonResult;";

    String action2 = "import test.TestNew;" + "t = new TestNew();"
            + "dao = new Dao(@localhost@, @27017@, @MetaDB@);" + "dao.setTableName(@ComputeMetaDataTable@);"
            + "jsonQuery = @{ @@Status@@ : @@Available@@, @@ComputePort@@ : @@4568@@ }@;"
            + "jsonResult = dao.executeQuery(jsonQuery);"
            + "return @Result1 : @ + t.compute(null) + @ Result2: @ + jsonResult;";

    //ScabiClient2.testAddJar();
    UnitTest2.testexclude();
    //DMJson j = new DMJson("1", "123");
    //j = j.add("1", "234");
    //System.out.println(j);
    /*
    DMeta meta = new DMeta("localhost", "5000");
            
    DComputeAsync c = new DComputeAsync(meta);
    DMClassLoader dcl = new DMClassLoader();
    Thread.currentThread().setContextClassLoader(dcl);
    c.addComputeUnitJars();
    */
    HttpResponse httpResponse = null;
    String result = null;
    Future<HttpResponse> f = null;

    //ComputeNoBlock cnb = new ComputeNoBlock();
    //cnb.execute();
    /*
     DComputeNoBlock cnb = new DComputeNoBlock(meta);
              
     cnb.addJar("/home/anees/self/test.jar");
     f = cnb.executeClass(CU.class);
            
     httpResponse = DComputeNoBlock.get(f);
     result = DComputeNoBlock.getResult(httpResponse);
     log.debug("result : {}", result);
            
     CU cu = new CU();
     cnb.addJar("/home/anees/self/test.jar");
     f = cnb.executeObject(cu);
              
     httpResponse = DComputeNoBlock.get(f);
     result = DComputeNoBlock.getResult(httpResponse);
     log.debug("result : {}", result);
            
     cnb.addJar("/home/anees/self/test.jar");
     f = cnb.executeClassNameInJar("/home/anees/self/test.jar", "TestNew");
             
     httpResponse = DComputeNoBlock.get(f);
     result = DComputeNoBlock.getResult(httpResponse);
     log.debug("result : {}", result);
             
     cnb.addJar("/home/anees/self/test.jar");
     f = cnb.executeCode(action2);   
             
     httpResponse = DComputeNoBlock.get(f);
     result = DComputeNoBlock.getResult(httpResponse);
     log.debug("result : {}", result);
    */
    /*
    f = cnb.executeCode(action);
            
    httpResponse = DComputeNoBlock.get(f);
    result = DComputeNoBlock.getResult(httpResponse);
    log.debug("result : {}", result);
    */
    //cnb.close();

    //DComputeNoBlock cnba[] = meta.getComputeNoBlockMany(1);
    //log.debug("cnba[0].toString() : {}", cnba[0].toString());
    //DComputeNoBlock cnb = cnba[0];
    /*
    Future<HttpResponse> future = cnb.executeCode(action);
    HttpResponse httpResponse = DComputeNoBlock.get(future);
    String result = DComputeNoBlock.getResult(httpResponse);
    log.debug("result : {}", result);
    */

    //meta.close();

}

From source file:Main.java

/**
 * /*from   www  .  j a v a 2  s  .co m*/
 * @param xPathS
 * @param node
 * @param nsuri
 * @param pre
 * @param returnType
 * @return Return type is one of XPathConstants .BOOLEAN, .NODE, .NODESET,
 *         .NUMBER, .STRING
 * @throws Exception
 */
public static Object getNodesListXpath(final String xPathS, final Node node, final String nsuri,
        final String pre, final QName returnType) throws Exception {
    Object matches = null;
    System.setProperty("javax.xml.xpath.XPathFactory:" + XPathConstants.DOM_OBJECT_MODEL, XPATH_FACTORY);

    XPathFactory xpathFactory = XPathFactory.newInstance(XPathConstants.DOM_OBJECT_MODEL);
    XPath xpath = xpathFactory.newXPath();
    XPathExpression xpe = xpath.compile(xPathS);
    matches = xpe.evaluate(node, returnType);

    return matches;
}

From source file:com.redhat.victims.mock.MockEnvironment.java

public static void setUp(File updateResponse, File removeResponse) throws IOException {
    initCache();//from w w w .ja va  2 s.c o  m
    MockService.start(updateResponse, removeResponse);
    System.setProperty(VictimsConfig.Key.DB_PURGE, "true");
    System.setProperty(VictimsConfig.Key.URI, MockService.uri());
    System.setProperty(VictimsConfig.Key.HOME, TEMP_CACHE.getAbsolutePath());
}

From source file:com.sec.ose.airs.controller.cli.CLIMain.java

private static void setProxy(CLICommandLogin cm) {
    if (StringUtils.isNotEmpty(cm.getProxyHost())) {
        System.setProperty("http.proxyHost", cm.getProxyHost());
        if (StringUtils.isNotEmpty(cm.getProxyPort())) {
            System.setProperty("http.proxyPort", cm.getProxyPort());
        }//w  ww . j a v a2  s  .com
    }
}

From source file:atg.tools.dynunit.util.PropertiesUtil.java

public static void setSystemProperty(final String key, final String value) {
    logger.entry(key, value);//from   w  ww .  jav  a 2 s .c o  m
    System.setProperty(key, value);
    logger.exit();
}

From source file:edu.toronto.cs.xml2rdf.utils.LogUtils.java

public static void shutup() {
    System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.NoOpLog");
}

From source file:Main.java

/**
 * Turns on various logging interfaces for Apache HTTP Client including the use of SimpleLog
 *//*from   ww  w.  j a v  a 2s .co  m*/
public static void configuringLoggingApacheClient() {
    // According to http://stackoverflow.com/questions/3246792/how-to-enable-logging-for-apache-commons-httpclient-on-android
    // the following two lines are needed on Android. They aren't needed in general Java.
    Logger.getLogger("org.apache.http.wire").setLevel(Level.FINEST);
    Logger.getLogger("org.apache.http/headers").setLevel(Level.FINEST);

    System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.SimpleLog");

    System.setProperty("org.apache.commons.logging.simplelog.showdatetime", "true");

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

    System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.commons.httpclient", "debug");

    System.setProperty("org.apache.commons.logging.simplelog.defaultlog", "all");
}

From source file:org.eclipse.swt.snippets.Snippet370.java

private static void createForLocale(Shell shell, Locale locale) {
    System.setProperty("swt.datetime.locale", locale.toLanguageTag());
    Composite composite = new Composite(shell, SWT.BORDER);
    composite.setLayout(new RowLayout(SWT.HORIZONTAL));
    new Label(composite, SWT.NONE).setText(locale.toLanguageTag());
    new DateTime(composite, SWT.DROP_DOWN);
    new DateTime(composite, SWT.SHORT);
    new DateTime(composite, SWT.TIME);
}

From source file:file.FileOperatorTest.java

/**
 *http://stackoverflow.com/questions/16524065/is-filevisitoption-follow-links-the-only-filevisitoption-available
 *//* w  ww.ja va  2s . com*/
public static List<Path> testWalkFileWithStream() {
    try {
        System.setProperty("java.util.concurrent.ForkJoinPool.common.parallelism", "20");
        long a = System.currentTimeMillis();
        Files.walk(Paths.get(ROOT_DIR), FileVisitOption.FOLLOW_LINKS).parallel().filter(x -> {
            return x.toFile().isFile();
        }).forEach(x -> {
            // Files.copy(x, Paths.get(""), CopyOption )
        });
        long b = System.currentTimeMillis();
        System.out.println(":" + (b - a));
        return null;
    } catch (IOException e) {
        e.printStackTrace();
        return null;
    }
}

From source file:com.dianping.dpsf.centralstat.test.CentralStatTestCase.java

@BeforeClass
public static void init() throws Exception {
    System.setProperty(NettyClientManager.DISABLE_DYNAMIC_SERVICE, "true");
    new ClassPathXmlApplicationContext("classpath*:centralstat-sever.xml");
    context = new ClassPathXmlApplicationContext("classpath*:centralstat-client.xml");
}