Example usage for org.apache.commons.lang SystemUtils IS_OS_WINDOWS

List of usage examples for org.apache.commons.lang SystemUtils IS_OS_WINDOWS

Introduction

In this page you can find the example usage for org.apache.commons.lang SystemUtils IS_OS_WINDOWS.

Prototype

boolean IS_OS_WINDOWS

To view the source code for org.apache.commons.lang SystemUtils IS_OS_WINDOWS.

Click Source Link

Document

Is true if this is Windows.

The field will return false if OS_NAME is null.

Usage

From source file:de.sub.goobi.helper.FilesystemHelper.java

/**
 * This function implements file renaming. Renaming of files is full of
 * mischief under Windows which unaccountably holds locks on files.
 * Sometimes running the JVMs garbage collector puts things right.
 *
 * @param oldFileName/* ww  w.  j  a va  2  s . com*/
 *            File to move or rename
 * @param newFileName
 *            New file name / destination
 * @throws IOException
 *             is thrown if the rename fails permanently
 * @throws FileNotFoundException
 *             is thrown if old file (source file of renaming) does not
 *             exists
 */
public static void renameFile(String oldFileName, String newFileName) throws IOException {
    final int SLEEP_INTERVAL_MILLIS = 20;
    final int MAX_WAIT_MILLIS = 150000; // 2 minutes
    File oldFile;
    File newFile;
    boolean success;
    int millisWaited = 0;

    if ((oldFileName == null) || (newFileName == null)) {
        return;
    }

    oldFile = new File(oldFileName);
    newFile = new File(newFileName);

    if (!oldFile.exists()) {
        if (logger.isDebugEnabled()) {
            logger.debug("File " + oldFileName + " does not exist for renaming.");
        }
        throw new FileNotFoundException(oldFileName + " does not exist for renaming.");
    }

    if (newFile.exists()) {
        String message = "Renaming of " + oldFileName + " into " + newFileName + " failed: Destination exists.";
        logger.error(message);
        throw new IOException(message);
    }

    do {
        if (SystemUtils.IS_OS_WINDOWS && millisWaited == SLEEP_INTERVAL_MILLIS) {
            if (logger.isEnabledFor(Level.WARN)) {
                logger.warn("Renaming " + oldFileName
                        + " failed. This is Windows. Running the garbage collector may yield good results. Forcing immediate garbage collection now!");
            }
            System.gc();
        }
        success = oldFile.renameTo(newFile);
        if (!success) {
            if (millisWaited == 0 && logger.isInfoEnabled()) {
                logger.info("Renaming " + oldFileName + " failed. File may be locked. Retrying...");
            }
            try {
                Thread.sleep(SLEEP_INTERVAL_MILLIS);
            } catch (InterruptedException e) {
            }
            millisWaited += SLEEP_INTERVAL_MILLIS;
        }
    } while (!success && millisWaited < MAX_WAIT_MILLIS);

    if (!success) {
        logger.error("Rename " + oldFileName + " failed. This is a permanent error. Giving up.");
        throw new IOException("Renaming of " + oldFileName + " into " + newFileName + " failed.");
    }

    if (millisWaited > 0 && logger.isInfoEnabled()) {
        logger.info("Rename finally succeeded after" + Integer.toString(millisWaited) + " milliseconds.");
    }
}

From source file:com.tesora.dve.sql.IgnoreForeignKeyTest.java

@Test
public void testColocatedDeclaration() throws Throwable {
    try {/* ww  w.j  av a2 s  . co m*/
        checkDDL.create(conn);
        conn.execute("create range openrange (int) persistent group checkg");
        conn.execute(
                "create table P (`id` int, `fid` int, `sid` int, primary key (`id`)) range distribute on (id) using openrange");
        conn.execute(
                "create table C (`id` int, `fid` int, primary key (`id`), foreign key (`fid`) references P (`id`)) range distribute on (fid) using openrange");
        assertFalse("should not have warnings", conn.hasWarnings());
        Object[] results = br(nr, "C", "fid", "P", "id");
        Object[] windowsNativeResults = br(nr, "c", "fid", "p", "id");
        conn.assertResults(peinfoSql, results);
        dbh.assertResults(nativeInfoSql, (SystemUtils.IS_OS_WINDOWS ? windowsNativeResults : results));
    } finally {
        checkDDL.destroy(conn);
    }

}

