org.apache.commons.exec.OS.isFamilyWindows()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(10.3k)|赞(0)|评价(0)|浏览(188)

本文整理了Java中org.apache.commons.exec.OS.isFamilyWindows()方法的一些代码示例,展示了OS.isFamilyWindows()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。OS.isFamilyWindows()方法的具体详情如下:
包路径:org.apache.commons.exec.OS
类名称:OS
方法名:isFamilyWindows

OS.isFamilyWindows介绍

暂无

代码示例

代码示例来源:origin: org.apache.commons/commons-exec

  1. /**
  2. * Creates a map that obeys the casing rules of the current platform for key
  3. * lookup. E.g. on a Windows platform, the map keys will be
  4. * case-insensitive.
  5. *
  6. * @return The map for storage of environment variables, never
  7. * {@code null}.
  8. */
  9. private Map<String, String> createEnvironmentMap() {
  10. if (OS.isFamilyWindows()) {
  11. return new TreeMap<String, String>(new Comparator<String>() {
  12. public int compare(final String key0, final String key1) {
  13. return key0.compareToIgnoreCase(key1);
  14. }
  15. });
  16. }
  17. return new HashMap<String, String>();
  18. }

代码示例来源:origin: com.addc.mojo/addc-mojo

  1. /**
  2. * Get the Executable name with .exe appended if on Windows and with the
  3. * exePath prepended.
  4. *
  5. * @param executableName
  6. * The base(UNIX) name of the process
  7. * @return The executable name with .exe appended if on Windows and with the
  8. * exePath prepended.
  9. */
  10. protected String getExecutable(String executableName) {
  11. String exeName= OS.isFamilyWindows() ? executableName + ".exe" : executableName;
  12. if (exePath != null) {
  13. File exec= new File(exePath, exeName);
  14. return exec.getAbsolutePath();
  15. }
  16. return exeName;
  17. }

代码示例来源:origin: com.github.becauseQA/becauseQA-utils

  1. /**
  2. * Constructs an Appium server instance. You specify the custom directory to
  3. * your Appium server.
  4. *
  5. * @param absoluteServerDirectory The custom directory to your Appium
  6. * server. The directory that contains the "node_modules" directory &amp;
  7. * the NodeJS executable.
  8. * @param serverArguments The server arguments to be used when working with
  9. * the server.
  10. */
  11. public AppiumServer(File absoluteServerDirectory, ServerArguments serverArguments) {
  12. this._absoluteServerDirectory = absoluteServerDirectory;
  13. this._serverArguments = serverArguments;
  14. // make sure to get the node executable file path along with the appium.js path too.
  15. _nodeExecutableFilePath = new File(OS.isFamilyWindows()
  16. ? _absoluteServerDirectory + node_execuable : _absoluteServerDirectory + "/node/bin/node");
  17. _appiumJavaScriptFilePath = new File(_absoluteServerDirectory
  18. + appium_server);
  19. }

代码示例来源:origin: com.github.becausetesting/commons

  1. /**
  2. * Constructs an Appium server instance. You specify the custom directory to
  3. * your Appium server.
  4. *
  5. * @param absoluteServerDirectory The custom directory to your Appium
  6. * server. The directory that contains the "node_modules" directory &amp;
  7. * the NodeJS executable.
  8. * @param serverArguments The server arguments to be used when working with
  9. * the server.
  10. */
  11. public AppiumServer(File absoluteServerDirectory, ServerArguments serverArguments) {
  12. this._absoluteServerDirectory = absoluteServerDirectory;
  13. this._serverArguments = serverArguments;
  14. // make sure to get the node executable file path along with the appium.js path too.
  15. _nodeExecutableFilePath = new File(OS.isFamilyWindows()
  16. ? _absoluteServerDirectory + node_execuable : _absoluteServerDirectory + "/node/bin/node");
  17. _appiumJavaScriptFilePath = new File(_absoluteServerDirectory
  18. + appium_server);
  19. }

代码示例来源:origin: mesos/docker-compose-executor

  1. public static boolean isProcessRunning(int pid) {
  2. String line;
  3. if (OS.isFamilyWindows()) {
  4. line = "cmd /c \"tasklist /FI \"PID eq " + pid + "\" | findstr " + pid + "\"";
  5. } else {
  6. line = "ps -p " + pid;
  7. }
  8. int exitValue = ProcessUtils.executeCommand(line, null);
  9. return exitValue == 0;
  10. }

