From kato-commits-return-934-apmail-incubator-kato-commits-archive=incubator.apache.org@incubator.apache.org Fri Dec 04 11:19:21 2009 Return-Path: Delivered-To: apmail-incubator-kato-commits-archive@minotaur.apache.org Received: (qmail 26903 invoked from network); 4 Dec 2009 11:19:21 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 4 Dec 2009 11:19:21 -0000 Received: (qmail 52593 invoked by uid 500); 4 Dec 2009 11:19:21 -0000 Delivered-To: apmail-incubator-kato-commits-archive@incubator.apache.org Received: (qmail 52578 invoked by uid 500); 4 Dec 2009 11:19:21 -0000 Mailing-List: contact kato-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: kato-dev@incubator.apache.org Delivered-To: mailing list kato-commits@incubator.apache.org Received: (qmail 52568 invoked by uid 99); 4 Dec 2009 11:19:21 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Dec 2009 11:19:21 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Dec 2009 11:19:18 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 2D5C823889DA; Fri, 4 Dec 2009 11:18:57 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: kato-commits@incubator.apache.org From: spoole@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20091204111857.2D5C823889DA@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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 methods=runtime.getCompiledMethods(); + if(methods.isEmpty()) return; // no threads to test + + int counter=0; + + for(JavaMethod m:methods) { + + + List sections=m.getBytecodeSections(); + + assertNotNull("Entry "+counter+":bytecode sections is null",sections); + + sections=m.getCompiledSections(); + + assertNotNull("Entry "+counter+":compiled sections is null",sections); + + List 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++; + } + + + + } +}