incubator-kato-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From spo...@apache.org
Subject svn commit: r888468 - in /incubator/kato/trunk/org.apache.kato/kato.tck/testcases/src/main/java/org/apache/kato/tck/tests/legacy: AllTests.java TestJavaClassLoaders.java
Date Tue, 08 Dec 2009 16:23:57 GMT
Author: spoole
Date: Tue Dec  8 16:23:57 2009
New Revision: 888468

URL: http://svn.apache.org/viewvc?rev=888468&view=rev
Log:
added new tests for javaClassloaders

Added:
    incubator/kato/trunk/org.apache.kato/kato.tck/testcases/src/main/java/org/apache/kato/tck/tests/legacy/TestJavaClassLoaders.java
Modified:
    incubator/kato/trunk/org.apache.kato/kato.tck/testcases/src/main/java/org/apache/kato/tck/tests/legacy/AllTests.java

Modified: incubator/kato/trunk/org.apache.kato/kato.tck/testcases/src/main/java/org/apache/kato/tck/tests/legacy/AllTests.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.tck/testcases/src/main/java/org/apache/kato/tck/tests/legacy/AllTests.java?rev=888468&r1=888467&r2=888468&view=diff
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.tck/testcases/src/main/java/org/apache/kato/tck/tests/legacy/AllTests.java
(original)
+++ incubator/kato/trunk/org.apache.kato/kato.tck/testcases/src/main/java/org/apache/kato/tck/tests/legacy/AllTests.java
Tue Dec  8 16:23:57 2009
@@ -31,6 +31,7 @@
 		suite.addTestSuite(TestJavaThread.class);
 		suite.addTestSuite(TestCompiledMethods.class);
 		suite.addTestSuite(TestJavaHeapRoots.class);
+		suite.addTestSuite(TestJavaClassLoaders.class);
 		//$JUnit-END$
 		return suite;
 	}

Added: incubator/kato/trunk/org.apache.kato/kato.tck/testcases/src/main/java/org/apache/kato/tck/tests/legacy/TestJavaClassLoaders.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.tck/testcases/src/main/java/org/apache/kato/tck/tests/legacy/TestJavaClassLoaders.java?rev=888468&view=auto
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.tck/testcases/src/main/java/org/apache/kato/tck/tests/legacy/TestJavaClassLoaders.java
(added)
+++ incubator/kato/trunk/org.apache.kato/kato.tck/testcases/src/main/java/org/apache/kato/tck/tests/legacy/TestJavaClassLoaders.java
Tue Dec  8 16:23:57 2009
@@ -0,0 +1,95 @@
+/*******************************************************************************
+ * Licensed 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.kato.tck.tests.legacy;
+
+import java.util.List;
+
+import javax.tools.diagnostics.image.CorruptDataException;
+import javax.tools.diagnostics.image.DataUnavailable;
+import javax.tools.diagnostics.image.ImagePointer;
+import javax.tools.diagnostics.image.ImageSection;
+import javax.tools.diagnostics.image.ImageThread;
+import javax.tools.diagnostics.runtime.java.JavaClass;
+import javax.tools.diagnostics.runtime.java.JavaClassLoader;
+import javax.tools.diagnostics.runtime.java.JavaObject;
+import javax.tools.diagnostics.runtime.java.JavaReference;
+import javax.tools.diagnostics.runtime.java.JavaRuntime;
+import javax.tools.diagnostics.runtime.java.JavaStackFrame;
+import javax.tools.diagnostics.runtime.java.JavaThread;
+
+import org.apache.kato.tck.harness.TCKJavaRuntimeTestcase;
+
+/**
+ * 
+ */
+public class TestJavaClassLoaders  extends TCKJavaRuntimeTestcase {
+
+	
+	public void testClassLoaders() {
+		JavaRuntime runtime=getJavaRuntime();
+		
+		List<JavaClassLoader> loaders=runtime.getJavaClassLoaders();
+		
+		if(loaders.isEmpty()) return; // no threads to test
+		
+		int counter=0;
+		
+		for(JavaClassLoader loader:loaders) {
+			
+			
+			// name
+			
+			try {
+				loader.getObject();
+			} catch (CorruptDataException e) {
+				// allowed
+			}
+			
+			List<JavaClass> definedClasses=loader.getDefinedClasses();
+			assertNotNull("Entry "+counter+":defined classes list is null",definedClasses);
+			
+			List<JavaClass> cachedClasses=loader.getCachedClasses();
+			assertNotNull("Entry "+counter+":cached classes list is null",cachedClasses);
+			
+			
+			try {
+				loader.findClass(null);
+				
+			} catch (CorruptDataException e) {
+				// allowed
+			}
+			
+			try {
+				loader.findClass("");
+				
+			} catch (CorruptDataException e) {
+				// allowed
+			}
+			try {
+				loader.findClass("java/lang/String");
+				
+			} catch (CorruptDataException e) {
+				// allowed
+			}
+			
+			
+			
+			counter++;
+		}
+		
+		
+		
+	}
+}



Mime
View raw message