From source file:com.asakusafw.testdriver.DefaultJobExecutor.java

private void raiseInvalid(String message) {
    if (SystemUtils.IS_OS_WINDOWS) {
        LOG.warn(message);//from ww w .  j a v  a  2s . co  m
        LOG.info(MessageFormat.format(Messages.getString("DefaultJobExecutor.infoSkipExecution"), //$NON-NLS-1$
                context.getCallerClass().getName()));
        Assume.assumeTrue(false);
    } else {
        throw new AssertionError(message);
    }
}

From source file:net.landora.video.utils.UIUtils.java

public static void openBrowser(String url) {
    try {/*from w w  w  . ja  v a2  s.c  om*/
        Desktop.getDesktop().browse(new URI(url));
        return;
    } catch (Exception ignore) {
    }

    List<String> cmd = new ArrayList<String>();

    if (SystemUtils.IS_OS_MAC) {
        cmd.add("open");
    } else if (SystemUtils.IS_OS_WINDOWS) {
        cmd.add("cmd");
        cmd.add("/c");
        cmd.add("start");
    } else {
        cmd.add("xdg-open");
    }

    cmd.add(url);
    try {
        Runtime.getRuntime().exec(cmd.toArray(new String[cmd.size()]));
    } catch (IOException ex) {
        LoggerFactory.getLogger(UIUtils.class).error("Error opening browsner: " + url, ex);
    }
}

From source file:de.interactive_instruments.ShapeChange.BasicTest.java

