/** * Determines if the OS on which Ant is executing matches the given OS name. * * @param name * the OS name to check for * @return true if the OS matches */ public static boolean isName(final String name) { return isOs(null, name, null, null); }
/** * Determines if the OS on which Ant is executing matches the given OS * architecture. * * @param arch * the OS architecture to check for * @return true if the OS matches */ public static boolean isArch(final String arch) { return isOs(null, null, arch, null); }
/** * Determines if the OS on which Ant is executing matches the given OS * version. * * @param version * the OS version to check for * @return true if the OS matches */ public static boolean isVersion(final String version) { return isOs(null, null, null, version); }
/** * Determines if the OS on which Ant is executing matches the given OS * family. * Possible values:<br /> * <ul> * <li>dos</li> * <li>mac</li> * <li>netware</li> * <li>os/2</li> * <li>tandem</li> * <li>unix</li> * <li>windows</li> * <li>win9x</li> * <li>z/os</li> * <li>os/400</li> * </ul> * * @param family * the family to check for * @return true if the OS matches */ private static boolean isFamily(final String family) { return isOs(family, null, null, null); }
@Override protected void runChild(final FrameworkMethod method, RunNotifier notifier) { Description description = describeChild(method); if (method.getAnnotation(Ignore.class) != null) { notifier.fireTestIgnored(description); } else if (method.getAnnotation(TargetOS.class) != null) { final TargetOS tos = method.getAnnotation(TargetOS.class); String name = tos.name().equals("") ? null : tos.name(); String arch = tos.arch().equals("") ? null : tos.arch(); String version = tos.version().equals("") ? null : tos.version(); if (OS.isOs(tos.family(), name, arch, version)) { runLeaf(methodBlock(method), description, notifier); } else { notifier.fireTestIgnored(description); } } else { runLeaf(methodBlock(method), description, notifier); } }