Example usage for org.apache.commons.lang3 SystemUtils IS_JAVA_1_7

List of usage examples for org.apache.commons.lang3 SystemUtils IS_JAVA_1_7

Introduction

In this page you can find the example usage for org.apache.commons.lang3 SystemUtils IS_JAVA_1_7.

Prototype

boolean IS_JAVA_1_7

To view the source code for org.apache.commons.lang3 SystemUtils IS_JAVA_1_7.

Click Source Link

Document

Is true if this is Java version 1.7 (also 1.7.x versions).

Usage

From source file:com.google.cloud.tools.maven.RunMojo.java

/**
 * Adds JVM flag -Dappengine.user.timezone=UTC to allow the Dev App Server to run on JVMs other
 * than version 1.7./*from   w w w .jav  a2s  .c o  m*/
 */
protected void workAroundNonJava7Version() {
    if (!SystemUtils.IS_JAVA_1_7) {
        if (jvmFlags == null) {
            jvmFlags = new ArrayList<>();
        }
        jvmFlags.add("-Dappengine.user.timezone=UTC");
    }
}

From source file:org.kawanfw.file.test.run.loop.TestRunnerConsoleNioLoopTest.java

public static void startIt() throws Exception {
    if (SystemUtils.IS_JAVA_1_7) {
        System.setProperty("java.net.preferIPv4Stack", "true");
    }/*  w w w  .j  a  va  2 s . c  o m*/

    Proxy proxy = null;
    PasswordAuthentication passwordAuthentication = null;

    //   ProxyLoader proxyLoader = new ProxyLoader();
    //   proxy =proxyLoader.getProxy();
    //   passwordAuthentication =proxyLoader.getPasswordAuthentication();

    SessionParameters sessionParameters = new SessionParameters();

    if (TestParms.AWAKE_URL.startsWith("https:") && TestParms.AWAKE_URL.contains("localhost")) {
        sessionParameters.setAcceptAllSslCertificates(true);
    }

    sessionParameters.setCompressionOn(TestParms.COMPRESSION_ON);

    System.out.println(new Date() + " Starting...");
    while (true) {

        //MessageDisplayer.display("new RemoteSession()...");
        RemoteSession remoteSession = null;

        //Thread.sleep(100);

        remoteSession = new RemoteSession(TestParms.AWAKE_URL, TestParms.REMOTE_USER,
                TestParms.REMOTE_PASSWORD.toCharArray(), null, null, null);

        remoteSession.logoff();

        //System.out.println(new Date());

    }
}

From source file:org.kawanfw.file.test.run.TestRunnerConsole.java

public static void startIt() throws Exception {

    if (SystemUtils.IS_JAVA_1_7) {
        System.setProperty("java.net.preferIPv4Stack", "true");
    }//from ww  w.j ava 2  s .  c o m

    ProxyLoader proxyLoader = new ProxyLoader();
    Proxy proxy = proxyLoader.getProxy();
    PasswordAuthentication passwordAuthentication = proxyLoader.getPasswordAuthentication();
    SessionParameters sessionParameters = new SessionParameters();

    sessionParameters.setCompressionOn(true);

    while (true) {

        FileSession fileSession = new FileSession(TestParms.AWAKE_URL, TestParms.REMOTE_USER,
                TestParms.REMOTE_PASSWORD.toCharArray(), proxy, passwordAuthentication, sessionParameters);

        System.out.println(new Date());

        UrlSession urlSession = new UrlSession(proxy, passwordAuthentication);

        Date begin = new Date();

        List<String> directories = fileSession.listDirectories("/");
        MessageDisplayer.display("List / directories: " + directories);

        List<String> files = fileSession.listFiles("/");
        MessageDisplayer.display("List / files: " + files);

        testAll(fileSession);

        String downloadUrl = null;

        // Tests if we are in localhost or not
        if (fileSession.getUrl().contains("localhost")) {
            downloadUrl = "http://localhost:8080/AwakeFILE/awake-file-download.html";
        } else {
            downloadUrl = "https://www.aceql.com/soft/3.0/aceql-3.0-quick-start.html";
        }

        MessageDisplayer.display("");
        String urlDownload = urlSession.download(new URL(downloadUrl));

        if (urlDownload.length() > 80) {
            MessageDisplayer.display("String first 80 chars: " + urlDownload.substring(0, 80));
        } else {
            MessageDisplayer.display("String first 80 chars: " + urlDownload);
        }

        File fileUrl = createAwakeTempFile();
        urlSession.download(new URL(downloadUrl), fileUrl);
        urlDownload = FileUtils.readFileToString(fileUrl);

        if (urlDownload.length() > 80) {
            MessageDisplayer.display("File first 80 chars: " + urlDownload.substring(0, 80));
        } else {
            MessageDisplayer.display("String first 80 chars: " + urlDownload);
        }

        fileUrl.delete();

        Date end = new Date();

        MessageDisplayer.display("");
        MessageDisplayer.display("Begin: " + begin);
        MessageDisplayer.display("End  : " + end);

        fileSession.logoff();

        if (!TestParms.LOOP_MODE) {
            return;
        }

    }
}

