KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > excalibur > util > test > SystemUtilTestCase


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12  * implied.
13  *
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17 package org.apache.excalibur.util.test;
18
19 import junit.framework.TestCase;
20
21 import org.apache.excalibur.util.SystemUtil;
22
23 /**
24  * This is used to test SystemUtil for correctness.
25  *
26  * @author <a HREF="mailto:dev@avalon.apache.org">Avalon Development Team</a>
27  */

28 public final class SystemUtilTestCase
29     extends TestCase
30 {
31     public SystemUtilTestCase( String JavaDoc name )
32     {
33         super( name );
34     }
35
36     public void testSystemUtil()
37     {
38         System.out.println( "Number of Processors: " + SystemUtil.numProcessors() );
39         System.out.println( "CPU Info: " + SystemUtil.cpuInfo() );
40         System.out.println( "Architecture: " + SystemUtil.architecture() );
41         System.out.println( "Operating System: " + SystemUtil.operatingSystem() );
42         System.out.println( "OS Version: " + SystemUtil.osVersion() );
43
44         assertEquals( SystemUtil.architecture(), System.getProperty( "os.arch" ) );
45         assertEquals( SystemUtil.operatingSystem(), System.getProperty( "os.name" ) );
46         assertEquals( SystemUtil.osVersion(), System.getProperty( "os.version" ) );
47     }
48 }
49
Popular Tags