@Test
public void test() {
    initialise();/*from  www  .ja v a  2  s  . co  m*/

    /*
     * Invoke without parameters, if we are connected
     */
    String[] xsdTest = { "test" };
    try {
        URL url = new URL("http://shapechange.net/resources/config/minimal.xml");
        InputStream configStream = url.openStream();
        if (configStream != null) {
            xsdTest(null, xsdTest, null, ".", "src/test/resources/reference/xsd");
        }
    } catch (Exception e) {
    }

    /*
     * Process the XMI 1.0 test model
     */
    xsdTest("src/test/resources/config/testXMI.xml", xsdTest, null, "testResults/xmi/INPUT",
            "src/test/resources/reference/xsd");

    /*
     * On Windows process also the EA test models
     */
    if (SystemUtils.IS_OS_WINDOWS) {

        /*
         * First the same test model as the XMI 1.0 test model
         */
        xsdTest("src/test/resources/config/testEA.xml", xsdTest, null, "testResults/ea/INPUT",
                "src/test/resources/reference/xsd");

        /*
         * Now with some replacement values
         */
        HashMap<String, String> replace = new HashMap<String, String>();
        replace.put("$eap$", "src/test/resources/test.eap");
        replace.put("$log$", "testResults/ea/log.xml");
        replace.put("$out$", "testResults/ea");
        xsdTest("src/test/resources/config/testEA_x.xml", xsdTest, null, replace, "testResults/ea/INPUT",
                "src/test/resources/reference/xsd");

        /*
         * Test property options: ordered, uniqueness and inline/byReference
         */
        multiTest("src/test/resources/config/testEA_prop.xml", new String[] { "xsd", "xml", "html" },
                "testResults/ea/prop/INPUT", "src/test/resources/reference/prop");

        /*
         * Test multiple tagged values and stereotypes
         */
        HashMap<String, String> replace2 = new HashMap<String, String>();
        replace2.put("$tvimpl$", "");
        replace2.put("$logout$", "testResults/multipleTaggedValuesAndStereotypes/tv_map_impl/log.xml");
        replace2.put("$xsdout$", "testResults/multipleTaggedValuesAndStereotypes/tv_map_impl");
        xsdTest("src/test/resources/config/testEA_multipleTaggedValuesAndStereotypes.xml",
                new String[] { "multTvAndSt" }, null, replace2,
                "testResults/multipleTaggedValuesAndStereotypes/tv_map_impl/INPUT",
                "src/test/resources/reference/xsd/multipleTaggedValuesAndStereotypes/INPUT");

        /*
         * Test multiple tagged values and stereotypes - with array
         * implementation for tagged values.
         */
        replace2 = new HashMap<String, String>();
        replace2.put("$tvimpl$", "array");
        replace2.put("$logout$", "testResults/multipleTaggedValuesAndStereotypes/tv_array_impl/log.xml");
        replace2.put("$xsdout$", "testResults/multipleTaggedValuesAndStereotypes/tv_array_impl");
        xsdTest("src/test/resources/config/testEA_multipleTaggedValuesAndStereotypes.xml",
                new String[] { "multTvAndSt" }, null, replace2,
                "testResults/multipleTaggedValuesAndStereotypes/tv_array_impl/INPUT",
                "src/test/resources/reference/xsd/multipleTaggedValuesAndStereotypes/INPUT");

        /*
         * Test the descriptor functionality
         */
        multiTest("src/test/resources/config/testEA_descriptors_fc_en.xml", new String[] { "xml", "html" },
                "testResults/html/descriptors/INPUT", "src/test/resources/reference/html/descriptors");

        multiTest("src/test/resources/config/testEA_descriptors_fc_de.xml", new String[] { "xml", "html" },
                "testResults/html/descriptors/INPUT", "src/test/resources/reference/html/descriptors");

        multiTest("src/test/resources/config/testEA_descriptors_inspire.xml", new String[] { "xml", "html" },
                "testResults/html/descriptors/INPUT", "src/test/resources/reference/html/descriptors");

        multiTest("src/test/resources/config/testEA_descriptors_aaa.xml", new String[] { "xml", "html" },
                "testResults/html/descriptors/INPUT", "src/test/resources/reference/html/descriptors");

        multiTest("src/test/resources/config/testEA_descriptors_bbr.xml", new String[] { "xml", "html" },
                "testResults/html/descriptors/INPUT", "src/test/resources/reference/html/descriptors");

        /*
         * Test derivation of application schema metadata.
         */
        multiTest("src/test/resources/config/testEA_schema_metadata.xml", new String[] { "xml" },
                "testResults/schema_metadata/INPUT", "src/test/resources/reference/schema_metadata/INPUT");

        /*
         * Test creation of an HTML feature catalogue with
         * inheritedProperties=true and noAlphabeticSortingForProperties =
         * true
         */
        multiTest("src/test/resources/config/testEA_fc_inheritedProperties.xml", new String[] { "xml", "html" },
                "testResults/html/inheritedProperties/INPUT",
                "src/test/resources/reference/html/inheritedProperties/INPUT");

        /*
         * Test derivation of application schema differences (output as
         * single page HTML feature catalogue).
         */
        multiTest("src/test/resources/config/testEA_model_diff.xml", new String[] { "xml", "html" },
                "testResults/html/diff/INPUT", "src/test/resources/reference/html/diff/INPUT");

        /*
         * SQL - basic text
         */
        multiTest("src/test/resources/config/testEA_sql.xml", new String[] { "sql" }, "testResults/sql/basic",
                "src/test/resources/reference/sql/basic");

        /*
         * SQL - associative tables tests
         */
        multiTest("src/test/resources/config/testEA_sqlAssociativeTables.xml", new String[] { "sql" },
                "testResults/sql/associativeTables", "src/test/resources/reference/sql/associativeTables");

        /*
         * SQL - geometry parameters test
         */
        multiTest("src/test/resources/config/testEA_sqlGeometryParameters.xml", new String[] { "sql" },
                "testResults/sql/geometryParameters", "src/test/resources/reference/sql/geometryParameters");

        /*
         * Test XML Schema creation for Application Schema with multiple
         * packages that shall be output as individual xsd files.
         */
        multiTest("src/test/resources/config/testEA_packageIncludes.xml", new String[] { "xsd" },
                "testResults/xsd/packageIncludes", "src/test/resources/reference/xsd/packageIncludes");

        /*
         * Test XML Schema creation for two Application Schema, with
         * identity transformation.
         */
        multiTest("src/test/resources/config/testEA_MultipleAppSchema.xml", new String[] { "xsd" },
                "testResults/xsd/multiAppSchema", "src/test/resources/reference/xsd/multiAppSchema");

        /*
         * A simple model to test the creation of a single-file html feature
         * catalogue
         */
        htmlTest("src/test/resources/config/testEA_Html.xml", new String[] { "test" }, "testResults/html/INPUT",
                "src/test/resources/reference/html");

        /*
         * A simple model to test the localization functionality
         */
        htmlTest("src/test/resources/config/testEA_HtmlLocalization.xml", new String[] { "test" },
                "testResults/html/localization/INPUT", "src/test/resources/reference/html/localization");

        /*
         * A simple model to test the creation of a docx feature catalogue
         */
        docxTest("src/test/resources/config/testEA_Docx.xml", new String[] { "test" },
                "testResults/docx/myInputId", "src/test/resources/reference/docx");

        /*
         * A simple model to test the creation of a docx feature catalogue
         * that includes UML diagrams
         */
        // TODO image file names and sizes not stable
        // docxTest("src/test/resources/config/testEA_Docx_FC_with_images.xml",
        // new String[]{"test_featurecatalog_with_images"},
        // "testResults/docx_with_images/myInputId",
        // "src/test/resources/reference/docx");

        /*
         * A test model where documentation is retrieved from classifiers
         * that are suppliers of a dependency (feature, attribute and value
         * concepts)
         */
        xsdTest("src/test/resources/config/testEA_dep.xml", xsdTest, null, "testResults/ea/INPUT",
                "src/test/resources/reference/xsd");

        /*
         * A simple CityGML Application Domain Extension (ADE)
         */
        String[] xsdADE = { "ade" };
        xsdTest("src/test/resources/config/testEA_ADE.xml", xsdADE, null, "testResults/ea/INPUT",
                "src/test/resources/reference/xsd");

        /*
         * Qualified associations as well as array and list properties. Note
         * that there are errors reported during the conversion (on purpose)
         * unlike in most other tests.
         */
        String[] xsdaaask = { "testaaask" };
        xsdTest("src/test/resources/config/testEA_aaa-sk.xml", xsdaaask, null, "testResults/ea/INPUT",
                "src/test/resources/reference/xsd", false);

        /*
         * An association class and the GML 3.3 code list values
         */
        String[] xsdgml33 = { "testgml33" };
        xsdTest("src/test/resources/config/testEA_gml33.xml", xsdgml33, xsdgml33, "testResults/ea/INPUT",
                "src/test/resources/reference/xsd");

        /*
         * Test the mixin options
         */
        String[] xsdmixin = { "testgroupmixin" };
        xsdTest("src/test/resources/config/testEA_groupmixin.xml", xsdmixin, null, "testResults/ea/INPUT",
                "src/test/resources/reference/xsd");

        /*
         * A simple 19115 metadata profile and Schematron tests
         */
        String[] xsdmd = { "testbasetypes", "testprofile", "testlet" };
        String[] schmd = { "testprofile", "testlet" };
        xsdTest("src/test/resources/config/testEA_md.xml", xsdmd, schmd, "testResults/ea/md/INPUT",
                "src/test/resources/reference/xsd");

        /*
         * The SWE Common 2.0 encoding
         */
        String[] xsdswe = { "advanced_encodings", "basic_types", "block_components", "choice_components",
                "record_components", "simple_components", "simple_encodings", "swe" };
        xsdTest("src/test/resources/config/testEA_swe.xml", xsdswe, null, "testResults/ea/swe/INPUT",
                "src/test/resources/reference/xsd/swe");

        // TODO add INSPIRE, OKSTRA, no GML, more Schematron tests

        /*
         * JSON encoding with geoservices encoding rule
         */
        String[] typenamesGsr = { "FeatureType1", "FeatureType2" };
        jsonTest("src/test/resources/config/testEA_JsonGsr.xml", typenamesGsr,
                "testResults/ea/json/geoservices/INPUT", "src/test/resources/reference/json/geoservices");

        /*
         * JSON encoding with extended geoservices encoding rule
         */
        String[] typenamesGsrExtended = { "DataType", "DataType2", "FeatureType1", "FeatureType2", "NilUnion",
                "Union" };
        jsonTest("src/test/resources/config/testEA_JsonGsrExtended.xml", typenamesGsrExtended,
                "testResults/ea/json/geoservices_extended/INPUT",
                "src/test/resources/reference/json/geoservices_extended");

        /*
         * SKOS codelists
         */
        String[] rdfskos = { "Codelists" };
        rdfTest("src/test/resources/config/testEA_skos.xml", rdfskos, "testResults/ea/skos/INPUT",
                "src/test/resources/reference/rdf/skos");

        /*
         * OWL 19150-2 ontologies
         */
        String[] rdfowl = { "SchemaA/SchemaA", "SchemaB/SchemaB" };
        // FIXME text comparison does not work, order changes each time,
        // compare ttl files on a triple level (with Jena?)
        // ttlTest("src/test/resources/config/testEA_owliso19150_default.xml",
        // rdfowl, "testResults/ea/owl/default/INPUT",
        // "src/test/resources/reference/rdf/owliso19150/default");
        // ttlTest("src/test/resources/config/testEA_owliso19150_extensions.xml",
        // rdfowl, "testResults/ea/owl/extensions/INPUT",
        // "src/test/resources/reference/rdf/owliso19150/extensions");

        /*
         * Flattening transformation
         */
        multiTest("src/test/resources/config/testEA_Flattening.xml", new String[] { "xsd" },
                "testResults/flattening/xsd", "src/test/resources/reference/flattening/xsd");

        /*
         * Flattening transformation - only homogeneous geometries
         */
        multiTest("src/test/resources/config/testEA_Flattening_homogeneousGeometries.xml",
                new String[] { "xsd" }, "testResults/flattening/homogeneousGeometry_core/",
                "src/test/resources/reference/flattening/homogeneousGeometry");

        /*
         * Flattening transformation - only homogeneous geometries - Test1
         * (handling of associations)
         */
        multiTest("src/test/resources/config/testEA_Flattening_homogeneousGeometries_test1.xml",
                new String[] { "xsd" }, "testResults/flattening/homogeneousGeometry_test1/",
                "src/test/resources/reference/flattening/homogeneousGeometry_test1");

        /*
         * Flattening transformation - only inheritance
         */
        multiTest("src/test/resources/config/testEA_Flattening_inheritance.xml", new String[] { "xsd" },
                "testResults/flattening/inheritance/", "src/test/resources/reference/flattening/inheritance");

        /*
         * Flattening transformation - cycles (and isFlatTarget setting)
         */
        multiTest("src/test/resources/config/testEA_Flattening_cycles.xml", new String[] { "xsd" },
                "testResults/flattening/xsd/cycles_step1",
                "src/test/resources/reference/flattening/xsd/cycles_step1");

        /*
         * Flattening transformation - remove feature-2-feature
         * relationships
         */
        multiTest("src/test/resources/config/testEA_Flattening_removeFeatureTypeRelationships.xml",
                new String[] { "xsd" }, "testResults/flattening/removeFeatureTypeRelationships",
                "src/test/resources/reference/flattening/removeFeatureTypeRelationships");

        /*
         * Flattening transformation - remove object-2-feature relationships
         * for specific object types
         */
        multiTest("src/test/resources/config/testEA_Flattening_removeObjectToFeatureTypeNavigability.xml",
                new String[] { "xsd" }, "testResults/flattening/removeObjectToFeatureTypeNavigability",
                "src/test/resources/reference/flattening/removeObjectToFeatureTypeNavigability");

        /*
         * Replication schema target
         */
        multiTest("src/test/resources/config/testEA_repSchema.xml", new String[] { "xsd" },
                "testResults/repSchema/repXsd", "src/test/resources/reference/xsd/replicationSchema");

        /*
         * Attribute creation transformer
         */
        multiTest("src/test/resources/config/testEA_attributeCreation.xml", new String[] { "xsd" },
                "testResults/attribute_creation/xsd", "src/test/resources/reference/xsd/attributeCreation");

        /*
         * Test the profiling functionality
         */

        multiTest("src/test/resources/config/testEA_Profiling.xml", new String[] { "xsd", "xml" },
                "testResults/profiling/xsd", "src/test/resources/reference/profiling/xsd");

        /*
         * Test the profiling functionality - with explicit profile settings
         * behavior
         */
        multiTest("src/test/resources/config/testEA_Profiling_explicitProfileSettings.xml",
                new String[] { "xsd", "xml" }, "testResults/profiling_explicitProfileSettings/xsd",
                "src/test/resources/reference/profiling_explicitProfileSettings/xsd");

        // /*
        // * Test the creation of a frame-based html feature catalogue
        // */
        // multiTest("src/test/resources/config/testEA_HtmlFrame.xml",
        // new String[] { "html" }, "testResults/html/frame/INPUT",
        // "src/test/resources/reference/html/frame/INPUT");

        /*
         * Schematron derived from SBVR (with intermediate translation to
         * FOL)
         */
        multiTest("src/test/resources/config/testEA_Sbvr.xml", new String[] { "xml" },
                "testResults/fol/fromSbvr/sch/step3", "src/test/resources/reference/sch/fromSbvr");
    }
}