代码示例来源:origin: mojohaus/exec-maven-plugin

  1. static String findExecutable( final String executable, final List<String> paths )
  2. {
  3. File f = null;
  4. search: for ( final String path : paths )
  5. {
  6. f = new File( path, executable );
  7. if ( !OS.isFamilyWindows() && f.isFile() )
  8. break;
  9. else
  10. for ( final String extension : getExecutableExtensions() )
  11. {
  12. f = new File( path, executable + extension );
  13. if ( f.isFile() )
  14. break search;
  15. }
  16. }
  17. if ( f == null || !f.exists() )
  18. return null;
  19. return f.getAbsolutePath();
  20. }

代码示例来源:origin: com.github.becauseQA/becauseQA-utils

  1. /**
  2. * Constructs an Appium server instance. Searches automatically for an
  3. * installed Appium server on your machine using the default installation
  4. * location according to your operating system.
  5. *
  6. * The searched directories are: <br><ul><li>Windows OS: "C:/Program
  7. * Files/Appium" &amp; "C:/Program Files (x86)/Appium"</li> <li>Mac OS:
  8. * "/Applications/Appium.app/Contents/Resources" </li></ul>zz
  9. *
  10. * @param serverArguments The server arguments to be used when working with
  11. * the server.
  12. */
  13. public AppiumServer(ServerArguments serverArguments) {
  14. this._serverArguments = serverArguments;
  15. // search for installed Appium server
  16. _absoluteServerDirectory = searchForServerDirectory();
  17. // make sure to get the node executable file path along with the appium.js path too.
  18. _nodeExecutableFilePath = new File(OS.isFamilyWindows()
  19. ? _absoluteServerDirectory + node_execuable : _absoluteServerDirectory + "/node/bin/node");
  20. _appiumJavaScriptFilePath = new File(_absoluteServerDirectory
  21. + appium_server);
  22. }

代码示例来源:origin: org.codehaus.mojo/exec-maven-plugin

  1. static String findExecutable( final String executable, final List<String> paths )
  2. {
  3. File f = null;
  4. search: for ( final String path : paths )
  5. {
  6. f = new File( path, executable );
  7. if ( !OS.isFamilyWindows() && f.isFile() )
  8. break;
  9. else
  10. for ( final String extension : getExecutableExtensions() )
  11. {
  12. f = new File( path, executable + extension );
  13. if ( f.isFile() )
  14. break search;
  15. }
  16. }
  17. if ( f == null || !f.exists() )
  18. return null;
  19. return f.getAbsolutePath();
  20. }

代码示例来源:origin: com.github.becausetesting/commons

  1. /**
  2. * Constructs an Appium server instance. Searches automatically for an
  3. * installed Appium server on your machine using the default installation
  4. * location according to your operating system.
  5. *
  6. * The searched directories are: <br><ul><li>Windows OS: "C:/Program
  7. * Files/Appium" &amp; "C:/Program Files (x86)/Appium"</li> <li>Mac OS:
  8. * "/Applications/Appium.app/Contents/Resources" </li></ul>zz
  9. *
  10. * @param serverArguments The server arguments to be used when working with
  11. * the server.
  12. */
  13. public AppiumServer(ServerArguments serverArguments) {
  14. this._serverArguments = serverArguments;
  15. // search for installed Appium server
  16. _absoluteServerDirectory = searchForServerDirectory();
  17. // make sure to get the node executable file path along with the appium.js path too.
  18. _nodeExecutableFilePath = new File(OS.isFamilyWindows()
  19. ? _absoluteServerDirectory + node_execuable : _absoluteServerDirectory + "/node/bin/node");
  20. _appiumJavaScriptFilePath = new File(_absoluteServerDirectory
  21. + appium_server);
  22. }

代码示例来源:origin: mojohaus/exec-maven-plugin

  1. if ( OS.isFamilyWindows() )

代码示例来源:origin: org.codehaus.mojo/exec-maven-plugin

  1. if ( OS.isFamilyWindows() )

