Author: mturk Date: Thu Apr 9 14:17:52 2009 New Revision: 763662 URL: http://svn.apache.org/viewvc?rev=763662&view=rev Log: Add OS class test suite
Added: commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestOS.java (with props) Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/OS.java commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestAll.java Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/OS.java URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/OS.java?rev=763662&r1=763661&r2=763662&view=diff ============================================================================== --- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/OS.java (original) +++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/OS.java Thu Apr 9 14:17:52 2009 @@ -100,4 +100,14 @@ */ public static native String getMachine(); + /** + * Proccessor used. + */ + public static native String getProcessor(); + + /** + * Machine hardware platform. + */ + public static native String getHardwarePlatform(); + } Modified: commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestAll.java URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestAll.java?rev=763662&r1=763661&r2=763662&view=diff ============================================================================== --- commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestAll.java (original) +++ commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestAll.java Thu Apr 9 14:17:52 2009 @@ -32,6 +32,7 @@ TestSuite suite = new TestSuite(); // Fundamentals suite.addTest(TestProperties.suite()); + suite.addTest(TestOS.suite()); return suite; } Added: commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestOS.java URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestOS.java?rev=763662&view=auto ============================================================================== --- commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestOS.java (added) +++ commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestOS.java Thu Apr 9 14:17:52 2009 @@ -0,0 +1,63 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.commons.runtime; + +import java.lang.System; +import java.util.Properties; +import junit.framework.*; + +/** + * OS Test. + * + */ +public class TestOS extends TestCase +{ + + public static Test suite() { + TestSuite suite = new TestSuite(TestOS.class); + return suite; + } + + protected void setUp() + throws Exception + { + System.loadLibrary("acr"); + } + + public void testOS() + throws Exception + { + boolean win = OS.IS_WINDOWS; + boolean unx = OS.IS_UNIX; + assertTrue("Unix or Windows not defined", win | unx); + assertFalse("Unix and Windows defined", win & unx); + assertNotNull("Sysname " + OS.getSysname()); + + /* The following are just for display purpose */ + System.out.println(""); + System.out.println("Name " + OS.getSysname()); + System.out.println("Node " + OS.getNodename()); + System.out.println("Release " + OS.getRelease()); + System.out.println("Version " + OS.getVersion()); + + System.out.println("Machine " + OS.getMachine()); + System.out.println("Processor " + OS.getProcessor()); + System.out.println("Hardware " + OS.getHardwarePlatform()); + + } + +} Propchange: commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestOS.java ------------------------------------------------------------------------------ svn:eol-style = native