From source file:com.enonic.cms.core.plugin.container.OsgiContainer.java

private void copyFrameworkJar(final File targetFile) throws Exception {
    URL location = FrameworkProperties.class.getProtectionDomain().getCodeSource().getLocation();

    final String locationFile = location.getFile();

    LOG.info("Location of framework.jar : " + locationFile);

    if (locationFile.endsWith(".jar!/")) // for IBM Websphere 8.5 Liberty Profile
    {//from ww  w. j  av  a2s  .co m
        String absolutePath = locationFile.substring(0, locationFile.length() - 2);

        location = new URL(absolutePath);
    }

    else if (ResourceUtils.URL_PROTOCOL_VFS.equals(location.getProtocol())) // JBOSS 7.1.1 VFS
    {
        final URI uri = ResourceUtils.toURI(location);
        final UrlResource urlResource = new UrlResource(uri);
        final File file = urlResource.getFile();

        String absolutePath = file.getAbsolutePath();

        if (!absolutePath.endsWith(urlResource.getFilename())) {
            // removing /contents folder from path and adding unpacked jar to path.
            absolutePath = absolutePath.substring(0, absolutePath.length() - VFS_CONTENTS_FOLDER.length())
                    + urlResource.getFilename();
        }

        final StringBuilder stringBuilder = new StringBuilder("file:/");
        if (!SystemUtils.IS_OS_WINDOWS) // windows already has one slash in path like /c:/Program Files/....
        {
            stringBuilder.append('/');
        }
        stringBuilder.append(absolutePath);

        location = new URL(stringBuilder.toString());
    }

    LOG.info("Copying " + location.toString() + " to " + targetFile.toString());
    Files.copy(Resources.newInputStreamSupplier(location), targetFile);
}