代码示例来源:origin: com.github.becauseQA/becauseQA-utils

  1. if (OS.isFamilyWindows()) {
  2. stopServerCommand = new String[]{"cmd", "/c",
  3. "echo off & FOR /F \"usebackq tokens=5\" %a in (`netstat -nao ^| findstr /R /C:\""

代码示例来源:origin: com.github.becausetesting/commons

  1. if (OS.isFamilyWindows()) {
  2. stopServerCommand = new String[]{"cmd", "/c",
  3. "echo off & FOR /F \"usebackq tokens=5\" %a in (`netstat -nao ^| findstr /R /C:\""

代码示例来源:origin: com.github.becauseQA/becauseQA-utils

  1. /**
  2. * Search the operating system for an Appium server installation directory.
  3. *
  4. * @return A File representation to the Appium server installation
  5. * directory.
  6. */
  7. private File searchForServerDirectory() {
  8. if (OS.isFamilyWindows()) {
  9. if (getArch().equals("32")) {
  10. return doesDirectoryExists(System.getenv("ProgramFiles")
  11. + "/Appium");
  12. } else {
  13. // must be the x86_64
  14. return doesDirectoryExists(System.getenv("ProgramFiles")
  15. + " (x86)/Appium");
  16. }
  17. } else if (OS.isFamilyMac()) {
  18. return doesDirectoryExists("/Applications/Appium.app/Contents/Resources");
  19. }
  20. // server directrory was not found.
  21. throw new ServerDirectoryNotFoundException();
  22. }

代码示例来源:origin: com.github.becausetesting/commons

  1. /**
  2. * Search the operating system for an Appium server installation directory.
  3. *
  4. * @return A File representation to the Appium server installation
  5. * directory.
  6. */
  7. private File searchForServerDirectory() {
  8. if (OS.isFamilyWindows()) {
  9. if (getArch().equals("32")) {
  10. return doesDirectoryExists(System.getenv("ProgramFiles")
  11. + "/Appium");
  12. } else {
  13. // must be the x86_64
  14. return doesDirectoryExists(System.getenv("ProgramFiles")
  15. + " (x86)/Appium");
  16. }
  17. } else if (OS.isFamilyMac()) {
  18. return doesDirectoryExists("/Applications/Appium.app/Contents/Resources");
  19. }
  20. // server directrory was not found.
  21. throw new ServerDirectoryNotFoundException();
  22. }

代码示例来源:origin: com.github.becauseQA/becauseQA-utils

  1. if (OS.isFamilyWindows()) {
  2. commanddLine = new CommandLine("\"" + command + "\"");
  3. } else if (OS.isFamilyMac() || OS.isFamilyUnix()) {
  4. if (OS.isFamilyWindows()) {
  5. for (String parameter : parameters) {
  6. commanddLine.addArgument("\"" + parameter + "\"", false);

代码示例来源:origin: com.github.becausetesting/commons

  1. if (OS.isFamilyWindows()) {
  2. commanddLine = new CommandLine("\"" + command + "\"");
  3. } else if (OS.isFamilyMac() || OS.isFamilyUnix()) {
  4. if (OS.isFamilyWindows()) {
  5. for (String parameter : parameters) {
  6. commanddLine.addArgument("\"" + parameter + "\"", false);

代码示例来源:origin: vmi/selenese-runner-java

  1. @Override
  2. public WebDriver newInstance(DriverOptions driverOptions) {
  3. if (!OS.isFamilyWindows())
  4. throw new UnsupportedOperationException("Unsupported platform: " + Platform.getCurrent());
  5. InternetExplorerDriverService service = setupBuilder(new InternetExplorerDriverService.Builder(), driverOptions, IEDRIVER).build();
  6. InternetExplorerOptions options = newInternetExplorerOptions(driverOptions);
  7. options.merge(driverOptions.getCapabilities());
  8. InternetExplorerDriver driver = new InternetExplorerDriver(service, options);
  9. setInitialWindowSize(driver, driverOptions);
  10. return driver;
  11. }
  12. }

代码示例来源:origin: bonitasoft/bonita-engine

  1. public static CommandLine createCommandLine() {
  2. if (OS.isFamilyWindows() || OS.isFamilyWin9x()) {
  3. CommandLine oCmdLine = new CommandLine("cmd");
  4. oCmdLine.addArgument("/c");
  5. oCmdLine.addArgument("setup.bat");
  6. return oCmdLine;
  7. } else {
  8. CommandLine oCmdLine = new CommandLine("sh");
  9. oCmdLine.addArgument("setup.sh");
  10. return oCmdLine;
  11. }
  12. }
  13. }

代码示例来源:origin: vmi/selenese-runner-java

  1. @Override
  2. public WebDriver newInstance(DriverOptions driverOptions) {
  3. if (!OS.isFamilyWindows())
  4. throw new UnsupportedOperationException("Unsupported platform: " + Platform.getCurrent());
  5. EdgeDriverService service = setupBuilder(new EdgeDriverService.Builder(), driverOptions, EDGEDRIVER).build();
  6. EdgeOptions options = newEdgeOptions(driverOptions);
  7. options.merge(driverOptions.getCapabilities());
  8. EdgeDriver driver = new EdgeDriver(service, options);
  9. setInitialWindowSize(driver, driverOptions);
  10. return driver;
  11. }
  12. }

相关文章