List of usage examples for org.apache.commons.lang SystemUtils IS_OS_WINDOWS
boolean IS_OS_WINDOWS
To view the source code for org.apache.commons.lang SystemUtils IS_OS_WINDOWS.
Click Source Link
Is true
if this is Windows.
The field will return false
if OS_NAME
is null
.
From source file:ddf.content.plugin.video.TestVideoThumbnailPlugin.java
private void setUpMockBundleContext() { mockBundleContext = mock(BundleContext.class); final Bundle mockBundle = mock(Bundle.class); doReturn(mockBundle).when(mockBundleContext).getBundle(); String ffmpegResourcePath;/*from w ww. ja va2 s. com*/ URL ffmpegBinaryUrl; if (SystemUtils.IS_OS_LINUX) { ffmpegResourcePath = "linux/ffmpeg"; } else if (SystemUtils.IS_OS_MAC) { ffmpegResourcePath = "osx/ffmpeg"; } else if (SystemUtils.IS_OS_WINDOWS) { ffmpegResourcePath = "windows/ffmpeg.exe"; } else if (SystemUtils.IS_OS_SOLARIS) { ffmpegResourcePath = "solaris/ffmpeg"; } else { fail("Platform is not Linux, Mac, or Windows. No FFmpeg binaries are provided for this platform."); return; } ffmpegBinaryUrl = getClass().getClassLoader().getResource(ffmpegResourcePath); doReturn(ffmpegBinaryUrl).when(mockBundle).getEntry(ffmpegResourcePath); }
From source file:it.serverSystem.RestartTest.java
/** * SONAR-4843//ww w . ja v a2s .co m */ @Test public void restart_on_dev_mode() throws Exception { // server classloader locks Jar files on Windows if (!SystemUtils.IS_OS_WINDOWS) { orchestrator = Orchestrator.builderEnv().setServerProperty("sonar.web.dev", "true").build(); orchestrator.start(); newAdminWsClient(orchestrator).system().restart(); assertThat(FileUtils.readFileToString(orchestrator.getServer().getWebLogs())) .contains("Fast restarting WebServer...").contains("WebServer restarted"); } }
From source file:de.rinderle.softvis3d.layout.dot.DotExecutor.java
public Graph run(final Graph inputGraph, final GraphvizPath path, final LayoutViewType viewType) throws DotExecutorException { final Version currentVersion = this.dotVersion.getVersion(path); final Version firstNeatoVersion = new Version("2.2.1"); // return -1 (a<b) return 0 (a=b) final boolean noNeato = currentVersion.compareTo(firstNeatoVersion) < 1; String command = path.getDotExecutable(); if (!noNeato && (LayoutViewType.CITY.equals(viewType) || inputGraph.edgeElementsAsArray().length == 0)) { command = command + " -K neato"; }//from w ww. j a v a 2 s . c om final StringWriter writer = new StringWriter(); inputGraph.printGraph(writer); final String sourceDot = writer.toString(); String adot = this.executeCommand.executeCommandReadAdot(command, sourceDot, currentVersion); if (currentVersion.equals(DOT_BUG_VERSION)) { try { if (this.translationFile == null) { final InputStream file = DotExecutor.class.getResourceAsStream("/translate.g"); this.translationFile = File.createTempFile("translate", ".g"); final FileOutputStream out = new FileOutputStream(this.translationFile); IOUtils.copy(file, out); } String normalizedTranslationFilePath = normalizeFilePath(this.translationFile.getAbsolutePath(), SystemUtils.IS_OS_WINDOWS); String translationCommand = path.getGvprExecutable() + " -c -f " + normalizedTranslationFilePath; adot = this.executeCommand.executeCommandReadAdot(translationCommand, adot, currentVersion); } catch (final IOException e) { throw new DotExecutorException("Error on create temp file", e); } } return this.parseDot(adot); }
From source file:net.praqma.jenkins.rqm.unit.RqmTestCase.java
private RqmBuilder createBuilder(boolean shouldFail) { RqmBuilder builder = null;/*ww w . j ava2s .co m*/ RqmCollector collector = new net.praqma.jenkins.rqm.collector.DummyCollectionStrategy(shouldFail); if (!shouldFail) { if (SystemUtils.IS_OS_WINDOWS) { final BuildStep f = new BatchFile("dir"); final BuildStep f2 = new BatchFile("dir"); builder = new RqmBuilder(collector, Arrays.asList(f, f2), Arrays.asList(f, f2), Arrays.asList(f, f2)); } else { final BuildStep s = new Shell("ls"); final BuildStep s2 = new Shell("ls"); builder = new RqmBuilder(collector, Arrays.asList(s, s2), Arrays.asList(s, s2), Arrays.asList(s, s2)); } } else { if (SystemUtils.IS_OS_WINDOWS) { final BuildStep f = new BatchFile("dir"); final BuildStep f2 = new BatchFile("exit 1"); builder = new RqmBuilder(collector, Arrays.asList(f, f2), Arrays.asList(f, f2), Arrays.asList(f, f2)); } else { final BuildStep s = new Shell("ls"); final BuildStep s2 = new Shell("exit 1"); builder = new RqmBuilder(collector, Arrays.asList(s, s2), Arrays.asList(s, s2), Arrays.asList(s, s2)); } } return builder; }
From source file:ddf.content.plugin.video.VideoThumbnailPlugin.java
private String getBundledFFmpegBinaryPath() { if (SystemUtils.IS_OS_LINUX) { return "linux/ffmpeg"; } else if (SystemUtils.IS_OS_MAC) { return "osx/ffmpeg"; } else if (SystemUtils.IS_OS_SOLARIS) { return "solaris/ffmpeg"; } else if (SystemUtils.IS_OS_WINDOWS) { return "windows/ffmpeg.exe"; } else {//from www .ja v a2 s. c o m throw new RuntimeException("OS is not Linux, Mac, Solaris, or Windows." + " No FFmpeg binary is available for this OS, so the plugin will not work."); } }
From source file:de.rinderle.softvis3d.layout.bottomup.SnapshotVisitorBean.java
@Inject public SnapshotVisitorBean(final LayerFormatter formatter, final DotExecutor dotExecutor, final GrappaNodeFactory nodeFactory, final GrappaEdgeFactory edgeFactory, final DaoService daoService, @Assisted final Settings settings, @Assisted final VisualizationRequest requestDTO) { this.graphvizPath = new GraphvizPath(settings.getString(SoftVis3DConstants.DOT_BIN_KEY), SystemUtils.IS_OS_WINDOWS); this.dotExecutor = dotExecutor; this.formatter = formatter; this.nodeFactory = nodeFactory; this.edgeFactory = edgeFactory; this.minMaxMetricFootprint = daoService.getMinMaxMetricValuesByRootSnapshotId( requestDTO.getRootSnapshotId(), requestDTO.getFootprintMetricId()); this.minMaxMetricHeight = daoService.getMinMaxMetricValuesByRootSnapshotId(requestDTO.getRootSnapshotId(), requestDTO.getHeightMetricId()); this.dependenciesCount = daoService.getDependencies(requestDTO.getRootSnapshotId()).size(); this.maxScmInfo = daoService.getMaxScmInfo(requestDTO); LOGGER.info("minMaxValues for " + requestDTO.getRootSnapshotId() + " : " + minMaxMetricFootprint.toString() + " " + minMaxMetricHeight.toString() + " Dependencies: " + this.dependenciesCount); this.viewType = requestDTO.getViewType(); this.scmInfoType = requestDTO.getScmInfoType(); }
From source file:com.silverpeas.kmelia.export.SilverpeasImageFinder.java
/** * Finds the image having as unique identifier in Silverpeas the specified relative web reference. * * @param href the web reference of the image is the path of the image relative to the web context * of Silverpeas. This path is Silverpeas component dependent, so that only a given Silverpeas * component can process it.//w w w . j a v a 2s. com * @return the URI of the image in the server. * @throws Exception if an error occurs while finding the image referenced by the specified href. */ public String findImageReferenceddBy(String href) throws Exception { String path = ""; if (isAnAttachment(href)) { path = findWithAttachmentController(href); } else if (isServedByFileServer(href)) { // bad news, the image was uploaded by the old servlet path = findWithFileService(href); } else if (isInGallery(href)) { path = findWithGalleryComponent(href); } else { path = FileRepositoryManager.getUploadPath() + href; } if (SystemUtils.IS_OS_WINDOWS) { path = "file:/" + path.replaceAll("\\\\", "/"); } else { path = "file://" + path; } return path.replaceAll(" ", "%20"); }
From source file:com.asakusafw.testdriver.inprocess.EmulatorUtilsTest.java
/** * check command suffix (for windows)./*from ww w .j av a 2 s . c o m*/ */ @Test public void hasCommandSuffix_windows() { Assume.assumeTrue(SystemUtils.IS_OS_WINDOWS); assertThat(EmulatorUtils.hasCommandSuffix("path\\to\\command", "path/to/command"), is(true)); assertThat(EmulatorUtils.hasCommandSuffix("command", "path/to/command"), is(false)); assertThat(EmulatorUtils.hasCommandSuffix("path\\to\\other", "path/to/command"), is(false)); assertThat(EmulatorUtils.hasCommandSuffix("C:\\absolute\\windows\\path\\to\\command", "path/to/command"), is(true)); assertThat(EmulatorUtils.hasCommandSuffix("C:\\absolute\\windows\\path\\to\\other", "path/to/command"), is(false)); }
From source file:com.asakusafw.yaess.basic.BasicScriptHandlerTestRoot.java
/** * Puts source file into the path as an executable file. * @param source original contents on classpath * @param file target file path//from w w w. j av a 2s .c om * @return the put file * @throws IOException if failed */ protected File putScript(String source, File file) throws IOException { Assume.assumeThat("Windows does not supported", SystemUtils.IS_OS_WINDOWS, is(false)); LOG.debug("Deploy script: {} -> {}", source, file); try (InputStream in = getClass().getResourceAsStream(source)) { assertThat(source, in, is(notNullValue())); copyTo(in, file); } file.setExecutable(true); return file; }
From source file:com.casewaresa.framework.util.LegacyJasperInputStream.java
public static InputStream convertStringToInputStream(final String template) { InputStream is = null;//from w ww . j a v a 2 s.c o m try { if (SystemUtils.IS_OS_WINDOWS) { log.trace("### Cargando el objeto desde un ambiente WINDOWS"); is = new ByteArrayInputStream(template.getBytes("UTF-8")); } else if (SystemUtils.IS_OS_LINUX) { log.trace("### Cargando el objeto desde un ambiente UNIX (LINUX)"); is = new ByteArrayInputStream(template.getBytes()); } else if (SystemUtils.IS_OS_MAC) { log.trace("### Cargando el objeto desde un ambiente MAC"); is = new ByteArrayInputStream(template.getBytes("UTF-8")); } } catch (UnsupportedEncodingException ex) { log.debug(ex.getMessage(), ex); } return is; }