Add methods for configuring platform emulation

Specifically we support setting system properties for Windows, generic
Unix and current test platform.

Change-Id: Ib02be417c4915350dfec64fda3face1138552871
This commit is contained in:
Robin Rosenberg 2011-10-26 01:54:54 +02:00
parent 251bc02840
commit dfcb43eff1
1 changed files with 30 additions and 0 deletions

View File

@ -150,4 +150,34 @@ public TimeZone getTimeZone() {
public Locale getLocale() {
return Locale.US;
}
/**
* Assign some properties for the currently executing platform
*/
public void setCurrentPlatform() {
setProperty("os.name", System.getProperty("os.name"));
setProperty("file.separator", System.getProperty("file.separator"));
setProperty("path.separator", System.getProperty("path.separator"));
setProperty("line.separator", System.getProperty("line.separator"));
}
/**
* Emulate Windows
*/
public void setWindows() {
setProperty("os.name", "Windows");
setProperty("file.separator", "\\");
setProperty("path.separator", ";");
setProperty("line.separator", "\r\n");
}
/**
* Emulate Unix
*/
public void setUnix() {
setProperty("os.name", "*nix"); // Essentially anything but Windows
setProperty("file.separator", "/");
setProperty("path.separator", ":");
setProperty("line.separator", "\n");
}
}