db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bpendle...@apache.org
Subject svn commit: r1517149 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/SysinfoCPCheckTest.java
Date Sat, 24 Aug 2013 15:24:38 GMT
Author: bpendleton
Date: Sat Aug 24 15:24:37 2013
New Revision: 1517149

URL: http://svn.apache.org/r1517149
Log:
DERBY-6307: Improve code coverage of org.apache.derby.iapi.services.info

This patch was contributed by Ahsan Shamsudeen (ahsan dot competition at gmail dot com)

This patch adds several tests which directly exercise the utility methods in
org.apache.derby.iapi.services.info.JVMInfo.

Note that the precise code paths that are tested by these new test cases will
depend on the configuration of the test environment, since the JVMInfo code
is highly sensitive to the user's JDK level and JDK vendor.

The only JVMInfo method not directly tested at this point is javaDump,
which is a bit delicate to directly test because exercising this method can
give the appearance that a fatal error has occurred, which might confuse
somebody running the tests into thinking there was a real crash instead of
just an artificial execution of javaDump. So testing that method is deferred
until a later date.


Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/SysinfoCPCheckTest.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/SysinfoCPCheckTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/SysinfoCPCheckTest.java?rev=1517149&r1=1517148&r2=1517149&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/SysinfoCPCheckTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/SysinfoCPCheckTest.java
Sat Aug 24 15:24:37 2013
@@ -36,6 +36,7 @@ import org.apache.derbyTesting.junit.Bas
 import org.apache.derbyTesting.junit.Derby;
 import org.apache.derbyTesting.junit.JDBC;
 import org.apache.derbyTesting.junit.LocaleTestSetup;
+import org.apache.derby.iapi.services.info.JVMInfo;
 
 public class SysinfoCPCheckTest extends BaseJDBCTestCase {
 
@@ -225,4 +226,56 @@ public class SysinfoCPCheckTest extends 
     ByteArrayOutputStream getOutputStream() {
         return new ByteArrayOutputStream(20 * 1024);
     }
+    
+    public void testjavaVersion(){
+  	   assertTrue( JVMInfo.JDK_ID == JVMInfo.J2SE_16 ||
+  		       JVMInfo.JDK_ID == JVMInfo.J2SE_17 ||
+  		       JVMInfo.JDK_ID == JVMInfo.J2SE_18 );  
+     }
+     
+     public void testderbyVMLevel(){
+     	switch (JVMInfo.JDK_ID) {
+         	case JVMInfo.J2SE_16: 
+         		assertEquals("Java SE 6 - JDBC 4.1",JVMInfo.derbyVMLevel());
+         		break;
+         	case JVMInfo.J2SE_17: 
+         		assertEquals("Java SE 7 - JDBC 4.1",JVMInfo.derbyVMLevel());
+         		break;
+         	case JVMInfo.J2SE_18: 
+         		assertEquals("Java SE 8 - JDBC 4.1",JVMInfo.derbyVMLevel());
+         		break;
+         	default: 
+ 			 assertEquals("?-?",JVMInfo.derbyVMLevel());
+ 			 break;
+ 		}
+     	
+     }
+     
+     public void testisSunJVM(){
+    	 if(JVMInfo.isSunJVM()==true){
+    		 assertEquals(true,JVMInfo.isSunJVM());	
+    	 }
+    	 else{
+    		 assertEquals(false,JVMInfo.isSunJVM());		 
+    	 }
+     }
+     
+     public void testisIBMJVM(){
+    	 if(JVMInfo.isIBMJVM()==true){
+    		 assertEquals(true,JVMInfo.isIBMJVM());	
+    	 }
+    	 else{
+    		 assertEquals(false,JVMInfo.isIBMJVM());		 
+    	 }
+    }
+     
+    public void testhasJNDI(){
+    	if(JVMInfo.hasJNDI()==true){
+    		assertEquals(true,JVMInfo.hasJNDI());		
+    	}
+    	else{
+    		assertEquals(false,JVMInfo.hasJNDI());
+    	}
+    	
+    }
 }



Mime
View raw message