From source file:io.sloeber.core.managers.InternalPackageManager.java

/**
 * Given a platform description in a json file download and install all needed
 * stuff. All stuff is including all tools and core files and hardware specific
 * libraries. That is (on windows) inclusive the make.exe
 *
 * @param platform/*from   www. ja  v  a2 s  .c  om*/
 * @param monitor
 * @param object
 * @return
 */
static public IStatus downloadAndInstall(ArduinoPlatform platform, boolean forceDownload,
        IProgressMonitor monitor) {

    MyMultiStatus mstatus = new MyMultiStatus("Failed to install " + platform.getName()); //$NON-NLS-1$
    mstatus.addErrors(downloadAndInstall(platform.getUrl(), platform.getArchiveFileName(),
            platform.getInstallPath(), forceDownload, monitor));
    if (!mstatus.isOK()) {
        // no use going on installing tools if the boards failed installing
        return mstatus;
    }

    if (platform.getToolsDependencies() != null) {
        for (ToolDependency tool : platform.getToolsDependencies()) {
            monitor.setTaskName(InstallProgress.getRandomMessage());
            mstatus.addErrors(tool.install(monitor));
        }
    }
    // On Windows install make
    if (SystemUtils.IS_OS_WINDOWS) {
        IPath localMakePath = ConfigurationPreferences.getMakePath();
        if (!ConfigurationPreferences.getMakePath().append("make.exe").toFile().exists()) { //$NON-NLS-1$
            mstatus.addErrors(downloadAndInstall("https://eclipse.baeyens.it/download/make.zip", "make.zip", //$NON-NLS-1$//$NON-NLS-2$
                    localMakePath, forceDownload, monitor));
        }
    }

    // on Windows fix esp8266 platform.txt file
    // replace -DARDUINO_BOARD="{build.board}" with
    // -DARDUINO_BOARD="\"{build.board}\""
    if (SystemUtils.IS_OS_WINDOWS) {
        if ("esp8266".equals(platform.getArchitecture()) && "esp8266".equals(platform.getName())) { //$NON-NLS-1$ //$NON-NLS-2$
            FileModifiers.replaceInFile(platform.getPlatformFile(), false, "-DARDUINO_BOARD=\"{build.board}\"", //$NON-NLS-1$
                    "-DARDUINO_BOARD=\"\\\"{build.board}\\\"\""); //$NON-NLS-1$
        }
    }
    return mstatus;

}