From source file:org.kawanfw.file.test.run.TestRunnerConsoleNio.java

public static void startIt() throws Exception {
    if (SystemUtils.IS_JAVA_1_7) {
        System.setProperty("java.net.preferIPv4Stack", "true");
    }/*from w  w w  .ja  v  a 2 s.  co m*/

    ProxyLoader proxyLoader = new ProxyLoader();
    Proxy proxy = proxyLoader.getProxy();
    PasswordAuthentication passwordAuthentication = proxyLoader.getPasswordAuthentication();
    SessionParameters sessionParameters = new SessionParameters();

    if (TestParms.AWAKE_URL.startsWith("https:") && TestParms.AWAKE_URL.contains("localhost")) {
        sessionParameters.setAcceptAllSslCertificates(true);
    }

    sessionParameters.setCompressionOn(TestParms.COMPRESSION_ON);

    while (true) {

        MessageDisplayer.display("new RemoteSession()...");
        RemoteSession remoteSession = null;

        remoteSession = new RemoteSession(TestParms.AWAKE_URL, TestParms.REMOTE_USER,
                TestParms.REMOTE_PASSWORD.toCharArray(), proxy, passwordAuthentication, sessionParameters);

        MessageDisplayer.display(new Date());

        Date begin = new Date();
        long longBegin = System.currentTimeMillis();
        testAll(remoteSession);
        Date end = new Date();
        long longEnd = System.currentTimeMillis();

        MessageDisplayer.display("");
        MessageDisplayer.display("Begin: " + begin);
        MessageDisplayer.display("End  : " + end);
        MessageDisplayer.display("Elapsed  : " + (longEnd - longBegin));
        remoteSession.logoff();

        if (!TestParms.LOOP_MODE) {
            return;
        }

    }
}

From source file:org.kawanfw.test.api.client.ArrayTest.java

public static void main(String[] args) throws Exception {

    if (SystemUtils.IS_JAVA_1_7) {
        System.setProperty("java.net.preferIPv4Stack", "true");
    }// w w w.  ja  v  a2  s .c om

    new ArrayTest().test();
}

From source file:org.kawanfw.test.api.client.autogeneratedkeys.InsertPrepStatementAutoKeysTest.java

public static void main(String[] args) throws Exception {

    if (SystemUtils.IS_JAVA_1_7) {
        System.setProperty("java.net.preferIPv4Stack", "true");
    }//www .  j a  v a 2 s. c  o  m

    new InsertPrepStatementAutoKeysTest().test();
}

From source file:org.kawanfw.test.api.client.autogeneratedkeys.InsertStatementTestAutoKeysTest.java

public static void main(String[] args) throws Exception {

    if (SystemUtils.IS_JAVA_1_7) {
        System.setProperty("java.net.preferIPv4Stack", "true");
    }/*  w ww  . ja v a 2  s .com*/

    new InsertStatementTestAutoKeysTest().test();
}

From source file:org.kawanfw.test.api.client.DateCharTest.java

public static void main(String[] args) throws Exception {

    if (SystemUtils.IS_JAVA_1_7) {
        System.setProperty("java.net.preferIPv4Stack", "true");
    }/*from  w ww  .ja  v a 2  s .c om*/

    SqlTestParms.REMOTE = true;
    new DateCharTest().test();
}

From source file:org.kawanfw.test.api.client.InsertAndUpdatePrepStatementTest.java

public static void main(String[] args) throws Exception {

    if (SystemUtils.IS_JAVA_1_7) {
        System.setProperty("java.net.preferIPv4Stack", "true");
    }//from  w w  w . j av  a2 s .  co m

    new InsertAndUpdatePrepStatementTest().test();
}

From source file:org.kawanfw.test.api.client.InsertPreparedStatementTest.java

public static void main(String[] args) throws Exception {

    if (SystemUtils.IS_JAVA_1_7) {
        System.setProperty("java.net.preferIPv4Stack", "true");
    }/*from  w ww.jav a 2 s  .  c  o m*/
    new InsertPreparedStatementTest().test();
}