List of usage examples for org.apache.commons.lang SystemUtils IS_OS_MAC
boolean IS_OS_MAC
To view the source code for org.apache.commons.lang SystemUtils IS_OS_MAC.
Click Source Link
Is true
if this is Mac.
The field will return false
if OS_NAME
is null
.
From source file:org.kitodo.selenium.WorkingST.java
@Test public void editOwnedTaskAndTakeNextForParallelWorkflowTest() throws Exception { assumeTrue(!SystemUtils.IS_OS_WINDOWS && !SystemUtils.IS_OS_MAC); Task task = ServiceManager.getTaskService().getById(19); tasksPage.editOwnedTask(task.getTitle(), task.getProcess().getTitle()); assertTrue("Redirection after click edit own task was not successful", currentTasksEditPage.isAt()); currentTasksEditPage.closeTask();/*from ww w. java2s .c o m*/ assertTrue("Redirection after click close task was not successful", tasksPage.isAt()); task = ServiceManager.getTaskService().getById(19); assertEquals("Task '" + task.getTitle() + "' was not closed!", TaskStatus.DONE, task.getProcessingStatus()); task = ServiceManager.getTaskService().getById(20); assertEquals("Task '" + task.getTitle() + "' can not be taken by user!", TaskStatus.OPEN, task.getProcessingStatus()); task = ServiceManager.getTaskService().getById(21); assertEquals("Task '" + task.getTitle() + "' can be taken by user!", TaskStatus.DONE, task.getProcessingStatus()); task = ServiceManager.getTaskService().getById(22); assertEquals("Task '" + task.getTitle() + "' can not be taken by user!", TaskStatus.OPEN, task.getProcessingStatus()); tasksPage.takeOpenTask("Task4", "Parallel"); assertTrue("Redirection after click take task was not successful", currentTasksEditPage.isAt()); task = ServiceManager.getTaskService().getById(22); assertEquals("Task '" + task.getTitle() + "' was not taken by user!", TaskStatus.INWORK, task.getProcessingStatus()); task = ServiceManager.getTaskService().getById(20); assertEquals("Task '" + task.getTitle() + "' was not blocked after concurrent task was taken by user!", TaskStatus.LOCKED, task.getProcessingStatus()); }
From source file:org.kitodo.selenium.WorkingST.java
@Test public void downloadLogTest() throws Exception { assumeTrue(!SystemUtils.IS_OS_WINDOWS && !SystemUtils.IS_OS_MAC); processesPage.goTo().downloadLog();/*from ww w . jav a 2s. c om*/ File logFile = new File("src/test/resources/users/kowal/Second__process_log.xml"); assertTrue("Log file was not downloaded", logFile.exists()); logFile.delete(); }
From source file:org.kitodo.services.data.UserServiceIT.java
@Test public void shouldGetHomeDirectory() throws Exception { assumeTrue(!SystemUtils.IS_OS_WINDOWS && !SystemUtils.IS_OS_MAC); User user = userService.getById(1);/*from w w w . j a v a 2 s . c om*/ String homeDirectory = ConfigCore.getParameter(Parameters.DIR_USERS); File script = new File(ConfigCore.getParameter(Parameters.SCRIPT_CREATE_DIR_USER_HOME)); ExecutionPermission.setExecutePermission(script); URI homeDirectoryForUser = userService.getHomeDirectory(user); boolean condition = homeDirectoryForUser.getRawPath().contains(homeDirectory + user.getLogin()); assertTrue("Home directory of user is incorrect!", condition); user = userService.getById(2); homeDirectoryForUser = userService.getHomeDirectory(user); condition = homeDirectoryForUser.getRawPath().contains(user.getLogin()); assertTrue("Home directory of user is incorrect!", condition); ExecutionPermission.setNoExecutePermission(script); }
From source file:org.kitodo.services.file.FileServiceTest.java
@Test public void testCreateMetaDirectory() throws IOException { assumeTrue(!SystemUtils.IS_OS_WINDOWS && !SystemUtils.IS_OS_MAC); File script = new File(ConfigCore.getParameter(Parameters.SCRIPT_CREATE_DIR_META)); ExecutionPermission.setExecutePermission(script); boolean result = fileService.createMetaDirectory(URI.create("fileServiceTest"), "testMetaScript"); File file = fileService.getFile((URI.create("fileServiceTest/testMetaScript"))); ExecutionPermission.setNoExecutePermission(script); Assert.assertTrue("Result of execution was incorrect!", result); Assert.assertTrue("Created resource is not directory!", file.isDirectory()); Assert.assertFalse("Created resource is file!", file.isFile()); Assert.assertTrue("Directory was not created!", file.exists()); }
From source file:org.kitodo.services.file.FileServiceTest.java
@Test public void shouldCreateSymLink() throws IOException { assumeTrue(!SystemUtils.IS_OS_WINDOWS && !SystemUtils.IS_OS_MAC); URI symLinkSource = URI.create("symLinkSource"); URI symLinkTarget = URI.create("symLinkTarget"); File script = new File(ConfigCore.getParameter(Parameters.SCRIPT_CREATE_SYMLINK)); URI directory = fileService.createDirectory(URI.create(""), "symLinkSource"); fileService.createResource(directory, "meta.xml"); User user = new User(); user.setLogin(SystemUtils.USER_NAME); ExecutionPermission.setExecutePermission(script); boolean result = fileService.createSymLink(symLinkSource, symLinkTarget, false, user); ExecutionPermission.setNoExecutePermission(script); Assert.assertTrue("Create symbolic link has failed!", result); File scriptClean = new File(ConfigCore.getParameter(Parameters.SCRIPT_DELETE_SYMLINK)); ExecutionPermission.setExecutePermission(scriptClean); fileService.deleteSymLink(symLinkTarget); ExecutionPermission.setNoExecutePermission(scriptClean); fileService.delete(symLinkSource);/* w ww . j a va2s . com*/ fileService.delete(symLinkTarget); }
From source file:org.ngrinder.recorder.browser.BrowserFactoryEx.java
/** * Get the supported browser.//from w w w . ja v a 2 s .co m * * @return supported browser list */ public static List<BrowserType> getSupportedBrowser() { List<BrowserType> result = newArrayList(); if (SystemUtils.IS_OS_WINDOWS) { addIfAvailable(result, BrowserType.IE); if (BrowserType.Mozilla15.isSupported()) { addIfAvailable(result, BrowserType.Mozilla15); } else if (BrowserType.Mozilla.isSupported()) { addIfAvailable(result, BrowserType.Mozilla); } } else if (SystemUtils.IS_OS_MAC) { if (BrowserType.Mozilla15.isSupported()) { addIfAvailable(result, BrowserType.Mozilla15); } else if (BrowserType.Mozilla.isSupported()) { addIfAvailable(result, BrowserType.Mozilla); } else { addIfAvailable(result, BrowserType.Safari); } } else { if (BrowserType.Mozilla.isSupported()) { addIfAvailable(result, BrowserType.Mozilla); } else { addIfAvailable(result, BrowserType.Mozilla15); } } return result; }
From source file:org.nuxeo.functionaltests.drivers.ChromeDriverProvider.java
@Override public RemoteWebDriver init(DesiredCapabilities dc) throws Exception { if (System.getProperty(SYSPROP_CHROME_DRIVER_PATH) == null) { String chromeDriverDefaultPath = null; String chromeDriverExecutableName = CHROME_DRIVER_DEFAULT_EXECUTABLE_NAME; if (SystemUtils.IS_OS_LINUX) { chromeDriverDefaultPath = CHROME_DRIVER_DEFAULT_PATH_LINUX; } else if (SystemUtils.IS_OS_MAC) { chromeDriverDefaultPath = CHROME_DRIVER_DEFAULT_PATH_MAC; } else if (SystemUtils.IS_OS_WINDOWS_XP) { chromeDriverDefaultPath = CHROME_DRIVER_DEFAULT_PATH_WINXP; chromeDriverExecutableName = CHROME_DRIVER_WINDOWS_EXECUTABLE_NAME; } else if (SystemUtils.IS_OS_WINDOWS_VISTA) { chromeDriverDefaultPath = CHROME_DRIVER_DEFAULT_PATH_WINVISTA; chromeDriverExecutableName = CHROME_DRIVER_WINDOWS_EXECUTABLE_NAME; } else if (SystemUtils.IS_OS_WINDOWS) { // Unknown default path on other Windows OS. To be completed. chromeDriverDefaultPath = CHROME_DRIVER_DEFAULT_PATH_WINVISTA; chromeDriverExecutableName = CHROME_DRIVER_WINDOWS_EXECUTABLE_NAME; }/*from w ww . j av a 2 s . com*/ if (chromeDriverDefaultPath != null && new File(chromeDriverDefaultPath).exists()) { log.warn(String.format("Missing property %s but found %s. Using it...", SYSPROP_CHROME_DRIVER_PATH, chromeDriverDefaultPath)); System.setProperty(SYSPROP_CHROME_DRIVER_PATH, chromeDriverDefaultPath); } else { // Can't find chromedriver in default location, check system // path File chromeDriverExecutable = findExecutableOnPath(chromeDriverExecutableName); if ((chromeDriverExecutable != null) && (chromeDriverExecutable.exists())) { log.warn(String.format("Missing property %s but found %s. Using it...", SYSPROP_CHROME_DRIVER_PATH, chromeDriverExecutable.getCanonicalPath())); System.setProperty(SYSPROP_CHROME_DRIVER_PATH, chromeDriverExecutable.getCanonicalPath()); } else { log.error(String.format( "Could not find the Chrome driver looking at %s or system path." + " Download it from %s and set its path with " + "the System property %s.", chromeDriverDefaultPath, "http://code.google.com/p/chromedriver/downloads/list", SYSPROP_CHROME_DRIVER_PATH)); } } } ChromeOptions options = new ChromeOptions(); options.addArguments(Arrays.asList("--ignore-certificate-errors")); dc.setCapability(ChromeOptions.CAPABILITY, options); driver = new ChromeDriver(dc); return driver; }
From source file:org.nuxeo.launcher.gui.NuxeoLauncherGUI.java
/** * @param aLauncher Launcher being used in background *//* www.java2s .c o m*/ public NuxeoLauncherGUI(NuxeoLauncher aLauncher) { launcher = aLauncher; // Set OS-specific decorations if (SystemUtils.IS_OS_MAC) { System.setProperty("apple.laf.useScreenMenuBar", "true"); System.setProperty("com.apple.mrj.application.growbox.intrudes", "false"); System.setProperty("com.apple.mrj.application.live-resize", "true"); System.setProperty("com.apple.macos.smallTabs", "true"); } initFrame(); dumpedConfigMonitor = new DefaultFileMonitor(new FileListener() { @Override public void fileDeleted(FileChangeEvent event) { // Ignore } @Override public void fileCreated(FileChangeEvent event) { updateNuxeoFrame(); } @Override public void fileChanged(FileChangeEvent event) { updateNuxeoFrame(); } synchronized private void updateNuxeoFrame() { waitForFrameLoaded(); log.debug("Configuration changed. Reloading frame..."); launcher.init(); updateServerStatus(); try { Properties props = new Properties(); props.load(new FileReader(getConfigurationGenerator().getDumpedConfig())); nuxeoFrame.updateLogsTab(props.getProperty("log.id")); } catch (IOException e) { log.error(e); } } }); try { dumpedConfigMonitor.setRecursive(false); FileObject dumpedConfig = VFS.getManager() .resolveFile(getConfigurationGenerator().getDumpedConfig().getPath()); dumpedConfigMonitor.addFile(dumpedConfig); dumpedConfigMonitor.start(); } catch (FileSystemException e) { throw new RuntimeException("Couldn't find " + getConfigurationGenerator().getNuxeoConf(), e); } }
From source file:org.openhab.binding.network.internal.utils.NetworkUtils.java
/** * Return the working method for the native system ping. If no native ping * works JavaPing is returned.//from w w w .j av a 2 s . c o m */ public IpPingMethodEnum determinePingMethod() { IpPingMethodEnum method; if (SystemUtils.IS_OS_WINDOWS) { method = IpPingMethodEnum.WINDOWS_PING; } else if (SystemUtils.IS_OS_MAC) { method = IpPingMethodEnum.MAC_OS_PING; } else if (SystemUtils.IS_OS_UNIX) { method = IpPingMethodEnum.IPUTILS_LINUX_PING; } else { // We cannot estimate the command line for any other operating system and just return false return IpPingMethodEnum.JAVA_PING; } try { if (nativePing(method, "127.0.0.1", 1000)) { return method; } } catch (IOException ignored) { } catch (InterruptedException e) { Thread.currentThread().interrupt(); // Reset interrupt flag } return IpPingMethodEnum.JAVA_PING; }
From source file:org.openmicroscopy.shoola.util.ui.UIUtilities.java
/** * Returns <code>true</code> if the OS is MAC, <code>false</code> * otherwise.//from w w w. ja va2 s . c o m * * @return See above. */ public static boolean isMacOS() { //String osName = System.getProperty("os.name").toLowerCase(); //return osName.startsWith("mac os"); return (SystemUtils.IS_OS_MAC || SystemUtils.IS_OS_MAC_OSX); }