From source file:de.hopmann.msc.slave.util.RCMDBuilder.java

public RCMDOutputReader start() throws IOException {

    List<String> commands = new ArrayList<String>();
    commands.add(rExecutablePath.toAbsolutePath().toString());
    commands.add("CMD");

    processCommands(commands);//from  w  ww.j a  v  a  2  s .com

    if (targetLibraryPath != null) {
        commands.add("--library=" + targetLibraryPath.toAbsolutePath().toString());
    }

    commands.add(packagePath.toAbsolutePath().toString());

    ProcessBuilder cmdProcessBuilder = new ProcessBuilder(commands)
            .directory(workingDirectoryPath.toAbsolutePath().toFile()).redirectErrorStream(true);

    if (!sourceLibraryPaths.isEmpty()) {
        StringBuilder rlibs = new StringBuilder();

        for (Path libPath : sourceLibraryPaths) {
            if (rlibs.length() != 0) {
                // Add separator char
                rlibs.append(SystemUtils.IS_OS_WINDOWS ? ";" : ":");
            }
            rlibs.append(libPath.toAbsolutePath().toString());
        }
        Map<String, String> processEnvironment = cmdProcessBuilder.environment();
        processEnvironment.put(R_LIBS_ENVIR, rlibs.toString());
        processEnvironment.put(R_LANGUAGE_ENVIR, "en");
        processEnvironment.put(LC_ALL, "English");
        processEnvironment.put(CYQWIN_ENVIR, "nodosfilewarning");
        for (Entry<String, String> envirEntry : customEnvironment.entrySet()) {
            processEnvironment.put(envirEntry.getKey(), envirEntry.getValue());
        }
    }

    processEnvironment(cmdProcessBuilder.environment());

    final Process cmdProcess = cmdProcessBuilder.start();

    // BufferedReader processOut = new BufferedReader(
    // new InputStreamReader(installProcess.getInputStream()));
    // while (processOut.readLine() != null) { }

    // IOUtils.copy(installProcess.getInputStream(), System.out);

    return new RCMDOutputReader(cmdProcess, logPrintStream) {
        @Override
        public void close() throws IOException {
            try {
                cmdProcess.waitFor();// XXX or .destroy()?
            } catch (InterruptedException e) {

            }
            super.close();
        }
    };

}

