incubator-kato-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From spo...@apache.org
Subject svn commit: r887159 - /incubator/kato/trunk/org.apache.kato/kato.tck/testcases/src/main/java/org/apache/kato/tck/tests/legacy/TestCompiledMethods.java
Date Fri, 04 Dec 2009 11:18:57 GMT
Author: spoole
Date: Fri Dec  4 11:18:56 2009
New Revision: 887159

URL: http://svn.apache.org/viewvc?rev=887159&view=rev
Log:
Added new legacy test and fixed a couple of failures in cjvmti 

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

Added: incubator/kato/trunk/org.apache.kato/kato.tck/testcases/src/main/java/org/apache/kato/tck/tests/legacy/TestCompiledMethods.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/TestCompiledMethods.java?rev=887159&view=auto
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.tck/testcases/src/main/java/org/apache/kato/tck/tests/legacy/TestCompiledMethods.java
(added)
+++ incubator/kato/trunk/org.apache.kato/kato.tck/testcases/src/main/java/org/apache/kato/tck/tests/legacy/TestCompiledMethods.java
Fri Dec  4 11:18:56 2009
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * 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.ImageSection;
+import javax.tools.diagnostics.runtime.java.JavaClass;
+import javax.tools.diagnostics.runtime.java.JavaMethod;
+import javax.tools.diagnostics.runtime.java.JavaRuntime;
+import javax.tools.diagnostics.runtime.java.JavaVariable;
+
+import org.apache.kato.tck.harness.TCKJavaRuntimeTestcase;
+
+/**
+ * 
+ */
+public class TestCompiledMethods  extends TCKJavaRuntimeTestcase {
+
+	
+	public void testMethods() {
+		JavaRuntime runtime=getJavaRuntime();
+		List<JavaMethod> methods=runtime.getCompiledMethods();
+		if(methods.isEmpty()) return; // no threads to test
+		
+		int counter=0;
+		
+		for(JavaMethod m:methods) {
+			
+				
+			List<ImageSection> sections=m.getBytecodeSections();
+				
+			assertNotNull("Entry "+counter+":bytecode sections is null",sections);
+			
+			sections=m.getCompiledSections();
+			
+			assertNotNull("Entry "+counter+":compiled sections is null",sections);
+		
+			List<JavaVariable> variables=m.getVariables();
+			assertNotNull("Entry "+counter+":variables list is null",variables);
+			
+			try {
+				JavaClass clazz=m.getDeclaringClass();
+				assertNotNull("Entry "+counter+":declaring class is null - DataUnavailable should have
been thrown instead",clazz);
+			} catch (CorruptDataException e) {
+				// allowed
+			} catch (DataUnavailable e) {
+				// allowed
+			}
+			
+			try {
+				m.getModifiers();
+			} catch (CorruptDataException e) {
+				// allowed
+			}
+			
+			try {
+				String name=m.getName();
+				assertNotNull("Entry "+counter+":name  is null - DataUnavailable should have been thrown
instead",name);
+			} catch (CorruptDataException e) {
+				// allowed
+			}
+			
+			try {
+				String signature=m.getSignature();
+				assertNotNull("Entry "+counter+":signature  is null - DataUnavailable should have been
thrown instead",signature);
+			} catch (CorruptDataException e) {
+				// allowed
+			}
+			
+		
+			
+			counter++;
+		}
+		
+		
+		
+	}
+}



Mime
View raw message