From source file:com.igormaznitsa.mindmap.model.ModelUtilsTest.java

@Test
public void testToFile() throws Exception {
    if (SystemUtils.IS_OS_WINDOWS)
        assertEquals("P:\\Some text document.txt",
                new MMapURI("file://P:/Some%20text%20document.txt").asFile(null).getAbsolutePath());
    else//w w w . j a  v a  2s  .  co  m
        assertEquals("/Some text document.txt",
                new MMapURI("file:///Some%20text%20document.txt").asFile(null).getAbsolutePath());
}

From source file:hudson.tasks.AntTest.java

@Test
public void testSensitiveParameters() throws Exception {
    FreeStyleProject project = r.createFreeStyleProject();
    ParametersDefinitionProperty pdb = new ParametersDefinitionProperty(
            new StringParameterDefinition("string", "defaultValue", "string description"),
            new PasswordParameterDefinition("password", "12345", "password description"),
            new StringParameterDefinition("string2", "Value2", "string description"));
    project.addProperty(pdb);//from   w  w  w . j  a  va 2 s . c  o  m
    project.setScm(new SingleFileSCM("build.xml",
            hudson.tasks._ant.AntTargetAnnotationTest.class.getResource("simple-build.xml")));

    project.getBuildersList().add(new Ant("foo", null, null, null, null));

    FreeStyleBuild build = project.scheduleBuild2(0).get();
    // Due to bug JENKINS-28790. Password should not be shown but it is.
    if (SystemUtils.IS_OS_WINDOWS && Jenkins.getVersion().isOlderThan(new VersionNumber("1.653"))) {
        r.assertLogContains("-Dpassword=12345", build);
    } else {
        r.assertLogNotContains("-Dpassword=12345", build);
    }
}